/* =============================================================
   Ryan J. Mattana — portfolio stylesheet
   Aesthetic: monochrome / technical minimalism / flight-computer
   -------------------------------------------------------------
   Palette is strictly grayscale.
   Inter for body copy, Fira Code (monospace) for technical labels.
   ============================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap");

:root {
    /* Grayscale palette ----------------------------------- */
    --black:        #050506;
    --ink:          #0e0f10;
    --steel:        #2a2c30;
    --slate:        #4a4d52;
    --slate-soft:   #7d8086;
    --line:         rgba(255, 255, 255, 0.08);
    --line-strong:  rgba(255, 255, 255, 0.18);
    --line-dark:    rgba(0, 0, 0, 0.10);
    --paper:        #f5f5f5;
    --paper-soft:   #ececec;
    --bone:         #c9c9cb;

    /* Typography ----------------------------------------- */
    --font-sans:    "Inter", ui-sans-serif, system-ui, -apple-system,
                    BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:    "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas,
                    "Liberation Mono", monospace;

    /* Layout --------------------------------------------- */
    --max:          1320px;
    --gutter:       clamp(20px, 4vw, 64px);
    --radius:       14px;
    --radius-sm:    8px;
    --radius-lg:    22px;
    --shadow-glow:  0 30px 80px rgba(0, 0, 0, 0.55);
    --shadow-soft:  0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    /* anchor links land below the sticky header */
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--paper);
    background: var(--black);
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* High-altitude gradient + faint engineering grid behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.0) 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%,
            rgba(255, 255, 255, 0.04) 0%,
            rgba(255, 255, 255, 0.0) 60%),
        linear-gradient(180deg, #08090b 0%, #050506 60%, #030304 100%);
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    background-position: 0 0;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 30%, transparent 80%);
}

/* Canvas where main.js renders the starfield (also fixed, behind content) */
.starfield {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.65;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input { font: inherit; }

/* ============================================================
   Typography utilities
   ============================================================ */
.mono {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.kicker {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.32em;
    font-size: 11px;
    color: var(--slate-soft);
    margin: 0 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.kicker::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--slate);
    display: inline-block;
}

h1, h2, h3, h4 {
    color: var(--paper);
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    font-weight: 600;
}

h1 {
    font-size: clamp(44px, 6.6vw, 92px);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

h2 {
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.05;
}

h3 {
    font-size: clamp(20px, 2vw, 26px);
    line-height: 1.2;
}

p { margin: 0 0 14px; color: var(--bone); }

.muted { color: var(--slate-soft); }

/* ============================================================
   Site header (sticky, anchor-link nav)
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gutter);
    background: rgba(5, 5, 6, 0.78);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
}

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

.brand-mark {
    width: 40px;
    height: 32px;
    filter: invert(1) brightness(1.4);
    opacity: 0.92;
}

.brand strong {
    display: block;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--paper);
}

.brand small {
    color: var(--slate-soft);
    font-family: var(--font-mono);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-size: 9px;
}

.nav-links {
    display: flex;
    gap: clamp(14px, 2.6vw, 36px);
    align-items: center;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--slate-soft);
    padding: 26px 0;
    border-bottom: 1px solid transparent;
    transition: color 200ms ease, border-color 200ms ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--paper);
    border-bottom-color: var(--paper);
}

.theme-toggle {
    background: transparent;
    color: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 14px;
    transition: 200ms ease;
}

.theme-toggle:hover {
    background: var(--paper);
    color: var(--black);
}

.theme-toggle .moon { display: none; }
body.high-contrast .theme-toggle .sun { display: none; }
body.high-contrast .theme-toggle .moon { display: inline; }

/* ============================================================
   Section frame — every section uses the same container
   ============================================================ */
.section {
    position: relative;
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(64px, 9vh, 120px) var(--gutter);
}

.section-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 0;
    max-width: var(--max);
    margin-left: auto;
    margin-right: auto;
}

/* Subtle scroll-in fade: starts hidden, JS adds .visible */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 700ms ease, transform 700ms ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   1. HERO
   ============================================================ */
.hero {
    position: relative;
    min-height: calc(100vh - 76px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.85fr);
    gap: 56px;
    align-items: center;
    padding-top: clamp(60px, 10vh, 120px);
    padding-bottom: clamp(80px, 12vh, 140px);
    overflow: hidden;
}

.hero-copy { position: relative; z-index: 2; }

.hero h1 {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--paper);
}

.hero h1 .name-line {
    display: block;
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.04em;
}

.hero h1 .pipe {
    color: var(--slate);
    margin: 0 0.18em;
    font-weight: 300;
}

.hero h1 .role-line {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.42em;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: var(--slate-soft);
    margin-top: 18px;
}

.hero-sub {
    font-size: clamp(17px, 1.6vw, 21px);
    color: var(--bone);
    max-width: 600px;
    margin: 24px 0 28px;
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 999px;
    border: 1px solid var(--paper);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 500;
    cursor: pointer;
    transition: 220ms ease;
    background: transparent;
    color: var(--paper);
}

.button-primary {
    background: var(--paper);
    color: var(--black);
}

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

.button-ghost:hover {
    background: var(--paper);
    color: var(--black);
    transform: translateY(-2px);
}

.button .arrow { transition: transform 220ms ease; }
.button:hover .arrow { transform: translateX(4px); }

/* Pilot status callout under the CTAs */
.pilot-callout {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--bone);
}

.pilot-callout .led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--paper);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .35; transform: scale(.7); }
}

/* Hero stats row */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-top: 40px;
    max-width: 580px;
}

.hero-stat {
    padding: 18px 0;
    border-right: 1px solid var(--line);
}

.hero-stat:last-child { border-right: 0; }

.hero-stat .v {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--paper);
    display: block;
}

.hero-stat .l {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--slate-soft);
    margin-top: 6px;
    display: block;
}

/* Hero art column — wireframe blueprint + orbital arcs (parallax) */
.hero-art {
    position: relative;
    z-index: 1;
    height: 100%;
    min-height: 460px;
    display: grid;
    place-items: center;
}

.hero-orbit-stack {
    position: relative;
    width: min(520px, 100%);
    aspect-ratio: 1 / 1;
}

.hero-orbit-stack svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.hero-orbit-stack .orbit-arc {
    fill: none;
    stroke: var(--line-strong);
    stroke-dasharray: 4 6;
    transform-origin: 50% 50%;
}

.hero-orbit-stack .orbit-arc.solid {
    stroke: rgba(255, 255, 255, 0.22);
    stroke-dasharray: none;
}

.hero-orbit-stack .crosshair {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1;
    fill: none;
}

.hero-orbit-stack .blueprint {
    fill: none;
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1.2;
}

.hero-orbit-stack .label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--slate-soft);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-orbit-stack .dot {
    fill: var(--paper);
}

/* Coordinate readout in the hero */
.coordinates {
    position: absolute;
    bottom: 28px;
    left: var(--gutter);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--slate-soft);
    z-index: 2;
}

.coordinates span {
    display: block;
    margin-bottom: 4px;
    color: var(--paper);
}

/* ============================================================
   2. ABOUT
   ============================================================ */
.about {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 64px;
    align-items: start;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.about-list li {
    position: relative;
    padding-left: 30px;
    color: var(--bone);
    font-size: 16px;
}

.about-list li::before {
    content: "+";
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font-mono);
    color: var(--slate-soft);
}

.about-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 26px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.about-meta .row {
    display: grid;
    gap: 4px;
}

.about-meta .row .k {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--slate-soft);
}

.about-meta .row .v {
    font-family: var(--font-mono);
    color: var(--paper);
    font-size: 13px;
}

/* ============================================================
   3. CORE COMPETENCIES
   ============================================================ */
.competency-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.competency-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    background: rgba(255, 255, 255, 0.02);
    transition: 280ms ease;
    position: relative;
    overflow: hidden;
}

.competency-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at top right, rgba(255, 255, 255, 0.05), transparent 70%);
    opacity: 0;
    transition: opacity 280ms ease;
    pointer-events: none;
}

.competency-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.competency-card:hover::after { opacity: 1; }

.competency-card .module-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate-soft);
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.competency-card h3 {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--paper);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.competency-card .summary {
    font-size: 14px;
    color: var(--bone);
    line-height: 1.55;
    min-height: 74px;
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-list li {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--bone);
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    letter-spacing: 0.04em;
}

/* ============================================================
   4. FEATURED PROJECTS
   ============================================================ */
.projects-grid {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.project-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 36px;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.025) 0%,
        rgba(255, 255, 255, 0.01) 100%);
    transition: 320ms ease;
}

.project-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.06), transparent 55%);
    opacity: 0;
    transition: opacity 320ms ease;
    pointer-events: none;
}

.project-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.project-card:hover::before { opacity: 1; }

.project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.project-code {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--slate-soft);
}

.project-card h3 {
    font-size: clamp(22px, 2.4vw, 32px);
    color: var(--paper);
    margin-bottom: 10px;
}

.project-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate-soft);
    letter-spacing: 0.06em;
    margin-bottom: 18px;
}

.project-card p { color: var(--bone); }

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}

.project-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--bone);
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
}

/* Right side: metrics readout + insight trigger */
.project-readout {
    display: grid;
    gap: 16px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.metric {
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    text-align: center;
}

.metric:last-child { border-right: 0; }

.metric .v {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--paper);
    display: block;
    line-height: 1.1;
}

.metric .l {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--slate-soft);
    margin-top: 8px;
    display: block;
    line-height: 1.4;
}

.project-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: 220ms ease;
}

.btn-link:hover {
    background: var(--paper);
    color: var(--black);
    border-color: var(--paper);
}

/* ============================================================
   5. EXPERIENCE TIMELINE
   ============================================================ */
.timeline {
    position: relative;
    margin-top: 28px;
    padding-left: 32px;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 8px;
    width: 1px;
    background: linear-gradient(180deg,
        transparent 0%, var(--line-strong) 8%,
        var(--line-strong) 92%, transparent 100%);
}

.timeline-item {
    position: relative;
    padding: 0 0 36px 36px;
}

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

.timeline-item::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 4px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--black);
    box-shadow: 0 0 0 1px var(--line-strong);
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-bottom: 8px;
    align-items: center;
}

.timeline-dates,
.timeline-location {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--slate-soft);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.timeline-impact {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--paper);
    padding: 4px 10px;
    border: 1px solid var(--paper);
    border-radius: 999px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.timeline-item h3 {
    margin-bottom: 4px;
    font-size: 22px;
}

.timeline-item .role {
    font-family: var(--font-mono);
    color: var(--slate-soft);
    font-size: 13px;
    margin-bottom: 12px;
}

.timeline-item ul {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--bone);
    font-size: 14.5px;
    line-height: 1.6;
}

.timeline-item ul li { margin-bottom: 4px; }

.timeline-item .preview-trigger {
    margin-top: 14px;
}

/* ============================================================
   6. LATERAL INTERESTS — the human element
   ============================================================ */
.interests-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.interest-chip {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    transition: 240ms ease;
}

.interest-chip:hover {
    background: var(--paper);
    color: var(--black);
    border-color: var(--paper);
}

.interest-chip:hover .interest-tag {
    color: var(--black);
    border-color: var(--black);
}

.interest-label {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.interest-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate-soft);
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    transition: 240ms ease;
}

/* ============================================================
   7. CONTACT / FOOTER
   ============================================================ */
.contact-card {
    margin-top: 28px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 40px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 36px;
    align-items: center;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.005));
}

.contact-card h2 {
    font-size: clamp(28px, 3vw, 40px);
    margin-bottom: 12px;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: grid;
    gap: 10px;
}

.contact-list a {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--paper);
    border-bottom: 1px solid var(--slate);
    padding-bottom: 4px;
    transition: 220ms ease;
}

.contact-list a:hover {
    border-color: var(--paper);
    color: var(--paper);
}

.contact-actions {
    display: grid;
    gap: 14px;
    justify-content: end;
    align-content: center;
    text-align: right;
}

.contact-icon {
    width: 92px;
    height: 92px;
    margin: 0 0 6px auto;
    opacity: 0.85;
}

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 40px;
    padding: 36px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate-soft);
}

.site-footer .tag {
    color: var(--paper);
}

/* ============================================================
   Hover media panel (kept from original; restyled for theme)
   ============================================================ */
.media-panel {
    position: fixed;
    right: 24px;
    top: 110px;
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 140px);
    overflow: auto;
    background: rgba(8, 8, 9, 0.96);
    color: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    padding: 22px;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    transition: 200ms ease;
    z-index: 300;
    backdrop-filter: blur(12px);
}

.media-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.panel-close {
    position: absolute;
    right: 14px;
    top: 10px;
    background: transparent;
    color: var(--paper);
    border: 0;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.panel-kicker {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--slate-soft);
    font-size: 10px;
    margin-bottom: 6px;
}

.media-panel h3 {
    font-size: 22px;
    margin: 0 32px 6px 0;
}

.media-panel p {
    color: var(--bone);
    font-size: 13px;
    line-height: 1.5;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.media-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.media-item img,
.media-item video {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    filter: grayscale(0.85) contrast(1.05);
    transition: filter 320ms ease, transform 320ms ease;
}

.media-item:hover img,
.media-item:hover video {
    filter: grayscale(0) contrast(1);
    transform: scale(1.02);
}

.media-caption {
    padding: 10px;
}

.media-caption strong {
    display: block;
    font-size: 12px;
    font-family: var(--font-mono);
}

.media-caption small {
    display: block;
    color: var(--slate-soft);
    margin-top: 3px;
    line-height: 1.35;
    font-size: 11px;
}

/* ============================================================
   Technical insight modal
   ============================================================ */
.insight-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: grid;
    place-items: center;
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    backdrop-filter: blur(6px);
    padding: 24px;
}

.insight-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.insight-card {
    width: min(640px, 100%);
    background: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 36px;
    position: relative;
    transform: scale(0.96);
    transition: transform 260ms ease;
    box-shadow: var(--shadow-glow);
}

.insight-modal.visible .insight-card { transform: scale(1); }

.insight-card .insight-kicker {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--slate-soft);
    margin-bottom: 8px;
}

.insight-card h3 {
    font-size: 26px;
    margin-bottom: 16px;
}

.insight-card p {
    color: var(--bone);
    font-size: 15px;
    line-height: 1.65;
}

.insight-card .insight-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
}

.insight-card .insight-tags span {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--bone);
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
}

.insight-close {
    position: absolute;
    right: 18px;
    top: 14px;
    background: transparent;
    color: var(--paper);
    border: 0;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* ============================================================
   High-contrast / light mode toggle
   ============================================================ */
body.high-contrast {
    background: var(--paper);
    color: var(--black);
}

body.high-contrast::before {
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%,
            rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0) 60%),
        linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
}

body.high-contrast::after {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}

body.high-contrast .starfield { opacity: 0.18; filter: invert(1); }

body.high-contrast h1,
body.high-contrast h2,
body.high-contrast h3 { color: var(--black); }

body.high-contrast p,
body.high-contrast .about-list li { color: var(--steel); }

body.high-contrast .site-header {
    background: rgba(245, 245, 245, 0.86);
    border-bottom-color: var(--line-dark);
}

body.high-contrast .nav-links a { color: var(--slate); }
body.high-contrast .nav-links a:hover,
body.high-contrast .nav-links a.active { color: var(--black); border-bottom-color: var(--black); }

body.high-contrast .brand strong { color: var(--black); }
body.high-contrast .brand small  { color: var(--slate); }
body.high-contrast .brand-mark   { filter: none; }

body.high-contrast .competency-card,
body.high-contrast .project-card,
body.high-contrast .interest-chip,
body.high-contrast .contact-card,
body.high-contrast .metrics-grid {
    background: #fff;
    border-color: var(--line-dark);
}

body.high-contrast .competency-card h3,
body.high-contrast .project-card h3,
body.high-contrast .timeline-item h3,
body.high-contrast .contact-card h2,
body.high-contrast .metric .v,
body.high-contrast .interest-label,
body.high-contrast .hero-stat .v { color: var(--black); }

body.high-contrast .timeline::before { background: linear-gradient(180deg, transparent, rgba(0,0,0,.18), rgba(0,0,0,.18), transparent); }
body.high-contrast .timeline-item::before { background: var(--black); border-color: #fff; box-shadow: 0 0 0 1px var(--line-dark); }
body.high-contrast .timeline-impact { color: var(--black); border-color: var(--black); }

body.high-contrast .skill-list li,
body.high-contrast .project-tag,
body.high-contrast .interest-tag,
body.high-contrast .insight-card .insight-tags span,
body.high-contrast .pilot-callout,
body.high-contrast .btn-link { border-color: var(--line-dark); color: var(--steel); }

body.high-contrast .button {
    border-color: var(--black);
    color: var(--black);
}

body.high-contrast .button-primary {
    background: var(--black);
    color: var(--paper);
}

body.high-contrast .button-primary:hover {
    background: transparent;
    color: var(--black);
}

body.high-contrast .insight-card { background: #fff; }
body.high-contrast .insight-card p { color: var(--steel); }

body.high-contrast .media-panel { background: rgba(255,255,255,.96); color: var(--black); border-color: var(--line-dark); }
body.high-contrast .media-panel h3 { color: var(--black); }
body.high-contrast .media-panel p, body.high-contrast .media-caption small { color: var(--steel); }

body.high-contrast .site-footer { color: var(--steel); border-top-color: var(--line-dark); }
body.high-contrast .site-footer .tag { color: var(--black); }

body.high-contrast .hero-orbit-stack .orbit-arc,
body.high-contrast .hero-orbit-stack .orbit-arc.solid,
body.high-contrast .hero-orbit-stack .crosshair { stroke: rgba(0, 0, 0, 0.25); }
body.high-contrast .hero-orbit-stack .blueprint { stroke: rgba(0, 0, 0, 0.7); }
body.high-contrast .hero-orbit-stack .label { fill: var(--slate); }
body.high-contrast .hero-orbit-stack .dot { fill: var(--black); }

/* ============================================================
   Playground page (re-skin so it inherits the new aesthetic)
   ============================================================ */
.playground-layout {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(64px, 9vh, 120px) var(--gutter);
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 36px;
}

.section-title h2 {
    font-size: clamp(28px, 3vw, 40px);
    margin: 0;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.playground-layout .project-card {
    grid-template-columns: 1fr;
    padding: 24px;
}

.playground-layout .project-card .project-meta {
    margin-bottom: 14px;
}

.project-number {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--slate-soft);
    letter-spacing: 0.2em;
}

.status {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate-soft);
}

.status::before {
    content: "●";
    color: var(--paper);
    margin-right: 6px;
    font-size: 8px;
}

.add-card {
    border-style: dashed;
    text-align: left;
    color: var(--slate-soft);
}

.add-card .plus {
    font-size: 36px;
    color: var(--paper);
    display: block;
    margin-bottom: 10px;
}

.add-card code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--paper);
    font-size: 12px;
}

.grow-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.grow-panel h2 { font-size: 22px; margin-bottom: 12px; }

.grow-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.02);
}

.grow-item strong {
    display: block;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--paper);
    margin-bottom: 4px;
}

.grow-item span {
    color: var(--slate-soft);
    font-size: 12.5px;
    line-height: 1.4;
}

.grow-callout {
    margin-top: 18px;
    background: var(--paper);
    color: var(--black);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.grow-callout::after {
    content: "↗";
    position: absolute;
    right: 20px;
    bottom: 12px;
    font-size: 56px;
    opacity: 0.18;
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */
@media (max-width: 1080px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
        min-height: auto;
        padding-top: 60px;
        padding-bottom: 80px;
    }

    .hero-art { min-height: 360px; }

    .about,
    .contact-card,
    .project-card {
        grid-template-columns: 1fr;
    }

    .competency-grid,
    .interests-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .contact-actions { justify-content: start; text-align: left; }
    .contact-icon { margin-left: 0; }

    .playground-layout {
        grid-template-columns: 1fr;
    }

    .grow-panel { position: static; }
}

@media (max-width: 720px) {
    .site-header {
        height: auto;
        padding: 16px var(--gutter);
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 18px;
        padding-bottom: 4px;
    }

    .nav-links a {
        padding: 4px 0 8px;
        white-space: nowrap;
    }

    .competency-grid,
    .interests-grid,
    .project-grid,
    .panel-grid,
    .metrics-grid,
    .about-meta {
        grid-template-columns: 1fr;
    }

    .metrics-grid .metric { border-right: 0; border-bottom: 1px solid var(--line); }
    .metrics-grid .metric:last-child { border-bottom: 0; }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
        font-size: 12px;
    }

    .hero-stat .v { font-size: 17px; }

    .timeline { padding-left: 18px; }
    .timeline-item { padding-left: 26px; }

    .media-panel {
        right: 12px; left: 12px; top: auto; bottom: 12px;
        width: auto; max-height: 60vh;
    }

    .site-footer { flex-direction: column; align-items: flex-start; }
}

/* Reduced motion users get a calmer experience */
@media (prefers-reduced-motion: reduce) {
    .fade-in { opacity: 1; transform: none; transition: none; }
    .pilot-callout .led { animation: none; }
    html { scroll-behavior: auto; }
}
