/* =========================================================
   styles.css — shared skeleton for every page
   Page-specific sections get added below as we build each page.
   ========================================================= */

/* ---------- 1. Design tokens (the one place colors live) ---------- */
:root {
    --wood:          #7d5030;          /* desk color while the wood image loads */
    --paper:         #fdfbf6;          /* business card + page sheets */
    --bg-base:       #e6dccf;
    --text:          #2d241e;
    --text-muted:    #5c4d41;
    --heading:       #1a130e;
    --rule:          #baab98;
    --primary:       #8b5a2b;
    --primary-hover: #6e441f;
    --nav-bg:        #2b231d;
    --nav-text:      #f4efe8;
    --nav-accent:    #dcb88f;
    --card-bg:       rgba(255, 255, 255, 0.75);
    --card-border:   rgba(255, 255, 255, 0.5);
    --shadow:        0 6px 20px rgba(45, 36, 30, 0.08);
    --radius:        12px;
    --font:          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display:  "Young Serif", Georgia, "Times New Roman", serif;
    --sheet-shadow:  0 1px 2px rgba(0, 0, 0, 0.25), 0 26px 40px -14px rgba(20, 10, 4, 0.65);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    background: var(--wood) url("/assets/wood.svg") repeat;   /* the wooden desk */
}

/* Emblem in the bottom-right corner of every page */
body::after {
    content: "";
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 78px;
    height: 78px;
    background: url("/assets/emblem.svg") center / contain no-repeat;
    filter: drop-shadow(0 4px 6px rgba(20, 10, 4, 0.5));
    pointer-events: none;
    z-index: 50;
}

main { flex: 1; }   /* pushes the footer to the bottom on short pages */

h1, h2, h3 { color: var(--heading); line-height: 1.2; }
h1, h2 { font-family: var(--font-display); font-weight: 400; }

:focus-visible { outline: 3px solid var(--nav-accent); outline-offset: 3px; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

[hidden] { display: none !important; }   /* the hidden attribute always wins */

/* ---------- 3. Navigation ---------- */
.site-nav {
    background: var(--nav-bg);
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;                 /* wraps instead of overflowing on phones */
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.site-nav .brand {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--nav-accent);
    text-decoration: none;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.site-nav ul a {
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 600;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.site-nav ul a:hover,
.site-nav ul a[aria-current="page"] {
    color: var(--nav-accent);
    border-bottom-color: var(--nav-accent);
}

/* ---------- 4. Shared layout pieces ---------- */
/* Inner pages: a sheet of paper lying on the desk */
.container {
    width: calc(100% - 3rem);
    max-width: 860px;
    margin: 3rem auto;
    padding: 2.75rem 3rem;
    background: var(--paper);
    border-radius: 4px;
    box-shadow: var(--sheet-shadow);
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(3px);
    padding: 2rem;
}
/* Panels printed on a sheet: quieter than free-standing cards */
.container .card {
    background: #fff;
    border: 1px solid #e9e0d3;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(45, 36, 30, 0.06);
    backdrop-filter: none;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.85rem 1.75rem;
    border-radius: 0.5rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(139, 90, 43, 0.25);
    transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: var(--primary-hover); color: #fff; transform: translateY(-2px); }

/* ---------- 5. Footer ---------- */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: #f1e2cc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ---------- 6. Small screens ---------- */
@media (max-width: 600px) {
    .site-nav { padding: 1rem 1.25rem; }
    .container { width: calc(100% - 1.5rem); margin: 1rem auto; padding: 1.75rem 1.25rem; }
    .card { padding: 1.5rem; }
}

/* Phones: the emblem sits at the bottom of the page instead of floating over content */
@media (max-width: 760px) {
    body::after {
        position: static;
        align-self: flex-end;
        width: 56px;
        height: 56px;
        margin: 0 14px 14px 0;
    }
}

/* =========================================================
   Page-specific styles go below this line (home, about,
   projects, resume) as we work through each page.
   ========================================================= */

/* ---------- Home page (index.html): a business card on the desk ---------- */
.desk {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7rem 1.5rem 8rem;
    overflow: hidden;                 /* things can run off the edge of the desk */
    /* soft window light from the upper left */
    background: linear-gradient(118deg, rgba(255, 238, 210, 0.16) 0%, rgba(255, 238, 210, 0) 42%, rgba(20, 10, 4, 0.22) 100%);
}

/* Everything in the scene is sized from the scene's width (cqw), so it scales with the screen */
.desk-scene {
    position: relative;
    width: clamp(300px, 54vw, 900px);
    container-type: inline-size;
}

/* --- The card: wrapper tilts it and lands it; flipper turns it over --- */
.card-wrap {
    position: relative;
    z-index: 2;
    perspective: 1600px;
    transform: rotate(-2deg);
    animation: card-land 0.7s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes card-land {
    from { opacity: 0; transform: translateY(-28px) rotate(-7deg); }
    to   { opacity: 1; transform: rotate(-2deg); }
}

.card-flipper {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(.4, .1, .2, 1);
}
.card-flipper.flipped { transform: rotateY(180deg); }

.business-card {
    grid-area: 1 / 1;                 /* front and back occupy the same spot */
    position: relative;
    aspect-ratio: 7 / 4;              /* a real 3.5 x 2 in card */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    padding: 6cqw 6.5cqw;
    background: radial-gradient(120% 90% at 20% 10%, #fffefb 0%, var(--paper) 55%, #f3ede2 100%);
    border-radius: 6px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 22px 34px -10px rgba(20, 10, 4, 0.7);
}
.card-back { transform: rotateY(180deg); }

.card-front {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 5cqw;
}

.card-emblem { position: absolute; top: 2.6cqw; right: 2.6cqw; width: 7cqw; min-width: 38px; }

.card-photo {
    width: 27cqw;
    height: 27cqw;
    object-fit: cover;
    object-position: center top;
    border-radius: 50%;
    box-shadow: 0 0 0 4px #fff, 0 6px 14px rgba(45, 36, 30, 0.25);
}

.card-text { text-align: left; }
.card-text h1 { font-size: clamp(2rem, 6.4cqw, 3.6rem); margin: 0 0 0.4rem; }
.card-text p  { margin: 0 0 1.4rem; font-size: clamp(1rem, 2.5cqw, 1.35rem); color: #4a3e35; max-width: 30ch; }
.card-front .btn { font-size: clamp(0.95rem, 2.2cqw, 1.15rem); }

.actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.social-links { display: flex; gap: 1.25rem; }
.social-links a {
    font-size: clamp(1.75rem, 4.3cqw, 2.4rem);
    line-height: 1;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
}
.social-links .github   { color: #181717; }   /* GitHub's brand black */
.social-links .linkedin { color: #0a66c2; }   /* LinkedIn's brand blue */
.social-links a:hover   { opacity: 0.75; transform: translateY(-2px); }

.flip-btn {
    position: absolute;
    right: 2.2cqw;
    bottom: 2cqw;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(45, 36, 30, 0.2);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.flip-btn:hover { color: var(--primary); border-color: var(--primary); background: rgba(139, 90, 43, 0.06); }

.card-back { display: flex; align-items: center; }
.back-text { max-width: 78%; }
.back-text h2 { font-size: clamp(1.5rem, 4.2cqw, 2.3rem); margin: 0 0 0.75rem; }
.back-text p  { margin: 0 0 0.9rem; font-size: clamp(0.98rem, 2.3cqw, 1.25rem); color: #4a3e35; }
.back-text .currently strong { color: var(--primary); }
.back-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.back-links .btn { padding: 0.65rem 1.4rem; }

/* --- Desk objects that are links --- */
.desk-resume {
    position: absolute;
    z-index: 1;
    width: 44cqw;
    top: -17cqw;
    left: 5cqw;
    transform: rotate(-7deg);
    transition: transform 0.25s;
}
.desk-resume img {
    display: block;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 14px 22px -8px rgba(20, 10, 4, 0.6);
}
.desk-resume:hover, .desk-resume:focus-visible { transform: rotate(-7deg) translateY(-12px); }

.desk-notebook {
    position: absolute;
    z-index: 1;
    width: 34cqw;
    aspect-ratio: 3 / 4;
    right: -31cqw;
    bottom: -25cqw;
    transform: rotate(9deg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4cqw;
    text-decoration: none;
    border-radius: 4px 10px 10px 4px;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0, rgba(0, 0, 0, 0) 9%),          /* spine shading */
        radial-gradient(120% 80% at 30% 20%, #5a3b28 0%, #3c271a 70%, #2e1d13 100%);  /* leather */
    box-shadow:
        5px 0 0 -1px #efe6d6, 8px 0 0 -2px #e2d6c2, 11px 0 0 -3px #d6c8b1,          /* page edges */
        0 18px 28px -10px rgba(20, 10, 4, 0.75);
    transition: transform 0.25s;
}
.desk-notebook::after {                    /* elastic band */
    content: "";
    position: absolute;
    top: 0; bottom: 0; right: 14%;
    width: 4%;
    background: linear-gradient(90deg, #1c120b, #34221a, #1c120b);
}
.notebook-title {
    font-family: var(--font-display);
    font-size: clamp(1rem, 3cqw, 1.7rem);
    color: #d9b277;                         /* gold foil */
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.desk-notebook:hover, .desk-notebook:focus-visible { transform: rotate(9deg) translateY(-8px); }

.sticky-note {
    position: absolute;
    z-index: 3;
    width: 25cqw;
    min-width: 170px;
    right: -27cqw;
    bottom: -13cqw;
    transform: rotate(4deg);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 1.1rem 1rem 1rem;
    font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    color: #2b2118;
    text-decoration: none;
    background: linear-gradient(180deg, #f8e58c 0%, #f3da6f 100%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 12px 18px -8px rgba(20, 10, 4, 0.6);
    transition: transform 0.25s;
}
.sticky-note::before {                      /* the sticky strip along the top */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 18%;
    background: rgba(0, 0, 0, 0.04);
}
.note-label { font-size: 1.15rem; opacity: 0.75; }
.note-name  { font-size: clamp(1.35rem, 3cqw, 1.75rem); font-weight: 700; line-height: 1.05; }
.note-date  { font-size: 1.1rem; opacity: 0.8; }
.sticky-note:hover, .sticky-note:focus-visible { color: #2b2118; transform: rotate(2deg) translateY(-6px); }

/* --- Decorative props --- */
.prop { position: absolute; z-index: 4; pointer-events: none; user-select: none; }
.prop-coffee { width: 37cqw; top: -18cqw; right: -30cqw; }
.prop-coffee img { display: block; width: 100%; }
.prop-pastry { width: 46cqw; bottom: -22cqw; left: -35cqw; transform: rotate(-8deg); }
/* Drawing tablet peeking in from the top-right corner of the desk */
.prop-tablet { z-index: 0; width: clamp(280px, 31vw, 580px); top: -9vw; right: -3vw; transform: rotate(-11deg); }
/* Tablet pen lying below the card, centered */
.prop-pen { z-index: 1; width: 50cqw; left: 25cqw; bottom: -13cqw; transform: rotate(-3deg); }

.steam {
    position: absolute;
    left: 30%; top: 4%;
    width: 40%;
    overflow: visible;
}
.steam path {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0;
    filter: blur(1.5px);
    animation: steam 5s ease-in-out infinite;
}
.steam path:nth-child(2) { animation-delay: 1.6s; }
.steam path:nth-child(3) { animation-delay: 3.2s; }
@keyframes steam {
    0%   { opacity: 0;    transform: translateY(12px) scaleX(0.9); }
    35%  { opacity: 0.45; }
    100% { opacity: 0;    transform: translateY(-26px) scaleX(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .card-wrap { animation: none; }
    .card-flipper { transition: none; }
    .steam { display: none; }
}

/* Phones and small tablets: card stands upright; only the cup and pastry peek in */
@media (max-width: 760px) {
    .desk { padding: 5rem 1rem 3rem; flex-direction: column; }
    .desk-scene { width: 100%; display: flex; flex-direction: column; }
    .card-wrap { order: 1; transform: none; animation-name: card-land-flat; }
    @keyframes card-land-flat { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: none; } }
    .business-card { aspect-ratio: auto; padding: 2.25rem 1.5rem 3.5rem; }
    .card-front { grid-template-columns: 1fr; justify-items: center; gap: 1.25rem; }
    .card-photo { width: 150px; height: 150px; }
    .card-text, .card-text p { text-align: center; margin-left: auto; margin-right: auto; }
    .card-back { align-items: flex-start; }
    .back-text { max-width: 100%; padding-top: 2.5rem; }
    .flip-btn { right: 50%; transform: translateX(50%); bottom: 1rem; }
    .desk-resume, .desk-notebook, .prop-tablet, .prop-pen { display: none; }
    .sticky-note {
        position: relative;
        right: auto; bottom: auto;
        order: 2;
        width: 230px;
        margin: 2.25rem auto 0;
        transform: rotate(-2deg);
    }
    .prop { z-index: 0; }
    .prop-coffee { width: 150px; top: -78px; right: -48px; }
    .prop-pastry { width: 190px; bottom: -40px; top: auto; left: -70px; }
}

/* ---------- Projects page (projects.html) ---------- */
.projects-page h1 { text-align: center; margin-bottom: 0.5rem; }
.projects-page .subtitle { text-align: center; color: var(--text-muted); margin: 0 0 1.5rem; }

.project-section h2 {
    margin-top: 2.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rule);
    color: #4a3e35;
}

.project-list { list-style: none; padding: 0; margin: 0; }
.project-list li { margin: 1rem 0; }

.project-card {
    display: block;
    padding: 1.25rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.project-card:hover {
    color: var(--text);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(45, 36, 30, 0.14);
}

.project-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}
.project-head h3 { margin: 0; font-size: 1.2rem; color: var(--primary); }
.project-head time { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.project-card p { margin: 0.5rem 0 0.75rem; color: #4a3e35; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(139, 90, 43, 0.12);
    color: var(--primary-hover);
}

.coming-soon, .loading { color: var(--text-muted); font-style: italic; }

/* ---------- About page (about.html) ---------- */
.about-page h1 { text-align: center; margin-bottom: 1.5rem; }
.about-intro p { font-size: 1.1rem; color: #3d3128; margin: 0 0 1rem; }
.about-intro p:last-child { margin-bottom: 0; }

.about-block { margin-top: 2.5rem; }
.about-block h2 {
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rule);
    color: #4a3e35;
}

/* Vertical timeline */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0 0 0 1.5rem; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding-bottom: 1.5rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: calc(-1.5rem - 7px);
    top: 0.35rem;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-base);
}
.timeline .when { font-size: 0.85rem; font-weight: 700; color: var(--primary); }
.timeline h3 { margin: 0.2rem 0 0.3rem; font-size: 1.1rem; }
.timeline p { margin: 0; color: #4a3e35; }
.timeline p + p { margin-top: 0.6rem; }

.about-prose p { color: #3d3128; font-size: 1.05rem; margin: 1rem 0 0; max-width: 70ch; }
.about-cta p + p { margin-top: -0.25rem; }

.about-cta { margin-top: 2.5rem; text-align: center; }
.about-cta h2 { margin-top: 0; }
.about-cta p { color: #4a3e35; }
.cta-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; margin-top: 1.25rem; }

/* ---------- Page not found (404.html) ---------- */
.not-found { flex: 0 0 auto; max-width: 620px; margin: 5rem auto auto; text-align: center; }   /* sized to its content, footer stays at the bottom */
.not-found-emblem { width: 96px; margin-bottom: 0.5rem; }
.not-found h1 { margin: 0 0 0.75rem; }
.not-found p { margin: 0; color: #4a3e35; font-size: 1.1rem; }

/* ---------- Single project page (project.html) ---------- */
.back-link { display: inline-block; margin-bottom: 1rem; font-weight: 600; text-decoration: none; }

.project-header h1 { margin: 0 0 0.5rem; }
.project-header p  { margin: 0 0 0.75rem; font-size: 1.1rem; color: #4a3e35; }
.source-btn { margin-top: 1.25rem; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
button.btn { font: inherit; font-weight: 700; cursor: pointer; border: none; }
button.btn.btn-outline { border: 2px solid var(--primary); }
button.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.project-block { margin-top: 2rem; }
.project-block h2 { margin-top: 0; }
.project-block h3 { margin: 1.75rem 0 0.5rem; font-size: 1.05rem; }

.activity-summary { margin-top: 0; color: var(--text-muted); }

/* Contribution grid */
.grid-scroll { overflow-x: auto; padding-bottom: 0.25rem; }
.grid-months {
    display: grid;
    gap: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    height: 1.1rem;
    width: max-content;
}
.grid-months span { white-space: nowrap; }
.activity-grid {
    display: grid;
    grid-template-rows: repeat(7, 10px);
    grid-auto-flow: column;
    grid-auto-columns: 10px;
    gap: 3px;
    width: max-content;
}
.day { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.level-0 { background: rgba(45, 36, 30, 0.08); }
.level-1 { background: #dcb88f; }
.level-2 { background: #b8834f; }
.level-3 { background: #8b5a2b; }
.level-4 { background: #4e3016; }
.grid-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Commit list */
.commit-list { list-style: none; margin: 0; padding: 0; }
.commit-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(45, 36, 30, 0.1);
}
.commit-msg { flex: 1 1 18rem; }
.commit-meta { display: flex; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.commit-meta a { font-family: ui-monospace, Consolas, monospace; }

/* Demo */
.demo-note { color: #4a3e35; margin-top: 0; }
.demo-note code { background: rgba(45, 36, 30, 0.08); padding: 0.1rem 0.35rem; border-radius: 4px; }
.demo-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; margin: 1.25rem 0; }
.demo-status { color: var(--text-muted); font-size: 0.95rem; }
.demo-output {
    background: #1f1a16;
    color: #efe7dc;
    font: 0.85rem/1.5 ui-monospace, Consolas, "Courier New", monospace;
    padding: 1rem;
    border-radius: 8px;
    max-height: 420px;
    overflow: auto;
    white-space: pre;
    margin: 0;
}
.demo-output .stderr { color: #f2a68a; }
.demo-plots { display: grid; justify-items: center; gap: 1rem; margin-top: 1rem; }
.demo-plots img { max-width: 100%; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }   /* natural size, never wider than the card */

/* Optional "use your own file" control on demos */
.demo-upload { margin: 1.25rem 0 0.25rem; }
.demo-upload input[type="file"] {            /* hidden but still reachable by keyboard and screen readers */
    position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.demo-upload input[type="file"]:focus-visible + .upload-btn { outline: 3px solid var(--nav-accent); outline-offset: 3px; }
.upload-btn { cursor: pointer; padding: 0.65rem 1.3rem; }
.upload-chosen { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.9rem; margin-top: 0.9rem; }
.upload-chosen img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow); }
.upload-chosen span { font-weight: 600; word-break: break-all; }
.link-btn {
    font: inherit; font-size: 0.9rem; color: var(--primary); background: none; border: none;
    padding: 0; text-decoration: underline; cursor: pointer;
}
.upload-note { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--text-muted); }
.upload-error { margin: 0.6rem 0 0; font-size: 0.92rem; color: #a3341f; font-weight: 600; }

/* Optional "type your own input" box on demos */
.demo-text { margin: 1.25rem 0 0.25rem; }
.demo-text-label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.demo-text textarea {
    width: 100%;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 0.7rem 0.85rem;
    border: 1px solid #d8ccbb;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    resize: vertical;
}
.demo-text textarea:focus { outline: 3px solid var(--nav-accent); outline-offset: 1px; border-color: var(--primary); }
.demo-text-actions { display: flex; gap: 1.25rem; margin-top: 0.4rem; }

/* ---------- Word memory mini-experiment (web/mini_experiment.js) ---------- */
.mx-note { font-size: 0.88rem; color: var(--text-muted); }
.mx-start { margin-top: 0.5rem; }

.mx-study { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.mx-scene { width: 100%; max-width: 560px; max-height: 42vh; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow); }
.mx-words {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: 0.45rem 2.2rem;
    font-family: var(--font-display); font-size: 1.2rem; color: var(--heading);
}
.mx-timer { display: flex; align-items: center; gap: 0.75rem; width: 100%; max-width: 560px; }
.mx-bar { flex: 1; height: 6px; background: rgba(45, 36, 30, 0.12); border-radius: 999px; overflow: hidden; }
.mx-bar span { display: block; height: 100%; background: var(--primary); transition: width 0.2s linear; }
.mx-count { font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 3ch; text-align: right; }

.mx-test { text-align: center; padding: 1rem 0 0.5rem; }
.mx-progress { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.mx-question { margin: 1rem 0 0.25rem; font-size: 1.1rem; }
.mx-word { margin: 0 0 1.5rem; font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, 3.2rem); color: var(--heading); min-height: 1.3em; }
.mx-answers { display: flex; justify-content: center; gap: 1rem; }
.mx-answers .btn { min-width: 8.5rem; }

.mx-verdict { font-size: 1.1rem; font-weight: 600; margin-top: 0; }
.mx-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.mx-table th, .mx-table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid rgba(45, 36, 30, 0.12); text-align: left; }
.mx-table thead th { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.mx-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-table tbody th { font-weight: 500; }
.mx-lures { margin: 0 0 1rem; }

.mx-chart { display: block; max-width: 100%; height: auto; margin-top: 0.75rem; overflow: visible; }
.mx-grid { stroke: rgba(45, 36, 30, 0.12); }
.mx-tick { font-size: 12px; fill: var(--text-muted); }
.mx-label { font-size: 13px; font-weight: 600; fill: var(--text); }
.mx-dot { fill: #b9ab9a; opacity: 0.85; }
.mx-mean { stroke: var(--heading); stroke-width: 2.5; }
.mx-you { fill: var(--primary); stroke: #fff; stroke-width: 2.5; }
.mx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1.1rem; font-size: 0.85rem; color: var(--text-muted); margin: 0.25rem 0 0; }
.mx-legend > span { white-space: nowrap; }
.mx-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 0.2rem; }
.mx-key-you { background: var(--primary); }
.mx-key-dot { background: #b9ab9a; }
.mx-key-mean { width: 3px; height: 14px; border-radius: 0; background: var(--heading); }
.mx-again { margin-top: 0.75rem; }

@media (max-width: 600px) {
    .mx-words { gap: 0.4rem 1.3rem; font-size: 1.05rem; }
    .mx-table { font-size: 0.9rem; }
    .mx-table th, .mx-table td { padding: 0.5rem 0.3rem; }
    .mx-table td { white-space: normal; }
}

/* ---------- Resume page (resume.html) ---------- */
.resume-page { text-align: center; }
.resume-page h1 { margin-bottom: 0.5rem; }
.resume-page .subtitle { color: var(--text-muted); margin: 0 0 2rem; font-size: 1.1rem; }
.resume-cta { max-width: 650px; margin: 1.5rem auto 2.5rem; }

.resume-preview {
    position: relative;
    display: inline-block;
    max-width: 650px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(45, 36, 30, 0.15);
    transition: transform 0.3s, box-shadow 0.3s;
}
.resume-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(45, 36, 30, 0.25);
}
.resume-preview img { display: block; width: 100%; border: 1px solid rgba(0, 0, 0, 0.05); }

/* "Click to download" bar that slides in on hover (desktop) */
.resume-preview::after {
    content: "⬇  Click to download PDF";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 14px;
    background: rgba(139, 90, 43, 0.95);
    color: #fff;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s;
}
.resume-preview:hover::after { opacity: 1; }
