/* ============================================
   DESIGN TOKENS & SYSTEM VARIABLES
   ============================================ */
:root,
[data-theme="light"] {
    --bg: #f7f7f4;
    --text: #111111;
    --text-dim: #5c626d;
    --text-muted: #7d8490;

    --accent: #17805e;
    --accent-dim: #11684c;
    --accent-light: #e6f3ee;
    --accent-contrast: #ffffff;

    --surface: #ffffff;
    --surface-elevated: #f0f0eb;
    --surface-input: #ffffff;
    --surface-hover: #ebebe5;

    --border: #dcdcd6;
    --border-light: #e8e8e2;
    --border-subtle: rgba(0, 0, 0, 0.08);
    --btn-border: #333333;

    /* Typography Tokens */
    --font-mono: 'Geist Mono', monospace;
    --font-serif: 'Times New Roman', Times, Baskerville, Georgia, serif;
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Wide Framing Margins (reference layout) */
    --page-max-width: 900px;
    --page-margin: clamp(28px, 14vw, 180px);

    /* Slightly increased radius — still sharp but with more presence */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Sudoku & Status */
    --error: #d93829;
    --sudoku-given: #8a8f98;
    --sudoku-selected: #e1f4ec;
    --sudoku-highlight: #eff8f3;
    --sudoku-error-bg: #fdecea;
    --sudoku-box-border: #c8c8c2;

    --illus-opacity: 0.30;
    --illus-brightness: 0.35;
}

[data-theme="dark"] {
    --bg: #111213;
    --text: #f0f1f3;
    --text-dim: #9aa1ad;
    --text-muted: #6b7280;

    --accent: #3dd29d;
    --accent-dim: #10b981;
    --accent-light: #064e3b;
    --accent-contrast: #0b110e;

    --surface: #18191b;
    --surface-elevated: #1e2023;
    --surface-input: #131416;
    --surface-hover: #24262b;

    --border: #26282d;
    --border-light: #1f2125;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --btn-border: #dcdcd6;

    --sudoku-given: #606773;
    --sudoku-selected: #16382a;
    --sudoku-highlight: #13241b;
    --sudoku-error-bg: #291515;
    --sudoku-box-border: #3b3f49;

    --illus-opacity: 0.75;
    --illus-brightness: 1.25;
}

/* ============================================
   RESET & BASE SETUP
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: clip;
    overscroll-behavior-x: none;
    touch-action: pan-y pinch-zoom;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    line-height: 1.6;
    letter-spacing: -0.012em;
    /* slight decrease in letter spacing for body text */
    overflow-x: clip;
    transition: background-color 0.25s ease, color 0.25s ease;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s ease;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

img,
svg {
    display: block;
}

/* Wide centered layout - increased left and right margins, no vertical dashed lines */
.main-page-container {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 var(--page-margin);
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================
   TOP NAVBAR / HEADER
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 27px;
    background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 80%, transparent 100%);
    margin-bottom: 52px;
}

.site-header.contact-menu-open {
    z-index: 1002;
}

/* Center nav with curvy wavy active underline on all sections */
.center-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav-link {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    position: relative;
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-nav-link:hover {
    color: var(--text);
}

.header-nav-link.active {
    color: var(--text);
    font-weight: 600;
}

.active-wave {
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    width: 100%;
    height: 10px;
    color: var(--accent);
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.header-nav-link.active .active-wave {
    opacity: 1;
    transform: translateY(0);
}

/* Header Right Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

/* Contact & More Button matching reference */
.contact-menu-wrapper {
    position: relative;
}

.contact-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.contact-more-btn i {
    font-size: 0.95rem;
}

.contact-more-btn:hover {
    background: transparent;
    border-color: var(--border);
    color: var(--accent);
}

/* Expanded Contact & More Tile Dropdown matching 1st reference image */
.contact-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.contact-dropdown-panel.show {
    display: flex;
}

.contact-tile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text);
    transition: background 0.15s ease;
}

.contact-tile-row:last-child {
    border-bottom: none;
}

.contact-tile-row:hover {
    background: var(--surface-hover);
    color: var(--accent);
}

.contact-tile-row.highlighted-row {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.tile-label {
    letter-spacing: 0.06em;
    font-weight: 700;
    flex: 0 0 auto;
}

.tile-value {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--text-dim);
    font-weight: 400;
    white-space: nowrap;
}

.tile-value i {
    font-size: 0.75rem;
}

.contact-tile-row:hover .tile-value {
    color: var(--accent);
}

/* Theme Toggle Button (Simple icon based) */
.theme-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    /* Same as outer page background, no ffffff */
    color: var(--text);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.theme-icon-btn:hover {
    background: transparent;
    border-color: var(--border);
    color: var(--accent);
}

.theme-icon-btn:active {
    transform: scale(0.95);
}

[data-theme="light"] #theme-icon-sun {
    display: none;
}

[data-theme="light"] #theme-icon-moon {
    display: inline-block;
}

[data-theme="dark"] #theme-icon-sun {
    display: inline-block;
}

[data-theme="dark"] #theme-icon-moon {
    display: none;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    padding-bottom: 36px;
}

.hero-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

/* Profile image as logo */
.avatar-wrapper {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.hero-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Minimal status row without background div */
.hero-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
}

.status-divider {
    color: var(--text-muted);
}

/* Introduction Title */
.hero-heading {
    margin-bottom: 22px;
}

.hero-greeting-line {
    margin-bottom: 12px;
}

.hero-greeting-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.hero-greeting-btn:hover {
    background: transparent;
    border-color: var(--border);
}

.greeting-text {
    display: inline-block;
    transition: opacity 0.25s ease;
}

.greeting-text.fade-out {
    opacity: 0;
}

.greeting-text.fade-in {
    opacity: 1;
}

.greeting-wave-hand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.greeting-wave-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    transform: scale(1.08);
}

.hero-greeting-btn:hover .greeting-wave-hand {
    transform: rotate(15deg);
}

.hero-title-main {
    font-family: var(--font-serif);
    font-size: 2.1rem;
    font-weight: 400;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--text);
}

.hero-heading-name {
    color: var(--text);
    font-weight: 600;
}

.hero-description {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.8;
    letter-spacing: -0.012em;
    color: var(--text-dim);
    max-width: 680px;
    margin-bottom: 24px;
}

.hero-description strong {
    color: var(--text);
    font-weight: 500;
}

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

.hero-command-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.key-badge {
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--text);
    background: var(--surface-elevated);
}

.content-divider {
    height: 1px;
    background: var(--border-light);
    margin: 44px 0;
    width: 100%;
}

/* ============================================
   WORKS SECTION (Matching Reference Image 3)
   Zero card background box, zero shadows, sharp corners
   ============================================ */
.section-container {
    padding: 12px 0 32px;
}

.section-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.section-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
}

.section-header-row .section-title-group {
    margin-bottom: 0;
}

.section-heading {
    font-family: var(--font-sans);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.section-subtext {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: -0.012em;
    color: var(--text-muted);
    max-width: 680px;
}

.text-link {
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.works-nav {
    display: inline-flex;
    align-items: center;
    position: relative;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
}

.works-tab {
    position: relative;
    z-index: 2;
    padding: 4px 12px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-radius: 4px;
    transition: color 0.2s ease;
}

.works-tab.active {
    color: var(--bg);
}

.works-tab-indicator {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    background: var(--text);
    border-radius: 4px;
    z-index: 1;
    transition: transform 0.22s ease, width 0.22s ease;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Works 2-column Grid: NO card shadows, NO card background box */
.works-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 24px;
}

.works-grid.single-col {
    grid-template-columns: 1fr;
}

.work-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    /* No separate background */
    border: none;
    /* No box border */
    padding: 0;
    /* Clean direct layout */
    box-shadow: none;
    /* No shadow */
}

.work-card-media {
    position: relative;
    border-radius: var(--radius-sm);
    /* Sharp corner with little roundness */
    overflow: hidden;
    background: var(--surface-elevated);
    aspect-ratio: 16 / 10;
    cursor: pointer;
    border: 1px solid var(--border);
}

.work-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.35s ease;
}

/* Minimal image zoom on hover only */
.work-card:hover .work-card-img {
    transform: scale(1.02);
}

.work-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.work-card-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.work-card-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.work-card-slash {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.work-card-tagline {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-dim);
}

.work-card-body {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    line-height: 1.65;
    letter-spacing: -0.01em;
    color: var(--text-dim);
    margin: 2px 0 6px;
}

/* Link icons with minimal border in works grid */
.work-card-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.work-card-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.85rem;
    background: transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.work-card-link-icon:hover {
    color: var(--text);
    border-color: var(--border);
    background: transparent;
}

/* ============================================
   ORRERY PROJECT SHOWCASE (Exact reference layout)
   ============================================ */
.project-showcase-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 36px;
    align-items: center;
    padding: 16px 0 24px;
}

.orrery-diagram-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
    background-size: 16px 16px;
    background-position: 8px 8px;
    min-height: 230px;
}

[data-theme="dark"] .orrery-diagram-card {
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1.2px, transparent 1.2px);
}

.orrery-branch-svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    overflow: visible;
}

.svg-branch-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    fill: var(--text-muted);
}

.svg-node-trunk {
    fill: var(--surface);
    stroke: var(--text-dim);
    stroke-width: 1.6;
}

.svg-node-merge {
    fill: var(--text);
    stroke: var(--text);
    stroke-width: 1.6;
}

.project-details-col {
    display: flex;
    flex-direction: column;
}

.project-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.project-title-name {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.project-title-slash {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.project-title-desc {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.project-body-text {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.75;
    letter-spacing: -0.012em;
    color: var(--text-dim);
    margin: 14px 0 22px;
}

.project-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.project-pills {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-pill {
    display: inline-block;
    padding: 3px 10px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
}

.project-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.project-action-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    transition: color 0.15s ease;
}

.project-action-link:hover {
    color: var(--accent);
}

/* Full-width Orrery project showcase */
.project-showcase-full {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 0 24px;
}

.orrery-full-width {
    width: 100%;
    min-height: 240px;
    padding: 24px 20px;
}

.orrery-full-width .orrery-branch-svg {
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0 auto;
    display: block;
}

.orrery-full-width .svg-branch-label {
    font-size: 11px;
}

@media (max-width: 820px) {
    .orrery-full-width {
        min-height: 230px;
        padding: 16px 8px;
    }

    .orrery-full-width .orrery-branch-svg {
        width: 110%;
        max-width: none;
        margin-left: -5%;
    }

    .orrery-full-width .svg-branch-label {
        font-size: 12px;
    }
}

.orrery-details-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.orrery-title-block {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.orrery-body {
    margin: 10px 0 18px;
    max-width: 680px;
}

/* Icon+text links in projects */
.project-icon-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
}

.project-icon-link i {
    font-size: 0.9rem;
}

/* Legacy 2-column layout kept for future use */
.project-showcase-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 36px;
    align-items: center;
    padding: 16px 0 24px;
}

@media (max-width: 780px) {
    .project-showcase-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Pinterest-style graphic gallery; preserve each image's natural proportions */
.branding-masonry-grid {
    columns: 3;
    column-gap: 20px;
}

.branding-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 9px 18px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.2s ease;
}

.branding-item:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 12px 22px rgba(0, 0, 0, 0.16);
}

.branding-masonry-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
}

.branding-item:hover .branding-masonry-img {
    transform: scale(1.015);
}

@media (max-width: 768px) {
    .branding-masonry-grid {
        columns: 2;
        column-gap: 12px;
    }

    .branding-item {
        margin-bottom: 12px;
    }
}

@media (max-width: 380px) {
    .branding-masonry-grid {
        columns: 2;
    }
}

/* ============================================
   WORK EXPERIENCE SECTION (Matching Reference Image 4)
   ============================================ */
.company-icon-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
}

.company-icon-box {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text-muted);
    background: var(--surface);
    transition: all 0.2s ease;
}

.company-icon-box.active {
    border-color: var(--text);
    color: var(--accent);
}

.work-item-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 44px;
}

.work-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.work-item-title-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.role-bold {
    font-weight: 700;
    color: var(--text);
}

.company-underlined {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    color: var(--text);
    font-weight: 500;
}

.company-underlined:hover {
    color: var(--accent);
}

.date-muted {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.work-item-visual {
    min-width: 0;
}

.work-item-banner {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 330px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    cursor: pointer;
}

.work-item-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    display: block;
    transition: transform 0.35s ease;
}

.work-item-banner:hover .work-item-banner-img {
    transform: scale(1.015);
}

.work-item-banner-caption {
    position: absolute;
    bottom: 12px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.work-item-description {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.8;
    letter-spacing: -0.012em;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ============================================
   ABOUT ME SECTION
   ============================================ */
.about-grid-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 36px;
    align-items: start;
}

.about-portrait-card {
    display: flex;
    justify-content: center;
}

/* Album style photo frame with subtle drop shadow */
.about-album-frame {
    background: #ffffff;
    padding: 10px 10px 16px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

[data-theme="dark"] .about-album-frame {
    background: #191b1e;
    border-color: #2a2c32;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.about-album-frame:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .about-album-frame:hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.about-portrait-img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 1px;
    border: 1px solid var(--border-light);
    filter: grayscale(80%);
    transition: filter 0.3s ease;
}

.about-album-frame:hover .about-portrait-img {
    filter: grayscale(10%);
}

.album-caption {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-align: center;
}

.about-story-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.story-paragraph {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.8;
    letter-spacing: -0.012em;
    color: var(--text-dim);
}

/* ============================================
   MINIMAL FOOTER WITH BOTTOM FLUSH ARCHITECTURE SVG
   ============================================ */
.site-footer {
    position: relative;
    margin-top: 56px;
    padding-top: 40px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* Footer illustration as background on the right end */
.footer-architectural-illustration {
    position: absolute;
    bottom: 0;
    right: -20px;
    width: 360px;
    height: auto;
    max-height: none;
    display: block;
    overflow: visible;
    opacity: var(--illus-opacity);
    filter: brightness(var(--illus-brightness));
    pointer-events: none;
    z-index: 0;
}

.footer-building-svg {
    width: 100%;
    height: auto;
    display: block;
}

.footer-bottom-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 16px 0 0;
    border-top: 1px solid var(--border-light);
    margin-top: 48px;
}

.footer-social-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-social-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    font-size: 1rem;
    background: transparent;
    border: none;
    transition: color 0.15s ease;
}

.footer-social-icon-btn:hover {
    color: var(--text);
}

.footer-right-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-to-top-btn {
    color: var(--text-dim);
    transition: color 0.15s ease;
}

.back-to-top-btn:hover {
    color: var(--text);
}

/* Old monkey block removed — see bottom of file for definitive monkey styles */

/* ============================================
   SUDOKU MINI WINDOW
   ============================================ */
.sudoku-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.win-window {
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.win-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--accent);
    color: #ffffff;
}

.win-title-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
}

.win-ctrl-btn {
    font-size: 0.7rem;
    color: #ffffff;
}

.win-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    width: 240px;
    border: 1px solid var(--border);
}

.sudoku-cell {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
}

.sudoku-cell.selected {
    background: var(--sudoku-selected);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.sudoku-cell.given {
    color: var(--sudoku-given);
    font-weight: 600;
}

.sudoku-cell.error {
    color: var(--error);
    background: var(--sudoku-error-bg);
}

.sudoku-cell.highlight {
    background: var(--sudoku-highlight);
}

.sudoku-cell.box-right {
    border-right: 2px solid var(--sudoku-box-border);
}

.sudoku-cell.box-bottom {
    border-bottom: 2px solid var(--sudoku-box-border);
}

.sudoku-numpad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    width: 240px;
}

.num-btn {
    height: 32px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
}

.sudoku-win-msg {
    display: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
}

.sudoku-win-msg.show {
    display: block;
}

/* ============================================
   CASE STUDY SIDEBAR
   ============================================ */
.cs-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 10004;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cs-backdrop.cs-open {
    opacity: 1;
    pointer-events: auto;
}

.cs-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 100vw);
    height: 100vh;
    background: var(--surface);

    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.06);
    z-index: 10005;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.5s;
}

.cs-sidebar.cs-open {
    visibility: visible;
    transform: translateX(0);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}
/* Page shift when sidebar opens */
body.sidebar-open .main-page-container {
    transform: translateX(-100px);
}
@media (max-width: 820px) {
    body.sidebar-open .main-page-container {
        transform: none;
    }
}

/* Mobile: full-screen shot detail */
@media (max-width: 820px) {
    .cs-sidebar {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto;
        height: 100vh;
        height: 100dvh;
        border-left: none;
        border-top: none;
        border-radius: 0;
        box-shadow: none;
        transform: translateY(100%);
    }
    .cs-sidebar.cs-open {
        transform: translateY(0);
    }
    .cs-backdrop.cs-open {
        background: rgba(0, 0, 0, 0.35);
    }
    .cs-header::before {
        content: none;
    }
    .cs-header {
        position: relative;
        padding: 14px 18px;
    }
}

.cs-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    top: 0;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: sticky;
    z-index: 2;
    flex-shrink: 0;
}

@media (min-width: 821px) {
    .cs-header {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.cs-header-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.cs-tag {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.cs-tagline {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.cs-close {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.cs-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.cs-img-wrap {
    position: relative;
    width: 100%;
    flex-shrink: 0;
    background: var(--surface-elevated);

    overflow: hidden;
    max-height: 260px;
    cursor: zoom-in;
}

.cs-img {
    width: 100%;
    height: 100%;
    max-height: 260px;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform 0.3s ease;
}

.cs-img-wrap:hover .cs-img {
    transform: scale(1.02);
}

@media (min-width: 821px) {
    .cs-img-wrap {
        width: calc(100% - 20px);
        margin: 0 10px;
        border-radius: var(--radius-sm);
    }
}

/* Image lightbox */
.cs-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.cs-lightbox.cs-lb-open {
    opacity: 1;
    pointer-events: auto;
}

.cs-lightbox img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    transform: scale(0.96);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.cs-lightbox.cs-lb-open img {
    transform: scale(1);
}

.cs-body {
    padding: 18px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.cs-brief {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.8;
    color: var(--text-dim);
    letter-spacing: -0.01em;
}

.cs-links {
    display: flex;
    gap: 8px;
    padding: 0 18px 24px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.cs-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    transition: opacity 0.15s ease;
}

.cs-link-btn:hover {
    color: var(--text-muted);
    border-color: var(--border);
    opacity: 0.7;
}

/* Kinetic Cube for Orrery */
.loader {
    --size: 56px;
    width: var(--size);
    height: var(--size);
    position: relative;
    transform-style: preserve-3d;
    animation: rotateBox 6s infinite linear;
}

.loader .side {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.85;
    border: 1px solid var(--accent);
    background: rgba(23, 128, 94, 0.12);
}

.loader .front {
    transform: translateZ(calc(var(--size) / 2));
}

.loader .behind {
    transform: rotateY(180deg) translateZ(calc(var(--size) / 2));
}

.loader .right {
    transform: rotateY(90deg) translateZ(calc(var(--size) / 2));
}

.loader .left {
    transform: rotateY(-90deg) translateZ(calc(var(--size) / 2));
}

.loader .top {
    transform: rotateX(90deg) translateZ(calc(var(--size) / 2));
}

.loader .bottom {
    transform: rotateX(-90deg) translateZ(calc(var(--size) / 2));
}

@keyframes rotateBox {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 820px) {
    :root {
        --page-margin: 14px;
    }

    .cs-img-wrap {
        max-height: none;
    }

    .cs-img {
        height: auto;
        max-height: min(62vh, 620px);
        object-fit: contain;
    }

    /* Keep navigation and actions on one row */
    .site-header {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
        padding: 16px 0 19px;
        margin-bottom: 32px;
    }

    .center-nav {
        gap: clamp(8px, 2.5vw, 16px);
        order: 0;
        width: auto;
        min-width: 0;
    }

    .header-nav-link {
        font-size: clamp(0.63rem, 2.75vw, 0.73rem);
        white-space: nowrap;
    }

    .header-actions {
        order: 0;
        margin-left: auto;
        gap: 8px;
        flex-shrink: 0;
    }

    /* Contact button: hide label text on small screens */
    .contact-more-btn span {
        display: none;
    }

    .contact-more-btn {
        width: 48px;
        height: 34px;
        padding: 0;
        justify-content: center;
        font-size: 1rem;
    }

    .contact-more-btn i {
        font-size: 1.1rem;
    }

    .theme-icon-btn {
        width: 34px;
        height: 34px;
    }

    /* Hero title smaller on mobile */
    .hero-title-main {
        font-size: 1.55rem;
        line-height: 1.22;
    }

    .hero-description {
        font-size: 0.78rem;
    }

    /* Works grid: single column */
    .works-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Section header row: stack on mobile */
    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* About grid: single column */
    .about-grid-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .about-portrait-card {
        max-width: 200px;
    }

    /* Footer */
    .footer-bottom-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    /* Contact dropdown: full width on mobile */
    .contact-dropdown-panel {
        width: min(260px, calc(100vw - 32px));
    }
}

/* ============================================
   INTERACTIVE PIXEL MONKEY (CUTE, MINIMAL, NO SHADOWS)
   ============================================ */
.interactive-monkey {
    position: absolute;
    z-index: 999;
    cursor: pointer;
    user-select: none;
    transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), top 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
}

.monkey-sprite {
    display: block;
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    cursor: pointer;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.interactive-monkey:active .monkey-sprite {
    transform: scale(0.92);
}

/* Minimal Speech Bubble matching uploaded reference image media_1792062259365.png */
.monkey-minimal-bubble {
    position: fixed;
    top: var(--bubble-top, 0px);
    left: var(--bubble-left, 50%);
    transform: translateX(-50%) translateY(4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.06);
    z-index: 1001;
    max-width: calc(100vw - 16px);
}

.interactive-monkey.bubble-below .monkey-minimal-bubble {
    top: var(--bubble-top, 0px);
}

/* Speech bubble bottom pointer */
.monkey-minimal-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: var(--border) transparent transparent transparent;
}

.monkey-minimal-bubble::before {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0 4px;
    border-style: solid;
    border-color: var(--surface) transparent transparent transparent;
    z-index: 1;
}

.interactive-monkey.bubble-below .monkey-minimal-bubble::after {
    top: auto;
    bottom: 100%;
    border-width: 0 5px 5px;
    border-color: transparent transparent var(--border);
}

.interactive-monkey.bubble-below .monkey-minimal-bubble::before {
    top: auto;
    bottom: calc(100% - 1px);
    border-width: 0 4px 4px;
    border-color: transparent transparent var(--surface);
}

.interactive-monkey.show-bubble .monkey-minimal-bubble {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 820px) {
    .interactive-monkey.bubble-anchor-hidden .monkey-minimal-bubble {
        opacity: 0;
        pointer-events: none;
    }
}

.bubble-inner-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bubble-inner-row input {
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text);
    width: min(185px, calc(100vw - 72px));
    min-width: 0;
    height: 24px;
}

.bubble-inner-row input::placeholder {
    color: var(--text-muted);
}

.bubble-sudoku-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}

.bubble-sudoku-icon:hover {
    color: var(--accent);
    background: var(--surface-hover);
}

.bubble-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.bubble-send-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.bubble-mini-status {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--accent);
    margin-top: 4px;
    text-align: center;
    display: none;
}

/* Monkey hang tilt — pendulum physics on hover while hanging */
@keyframes monkeyPendulum {
    0%   { transform: rotate(-11deg); }
    25%  { transform: rotate(11deg); }
    50%  { transform: rotate(-11deg); }
    75%  { transform: rotate(11deg); }
    100% { transform: rotate(-11deg); }
}

.interactive-monkey.is-hanging:hover .monkey-sprite {
    animation: monkeyPendulum 2.2s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    transform-origin: top center;
}
