/* ==========================================================================
   v5 — Editorial layer
   --------------------------------------------------------------------------
   Loads last. The page reads like a datasheet rather than a dashboard: content
   sits on the page, separated by hairline rules and a consistent left rail,
   instead of being boxed into cards. Gold is used the way it is on a chip
   (pads, bond wires, the odd accent), never as a glow.

   Type roles
     Display   Space Grotesk 500, sentence case, balanced wrapping
     Body      Outfit 400, ~62ch measure, pretty wrapping
     Labels    JetBrains Mono, small uppercase, tracked

   The floating nav (.floating-hero and everything in it) is styled by
   main.css / neumorphic.css and animated by nav-motion.css, not here.
   ========================================================================== */

:root {
    /* Deeper, warmer ground and warm neutrals so the gold sits naturally */
    --neu-bg: #17191d;
    --neu-bg-hi: #1e2126;
    --neu-bg-lo: #121417;
    --text-primary: #ece8e1;
    --text-secondary: #a9a49b;
    --text-muted: #77736b;

    --label-font: 'JetBrains Mono', ui-monospace, monospace;
    --display-font: 'Space Grotesk', 'Outfit', sans-serif;
    --rule: rgba(236, 232, 225, 0.09);
    --rule-strong: rgba(236, 232, 225, 0.16);
    --gold: var(--neon-gold);
    --page-max: 1120px;
    --gutter: clamp(1rem, 4vw, 3rem);
    --rail: clamp(9rem, 16vw, 13rem);
    --measure: 64ch;
}

body {
    font-size: 1.0625rem;
    line-height: 1.65;
}

h1,
h2,
h3,
h4,
h5 {
    text-wrap: balance;
}

p,
li,
dd {
    text-wrap: pretty;
}

::selection {
    background: rgba(var(--neon-gold-rgb), 0.35);
    color: var(--text-primary);
}

/* Shared label style */
.hero-kicker,
.ed-no,
.ed-kicker,
.ed-subkicker,
.ed-when,
.ed-item-meta,
.ed-item-link,
.ed-more,
.ed-details dt,
.ed-field label,
.footer-section h3,
.die-figure figcaption {
    font-family: var(--label-font);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* 'Geist' was referenced in main.css but never loaded */
.cta-btn {
    font-family: inherit;
}

/* Calmer reveal, and the leftover title glitch is gone everywhere */
.fade-in {
    transform: translateY(10px);
}

.glitch::before,
.glitch::after {
    content: none;
    display: none;
}

/* ---------------------------------------------------------------------------
   Hero: name, one plain line, and the generated die as Fig. 1
   --------------------------------------------------------------------------- */
.hero.hero-die {
    min-height: min(92vh, 900px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 8rem var(--gutter) 3rem;
}

.hero-die .hero-content {
    max-width: none;
    text-align: left;
    margin: 0;
}

.hero-kicker {
    color: rgba(var(--neon-gold-rgb), 0.85);
    margin-bottom: 1.25rem;
}

.hero-name {
    font-family: var(--display-font);
    font-size: clamp(2.75rem, 6.6vw, 5.5rem);
    font-weight: 500;
    line-height: 0.98;
    letter-spacing: -0.035em;
    color: var(--text-primary);
}

.hero-die .tagline,
.ed-page-hero .tagline {
    display: block;
    font-family: inherit;
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0;
    color: var(--text-secondary);
    margin: 1.25rem 0 0;
    max-width: 34ch;
}

.hero-die .tagline::before,
.ed-page-hero .tagline::before {
    content: none;
}

.hero-die .cta-buttons,
.ed-page-hero .cta-buttons {
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 2.25rem;
}

/* Page CTAs: same family as the nav pills, quieter type */
.hero .cta-btn,
.ed-page-hero .cta-btn,
.ed-section .cta-btn {
    letter-spacing: 0.01em;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.8rem 1.4rem;
    border-radius: 10px;
}

.die-figure {
    margin: 0;
    justify-self: end;
    width: min(100%, 540px);
}

.die-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.die-canvas.is-drawn {
    opacity: 1;
}

.die-figure figcaption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: none;
}

.die-figure .fig-no {
    color: var(--gold);
    text-transform: uppercase;
}

.die-figure code {
    font-family: inherit;
    color: var(--text-secondary);
}

.die-respin {
    margin-left: auto;
    background: none;
    border: none;
    padding: 0.25rem 0;
    font: inherit;
    color: var(--gold);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(var(--neon-gold-rgb), 0.4);
}

.die-respin:hover {
    text-decoration-color: currentColor;
}

@media (max-width: 900px) {
    .hero.hero-die {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-top: 7.5rem;
        gap: 2.5rem;
    }

    .die-figure {
        justify-self: center;
        width: min(100%, 420px);
    }
}

/* Inner-page hero (projects archive) */
.ed-page-hero {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 9rem var(--gutter) 1rem;
}

/* ---------------------------------------------------------------------------
   Sections: a numbered left rail and a body column, both hung off a rule
   --------------------------------------------------------------------------- */
.ed-section {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 4vw, 4rem);
    max-width: var(--page-max);
    margin: 0 auto;
    padding: clamp(4.5rem, 10vw, 8rem) var(--gutter) 0;
}

.ed-head {
    align-self: start;
    position: sticky;
    top: 7.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule-strong);
}

.ed-no {
    display: block;
    color: var(--gold);
    margin-bottom: 0.6rem;
}

.ed-title {
    font-family: var(--display-font);
    font-size: clamp(1.6rem, 2.6vw, 2.1rem);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.ed-body {
    min-width: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--rule-strong);
}

.ed-lead {
    font-family: var(--display-font);
    font-size: clamp(1.3rem, 2.3vw, 1.7rem);
    font-weight: 400;
    line-height: 1.38;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    max-width: 36ch;
    margin: 0.25rem 0 1.5rem;
}

.ed-lead strong {
    font-weight: 500;
}

.ed-text,
.ed-note {
    color: var(--text-secondary);
    max-width: var(--measure);
}

.ed-text strong,
.ed-what strong,
.ed-item-desc strong {
    color: var(--text-primary);
    font-weight: 500;
}

.ed-note {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.ed-small {
    font-size: 0.92rem;
}

.ed-muted {
    color: var(--text-muted);
}

.ed-block {
    margin-top: clamp(3rem, 6vw, 4.5rem);
}

.ed-kicker {
    color: var(--text-muted);
    padding-bottom: 0.7rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--rule);
}

.ed-subkicker {
    color: var(--text-muted);
    margin: 1.75rem 0 0.5rem;
}

/* Timeline entries (work, education) */
.ed-entry {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.6rem 0;
    border-bottom: 1px solid var(--rule);
}

.ed-entry:last-child {
    border-bottom: none;
}

.ed-when {
    color: var(--text-muted);
    padding-top: 0.35rem;
    letter-spacing: 0.08em;
}

.ed-what h4 {
    font-family: var(--display-font);
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
}

.ed-where {
    color: rgba(var(--neon-gold-rgb), 0.85);
    font-size: 0.95rem;
    margin: 0.15rem 0 0.9rem;
}

.ed-where a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(var(--neon-gold-rgb), 0.4);
    text-underline-offset: 3px;
}

.ed-where a:hover {
    text-decoration-color: currentColor;
}

.ed-what>p {
    color: var(--text-secondary);
    max-width: var(--measure);
}

.ed-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    max-width: var(--measure);
}

.ed-list li {
    position: relative;
    padding-left: 1.25rem;
    margin: 0.45rem 0;
    color: var(--text-secondary);
}

.ed-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.78em;
    width: 0.55rem;
    height: 1px;
    background: var(--text-muted);
}

.ed-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 2rem;
    margin: 0;
}

.ed-modules>div {
    padding: 0.75rem 0;
    border-top: 1px solid var(--rule);
}

.ed-modules dt {
    font-family: var(--display-font);
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ed-modules dt span {
    font-family: var(--label-font);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

.ed-modules dd {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Inline lists separated by middots */
.ed-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0;
    margin: 1rem 0 1.25rem;
    font-family: var(--display-font);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.ed-inline span+span::before {
    content: '\00B7';
    color: var(--text-muted);
    margin: 0 0.7rem;
}

/* ---------------------------------------------------------------------------
   Selected work: a numbered index, not a card grid
   --------------------------------------------------------------------------- */
.ed-index {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: ed-item;
}

.ed-item {
    counter-increment: ed-item;
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
    column-gap: 1.25rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--rule);
}

.ed-item::before {
    content: counter(ed-item, decimal-leading-zero);
    font-family: var(--label-font);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--gold);
    padding-top: 0.15rem;
}

.ed-item[data-project-link]:focus-visible,
.ed-repo[data-project-link]:focus-visible {
    outline: 1px solid rgba(var(--neon-gold-rgb), 0.6);
    outline-offset: 6px;
}

.ed-item-meta {
    display: flex;
    flex-wrap: wrap;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.ed-item-meta span+span::before {
    content: '/';
    margin: 0 0.6rem;
    opacity: 0.6;
}

.ed-item-title {
    font-family: var(--display-font);
    font-size: clamp(1.3rem, 2.2vw, 1.65rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin: 0.4rem 0 0.7rem;
    transition: color 180ms ease;
}

.ed-item[data-project-link]:hover .ed-item-title,
.ed-item[data-modal-images]:hover .ed-item-title {
    color: var(--gold);
}

.ed-item-desc {
    color: var(--text-secondary);
    max-width: var(--measure);
}

/* Long descriptions show their opening lines; editorial.js adds the toggle */
.ed-item-desc.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ed-more-toggle {
    margin-top: 0.4rem;
    padding: 0.2rem 0;
    background: none;
    border: none;
    font-family: var(--label-font);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(var(--neon-gold-rgb), 0.35);
    text-underline-offset: 4px;
}

.ed-more-toggle:hover {
    text-decoration-color: currentColor;
}

@media (max-width: 600px) {
    .ed-item-desc.is-clamped {
        -webkit-line-clamp: 5;
    }
}

.ed-item-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.6rem;
    margin-top: 1rem;
    font-family: var(--label-font);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.ed-item-stats b {
    font-family: var(--display-font);
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-right: 0.3rem;
}

.ed-item-tags {
    margin-top: 0.8rem;
    font-family: var(--label-font);
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: var(--measure);
}

.ed-item-link {
    align-self: start;
    padding-top: 0.15rem;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: color 180ms ease;
}

a.ed-item-link:hover,
.ed-item:hover a.ed-item-link {
    color: var(--gold);
}

.ed-item-link span {
    display: inline-block;
    transition: transform 180ms ease;
}

.ed-item:hover a.ed-item-link span {
    transform: translate(2px, -2px);
}

.ed-item-link--muted {
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: none;
    white-space: normal;
    max-width: 10rem;
    text-align: right;
}

/* ---------------------------------------------------------------------------
   Open source: dense two-column list
   --------------------------------------------------------------------------- */
.ed-repos {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
}

.ed-repo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem;
    align-content: start;
    padding: 1.1rem 0 1.2rem;
    border-top: 1px solid var(--rule);
}

.ed-repo-name {
    font-family: var(--display-font);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    transition: color 180ms ease;
}

.ed-repo:hover .ed-repo-name {
    color: var(--gold);
}

.ed-repo-desc {
    grid-column: 1;
    margin-top: 0.3rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ed-repo-meta {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
    margin-top: 0.55rem;
    font-family: var(--label-font);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.ed-repo-link {
    grid-column: 2;
    grid-row: 1;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.3;
    transition: color 180ms ease, transform 180ms ease;
}

.ed-repo:hover .ed-repo-link {
    color: var(--gold);
    transform: translate(2px, -2px);
}

.ed-more {
    display: inline-flex;
    gap: 0.5rem;
    margin-top: 2rem;
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--neon-gold-rgb), 0.35);
    padding-bottom: 0.25rem;
    transition: border-color 180ms ease;
}

.ed-more:hover {
    border-color: var(--gold);
}

/* ---------------------------------------------------------------------------
   Toolkit: spec tables
   --------------------------------------------------------------------------- */
#skills .ed-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.75rem 3rem;
}

.ed-spec dl {
    margin: 0;
}

.ed-spec dl>div {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--rule);
}

.ed-spec dt {
    font-family: var(--display-font);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ed-spec dd {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   Contact
   --------------------------------------------------------------------------- */
.ed-contact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
}

.ed-contact .ed-lead {
    font-size: clamp(1.2rem, 1.9vw, 1.45rem);
    max-width: 26ch;
    margin-bottom: 1.1rem;
}

.ed-email {
    display: inline-block;
    font-family: var(--display-font);
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: rgba(var(--neon-gold-rgb), 0.45);
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
    /* only ever breaks at the <wbr> after the @ */
    overflow-wrap: normal;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

.ed-email:hover {
    color: var(--gold);
    text-decoration-color: currentColor;
}

.ed-details {
    margin: 2rem 0 0;
}

.ed-details>div {
    display: grid;
    grid-template-columns: 5.75rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--rule);
}

.ed-details dt {
    color: var(--text-muted);
    padding-top: 0.2rem;
}

.ed-details dd {
    margin: 0;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.ed-details a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--rule-strong);
    transition: color 180ms ease, border-color 180ms ease;
}

.ed-details a:hover {
    color: var(--gold);
    border-color: currentColor;
}

.ed-cv {
    margin-top: 2rem;
    gap: 0.75rem;
}

.ed-cv small {
    font-family: var(--label-font);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

.ed-form {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.ed-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ed-field label {
    color: var(--text-muted);
}

.ed-field input,
.ed-field textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--rule-strong);
    border-radius: 0;
    padding: 0.6rem 0;
    font: inherit;
    font-size: 1.05rem;
    color: var(--text-primary);
    transition: border-color 180ms ease;
}

.ed-field textarea {
    resize: vertical;
    min-height: 7rem;
}

.ed-field input::placeholder,
.ed-field textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.ed-field input:focus,
.ed-field textarea:focus {
    outline: none;
    border-bottom-color: var(--gold);
}

.ed-field input:focus-visible,
.ed-field textarea:focus-visible {
    box-shadow: 0 1px 0 0 var(--gold);
}

.ed-form .cta-btn {
    align-self: flex-start;
    margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.site-footer {
    max-width: var(--page-max);
    margin: clamp(5rem, 10vw, 8rem) auto 0;
    background: none !important;
    box-shadow: none !important;
    border-top: 1px solid var(--rule-strong);
    padding: 3rem var(--gutter) 2rem;
}

.site-footer::before {
    content: none;
}

.footer-content {
    max-width: none;
}

.footer-section h3 {
    color: var(--text-muted);
}

.footer-section a {
    display: flex;
    width: fit-content;
}

.footer-section a:hover {
    transform: none;
    color: var(--gold);
}

.footer-bottom {
    max-width: none;
    border-top-color: var(--rule);
    text-align: left;
}

.wafer-canvas {
    display: block;
    width: 112px;
    height: 112px;
    margin-top: 1.25rem;
    opacity: 0.9;
}

/* ---------------------------------------------------------------------------
   Narrow screens: rail folds into a heading above the body
   --------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .ed-section {
        grid-template-columns: minmax(0, 1fr);
    }

    .ed-head {
        position: static;
        display: flex;
        align-items: baseline;
        gap: 0.9rem;
        padding-top: 0.9rem;
    }

    .ed-no {
        margin: 0;
    }

    .ed-body {
        border-top: none;
        padding-top: 1.75rem;
    }

    #skills .ed-body,
    .ed-contact,
    .ed-repos {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .ed-entry {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.4rem;
    }

    .ed-modules {
        grid-template-columns: minmax(0, 1fr);
    }

    .ed-item {
        grid-template-columns: 2rem minmax(0, 1fr);
        padding: 1.6rem 0;
    }

    .ed-item-link {
        grid-column: 2;
        margin-top: 1rem;
    }

    .ed-item-link--muted {
        text-align: left;
        max-width: none;
    }

    .ed-spec dl>div,
    .ed-details>div {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.2rem;
    }

    /* main.css stacks page CTAs in a centred 300px column on phones; keep
       them side by side and flush with the left-aligned text instead */
    .hero-die .cta-buttons,
    .ed-page-hero .cta-buttons {
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .hero-die .cta-buttons .cta-btn,
    .ed-page-hero .cta-buttons .cta-btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        transform: none;
        transition: opacity 0.2s linear;
    }

    .die-canvas,
    .ed-item-title,
    .ed-item-link span,
    .ed-repo-link {
        transition: none;
    }
}
