/* ========================================================================
   gasqu.es — Scandinavian-minimal design system
   Self-contained. Replaces Pico CSS.
   Fonts: Inter Tight (sans), Source Serif 4 (display accents), JetBrains Mono (meta)
   Palette: paper white, fjord blue accent, warm rust spark, neutral inks

   Sections
     1. Tokens (light + dark)
     2. Reset & base typography
     3. Layout primitives (header, main, footer, container)
     4. Hero & intro
     5. Sections, section-label
     6. Stats strip
     7. Cards: gallery, work, bio, citation, patent, service
     8. Buttons & links
     9. Tags, venues
    10. Article content (figures, blockquote, lists, hgroup, image-grid)
    11. Theme toggle, animations, reveal
    12. Responsive (768 / 480)
    13. Print, reduced motion
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap');


/* ========================================================================
   1. Tokens
   ======================================================================== */

:root {
    /* Type */
    --font-sans: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

    /* Light palette */
    --paper: #FAFAF7;
    --paper-card: #FFFFFF;
    --paper-soft: #F2F1EC;
    --paper-dim: #ECEBE5;

    --ink: #14161A;
    --ink-2: #2B2F35;
    --ink-3: #5C636C;
    --ink-4: #9099A2;

    --rule: #E2E1DC;
    --rule-soft: #EDECE6;

    --accent: #2E5266;
    --accent-soft: #DCE6EB;
    --warm: #C46C46;     /* reserved — see design.md §Color */
    --success: #5C8A5A;  /* reserved — see design.md §Color */

    /* Layout */
    --container-max: 1180px;
    --container-pad: clamp(1.25rem, 4vw, 3.5rem);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.04);
    --shadow-md: 0 4px 16px rgba(20, 22, 26, 0.06);
    --shadow-lg: 0 12px 32px rgba(20, 22, 26, 0.10);

    /* Type scale */
    --fs-h1: clamp(2.25rem, 4.5vw, 4rem);
    --fs-h2: clamp(1.5rem, 2.4vw, 2.2rem);
    --fs-h3: 1.25rem;
    --fs-body: 1rem;
    --fs-meta: 0.78rem;
    --fs-mono-meta: 0.75rem;
    --leading-body: 1.65;
    --leading-tight: 1.15;
}

[data-theme="dark"] {
    --paper: #0E1014;
    --paper-card: #14171C;
    --paper-soft: #181B21;
    --paper-dim: #1E2128;

    --ink: #F2F1EC;
    --ink-2: #D1CFC8;
    --ink-3: #8A8E96;
    --ink-4: #5C636C;

    --rule: #262A31;
    --rule-soft: #1E2128;

    --accent: #7FA8BD;
    --accent-soft: #1A2731;
    --warm: #E08A66;     /* reserved — see design.md §Color */
    --success: #8FB48D;  /* reserved — see design.md §Color */

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0E1014;
        --paper-card: #14171C;
        --paper-soft: #181B21;
        --paper-dim: #1E2128;

        --ink: #F2F1EC;
        --ink-2: #D1CFC8;
        --ink-3: #8A8E96;
        --ink-4: #5C636C;

        --rule: #262A31;
        --rule-soft: #1E2128;

        --accent: #7FA8BD;
        --accent-soft: #1A2731;
        --warm: #E08A66;     /* reserved — see design.md §Color */
        --success: #8FB48D;  /* reserved — see design.md §Color */

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    }
}


/* ========================================================================
   2. Reset & base typography
   ======================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
    scroll-padding-top: 6rem;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--leading-body);
    font-feature-settings: 'ss01', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: var(--leading-tight);
    margin: 0 0 0.75rem;
    color: var(--ink);
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 1rem; color: var(--ink-2); }
p:last-child { margin-bottom: 0; }

em {
    font-style: italic;
    font-family: var(--font-serif);
    color: var(--accent);
    font-weight: 400;
}
strong { font-weight: 600; color: var(--ink); }

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--ink); }

small { font-size: var(--fs-meta); color: var(--ink-3); }

hr {
    border: 0; height: 1px; background: var(--rule);
    margin: 2.5rem 0;
}

img, video { max-width: 100%; height: auto; display: block; }

button {
    font-family: inherit;
    cursor: pointer;
}

ul, ol { line-height: var(--leading-body); }


/* ========================================================================
   3. Layout primitives
   ======================================================================== */

body > header,
body > main,
body > footer {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

main {
    padding-top: 1rem;
    padding-bottom: 4rem;
}

/* Header: 3-column grid (brand | nav | actions) */
body > header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
}

body > header nav {
    display: contents;
}

/* Brand list (first ul) */
body > header nav ul:first-of-type {
    list-style: none;
    margin: 0;
    padding: 0;
    justify-self: start;
}
body > header nav ul:first-of-type li { display: inline-flex; align-items: center; gap: 0.6rem; }
body > header nav ul:first-of-type a {
    color: var(--ink);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
body > header nav ul:first-of-type a strong { font-weight: 600; white-space: nowrap; }
body > header nav ul:first-of-type a::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

/* Nav links (second ul) */
body > header nav ul:nth-of-type(2) {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2.25rem;
    justify-self: center;
    align-items: center;
}
body > header nav ul:nth-of-type(2) a {
    font-size: 0.9rem;
    color: var(--ink-3);
    position: relative;
    padding: 0.4rem 0;
}
body > header nav ul:nth-of-type(2) a:hover { color: var(--ink); }
body > header nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 500;
}
body > header nav a[aria-current="page"]::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* Theme toggle li (injected by main.js) sits in the second ul; we want it in a third column */
body > header nav ul:nth-of-type(2) li:has(.theme-toggle) {
    margin-left: auto;
    position: absolute;
    right: var(--container-pad);
    top: 50%;
    transform: translateY(-50%);
}

/* Footer */
body > footer {
    max-width: 100%;
    margin: 4rem 0 0;
    padding-left: 0;
    padding-right: 0;
    background: var(--paper-soft);
    border-top: 1px solid var(--rule);
}
body > footer > * {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}
body > footer small {
    display: block;
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-4);
    letter-spacing: 0.02em;
}
body > footer small a {
    color: var(--ink-3);
}
body > footer small a:hover { color: var(--accent); }
body > footer .footer-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}
body > footer .footer-icons a {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}
body > footer .footer-icons svg {
    width: 14px;
    height: 14px;
    display: block;
}


/* ========================================================================
   4. Hero & intro
   ======================================================================== */

.hero {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    padding: 3rem 0 3.5rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0;
}

.hero__image {
    flex-shrink: 0;
    width: 220px;
    height: 275px;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--paper-soft);
    box-shadow: var(--shadow-sm);
}
.hero__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.95) contrast(1.02);
}

.hero__content { flex: 1; padding-top: 0.25rem; }

.hero__name {
    font-family: var(--font-sans);
    font-size: clamp(2.14rem, 3.8vw, 3.33rem);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.05;
    margin: 0 0 1rem;
}

.hero__linkedin {
    color: var(--ink-4);
    transition: color 0.2s ease;
    display: inline-block;
    vertical-align: 0.05em;
    margin-left: 0.35em;
    line-height: 1;
}
.hero__linkedin:hover { color: var(--accent); }
.hero__linkedin svg { width: 0.45em; height: 0.45em; display: inline-block; }

.hero__tagline {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    line-height: 1.45;
    color: var(--ink);
    letter-spacing: -0.005em;
    margin: 0 0 1.25rem;
    max-width: 50ch;
}
.hero__tagline a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }
.hero__tagline a:hover { border-bottom-color: var(--accent); }

.hero__previous {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--ink-3);
    margin: -0.5rem 0 1.25rem;
    max-width: 50ch;
}
.hero__previous a { color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.hero__previous a:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }

.hero__contact {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    margin-top: 0.5rem;
}


/* ========================================================================
   5. Sections, section-label
   ======================================================================== */

.section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--rule);
}
.section:last-of-type { border-bottom: 0; }

.section-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0.65rem;
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--accent);
    letter-spacing: 0;
    text-transform: none;
    font-style: italic;
    font-weight: 400;
    margin: 0 0 1.5rem;
}
.section-label::before {
    content: '';
    display: inline-block;
    width: 1.5rem;
    height: 1px;
    background: var(--accent);
    transform: translateY(-3px);
}

hgroup {
    padding: 1.5rem 0 2.5rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 2.5rem;
}
hgroup h1 {
    font-family: var(--font-sans);
    margin-bottom: 0.75rem;
}
hgroup p {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--ink-3);
    max-width: 56ch;
    line-height: 1.5;
    margin: 0;
}


/* ========================================================================
   6. Stats / numeric strip (re-usable)
   Reserved / deferred — see design.md §Components. Not currently rendered;
   intended for a "5 patents · 2 granted · …" strip on works/.
   ======================================================================== */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 2rem 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    margin: 2rem 0;
}
.stats > div {
    display: flex; flex-direction: column; gap: 0.4rem;
    padding: 0 1.25rem;
    border-right: 1px solid var(--rule);
}
.stats > div:last-child { border-right: 0; }
.stats strong {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--ink);
}
.stats span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}


/* ========================================================================
   7. Cards
   ======================================================================== */

/* Bio prose — flowing text, no card frame */
.bio-section p {
    color: var(--ink-2);
    font-size: 1.02rem;
    line-height: 1.75;
    margin-bottom: 1.1rem;
    max-width: 64ch;
}
.bio-section p:last-child { margin-bottom: 0; }

/* Gallery — works, thoughts listings */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem 1.75rem;
}

.gallery-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    transition: transform 0.3s ease;
}
.gallery-card > a:first-child {
    display: block;
    overflow: hidden;
    background: var(--paper-soft);
    aspect-ratio: 16/10;
}
.gallery-card > a:first-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16/10;
    transition: transform 0.4s ease, filter 0.3s ease;
}
.gallery-card:hover > a:first-child img {
    transform: scale(1.025);
    filter: brightness(1.04) saturate(1.06);
}

.gallery-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
}
.gallery-card__body small {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    letter-spacing: 0.04em;
    text-transform: none;
}
.gallery-card__body h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.gallery-card__body h3 a {
    color: var(--ink);
    text-decoration: none;
}
.gallery-card__body h3 a:hover { color: var(--accent); }
.gallery-card__body > p {
    font-size: 0.95rem;
    color: var(--ink-3);
    margin: 0;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card-list — vertical stack of work cards */
.card-list { display: flex; flex-direction: column; gap: 1rem; }

/* Work card — underline only, flowing prose */
.work-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.5rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    transition: border-color 0.2s ease;
}
.work-card:hover {
    border-bottom-color: var(--ink);
}
.work-card small {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    letter-spacing: 0.04em;
}
.work-card h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.work-card h3 a {
    color: var(--ink);
    text-decoration: none;
}
.work-card h3 a:hover { color: var(--accent); }
.work-card p {
    color: var(--ink-3);
    font-size: 0.97rem;
    margin: 0 0 0.5rem;
    line-height: 1.55;
}

/* Citation card — underline-only, hairlines not boxes (design.md Principle #3) */
.citation-card {
    padding: 1.75rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    margin-bottom: 0;
}
.citation-card p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--ink-2);
    margin-bottom: 1rem;
}
.citation-card__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Patent card — underline-only */
.patent-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 1.75rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    margin-bottom: 0;
}
.patent-card > img {
    flex: 0 0 200px;
    width: 200px;
}
.patent-card__body { flex: 1; min-width: 280px; }
.patent-card__body h3 {
    margin-top: 0;
    font-size: 1.2rem;
    font-weight: 500;
}
.patent-card__body p {
    font-size: 0.95rem;
    color: var(--ink-3);
}

/* Service grid (academic service section) — underline-only */
.service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
    margin-top: 1.5rem;
}
.service-block {
    padding: 1.75rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    transition: border-color 0.2s ease;
}
.service-block:hover { border-bottom-color: var(--ink); }
.service-block--wide { grid-column: 1 / -1; }
.service-block__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 1rem;
}
.service-block ul { list-style: none; padding: 0; margin: 0; }
.service-block li {
    padding: 0.55rem 0;
    font-size: 0.93rem;
    color: var(--ink-2);
}
.service-block li + li { border-top: 1px solid var(--rule-soft); }


/* ========================================================================
   8. Buttons & links
   ======================================================================== */

button:not(.theme-toggle):not(.cite-btn):not(.copy-btn):not(.bib-btn),
.btn,
a.btn,
a[role="button"] {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    border-radius: 100px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
button:hover:not(.theme-toggle):not(.cite-btn):not(.copy-btn):not(.bib-btn),
.btn:hover,
a.btn:hover,
a[role="button"]:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--paper);
}

a[role="button"].secondary,
.btn.secondary,
a.secondary[role="button"],
.cite-btn,
.copy-btn,
.bib-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--rule);
    border-radius: 100px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
a[role="button"].secondary:hover,
.btn.secondary:hover,
a.secondary[role="button"]:hover,
.cite-btn:hover,
.copy-btn:hover,
.bib-btn:hover {
    background: var(--paper-soft);
    border-color: var(--ink-3);
    color: var(--ink);
}

.btn-sm {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.78rem !important;
}

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent);
    border-bottom: 1px solid var(--accent-soft);
    padding-bottom: 1px;
    width: max-content;
    text-decoration: none;
}
.link-arrow::after {
    content: '\2192';
    transition: transform 0.2s ease;
}
.link-arrow:hover {
    color: var(--ink);
    border-color: var(--ink);
}
.link-arrow:hover::after { transform: translateX(3px); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-3);
    margin-bottom: 2rem;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.back-link::before { content: '\2190'; }
.back-link:hover { color: var(--accent); }


/* ========================================================================
   9. Tags & venues
   ======================================================================== */

.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--rule);
    border-radius: 100px;
    color: var(--ink-3);
    background: transparent;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
    text-transform: none;
}

.venue-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.venue {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3em;
    padding: 0.4rem 0.85rem;
    background: var(--paper-soft);
    border: 0;
    border-radius: 100px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--ink-2);
    transition: background 0.2s ease;
}
.venue:hover {
    background: var(--paper-dim);
    color: var(--ink);
}
.venue strong { color: var(--ink); font-weight: 600; }
.venue span { color: var(--ink-4); font-size: 0.8rem; }


/* ========================================================================
   10. Article content — figures, blockquotes, lists, image-grid
   ======================================================================== */

main > article {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 0 2rem;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

main > article > header { margin-bottom: 2rem; }
main > article > header small {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    letter-spacing: 0.04em;
}
main > article h1 {
    margin: 0.75rem 0 0.75rem;
    font-size: clamp(2rem, 3.6vw, 3rem);
    letter-spacing: -0.03em;
}
main > article h2 {
    margin-top: 2.5rem;
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
main > article h3 {
    margin-top: 1.75rem;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: -0.015em;
}

main > article p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--ink-2);
}

main > article > header > p > em,
main > article > header > p:first-of-type em {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--ink-3);
    font-style: italic;
    line-height: 1.45;
}

main > article ul,
main > article ol {
    padding-left: 1.5rem;
    line-height: 1.75;
    color: var(--ink-2);
}
main > article li { margin-bottom: 0.4rem; }

main > article blockquote {
    margin: 2rem 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-left: 2px solid var(--accent);
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-style: italic;
    color: var(--ink-2);
    line-height: 1.55;
}
main > article blockquote p { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }

main > article figure {
    max-width: 720px;
    margin: 2.5rem auto;
}
main > article figure.figure-sm { max-width: 420px; }
main > article figcaption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    text-align: center;
    margin-top: 0.6rem;
    letter-spacing: 0.04em;
}
main > article video {
    display: block;
    width: 100%;
    max-width: 720px;
    margin: 2.5rem auto;
}

.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0;
}
.image-grid figure { margin: 0; max-width: none; }
.image-grid img {
    width: 100%;
    height: auto;
}
.image-grid figcaption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-4);
    text-align: center;
    margin-top: 0.5rem;
}

/* Footnotes — small reference section at end of article */
main > article .footnotes {
    margin-top: 3.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
}
main > article .footnotes h2 {
    margin: 0 0 0.5rem;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: 0;
}
main > article .footnotes p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--ink-3);
    margin: 0.5rem 0;
}
main > article .footnotes p sup {
    color: var(--accent);
    font-family: var(--font-mono);
    margin-right: 0.15rem;
}
main > article .footnotes :target {
    background: var(--paper-soft);
}

main > article .footnote-ref {
    font-family: var(--font-mono);
    line-height: 0;
}
main > article .footnote-ref a {
    color: var(--accent);
    text-decoration: none;
}
main > article .footnote-ref a:hover {
    text-decoration: underline;
}

main > article .footnote-back {
    margin-left: 0.4rem;
    font-family: var(--font-mono);
    color: var(--accent);
    text-decoration: none;
}
main > article .footnote-back:hover {
    text-decoration: underline;
}


/* ========================================================================
   11. Theme toggle
   ======================================================================== */

.theme-toggle {
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 100px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--ink-3);
    padding: 0;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.4s ease;
}
.theme-toggle:hover {
    color: var(--ink);
    border-color: var(--ink-3);
    background: var(--paper-soft);
}
.theme-toggle.rotating { transform: rotate(360deg); }

/* FAB clone is appended to <body> by main.js; hidden on desktop, shown on mobile */
.theme-toggle.fab { display: none; }


/* Animations & reveal */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.hero__image { animation: fadeInUp 0.6s ease-out both; }
.hero__content > * { animation: fadeInUp 0.6s ease-out both; }
.hero__content > *:nth-child(1) { animation-delay: 0.05s; }
.hero__content > *:nth-child(2) { animation-delay: 0.10s; }
.hero__content > *:nth-child(3) { animation-delay: 0.18s; }
.hero__content > *:nth-child(4) { animation-delay: 0.26s; }

.reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}


/* ========================================================================
   12. Responsive
   ======================================================================== */

@media (max-width: 900px) {
    .hero { gap: 2rem; }
    .hero__image { width: 180px; height: 225px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stats > div:nth-child(2) { border-right: 0; }
    .service-grid { grid-template-columns: 1fr; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
    body > header {
        grid-template-columns: 1fr auto;
        gap: 1rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    body > header nav ul:first-of-type { justify-self: start; }
    body > header nav ul:nth-of-type(2) {
        justify-self: end;
        gap: 1.25rem;
    }
    body > header nav ul:nth-of-type(2) li:has(.theme-toggle) {
        display: none !important;
    }

    /* Hero stacks */
    .hero {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem 0 2.5rem;
    }
    .hero__image { width: 160px; height: 200px; }
    .hero__name {
        font-size: 2rem;
        flex-wrap: wrap;
    }
    .hero__tagline { font-size: 1.15rem; }

    hgroup {
        padding: 1rem 0 1.5rem;
        margin-bottom: 1.5rem;
    }
    hgroup p { font-size: 1rem; }

    .gallery {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .gallery-card:not(:last-child) {
        padding-bottom: 2rem;
        border-bottom: 1px solid var(--rule);
    }
    .citation-card__actions { flex-direction: column; }
    .citation-card__actions > * { width: 100%; justify-content: center; }
    .patent-card > img { flex: 0 0 100%; width: 100%; }

    main > article h1 { font-size: 2rem; }
    main > article h2 { font-size: 1.35rem; }

    .image-grid { grid-template-columns: 1fr; }

    /* Floating theme toggle FAB — body-level clone, only visible here */
    .theme-toggle.fab {
        display: inline-flex;
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        z-index: 60;
        background: var(--paper-card);
        box-shadow: var(--shadow-md);
        width: 44px;
        height: 44px;
        border-color: var(--rule);
    }
}

@media (max-width: 480px) {
    .hero__image { width: 140px; height: 175px; }
    .hero__name { font-size: 1.75rem; }
    .stats { grid-template-columns: 1fr 1fr; gap: 0; }
}


/* ========================================================================
   13. Print, reduced motion
   ======================================================================== */

@media print {
    body > header,
    body > footer,
    .theme-toggle { display: none; }
    body { background: white; color: black; }
    a { color: black; }
    .hero, .section { border: 0; padding: 1rem 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}
