/* =========================================================================
   Gregory W. Kyro, PhD — shared site styles
   Clean, pure, high-contrast: near-white type on true black, a single
   restrained accent, generous whitespace. Spectral for display titles,
   a San Francisco-style sans for everything else.
   ========================================================================= */

:root {
    --bg: #000000;
    --fg: #f5f5f7;             /* near-white primary text */
    --fg-soft: #d2d2d7;        /* secondary */
    --fg-muted: #a1a1a6;       /* tertiary / captions */
    --accent: #2997ff;         /* used sparingly: links, focus */
    --accent-soft: rgba(41, 151, 255, 0.55);
    --accent-faint: rgba(41, 151, 255, 0.10);
    --hairline: rgba(255, 255, 255, 0.10);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.05);

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-display: 'Spectral', Georgia, 'Times New Roman', serif;
    --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", "Menlo", monospace;

    --maxw: 820px;

    /* Fluid type scale */
    --fs-body: clamp(1.0625rem, 1.0rem + 0.35vw, 1.1875rem);
    --fs-h1:   clamp(2.2rem, 1.65rem + 2.6vw, 3.25rem);
    --fs-h2:   clamp(1.45rem, 1.24rem + 0.95vw, 1.8rem);
    --fs-h3:   clamp(1.12rem, 1.02rem + 0.5vw, 1.32rem);
    --fs-site-title: clamp(1.05rem, 0.95rem + 0.45vw, 1.3rem);
    --fs-nav:  clamp(0.82rem, 0.78rem + 0.2vw, 0.95rem);

    --lh-body: 1.65;
    --space-section: clamp(2.5rem, 2rem + 2.5vw, 4rem);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body,
html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--fg);
    background-color: var(--bg);
    font-weight: 400;
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

/* Thin reading-progress bar (progressive enhancement) — the one place a
   whisper of accent lives. */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--accent);
    opacity: 0.7;
    z-index: 200;
    pointer-events: none;
}

@supports (animation-timeline: scroll()) {
    .reading-progress {
        animation: growProgress linear;
        animation-timeline: scroll(root);
    }
}

@keyframes growProgress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* --------------------------------------------------------------------- */
/* Header + navigation                                                    */
/* --------------------------------------------------------------------- */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem clamp(1.25rem, 5vw, 2.5rem);
    border-bottom: 1px solid var(--hairline);
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-title {
    font-family: var(--font-display);
    font-size: var(--fs-site-title);
    font-weight: 400;
    margin: 0;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.site-title a {
    color: var(--fg);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.25s ease;
    border-bottom: none;
}

.site-title a:hover { opacity: 0.7; border-bottom: none; }

.navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.2rem 0.4rem;
}

.nav-link {
    color: var(--fg-soft);
    text-decoration: none;
    font-size: var(--fs-nav);
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: color 0.25s ease, background 0.25s ease;
    padding: 0.4rem 0.75rem;
    border-radius: 980px;
    white-space: nowrap;
    border-bottom: none;
}

.nav-link:hover {
    color: var(--fg);
    background: var(--surface-hover);
    border-bottom: none;
}

/* --------------------------------------------------------------------- */
/* Layout + content                                                       */
/* --------------------------------------------------------------------- */

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(2.5rem, 2rem + 3vw, 4.5rem) clamp(1.35rem, 5vw, 2rem) 2rem;
}

.content {
    line-height: var(--lh-body);
    animation: fadeIn 0.6s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--fg);
    line-height: 1.15;
}

h1 {
    font-family: var(--font-display);
    font-size: var(--fs-h1);
    font-weight: 300;
    letter-spacing: 0.005em;
    text-align: center;
    margin: 0 0 var(--space-section);
    line-height: 1.08;
}

h2 {
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: var(--space-section) 0 1rem;
}

h3 {
    font-size: var(--fs-h3);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--fg);
    margin: 2rem 0 0.6rem;
}

.content h2 strong,
.content h3 strong { font-weight: 700; color: var(--fg); }

p { margin: 1.1rem 0; color: var(--fg-soft); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
    border-bottom: none;
}

a:hover { opacity: 0.8; border-bottom: none; }

/* Inline content links: near-white with a hairline underline; accent only
   emerges on hover. Keeps the palette calm. */
.content a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.28);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.25s ease, color 0.25s ease;
    border-bottom: none;
}

.content a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
    border-bottom: none;
    opacity: 1;
}

ul { padding-left: 1.3rem; color: var(--fg-soft); }

li { margin: 0.6rem 0; }

li::marker { color: var(--fg-muted); }

li p { margin: 0.4rem 0; }

blockquote {
    border-left: 2px solid var(--hairline-strong);
    padding: 0.4rem 1.4rem;
    margin: 1.6rem 0;
    color: var(--fg-soft);
    font-style: italic;
}

code {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}

pre {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid var(--hairline);
}

pre code { background: transparent; padding: 0; }

/* Hairline dividers — quiet, generous. */
hr {
    border: 0;
    height: 1px;
    background: var(--hairline);
    margin: var(--space-section) 0;
}

/* --------------------------------------------------------------------- */
/* Section-specific (class names preserved) — all neutralized to white    */
/* --------------------------------------------------------------------- */

.about-section p:first-of-type {
    font-size: 1.2rem;
    line-height: 1.55;
    color: var(--fg);
    letter-spacing: -0.014em;
}

/* Space between narrative chapters once headings are removed */
.about-section details.disclosure + p { margin-top: 2.4rem; }

.experience-section h3,
.awards-section h3,
.recognition-section h3,
.research-section h3 { color: var(--fg); }

.award-item { margin-bottom: 1.4rem; }
.award-item strong { font-weight: 600; }

.media-coverage-section h3,
.media-coverage h3 {
    color: var(--fg);
    margin-top: 2.4rem;
    padding-bottom: 0;
    border-bottom: none;
    display: block;
}

.media-coverage-section strong,
.media-coverage strong { font-weight: 600; }

.publication-item { margin-bottom: 1.4rem; padding-left: 0; }

/* --------------------------------------------------------------------- */
/* Disclosures — progressive disclosure (native <details>)                */
/* --------------------------------------------------------------------- */

/* Large section-level disclosure (index style, used on Research/Recognition) */
details.section { border-top: 1px solid var(--hairline); }
details.section:first-of-type { border-top: none; }

details.section > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 0;
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg);
    transition: opacity 0.2s ease;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::marker { content: ""; }
details.section > summary:hover { opacity: 0.75; }

.section-title { min-width: 0; }

.section-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.95rem;
    flex-shrink: 0;
}
.section-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--fg-muted);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
}
.section-chevron {
    width: 9px;
    height: 9px;
    border-right: 1.6px solid var(--fg-muted);
    border-bottom: 1.6px solid var(--fg-muted);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    margin-bottom: 4px;
}
details.section[open] > summary .section-chevron {
    transform: rotate(-135deg);
    margin-bottom: -3px;
}

.section-body { padding-bottom: 1.9rem; animation: fadeIn 0.45s ease both; }
.section-body > :first-child { margin-top: 0; }
.section-body h3:first-child { margin-top: 0; }

/* Lighter inline disclosure (narrative, used on About) */
details.disclosure { margin: 0.6rem 0 0.2rem; }
details.disclosure > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--fg-soft);
    letter-spacing: 0.01em;
    padding: 0.35rem 0;
    transition: color 0.2s ease;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::marker { content: ""; }
details.disclosure > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 1.6px solid var(--accent);
    border-bottom: 1.6px solid var(--accent);
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--fg); }
details.disclosure > ul { animation: fadeIn 0.45s ease both; margin-top: 0.7rem; }

/* --------------------------------------------------------------------- */
/* Résumé-style entries (Experience / Education)                          */
/* --------------------------------------------------------------------- */

.entry { margin: 1.7rem 0; }
.entry:first-of-type { margin-top: 1.1rem; }

.entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.2rem 1.5rem;
    flex-wrap: wrap;
}
.entry-org {
    font-size: var(--fs-h3);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--fg);
    margin: 0;
    line-height: 1.25;
}
.entry-date {
    color: var(--fg-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.entry-role { color: var(--fg-soft); margin: 0.25rem 0 0.5rem; font-weight: 500; }
.entry ul { margin: 0.5rem 0 0; }
.entry ul li { margin: 0.35rem 0; }

/* Single-line rows: "Role · Org" left, date pinned right (no separators) */
.line-list { list-style: none; padding-left: 0; margin: 0.6rem 0; font-size: 0.94rem; letter-spacing: -0.01em; }
.line-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.25rem;
    padding: 0.42rem 0;
    margin: 0;
}
.line-main { color: var(--fg-soft); flex: 1 1 auto; min-width: 0; }
.line-main strong { color: var(--fg); font-weight: 600; }
.line-sep { color: var(--fg-muted); margin: 0 0.32rem; }
.line-date {
    color: var(--fg-muted);
    white-space: nowrap;
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------- */
/* Publication list (Research)                                            */
/* --------------------------------------------------------------------- */

.pub-list { list-style: none; padding-left: 0; margin: 0; }
.pub-list > li { margin: 0 0 1.5rem; }
.pub-list > li:last-child { margin-bottom: 0; }
.pub-list p { margin: 0; line-height: 1.5; }
.pub-authors { color: var(--fg-muted); }
.pub-authors strong { color: var(--fg); font-weight: 600; }
.pub-list em { color: var(--fg-soft); }

/* --------------------------------------------------------------------- */
/* Project / content cards                                                */
/* --------------------------------------------------------------------- */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 16px;
    padding: 1.6rem;
    transition: transform 0.35s ease, background 0.35s ease, border-color 0.35s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    background: var(--surface-hover);
    border-color: var(--hairline-strong);
}

.project-card h3 { color: var(--fg); margin: 0 0 0.6rem; font-size: 1.3rem; }
.project-card p { flex-grow: 1; margin-bottom: 1rem; }
.project-links { margin-top: auto; }
.project-links a { display: inline-block; margin-right: 1rem; margin-bottom: 0.4rem; color: var(--accent); }

/* --------------------------------------------------------------------- */
/* Table of contents                                                      */
/* --------------------------------------------------------------------- */

.toc,
#TableOfContents {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 16px;
    padding: 1.6rem 1.9rem;
    margin: 2.5rem 0;
}

.toc-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--fg-muted);
}

#TableOfContents ul { list-style: none; padding-left: 0; }
#TableOfContents > ul > li { margin: 0.55rem 0; }
#TableOfContents > ul > li > a { font-weight: 500; font-size: 1rem; color: var(--fg); }
#TableOfContents > ul > li > ul {
    margin: 0.4rem 0 0 0.9rem;
    border-left: 1px solid var(--hairline);
    padding-left: 0.9rem;
}
#TableOfContents > ul > li > ul > li { margin: 0.4rem 0; }
#TableOfContents a {
    display: inline-block;
    padding: 0.2rem 0;
    color: var(--fg-muted);
    text-decoration: none;
    border-bottom: none;
    transition: color 0.25s ease;
}
#TableOfContents a:hover { color: var(--fg); border-bottom: none; }

/* --------------------------------------------------------------------- */
/* Footer                                                                 */
/* --------------------------------------------------------------------- */

.footer {
    text-align: center;
    padding: var(--space-section) 2rem 2.5rem;
    margin-top: var(--space-section);
    border-top: 1px solid var(--hairline);
    font-size: 0.85rem;
    color: var(--fg-muted);
}

.footer-content { max-width: var(--maxw); margin: 0 auto; }

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin: 1.75rem 0;
}

.footer .social-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    color: var(--fg-muted);
    transition: color 0.25s ease;
    text-decoration: none;
    border-bottom: none;
}

.footer .social-link i { font-size: 1.35rem; transition: transform 0.25s ease; }
.footer .social-link span {
    font-size: 0.8rem;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.footer .social-link:hover { color: var(--fg); border-bottom: none; }
.footer .social-link:hover span { opacity: 1; transform: translateY(0); }
.footer .social-link:hover i { transform: translateY(-2px); }

.copyright { margin: 0.5rem 0 0; color: var(--fg-muted); }

/* --------------------------------------------------------------------- */
/* Back-to-top                                                            */
/* --------------------------------------------------------------------- */

.back-to-top {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--hairline);
    color: var(--fg);
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.3s ease;
    z-index: 120;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: rgba(255, 255, 255, 0.12); border-bottom: 1px solid var(--hairline); }

/* --------------------------------------------------------------------- */
/* Accessibility                                                          */
/* --------------------------------------------------------------------- */

a:focus-visible,
.nav-link:focus-visible,
.back-to-top:focus-visible,
.site-title a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* --------------------------------------------------------------------- */
/* Responsive — phone-first refinements                                   */
/* --------------------------------------------------------------------- */

@media (max-width: 768px) {
    :root { --lh-body: 1.6; }

    .header {
        flex-direction: column;
        align-items: center;
        gap: 0.7rem;
        padding: 0.85rem 1rem;
    }

    .navigation {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        gap: 0.25rem;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    }

    .navigation::-webkit-scrollbar { display: none; }
    .nav-link { padding: 0.45rem 0.75rem; scroll-snap-align: center; }

    .about-section p:first-of-type { font-size: 1.1rem; }

    ul { padding-left: 1.15rem; }

    .footer-links { gap: 1.4rem; }
    .footer .social-link span { opacity: 1; transform: none; }  /* labels always visible on touch */

    .back-to-top { bottom: 1.1rem; right: 1.1rem; width: 42px; height: 42px; }

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

/* Slightly larger comfortable tap targets on very small phones */
@media (max-width: 420px) {
    .container { padding-top: 2.25rem; }
    h1 { margin-bottom: 2rem; }
}

/* --------------------------------------------------------------------- */
/* Print                                                                  */
/* --------------------------------------------------------------------- */

@media print {
    body { background: #fff; color: #000; }
    .header, .footer, .back-to-top, .reading-progress { display: none; }
    .container { max-width: 100%; padding: 0; }
    h1, h2, h3 { color: #000; page-break-after: avoid; }
    a, .content a { color: #000; text-decoration: underline; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 90%; }
    a[href^="/"]::after, a[href^="#"]::after { content: ""; }
    @page { margin: 1.5cm; }
}
