/* ===== CSS Variables ===== */
:root {
    --mac-gray: #c0c0c0;
    --mac-dark-gray: #808080;
    --mac-light-gray: #dfdfdf;
    --mac-black: #000000;
    --mac-white: #ffffff;
    --window-border: #000000;
    --shadow-dark: rgba(0, 0, 0, 0.4);
    --shadow-light: rgba(255, 255, 255, 0.8);
    --title-stripe-color: #000000;
    --title-outline-color: #ffffff;
}

:root.theme-night {
    --mac-gray: #252525;
    --mac-dark-gray: #aaa79f;
    --mac-light-gray: #303133;
    --mac-black: #ece8dd;
    --mac-white: #111214;
    --window-border: #ece8dd;
    --shadow-dark: rgba(0, 0, 0, 0.72);
    --shadow-light: rgba(255, 255, 255, 0.16);
    --title-stripe-color: #ffffff;
    --title-outline-color: #111214;
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
    background: var(--mac-gray);
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,.02) 2px,
            rgba(0,0,0,.02) 4px
        );
    color: var(--mac-black);
    line-height: 1.7;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Desktop Environment ===== */
.desktop {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.desktop-icon {
    position: absolute;
    top: 54px;
    left: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 82px;
    padding: 4px;
    border: 1px dotted transparent;
    background: transparent;
    color: var(--mac-black);
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    z-index: 20;
    transition: opacity 120ms ease-out;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
    border-color: var(--mac-black);
    outline: none;
}

.desktop-icon:active .desktop-icon-art {
    transform: translate(1px, 1px);
}

.desktop-icon-art {
    display: block;
    width: 60px;
    height: 45px;
    background: url("icons/classic-folder.svg?v=20260701-svg-icons-3") center / contain no-repeat;
}

.desktop-icon-label {
    display: inline-block;
    max-width: 72px;
    padding: 1px 3px;
    color: var(--mac-black);
    background: var(--mac-white);
    border: 1px dotted transparent;
    text-align: center;
    overflow-wrap: break-word;
}

.desktop-icon:hover .desktop-icon-label,
.desktop-icon:focus-visible .desktop-icon-label {
    color: var(--mac-white);
    background: var(--mac-black);
    border-color: var(--mac-white);
}

.desktop.blog-open .desktop-icon {
    opacity: 0;
    pointer-events: none;
}

.menu-bar {
    background: var(--mac-white);
    border-bottom: 2px solid var(--mac-black);
    padding: 5px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    font-family: "ChicagoFLF", "Chicago", "Geneva", "Lucida Grande", -apple-system, system-ui, sans-serif;
}

.menu-bar-left,
.menu-bar-right {
    display: flex;
    gap: 16px;
}

.menu-item {
    cursor: pointer;
    padding: 2px 8px;
}

.menu-brand {
    font-weight: inherit;
    text-shadow: none;
    background: transparent;
    padding: 2px 0;
    border: none;
    color: inherit;
    text-decoration: none;
}

.menu-item:hover {
    color: var(--mac-white);
    background-image:
        repeating-linear-gradient(
            45deg,
            #000000 0px,
            #000000 1px,
            #808080 1px,
            #808080 2px
        );
}

.menu-time {
    font-variant-numeric: tabular-nums;
}

/* ===== Window Container ===== */
.window-container {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    transition:
        opacity 220ms ease-out,
        transform 220ms ease-out;
}

.desktop.blog-closed .window-container {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98) translateY(8px);
    visibility: hidden;
}

.desktop.blog-open .window-container {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    visibility: visible;
}

/* ===== Mac OS Window Styles ===== */
.window {
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    box-shadow: 3px 3px 0 var(--shadow-dark);
}

.main-window {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
    transform-origin: 50% 20%;
    transition:
        opacity 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.main-window.is-open {
    opacity: 1;
    transform: none;
}

.window-active .title-bar {
    position: relative;
    padding: 4px 8px;
    background: var(--mac-white);
}

.window-active .title-bar::before {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 50%;
    height: 26px;
    transform: translateY(-50%);
    background-image:
        linear-gradient(
            180deg,
            transparent 0px,
            transparent 2px,
            var(--title-stripe-color) 2px,
            var(--title-stripe-color) 4px,
            transparent 4px,
            transparent 6px,
            var(--title-stripe-color) 6px,
            var(--title-stripe-color) 8px,
            transparent 8px,
            transparent 10px,
            var(--title-stripe-color) 10px,
            var(--title-stripe-color) 12px,
            transparent 12px,
            transparent 14px,
            var(--title-stripe-color) 14px,
            var(--title-stripe-color) 16px,
            transparent 16px,
            transparent 18px,
            var(--title-stripe-color) 18px,
            var(--title-stripe-color) 20px,
            transparent 20px,
            transparent 22px,
            var(--title-stripe-color) 22px,
            var(--title-stripe-color) 24px,
            transparent 24px,
            transparent 26px
        );
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.window-active .title-bar .title-bar-text,
.window-active .title-bar .title-bar-controls {
    position: relative;
    z-index: 1;
}
.window-active .title-bar .title-bar-text::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -8px;
    right: -8px;
    background: var(--mac-white);
    z-index: -1;
}

.window-active .title-bar .title-bar-controls::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    right: -1px;
    background: var(--mac-white);
    z-index: -1;
}

.zoom-rect {
    position: fixed;
    border: 2px dotted var(--mac-black);
    background: transparent;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2000;
    opacity: 0.9;
    will-change: left, top, width, height, opacity;
}

.menu-dropdown {
    position: fixed;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    box-shadow: 2px 2px 0 var(--shadow-dark);
    z-index: 1500;
    min-width: 140px;
    font-size: 12px;
}

.menu-dropdown-item {
    display: block;
    padding: 4px 16px 4px 20px;
    cursor: default;
}

.menu-dropdown-item:hover {
    background: var(--mac-dark-gray);
    color: var(--mac-white);
}

.menu-dropdown-item.active::before {
    content: '✓';
    display: inline-block;
    width: 12px;
    margin-left: -12px;
    margin-right: 4px;
}

.title-bar {
    background: var(--mac-white);
    border-bottom: 1px solid var(--mac-black);
    padding: 4px 8px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    cursor: grab;
}

.title-bar:active {
    cursor: grabbing;
}

.title-bar-text {
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 0.3px;
    font-family: "ChicagoFLF", "Chicago", "Geneva", "Lucida Grande", -apple-system, system-ui, sans-serif;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow:
        -1px 0 var(--title-outline-color),
        1px 0 var(--title-outline-color),
        0 -1px var(--title-outline-color),
        0 1px var(--title-outline-color);
}

.title-bar-controls {
    display: flex;
    gap: 4px;
    margin-right: 8px;
    order: -1;
}

.title-bar-text {
    flex: 1;
    display: block;
    padding: 0;
    margin: 0;
    text-align: center;
    background: transparent;
    border: none;
}

.window-active .title-bar-text {
    flex: 0 0 auto;
    display: inline-block;
    max-width: calc(100% - 52px);
    padding: 1px 6px;
    margin: 0 auto;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
}

.title-bar-button {
    width: 14px;
    height: 14px;
    border: 1px solid var(--mac-black);
    background: var(--mac-white);
    cursor: pointer;
    position: relative;
}

.title-bar-button:hover {
    background: var(--mac-light-gray);
}

.title-bar-button:hover::before,
.title-bar-button:hover::after {
    content: '';
    position: absolute;
    background: var(--mac-black);
}

.title-bar-button:hover::before {
    width: 8px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.title-bar-button:hover::after {
    width: 8px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.window-body {
    padding: 16px;
    background: var(--mac-white);
}

/* ===== Site Header ===== */
.site-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--mac-black);
}

.site-header h1 {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.tagline {
    font-size: 12px;
    color: var(--mac-dark-gray);
}

/* ===== Navigation ===== */
.navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--mac-gray);
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 14px;
    min-height: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.nav-button:hover {
    background: var(--mac-light-gray);
}

.nav-button:active {
    background: var(--mac-black);
    color: var(--mac-white);
}

.nav-button.active {
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    outline: 2px solid var(--mac-black);
    outline-offset: 1px;
}

/* ===== Blog Posts ===== */
.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.desktop[data-page-kind="folder"] .window-container {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1180px;
}

.desktop[data-page-kind="folder"] .main-window {
    width: 100%;
}

.finder-window-body {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.finder-window-body .site-header,
.finder-window-body .navigation {
    margin-left: 16px;
    margin-right: 16px;
}

.finder-window-body .site-header {
    margin-top: 16px;
}

.finder-content {
    display: grid;
    grid-template-columns: minmax(390px, 1fr) 310px;
    min-width: 760px;
    min-height: 520px;
    border-top: 1px solid var(--mac-gray);
}

.finder-file-browser {
    min-width: 0;
    padding: 14px;
}

.finder-integrated-info {
    min-width: 0;
    padding: 16px;
    background: var(--mac-white);
    border-left: 1px solid var(--mac-black);
    box-shadow: inset 1px 0 0 var(--mac-light-gray);
}

.folder-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.folder-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 8px;
    color: var(--mac-dark-gray);
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    font-size: 11px;
}

.folder-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px 10px;
    align-items: start;
}

.folder-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 108px;
    padding: 7px 6px;
    color: var(--mac-black);
    background: transparent;
    border: 1px dotted transparent;
    text-decoration: none;
    text-align: center;
    border-radius: 0;
    cursor: default;
    user-select: none;
}

.folder-file:hover,
.folder-file:focus-visible {
    border-color: var(--mac-black);
    outline: none;
}

.folder-file.is-selected {
    color: var(--mac-black);
    background: transparent;
    border-color: transparent;
}

.folder-file-icon {
    display: block;
    width: 42px;
    height: 42px;
    margin-top: 2px;
    background: url("icons/classic-file.svg?v=20260701-svg-icons-3") center / contain no-repeat;
}

.folder-file.is-selected .folder-file-icon {
    transform: translate(1px, 1px);
}

.folder-file-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    width: 100%;
}

.folder-file-name {
    display: inline;
    max-width: 100%;
    padding: 1px 3px;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

.folder-file.is-selected .folder-file-name {
    color: var(--mac-white);
    background: var(--mac-black);
}

.folder-file-date {
    color: var(--mac-dark-gray);
    font-size: 11px;
}

.folder-file.is-selected .folder-file-date {
    color: var(--mac-dark-gray);
}

.post {
    margin-bottom: 0;
}

.post-header {
    margin-bottom: 12px;
}

.post-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.post-date {
    font-size: 11px;
    color: var(--mac-dark-gray);
    font-style: italic;
}

.post-update,
.data-note,
.search-match {
    color: var(--mac-dark-gray);
    font-size: 11px;
    line-height: 1.45;
}

.post-update {
    margin-top: 6px;
}

.search-match {
    margin-top: -4px;
}

.post-content {
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.post-content p {
    margin-bottom: 14px;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-content h2 {
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
    font-size: 15px;
    font-weight: bold;
    margin-top: 24px;
    margin-bottom: 12px;
    padding-top: 12px;
    position: relative;
}

.post-content h2::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-top: 1px solid var(--mac-gray);
    box-shadow: 0 1px 0 var(--mac-white);
}

.post-content ul, .post-content ol {
    margin-left: 20px;
    margin-bottom: 14px;
}

.post-content li {
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}

.post-divider {
    border: none;
    border-top: 1px solid var(--mac-gray);
    border-bottom: 1px solid var(--mac-white);
    margin: 20px 0;
    opacity: 0.8;
}

/* ===== Sidebar ===== */
.sidebar-window {
    position: sticky;
    top: 20px;
}

.info-section {
    margin-bottom: 20px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h3 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--mac-black);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.info-section p {
    font-size: 12px;
    line-height: 1.5;
}

.finder-info-panel {
    font-size: 12px;
}

.finder-file-preview {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    background: url("icons/classic-file.svg?v=20260701-svg-icons-3") center / contain no-repeat;
}

.finder-info-panel > h3 {
    font-size: 17px;
    line-height: 1.25;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.finder-kind {
    color: var(--mac-dark-gray);
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 18px;
    overflow-wrap: anywhere;
}

.finder-info-section {
    margin-bottom: 18px;
}

.finder-info-section h3 {
    margin-bottom: 8px;
}

.finder-info-list {
    display: grid;
    gap: 0;
}

.finder-info-list div {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px solid var(--mac-gray);
}

.finder-info-list dt {
    color: var(--mac-dark-gray);
    font-weight: bold;
}

.finder-info-list dd {
    min-width: 0;
    font-weight: bold;
    overflow-wrap: anywhere;
}

.finder-detail {
    color: var(--mac-dark-gray);
    margin-top: 8px;
}

.finder-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.finder-tag {
    display: inline-flex;
    max-width: 100%;
    padding: 2px 6px;
    color: var(--mac-white);
    background: var(--mac-dark-gray);
    border: 1px solid var(--mac-black);
    font-size: 10px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.finder-open-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 14px;
    color: var(--mac-black);
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
}

.finder-open-button:hover,
.finder-open-button:focus-visible {
    background: var(--mac-light-gray);
    border-bottom: 1px solid var(--mac-black);
    outline: none;
}

.sidebar-status {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    margin-bottom: 8px;
}

.sidebar-status span {
    white-space: nowrap;
}

.post-list {
    list-style: none;
    font-size: 11px;
    margin: 0;
    padding: 0;
}

.post-list li {
    padding: 2px 0;
}

.post-list a {
    text-decoration: none;
    color: var(--mac-black);
    padding: 2px 4px;
    border: 1px dotted transparent;
}

.post-list a:hover {
    border-color: var(--mac-black);
}

.post-list a.is-current {
    background: var(--mac-black);
    color: var(--mac-white);
    border-style: dotted;
}

.recent-list {
    list-style: none;
    font-size: 11px;
}

.recent-list li {
    padding: 4px 0;
    border-bottom: 1px dotted var(--mac-gray);
}

.recent-list li:last-child {
    border-bottom: none;
}

/* ===== Links ===== */
a {
    color: var(--mac-black);
    text-decoration: underline;
}

a:hover:not(.nav-button):not(.menu-brand):not(.folder-file):not(.finder-open-button) {
    background: transparent;
    color: var(--mac-black);
    text-decoration: none;
    border-bottom: 1px dotted var(--mac-black);
}

/* ===== Chart Container ===== */
.chart-container {
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    padding: 16px;
    margin: 20px 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chart-container canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== Post-Specific Layout Components ===== */
.comparison-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

.comparison-side {
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    padding: 16px;
}

.comparison-side h4 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.comparison-side ul {
    font-size: 12px;
    line-height: 1.6;
    margin-left: 20px;
}

.comparison-side li {
    margin-bottom: 8px;
}

.status-demo {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 16px;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
}

.status-badge {
    padding: 8px 16px;
    font-weight: bold;
    font-size: 13px;
    border: 1px solid var(--mac-black);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    text-align: center;
}

.status-party { background: #d1fae5; color: #059669; }
.status-peachy { background: #fef3c7; color: #d97706; }
.status-meh { background: #f3f4f6; color: #6b7280; }
.status-watch { background: #dbeafe; color: #2563eb; }
.status-nobueno { background: #fef2f2; color: #dc2626; }

.code-block {
    background: var(--mac-black);
    color: #00ff00;
    padding: 16px;
    font-size: 14px;
    margin: 16px 0;
    border: 1px solid var(--mac-black);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    line-height: 1.5;
    white-space: pre;
    tab-size: 4;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

:root.theme-night .code-block {
    background: #070809;
    color: #7cff82;
    border-color: #4a5148;
}

.metric-box {
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    padding: 12px;
    margin: 12px 0;
    font-size: 12px;
}

.annotation-box {
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    border-left: 6px solid var(--mac-black);
    padding: 14px 16px;
    margin: 18px 0;
    font-size: 12px;
}

.annotation-box .annotation-label {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.annotation-box p:last-child {
    margin-bottom: 0;
}

.recipe-box {
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    padding: 14px 16px;
    margin: 18px 0;
    font-size: 12px;
}

.recipe-box h4 {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
}

.recipe-box ul {
    margin-bottom: 0;
}

.probability-viz {
    margin: 24px 0;
    padding: 20px;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
}

.probability-viz h4 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.scale-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.scale-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scale-label {
    min-width: 100px;
    font-size: 12px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.scale-bar-container {
    flex: 1;
    height: 30px;
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    position: relative;
    display: flex;
}

.scale-bar-negative {
    background: repeating-linear-gradient(
        45deg,
        #666,
        #666 10px,
        #888 10px,
        #888 20px
    );
    border-right: 1px solid var(--mac-black);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.scale-bar-positive {
    background: var(--mac-white);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 8px;
    font-size: 10px;
    font-weight: bold;
}

.age-label {
    min-width: 60px;
    font-size: 11px;
    color: var(--mac-dark-gray);
}

.stats-box {
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-black);
    padding: 16px;
    margin: 16px 0;
}

.stats-box h4 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.stats-box p {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.quadrant-grid {
    display: grid;
    grid-template-columns: 120px 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 0;
    margin: 24px 0;
    border: 1px solid var(--mac-black);
    background: var(--mac-white);
}

.quadrant-label {
    background: var(--mac-dark-gray);
    color: var(--mac-white);
    padding: 12px;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    border: 1px solid var(--mac-black);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.quadrant-cell {
    padding: 16px;
    border: 1px solid var(--mac-black);
    background: var(--mac-light-gray);
}

.quadrant-cell h4 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.quadrant-cell p {
    font-size: 12px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.quadrant-cell .example {
    font-size: 11px;
    font-style: italic;
    color: var(--mac-dark-gray);
    margin-top: 8px;
}

.axis-label {
    background: var(--mac-gray);
    padding: 8px;
    font-weight: bold;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mac-black);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

.corner {
    background: var(--mac-gray);
    border: 1px solid var(--mac-black);
}

/* ===== Math Equations ===== */
.equation,
.math-block {
    text-align: center;
    margin: 20px 0;
    padding: 12px;
    background: var(--mac-light-gray);
    border: 1px solid var(--mac-dark-gray);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.math-block {
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.65;
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
}

mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
}

.post-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

.post-content table th,
.post-content table td {
    vertical-align: top;
}

@media (max-width: 700px) {
    .comparison-box {
        grid-template-columns: 1fr;
    }

    .quadrant-grid {
        display: block;
        border: none;
        background: transparent;
    }

    .quadrant-grid .corner,
    .quadrant-grid .axis-label,
    .quadrant-grid .quadrant-label {
        display: none;
    }

    .quadrant-cell {
        margin-bottom: 10px;
        border: 1px solid var(--mac-black);
    }

    .quadrant-cell:last-child {
        margin-bottom: 0;
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 900px) {
    .window-container {
        grid-template-columns: 1fr;
    }

    .sidebar-window {
        position: static;
        order: 1;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 14px;
        line-height: 1.65;
    }

    .desktop {
        min-height: 100dvh;
    }

    .desktop-icon {
        top: 50px;
        left: 16px;
    }

    .window-container {
        padding: 10px;
        gap: 10px;
    }

    .menu-bar {
        font-size: 12px;
    }

    .menu-bar-left,
    .menu-bar-right {
        gap: 8px;
    }

    .menu-item {
        padding-left: 4px;
        padding-right: 4px;
    }

    .menu-dropdown {
        max-width: calc(100vw - 16px);
    }

    .title-bar {
        min-height: 30px;
    }

    .title-bar-controls {
        gap: 6px;
        margin-right: 6px;
    }

    .title-bar-button {
        width: 18px;
        height: 18px;
    }

    .window-body {
        padding: 12px;
    }

    .finder-window-body {
        padding: 0;
    }

    .finder-window-body .site-header,
    .finder-window-body .navigation {
        margin-left: 12px;
        margin-right: 12px;
    }

    .finder-content {
        grid-template-columns: minmax(360px, 1fr) 300px;
        min-width: 700px;
    }

    .finder-file-browser,
    .finder-integrated-info {
        padding: 12px;
    }

    .site-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .site-header h1 {
        font-size: 18px;
        line-height: 1.25;
    }

    .navigation {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
        padding-bottom: 14px;
    }

    .nav-button {
        min-height: 30px;
        padding: 4px 12px;
    }

    .folder-toolbar {
        flex-direction: column;
        gap: 2px;
    }

    .folder-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }

    .folder-file {
        min-height: 104px;
    }

    .finder-info-panel > h3 {
        font-size: 16px;
    }

    .finder-info-list div {
        grid-template-columns: 82px 1fr;
    }

    .finder-open-button {
        width: 100%;
        min-height: 32px;
    }

    .post-title {
        font-size: 15px;
        line-height: 1.35;
    }

    .post-content {
        font-size: 14px;
        line-height: 1.75;
    }

    .post-content h2 {
        font-size: 14px;
        line-height: 1.4;
        margin-top: 22px;
    }

    .post-content ul,
    .post-content ol {
        margin-left: 18px;
    }

    .annotation-box,
    .recipe-box,
    .metric-box,
    .stats-box,
    .probability-viz,
    .comparison-side {
        padding: 12px;
    }

    .status-demo {
        gap: 8px;
        padding: 12px;
    }

    .status-badge {
        flex: 1 1 120px;
        padding: 8px 10px;
    }

    .scale-row {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .scale-label,
    .age-label {
        width: 100%;
        min-width: 0;
    }

    .scale-bar-container {
        flex-basis: 100%;
    }

    .chart-container {
        margin: 16px 0;
        padding: 12px;
    }

    .chart-container canvas {
        min-width: 480px;
        max-width: none;
    }

    .post-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .post-content table tbody {
        display: table;
        min-width: 100%;
        width: max-content;
    }

    .post-content table th,
    .post-content table td {
        white-space: nowrap;
    }

    .code-block {
        padding: 12px;
        font-size: 14px;
    }

    .equation,
    .math-block {
        padding: 10px;
    }
}

/* ===== Dialog Boxes ===== */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 2000;
}

.dialog-overlay.active {
    display: flex;
}

.dialog-box {
    background: var(--mac-white);
    border: 3px solid var(--mac-black);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
    width: min(600px, calc(100vw - 24px));
    min-width: 0;
    max-width: 600px;
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 3px;
}

.dialog-box > * {
    border: 1px solid var(--mac-black);
}

.dialog-title-bar {
    background-image:
        repeating-linear-gradient(
            180deg,
            var(--mac-black) 0px,
            var(--mac-black) 1px,
            var(--mac-white) 1px,
            var(--mac-white) 2px,
            var(--mac-black) 2px,
            var(--mac-black) 3px,
            var(--mac-white) 3px,
            var(--mac-white) 4px
        );
    padding: 6px 12px;
    border-bottom: 1px solid var(--mac-black);
}

.dialog-title-text {
    font-weight: bold;
    font-size: 13px;
    text-align: center;
    font-family: "ChicagoFLF", "Chicago", "Geneva", "Lucida Grande", -apple-system, system-ui, sans-serif;
}

.dialog-body {
    padding: 20px;
}

.dialog-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.dialog-label {
    font-weight: bold;
    font-size: 13px;
    min-width: 48px;
}

.dialog-input {
    flex: 1;
    width: auto;
    padding: 4px 6px;
    border: 1px solid var(--mac-black);
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
    font-size: 13px;
    background: var(--mac-white);
}

.dialog-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px var(--mac-black);
}

.dialog-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 14px;
    min-height: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.dialog-button:hover {
    background: var(--mac-light-gray);
}

.dialog-button:active {
    background: var(--mac-black);
    color: var(--mac-white);
}

.dialog-button.default {
    background: var(--mac-white);
    border: 1px solid var(--mac-black);
    outline: 2px solid var(--mac-black);
    outline-offset: 1px;
}

@media (max-width: 600px) {
    .dialog-overlay {
        align-items: flex-start;
        padding-top: 52px;
    }

    .dialog-body {
        padding: 14px;
    }

    .dialog-row {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    .dialog-label {
        min-width: 0;
    }

    .dialog-buttons {
        justify-content: stretch;
    }

    .dialog-button {
        flex: 1;
        min-height: 32px;
        padding: 4px 12px;
    }
}

/* ===== Chart Fonts ===== */
.chart-container {
    font-family: "Geneva", "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
