/* ==========================================================================
   Grade 1 Learning Portfolio — styles
   --------------------------------------------------------------------------
   1. Colors & settings
   2. Base
   3. Layout helpers
   4. Header & navigation
   5. Introduction (hero)
   6. Section headings
   7. Project filters & cards
   8. Subjects
   9. Achievements
   10. Journey timeline
   11. Gallery
   12. Parent's note
   13. Footer
   14. Modal & lightbox
   15. Image placeholders
   16. Animations
   ========================================================================== */

/* 1. Colors & settings ---------------------------------------------------- */
:root {
    /* Page colors */
    --bg: #FFFAF3;
    --bg-tinted: #FFF3E6;
    --surface: #FFFFFF;
    --ink: #26304A;
    --ink-soft: #56607A;
    --line: #F0E5D6;
    --primary: #3A57C4;
    --primary-dark: #2B44A3;

    /* Soft pastel subject colors (+ a stronger shade of each) */
    --peach: #FFE4D6;    --peach-strong: #F4A585;
    --mint: #D9F3E6;     --mint-strong: #7CCBA2;
    --sky: #DCEBFF;      --sky-strong: #84AEEA;
    --lemon: #FFF1BF;    --lemon-strong: #EDC54A;
    --lavender: #E8E2FF; --lavender-strong: #A493E6;
    --pink: #FFE0EA;     --pink-strong: #EC97B2;

    --tint: var(--sky);
    --tint-strong: var(--sky-strong);

    --font-heading: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
    --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius: 22px;
    --radius-sm: 14px;
    --shadow: 0 1px 2px rgba(38, 48, 74, .05), 0 8px 24px rgba(38, 48, 74, .07);
    --shadow-hover: 0 2px 4px rgba(38, 48, 74, .06), 0 16px 36px rgba(38, 48, 74, .12);
    --header-h: 68px;
    --gutter: clamp(16px, 4vw, 32px);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 12px);
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

html.modal-open {
    overflow: hidden;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: break-word;
}

p, ul, ol, dl, dd, figure {
    margin: 0;
}

img {
    max-width: 100%;
    display: block;
}

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

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
}

[hidden] {
    display: none !important;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--ink);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    top: 12px;
}

/* 3. Layout helpers ------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.section {
    padding: clamp(56px, 8vw, 96px) 0;
}

.section--tinted {
    background: var(--bg-tinted);
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(58, 87, 196, .25);
    transition: background-color .2s, transform .2s;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background-color .2s, transform .2s;
}

.icon-button:hover {
    background: var(--lemon);
}

/* 4. Header & navigation -------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 250, 243, .92);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
}

.brand-icon {
    color: var(--lemon-strong);
    fill: var(--lemon);
    font-size: 1.4rem;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    padding: 0;
}

.site-nav a {
    display: block;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: .98rem;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}

.site-nav a:hover {
    background: var(--peach);
    color: var(--ink);
}

.site-nav a[aria-current="location"] {
    background: var(--sky);
    color: var(--ink);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    height: 2.5px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .25s, opacity .2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

@media (max-width: 899px) {
    .js .nav-toggle {
        display: flex;
    }

    .js .site-nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: var(--gutter);
        right: var(--gutter);
        padding: 10px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-hover);
    }

    .js .site-nav.is-open {
        display: block;
    }

    .js .site-nav ul {
        flex-direction: column;
    }

    .js .site-nav a {
        padding: 12px 16px;
        border-radius: 10px;
        font-size: 1.05rem;
    }
}

/* 5. Introduction (hero) -------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: clamp(40px, 7vw, 80px) 0 clamp(44px, 7vw, 72px);
    background:
        radial-gradient(circle at 12% 20%, var(--peach) 0, transparent 38%),
        radial-gradient(circle at 92% 80%, var(--sky) 0, transparent 40%),
        var(--bg);
}

.hero-inner {
    position: relative;
    display: grid;
    gap: 32px;
    align-items: center;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--mint);
    font-weight: 800;
    font-size: .85rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(1.9rem, 3.4vw + 1rem, 3.1rem);
    font-weight: 700;
    max-width: 18ch;
}

.hero-intro {
    margin-top: 14px;
    max-width: 52ch;
    color: var(--ink-soft);
    font-size: 1.15rem;
}

.info-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 28px;
}

.info-item {
    padding: 10px 18px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.info-item dt {
    color: var(--ink-soft);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.info-item dd {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.15rem;
}

.hero-photo {
    order: -1;
    justify-self: start;
    width: 128px;
    position: relative;
}

.hero-photo .img-frame {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 6px solid var(--surface);
    box-shadow: var(--shadow-hover);
    --tint: var(--lemon);
}

.hero-photo::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 4px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--lemon) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23EDC54A'%3E%3Cpath d='M12 2.8l2.8 5.7 6.3.9-4.55 4.44 1.07 6.26L12 17.2l-5.62 2.95 1.07-6.26L2.9 9.4l6.3-.9z'/%3E%3C/svg%3E") center / 20px no-repeat;
    border: 3px solid var(--surface);
}

.deco {
    position: absolute;
    font-size: 2.6rem;
    opacity: .35;
    pointer-events: none;
}

.deco-1 { top: 14%; right: 6%; color: var(--peach-strong); transform: rotate(-12deg); }
.deco-2 { top: 8%; left: 46%; color: var(--lemon-strong); font-size: 1.8rem; }
.deco-3 { bottom: 10%; left: 3%; color: var(--sky-strong); transform: rotate(8deg); }
.deco-4 { bottom: 12%; right: 32%; color: var(--mint-strong); transform: rotate(-20deg); }

@media (max-width: 767px) {
    .deco-1, .deco-2, .deco-4 { display: none; }
    .deco-3 { top: 24px; right: 20px; bottom: auto; left: auto; }
}

@media (min-width: 768px) {
    .hero-inner {
        grid-template-columns: 1fr auto;
        gap: 48px;
    }

    .hero-photo {
        order: 0;
        width: clamp(180px, 22vw, 240px);
        margin-right: clamp(0px, 4vw, 48px);
    }

    .hero-photo::after {
        width: 48px;
        height: 48px;
        right: 4px;
        bottom: 10px;
        background-size: 26px;
    }
}

/* 6. Section headings ------------------------------------------------------ */
.section-head {
    max-width: 640px;
    margin: 0 auto clamp(28px, 4vw, 40px);
    text-align: center;
}

.section-icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    border-radius: 16px;
    background: var(--tint);
    font-size: 1.5rem;
    transform: rotate(-4deg);
}

.section-head h2 {
    font-size: clamp(1.7rem, 2.4vw + 1rem, 2.4rem);
}

.section-head h2:focus {
    outline: none;
}

.section-lead {
    margin-top: 8px;
    color: var(--ink-soft);
}

/* 7. Project filters & cards ---------------------------------------------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.filter-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}

.filter-button:hover {
    border-color: var(--tint-strong);
    background: var(--tint);
}

.filter-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tint-strong);
}

.filter-button[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.filter-status {
    margin: 14px 0 24px;
    text-align: center;
    color: var(--ink-soft);
    font-size: .92rem;
    font-weight: 600;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: clamp(18px, 2.4vw, 28px);
    list-style: none;
    padding: 0;
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.project-card .img-frame {
    aspect-ratio: 4 / 3;
}

.photo-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(38, 48, 74, .78);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.photo-badge .icon {
    width: 14px;
    height: 14px;
}

.project-card img {
    transition: transform .4s ease;
}

.project-card:hover img {
    transform: scale(1.03);
}

.project-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding: 18px 20px 20px;
    border-top: 4px solid var(--tint);
}

.project-title {
    font-size: 1.25rem;
}

/* The title button covers the whole card, so the full card is clickable */
.project-open {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.project-open::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--radius);
}

.project-open:focus-visible {
    outline: none;
}

.project-open:focus-visible::after {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.project-subject {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
}

.project-subject-label {
    color: var(--ink-soft);
    font-weight: 700;
}

.subject-pill {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--tint);
    color: var(--ink);
    font-weight: 800;
    font-size: .88rem;
}

.project-desc {
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.55;
}

.project-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 4px;
    color: var(--primary);
    font-weight: 800;
    font-size: .92rem;
}

.project-more .icon {
    transition: transform .2s;
}

.project-card:hover .project-more .icon {
    transform: translateX(3px);
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--ink-soft);
    background: var(--surface);
    border-radius: var(--radius);
}

/* 8. Subjects -------------------------------------------------------------- */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 18px;
    list-style: none;
    padding: 0;
}

.subject-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    height: 100%;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.subject-emoji {
    grid-row: span 3;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--tint);
    font-size: 1.6rem;
    line-height: 1;
}

.subject-card h3 {
    font-size: 1.2rem;
    align-self: center;
}

.subject-card p {
    color: var(--ink-soft);
    font-size: .98rem;
}

.subject-link {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-weight: 800;
    font-size: .92rem;
    cursor: pointer;
}

.subject-link:hover {
    text-decoration: underline;
}

.subject-none {
    margin-top: 6px;
    font-size: .9rem !important;
    font-style: italic;
}

/* 9. Achievements ---------------------------------------------------------- */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 16px;
    list-style: none;
    padding: 0;
}

.achievement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 24px 18px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.achievement-emoji {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--tint);
    font-size: 1.8rem;
    line-height: 1;
}

.achievement-card h3 {
    font-size: 1.08rem;
    font-weight: 500;
}

@media (max-width: 479px) {
    .achievement-card {
        flex-direction: row;
        padding: 14px 18px;
        text-align: left;
    }

    .achievement-emoji {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
}

/* 10. Journey timeline ----------------------------------------------------- */
.timeline {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 14px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(var(--peach-strong), var(--lemon-strong), var(--mint-strong), var(--sky-strong), var(--lavender-strong));
    opacity: .55;
}

.timeline-item {
    position: relative;
    padding-left: 46px;
    margin-bottom: 12px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 19px;
    height: 19px;
    margin-top: -9.5px;
    border-radius: 50%;
    background: var(--tint-strong);
    border: 4px solid var(--bg-tinted);
}

.timeline-card {
    display: flex;
    flex-direction: column;
    gap: 2px 14px;
    padding: 12px 18px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.timeline-month {
    min-width: 86px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
}

.timeline-month::after {
    content: "";
    display: block;
    width: 28px;
    height: 3px;
    margin-top: 2px;
    border-radius: 3px;
    background: var(--tint-strong);
}

.timeline-text {
    color: var(--ink-soft);
}

@media (min-width: 900px) {
    .timeline::before {
        left: 50%;
        margin-left: -1.5px;
    }

    .timeline-item {
        width: 50%;
        padding: 0 36px 0 0;
        margin-bottom: 14px;
    }

    .timeline-item + .timeline-item {
        margin-top: -28px;
    }

    .timeline-item::before {
        left: auto;
        right: -9.5px;
    }

    .timeline-card {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
    }

    .timeline-item:nth-child(odd) .timeline-card {
        flex-direction: row-reverse;
        text-align: right;
    }

    .timeline-item:nth-child(odd) .timeline-month::after {
        margin-left: auto;
    }

    .timeline-item:nth-child(even) {
        margin-left: 50%;
        padding: 0 0 0 36px;
    }

    .timeline-item:nth-child(even)::before {
        left: -9.5px;
        right: auto;
    }
}

/* 11. Gallery -------------------------------------------------------------- */
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    max-width: 1000px;
    margin: 0 auto;
    list-style: none;
    padding: 0;
}

@media (min-width: 420px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (min-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

.gallery-item {
    height: 100%;
}

.gallery-button {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-align: left;
    cursor: zoom-in;
    transition: transform .25s, box-shadow .25s;
}

.gallery-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.gallery-button .img-frame {
    aspect-ratio: 4 / 3;
}

.gallery-caption {
    padding: 10px 14px 12px;
    color: var(--ink-soft);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
}

/* 12. Parent's note -------------------------------------------------------- */
.note-card {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    padding: clamp(32px, 6vw, 52px) clamp(24px, 6vw, 56px);
    background:
        repeating-linear-gradient(transparent 0 33px, rgba(132, 174, 234, .18) 33px 34px),
        var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 1.12rem;
    line-height: 34px;
}

.note-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: clamp(14px, 3.5vw, 36px);
    width: 2px;
    background: rgba(236, 151, 178, .35);
}

.note-heart {
    position: absolute;
    top: -22px;
    left: 50%;
    width: 48px;
    height: 48px;
    margin-left: -24px;
    padding: 11px;
    border-radius: 50%;
    background: var(--pink);
    color: #D9567F;
    fill: #F3A6BE;
    box-shadow: var(--shadow);
}

.note-body p + p {
    margin-top: 12px;
}

.note-greeting,
.note-signature {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.25rem;
}

.note-closing {
    margin-top: 24px !important;
}

/* 13. Footer --------------------------------------------------------------- */
.site-footer {
    padding: 40px 0 48px;
    background: var(--ink);
    color: #D7DCEA;
    text-align: center;
    font-size: .95rem;
}

.footer-inner p + p {
    margin-top: 4px;
}

.footer-title {
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
}

.footer-credit {
    margin-top: 12px !important;
}

/* 14. Modal & lightbox ----------------------------------------------------- */
.modal {
    width: min(720px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 30px 80px rgba(20, 26, 44, .35);
    overflow: hidden;
}

.modal[open] {
    display: flex;
    flex-direction: column;
}

.modal::backdrop {
    background: rgba(38, 48, 74, .55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

.modal-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-media .img-frame {
    display: grid;
    place-items: center;
    min-height: 220px;
    max-height: 55vh;
}

.modal-media .img-frame img {
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
}

.modal-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px clamp(20px, 5vw, 36px) 0;
}

.modal-thumbs[hidden] {
    display: none;
}

.modal-thumb {
    display: grid;
    gap: 6px;
    width: 116px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.modal-thumb .img-frame {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 3px solid transparent;
    transition: border-color .2s ease;
}

.modal-thumb:hover .img-frame {
    border-color: var(--tint);
}

.modal-thumb[aria-pressed="true"] {
    color: var(--ink);
}

.modal-thumb[aria-pressed="true"] .img-frame {
    border-color: var(--tint-strong);
}

.modal-body {
    padding: 24px clamp(20px, 5vw, 36px) 32px;
}

.modal-title {
    margin: 10px 0 18px;
    font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
}

.modal-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.learned-box {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    background: var(--lemon);
}

.learned-box .icon {
    color: #B48A0E;
    fill: var(--lemon-strong);
    font-size: 1.1rem;
}

.lightbox {
    width: min(960px, calc(100% - 32px));
    background: var(--surface);
}

.lightbox-figure {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.lightbox-media .img-frame {
    display: grid;
    place-items: center;
    min-height: 260px;
    background: #F4F1EC;
}

.lightbox-media .img-frame img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - 160px);
    object-fit: contain;
}

.lightbox-caption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 14px 20px 16px;
    font-weight: 700;
}

.lightbox-count {
    flex-shrink: 0;
    color: var(--ink-soft);
    font-size: .88rem;
}

.lightbox-nav {
    position: absolute;
    top: calc(50% - 44px);
    z-index: 2;
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

@media (prefers-reduced-motion: no-preference) {
    .modal[open] {
        animation: modal-in .25s ease-out;
    }

    .modal[open]::backdrop {
        animation: fade-in .25s ease-out;
    }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 15. Image placeholders (shown when a photo is missing) ------------------ */
.img-frame {
    position: relative;
    overflow: hidden;
    background: var(--tint);
}

.img-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 16px;
    background:
        radial-gradient(circle at 20% 25%, rgba(255, 255, 255, .55) 0 18%, transparent 19%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, .4) 0 14%, transparent 15%),
        var(--tint);
    color: var(--ink-soft);
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
}

.img-placeholder .icon {
    font-size: 2.2rem;
    color: var(--tint-strong);
}

.img-placeholder--initial {
    font-family: var(--font-heading);
    font-size: 3.4rem;
    font-weight: 600;
    color: var(--ink);
}

/* 16. Animations ----------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .js .reveal {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity .6s ease, transform .6s ease;
        transition-delay: var(--delay, 0ms);
    }

    .js .reveal.is-visible {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
