/* ==========================================================================
   Yu Chuan Oh — Portfolio stylesheet
   One file for every page (replaces style.css + pages.css).

   Contents
   1.  Theme colours (dark + light)
   2.  Base / reset
   3.  Header + navigation
   4.  Buttons + social icons
   5.  Section headings
   6.  Home: hero + typing effect
   7.  Home: featured projects, services, "let's connect"
   8.  Project + journal cards
   9.  Timeline (About page)
   10. Article pages (About, journal post, project detail)
   11. Footer
   12. Responsive + reduced motion
   13. Project pages + interactive demos
   14. Animated background (background.js)
   ========================================================================== */


/* 1. THEME COLOURS ---------------------------------------------------------
   Every colour on the site comes from these variables. Dark mode is the
   default. When script.js adds class="light" to <html>, the second block
   overrides the same variable names, so every rule below switches theme
   without being written twice.                                             */

:root{
    --bg:          #080808;               /* page background */
    --bg-2:        #131313;               /* alternate section background */
    --surface:     #0e0e0e;               /* cards and boxes */
    --text:        #f4f7f7;
    --muted:       #c3cbcb;               /* secondary text (bright enough to read over the background) */
    --accent:      #00ffee;               /* borders, dots, glow */
    --accent-ink:  #00ffee;               /* accent-coloured text + solid buttons */
    --on-accent:   #041414;               /* text on a solid accent button */
    --glow:        rgba(0, 255, 238, 0.55);
    --glow-soft:   rgba(0, 255, 238, 0.22);
    --line:        rgba(0, 255, 238, 0.20);
    --line-strong: rgba(0, 255, 238, 0.55);
    --header-bg:   rgba(0, 0, 0, 0.35);

    /* Status colours for the project demos (separate from the accent) */
    --ok:          #3ddc97;
    --warn:        #ffc857;
    --bad:         #ff5c7a;

    --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --gutter: clamp(16px, 8vw, 150px);   /* left/right page padding */

    color-scheme: dark;                   /* dark scrollbars + form controls */
}

/* Light mode: Lilac + Indigo.
   Bright colours like cyan or lilac are hard to read as text on white, so
   --accent-ink is a deeper indigo, used for text and solid buttons.       */
:root.light{
    --bg:          #f4f4fb;
    --bg-2:        #e9e8f7;
    --surface:     #ffffff;
    --text:        #16152c;
    --muted:       #45445f;
    --accent:      #7b6cff;
    --accent-ink:  #4338ca;
    --on-accent:   #ffffff;
    --glow:        rgba(123, 108, 255, 0.45);
    --glow-soft:   rgba(123, 108, 255, 0.18);
    --line:        rgba(67, 56, 202, 0.20);
    --line-strong: rgba(67, 56, 202, 0.50);
    --header-bg:   rgba(244, 244, 251, 0.75);

    --ok:          #12805c;
    --warn:        #a15c00;
    --bad:         #c8264a;

    color-scheme: light;
}


/* 2. BASE / RESET --------------------------------------------------------- */

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html{
    scroll-behavior: smooth;
    scroll-padding-top: 90px;   /* anchor links stop below the fixed header */
}

body{
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    transition: background-color .35s ease, color .35s ease;   /* smooth theme switch */
}

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

/* Visible outline for keyboard users only (not on mouse clicks) */
:focus-visible{
    outline: 2px solid var(--accent-ink);
    outline-offset: 3px;
}

/* Hidden on screen but still read out by screen readers */
.sr-only{
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

section{
    padding: 110px var(--gutter) 100px;
}

::-webkit-scrollbar{ width: 12px; }
::-webkit-scrollbar-thumb{ background-color: var(--accent); }
::-webkit-scrollbar-track{ background-color: var(--bg); }


/* 3. HEADER + NAVIGATION -------------------------------------------------- */

.header{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 22px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    transition: background-color .35s ease;
}

.logo{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 800;
    transition: transform .3s ease;
}
/* Header logo = brand/logo-horizontal.svg: the split-gear mark, the name in the logo's
   lettering (Chakra Petch) and the slogan. Same colours in both themes. */
.logo-mark{
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.logo-text{
    display: flex;
    flex-direction: column;
    font-family: "Chakra Petch", var(--sans);
    line-height: 1;
}
.logo-name{
    font-size: 26px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: linear-gradient(90deg, #3b82f6, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.logo-slogan{
    margin-top: 5px;
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: #7c6cf0;
}
.logo:hover{ transform: scale(1.06); }

.header-right{
    display: flex;
    align-items: center;
    gap: 28px;
}

.navbar{
    display: flex;
    gap: 34px;
}
.navbar a{
    font-size: 16px;
    font-weight: 500;
    padding-bottom: 2px;
    border-bottom: 3px solid transparent;
    transition: color .3s ease, border-color .3s ease;
}
.navbar a:hover,
.navbar a.active{
    color: var(--accent-ink);
    border-color: var(--accent);
}

/* Round icon buttons: theme toggle + mobile menu */
.icon-btn{
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 18px;
    background: transparent;
    color: var(--accent-ink);
    border: 2px solid var(--accent);
    cursor: pointer;
    transition: box-shadow .3s ease, transform .1s ease;
}
.icon-btn:hover{ box-shadow: 0 0 18px var(--glow); }
.icon-btn:active{ transform: scale(0.92); }   /* "press" feedback on click */

#menu-icon{ display: none; }                  /* only shown on small screens */


/* 4. BUTTONS + SOCIAL ICONS ----------------------------------------------- */

.btn-group{
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

/* Default button: outlined */
.btn{
    display: inline-block;
    padding: 11px 28px;
    border-radius: 999px;
    font: 600 15px var(--sans);
    letter-spacing: .02em;
    cursor: pointer;
    border: 2px solid var(--accent);
    color: var(--accent-ink);
    background: transparent;
    transition: box-shadow .3s ease, background-color .3s ease, transform .1s ease;
}
.btn:hover{
    background: var(--glow-soft);
    box-shadow: 0 0 22px var(--glow-soft);
}
.btn:active{ transform: scale(0.96); }
.btn i{ margin-right: 8px; }

/* Main call-to-action: solid + glowing. Use once per screen. */
.btn.primary{
    background: var(--accent-ink);
    border-color: var(--accent-ink);
    color: var(--on-accent);
    box-shadow: 0 0 22px var(--glow);
}
.btn.primary:hover{
    background: var(--accent-ink);
    box-shadow: 0 0 40px var(--glow);
}

.social-icons{
    display: flex;
    gap: 14px;
    margin: 26px 0 30px;
}
.social-icons a{
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 20px;
    border: 2px solid var(--accent);
    color: var(--accent-ink);
    transition: background-color .3s ease, color .3s ease, box-shadow .3s ease, transform .3s ease;
}
.social-icons a:hover{
    background: var(--accent-ink);
    color: var(--on-accent);
    box-shadow: 0 0 22px var(--glow);
    transform: translateY(-3px);
}


/* 5. SECTION HEADINGS ----------------------------------------------------- */

.heading{
    text-align: center;
    font-size: clamp(36px, 5vw, 56px);   /* scales with screen width, 36–56px */
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 56px;
    text-wrap: balance;
}
.heading span{ color: var(--accent-ink); }

/* Small label above a heading, e.g. "// SELECTED WORK" */
.eyebrow{
    display: block;
    text-align: center;
    font: 500 14px var(--mono);
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-bottom: 12px;
}
.eyebrow::before{
    content: "// ";
    opacity: .6;
}

.center{ text-align: center; }


/* 6. HOME: HERO + TYPING EFFECT ------------------------------------------- */

.home{
    min-height: 100vh;
    padding-top: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(40px, 8vw, 140px);
}

.home-content{ max-width: 620px; }

.home-content h1{
    font-size: clamp(42px, 6vw, 68px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.home-content h1 span{ color: var(--accent-ink); }

.home-content .intro{
    font-size: 16.5px;
    color: var(--muted);
    max-width: 56ch;   /* ~56 characters per line is comfortable to read */
}

/* "I'm a ____" — the words are typed by script.js */
.text-animation{
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 600;
    min-height: 1.5em;   /* stops the page jumping while a word is deleted */
    margin-bottom: 20px;
}
.typed{ color: var(--accent-ink); }

.cursor{
    display: inline-block;
    width: 3px;
    height: 1.05em;
    margin-left: 4px;
    vertical-align: -0.15em;
    background: var(--accent);
    box-shadow: 0 0 8px var(--glow);
    animation: blink .9s steps(1) infinite;
}
@keyframes blink{
    50%{ opacity: 0; }
}

.home-img{ flex-shrink: 0; }
.home-img img{
    display: block;
    width: min(32vw, 420px);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 25px var(--glow);
    transition: box-shadow .4s ease;
}
.home-img img:hover{
    box-shadow: 0 0 25px var(--glow), 0 0 60px var(--glow-soft);
}


/* 7. HOME: FEATURED PROJECTS, SERVICES, "LET'S CONNECT" ------------------- */

.featured{
    background: var(--bg-2);
    transition: background-color .35s ease;
}
.featured .work-grid{
    grid-template-columns: repeat(2, 1fr);   /* 4 featured cards = a 2 x 2 grid under the spotlight */
    margin-bottom: 44px;
}

/* Spotlight: one wide featured card (SigPath) above the row of three */
.work-card.spotlight{
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    align-items: center;
    gap: 28px;
    max-width: 1200px;
    margin: 0 auto 22px;
    padding: 18px;
}
.spotlight img{
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
}
.spotlight-text{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-right: 10px;
}
.spotlight-text .pill{ margin-bottom: 12px; }
.spotlight .spotlight-text h3{ font-size: 28px; }   /* more specific than .work-card h3 */
.spotlight .spotlight-text p{ flex-grow: 0; }
@media (max-width: 900px){
    .work-card.spotlight{ grid-template-columns: 1fr; gap: 18px; }
    .spotlight-text{ padding: 0 6px 6px; }
}

/* Services: 2 x 2 grid. Not clickable, so they only glow on hover (no zoom). */
.services-container{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}
.service-box{
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: 28px;
    padding: 34px 32px;
    transition: border-color .3s ease, box-shadow .3s ease;
}
.service-box:hover{
    border-color: var(--accent);
    box-shadow: 0 0 22px var(--glow-soft);
}
.service-box h4{
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-ink);
    margin-bottom: 10px;
}
.service-box p{
    font-size: 15px;
    color: var(--muted);
}

/* Replaces the old contact form */
.connect{
    padding-top: 90px;
    padding-bottom: 90px;
    background: var(--bg-2);
    text-align: center;
    transition: background-color .35s ease;
}
.connect .heading{ margin-bottom: 16px; }
.connect p{
    max-width: 52ch;
    margin: 0 auto 26px;
    color: var(--muted);
}


/* 8. PROJECT + JOURNAL CARDS ---------------------------------------------- */

.work-grid{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    max-width: 1200px;
    margin: 0 auto;
}
.journal-list{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
    max-width: 1000px;
    margin: 0 auto;
}

.work-card,
.journal-card{
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    padding: 28px 26px 24px;
    overflow: hidden;
    transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease;
}

/* Accent bar that slides in along the top edge on hover */
.work-card::before,
.journal-card::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
}

/* Only cards that are links (a.work-card) lift up. "Coming soon" cards stay still. */
a.work-card:hover,
a.journal-card:hover{
    border-color: var(--line-strong);
    transform: translateY(-6px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25), 0 0 24px var(--glow-soft);
}
a.work-card:hover::before,
a.journal-card:hover::before{ transform: scaleX(1); }
a.work-card:active,
a.journal-card:active{
    transform: translateY(-2px) scale(0.99);
    transition-duration: .08s;
}

/* Arriving from a Featured card (projects.html#daytonator) highlights that card */
.work-card:target{
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 0 30px var(--glow-soft);
    scroll-margin-top: 110px;
}

.work-index{
    font: 500 14px var(--mono);
    color: var(--muted);
    margin-bottom: 14px;
}
.work-card h3,
.journal-card h3{
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 12px;
}
.work-card p,
.journal-card p{
    font-size: 15px;
    line-height: 1.75;
    color: var(--muted);
    margin-bottom: 20px;
    flex-grow: 1;   /* pushes "Open project" to the bottom so cards line up */
}

.work-tags{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.work-tags span{
    font: 400 12.5px var(--mono);
    color: var(--accent-ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 9px;
}

.work-open{
    font: 500 14px var(--mono);
    transition: color .3s ease, letter-spacing .3s ease;
}
.work-open::after{
    content: " \2192";   /* → arrow */
    color: var(--accent-ink);
}
a.work-card:hover .work-open,
a.journal-card:hover .work-open{
    color: var(--accent-ink);
    letter-spacing: .06em;
}

.journal-date{
    font: 500 13px var(--mono);
    color: var(--accent-ink);
    margin-bottom: 10px;
}
.journal-card.soon{ opacity: .6; }
.soon-badge{
    align-self: flex-start;
    font: 500 12px var(--mono);
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    padding: 2px 9px;
    margin-bottom: 10px;
}


/* 9. TIMELINE (About page) ------------------------------------------------ */

.education{
    background: var(--bg-2);
    transition: background-color .35s ease;
}

.timeline-items{
    position: relative;
    display: grid;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}
/* The vertical line down the middle */
.timeline-items::before{
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1.5px);
    width: 3px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--glow-soft);
}

/* Odd items sit on the left, even items on the right */
.timeline-item{
    position: relative;
    width: 50%;
    padding-right: 34px;
    text-align: right;
}
.timeline-item:nth-child(even){
    margin-left: 50%;
    padding: 0 0 0 34px;
    text-align: left;
}

.timeline-dot{
    position: absolute;
    top: 8px;
    right: -10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 18px var(--glow);
}
.timeline-item:nth-child(even) .timeline-dot{
    right: auto;
    left: -10px;
}

.timeline-date{
    font-size: 19px;
    font-weight: 800;
    margin: 2px 0 12px;
}
.timeline-content{
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 28px;
    padding: 24px 34px;
    text-align: left;
    box-shadow: 0 0 12px var(--glow-soft);
}
.timeline-content h3{
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}
.timeline-content p{
    font-size: 15px;
    line-height: 1.7;
    color: var(--muted);
}


/* 10. ARTICLE PAGES (About, journal post, project detail) ----------------- */

.page-section{ padding-top: 150px; }

.doc{
    max-width: 760px;
    margin: 0 auto;
}
.doc h1{
    font-size: clamp(34px, 5vw, 46px);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 18px;
}
.doc h2{
    font-size: 24px;
    font-weight: 600;
    margin: 44px 0 16px;
    padding-left: 16px;
    border-left: 3px solid var(--accent);
}
.doc p{
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--muted);
    margin-bottom: 18px;
}
.doc strong{ color: var(--text); }

/* A big section heading used inside an article (e.g. "Let's talk" on About) */
.doc h2.heading{
    font-size: clamp(36px, 5vw, 56px);
    border: none;
    padding: 0;
    margin: 0 0 16px;
}

.doc .back-link{
    display: inline-block;
    font: 500 14px var(--mono);
    color: var(--muted);
    margin-bottom: 34px;
    transition: color .3s ease;
}
.doc .back-link:hover{ color: var(--accent-ink); }

/* Tags under an article title (date, language, etc.) */
.doc-meta{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 34px;
}
.doc-meta span{
    font: 400 13px var(--mono);
    color: var(--accent-ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 9px;
}

.doc-links{
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}
.doc-links.center{ justify-content: center; }

.intro-text{
    max-width: 640px;
    margin: 0 auto 56px;
    text-align: center;
    color: var(--muted);
}


/* 11. FOOTER -------------------------------------------------------------- */

.footer{
    background: var(--bg-2);
    padding: 44px var(--gutter);
    text-align: center;
    transition: background-color .35s ease;
}
.footer .social-icons{
    justify-content: center;
    margin: 0 0 22px;
}
.footer ul{
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 28px;
}
.footer ul a{
    border-bottom: 2px solid transparent;
    transition: border-color .3s ease;
}
.footer ul a:hover{ border-color: var(--accent); }
.copyright{
    margin-top: 26px;
    font-size: 14px;
    color: var(--muted);
}


/* 12. RESPONSIVE + REDUCED MOTION ----------------------------------------- */

/* Tablets */
@media (max-width: 1100px){
    .work-grid{ grid-template-columns: repeat(2, 1fr); }
    .featured .work-grid{ grid-template-columns: repeat(2, 1fr); }   /* keep the 2 x 2 featured grid on tablets */
}

/* Phones */
@media (max-width: 900px){
    :root{ --gutter: 20px; }

    /* Navigation turns into a drop-down opened by the menu button */
    #menu-icon{ display: grid; }
    .header-right{ gap: 12px; }
    .navbar{
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: min(70%, 300px);
        flex-direction: column;
        gap: 4px;
        padding: 12px 22px 18px;
        background: var(--surface);
        border-left: 2px solid var(--accent);
        border-bottom: 2px solid var(--accent);
        border-bottom-left-radius: 20px;
    }
    .navbar.open{ display: flex; }
    .navbar a{ padding: 10px 0; }

    /* Photo goes above the text */
    .home{
        flex-direction: column-reverse;
        gap: 36px;
        min-height: 0;
        padding-top: 120px;
    }
    .home-img img{ width: min(62vw, 300px); }

    /* Everything stacks to one column */
    .work-grid,
    .featured .work-grid,
    .journal-list,
    .services-container{ grid-template-columns: 1fr; }

    /* Timeline line moves to the left edge */
    .timeline-items::before{ left: 9px; }
    .timeline-item,
    .timeline-item:nth-child(even){
        width: 100%;
        margin-left: 0;
        padding: 0 0 0 40px;
        text-align: left;
    }
    .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot{
        left: 0;
        right: auto;
    }

    .page-section{ padding-top: 120px; }
}

/* Respect visitors who have asked their device to reduce animation */
@media (prefers-reduced-motion: reduce){
    html{ scroll-behavior: auto; }
    *{ transition: none !important; }
}


/* 13. PROJECT PAGES + INTERACTIVE DEMOS -----------------------------------
   Used by daytonator.html, medical-imaging.html and midknight-watcher.html.
   Each demo replays REAL output saved from the project's repository.     */

.project-pitch{
    font-size: 19px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 18px;
}

/* The demo box is wider than the article text so the visuals have room */
.demo{
    max-width: 1060px;
    margin: 44px auto;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: 18px;
    overflow: hidden;
}
.demo-bar{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
}
.demo-title{
    font: 500 13px var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-ink);
}
.demo-title::before{ content: "\25B6  "; }
.demo-body{ padding: 24px 22px; }
.demo-note{
    font-size: 13px;
    color: var(--muted);
    padding: 12px 22px;
    border-top: 1px solid var(--line);
}
.demo .btn{ padding: 8px 20px; font-size: 14px; }

/* Small status pill: idle / running / ok / warn / bad */
.pill{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 500 12px var(--mono);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    white-space: nowrap;
}
.pill::before{
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.pill.running{ color: var(--accent-ink); border-color: var(--accent); }
.pill.running::before{ animation: blink .8s steps(1) infinite; }
.pill.ok{   color: var(--ok);   border-color: var(--ok); }
.pill.warn{ color: var(--warn); border-color: var(--warn); }
.pill.bad{  color: var(--bad);  border-color: var(--bad); }

/* Monospace "terminal" text used by log replays */
.term{
    font: 400 12.5px/1.65 var(--mono);
    color: var(--muted);
    overflow-x: auto;
    white-space: pre;
}
.term .hit{ color: var(--bad); }
.term .good{ color: var(--ok); }


/* -- Daytonator: five sandbox forks side by side -------------------------- */
.pipeline-steps{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.pipeline-steps span{
    font: 500 12.5px var(--mono);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px dashed var(--line-strong);
    color: var(--muted);
    transition: color .3s ease, border-color .3s ease, background-color .3s ease;
}
.pipeline-steps span.done{
    color: var(--accent-ink);
    border-style: solid;
    border-color: var(--accent);
    background: var(--glow-soft);
}
/* The step I built: always outlined, with a small "my part" badge */
.pipeline-steps span.mine{
    border-style: solid;
    border-color: var(--accent);
}
.pipeline-steps span.mine em{
    font-style: normal;
    font-size: 11px;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-ink);
    color: var(--on-accent);
}

.forks{
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.fork{
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--bg);
    transition: border-color .3s ease, box-shadow .3s ease;
}
.fork.triggered{
    border-color: var(--bad);
    box-shadow: 0 0 22px color-mix(in srgb, var(--bad) 25%, transparent);
}
.fork-name{ font: 600 15px var(--mono); }
.fork-bait{ font-size: 12.5px; line-height: 1.5; color: var(--muted); min-height: 3.2em; }
.fork .term{ white-space: pre-wrap; font-size: 11.5px; min-height: 1.6em; }
.trace-out{
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
    background: var(--bg);
}

.verdict{
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 12px;
    border: 1.5px solid var(--bad);
    background: color-mix(in srgb, var(--bad) 8%, var(--surface));
}
.verdict-head{
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    margin-bottom: 8px;
}
.verdict-label{ font: 700 22px var(--mono); color: var(--bad); letter-spacing: .04em; }
.verdict-score{ font: 500 15px var(--mono); }
.verdict p{ color: var(--text); margin-bottom: 10px; }
.verdict ul{ list-style: none; display: grid; gap: 4px; }
.verdict li{ font: 400 13px var(--mono); color: var(--muted); }
.verdict li::before{ content: "\203A  "; color: var(--bad); }
.callout{
    margin-top: 14px;
    font-size: 14px;
    color: var(--muted);
}
.callout strong{ color: var(--text); }


/* -- Medical imaging: image picker, gate checks, decision axis ------------- */
.retina-picker{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}
.retina-option{
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font: 500 13px var(--sans);
    text-align: left;
    cursor: pointer;
    transition: border-color .3s ease, box-shadow .3s ease, transform .1s ease;
}
.retina-option img{
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    background: #000;
}
.retina-option:hover{ border-color: var(--line-strong); }
.retina-option:active{ transform: scale(0.98); }
.retina-option[aria-pressed="true"]{
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 20px var(--glow-soft);
}

.gate-list{
    list-style: none;
    display: grid;
    gap: 10px;
}
.gate{
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 6px 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--bg);
}
.gate-step{
    font: 600 13px var(--mono);
    color: var(--accent-ink);
    padding-top: 1px;
}
.gate h4{ font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.gate p{ font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.gate .term{ white-space: pre-wrap; font-size: 12px; margin-top: 4px; }

/* Decision axis: probability line with the abstention band + operating point */
.axis-wrap{ margin-top: 26px; }
.axis{
    position: relative;
    height: 46px;
    margin: 30px 6px 8px;
}
.axis-track{
    position: absolute;
    left: 0;
    right: 0;
    top: 20px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--ok), var(--warn) 35%, var(--bad));
    opacity: .55;
}
.axis-band{
    position: absolute;
    top: 12px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px dashed var(--warn);
    background: color-mix(in srgb, var(--warn) 14%, transparent);
}
.axis-op{
    position: absolute;
    top: 6px;
    width: 2px;
    height: 34px;
    background: var(--text);
}
.axis-label{
    position: absolute;
    top: -22px;
    transform: translateX(-50%);
    font: 500 11.5px var(--mono);
    color: var(--muted);
    white-space: nowrap;
}
.axis-dot{
    position: absolute;
    top: 13px;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    border-radius: 50%;
    background: var(--accent-ink);
    border: 3px solid var(--surface);
    box-shadow: 0 0 14px var(--glow);
    pointer-events: none;
}
.axis-ticks{
    display: flex;
    justify-content: space-between;
    font: 400 11.5px var(--mono);
    color: var(--muted);
    margin: 0 6px;
}
.axis input[type="range"]{
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
    opacity: 0;          /* invisible, but still draggable + keyboard accessible */
    cursor: pointer;
}
.axis:focus-within .axis-dot{ outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.decision-out{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 16px;
}
.decision-out p{ font-size: 14px; color: var(--muted); flex: 1 1 280px; }


/* -- Midknight Watcher: run timeline + scoreboard ------------------------- */
.run-grid{
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 22px;
    align-items: start;
}
.timeline-log{
    list-style: none;
    display: grid;
    gap: 2px;
    max-height: 430px;
    overflow-y: auto;
    padding-right: 4px;
}
.timeline-log li{
    display: grid;
    grid-template-columns: 48px 92px 1fr;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    animation: log-in .35s ease;
}
.timeline-log li:nth-child(odd){ background: var(--bg); }
.timeline-log time{ font: 500 12.5px var(--mono); color: var(--muted); padding-top: 1px; }
.timeline-log .tag{
    justify-self: start;
    font: 500 11px var(--mono);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid currentColor;
    color: var(--muted);
}
.tag.agent{ color: var(--accent-ink); }
.tag.failover{ color: var(--warn); }
.tag.crash{ color: var(--bad); }
.tag.human{ color: var(--ok); }
.tag.score{ color: var(--text); }
@keyframes log-in{
    from{ opacity: 0; transform: translateY(6px); }
    to{ opacity: 1; transform: none; }
}

.scoreboard{
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--bg);
}
.score-total{
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 14px;
}
.score-total strong{ font: 700 34px var(--mono); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.score-total span{ font: 400 13px var(--mono); color: var(--muted); }
.bars{ display: grid; gap: 9px; }
.bar-row{ display: grid; gap: 3px; }
.bar-label{
    display: flex;
    justify-content: space-between;
    font: 400 12px var(--mono);
    color: var(--muted);
}
.bar{
    height: 8px;
    border-radius: 4px;
    background: var(--line);
    overflow: hidden;
}
.bar i{
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: var(--accent);
    transition: width .9s ease;
}
.bar i.full{ background: var(--ok); }
.score-foot{ margin-top: 14px; font-size: 13px; color: var(--muted); }

/* -- Pong: playable canvas ------------------------------------------------ */
.pong-canvas{
    display: block;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4 / 3;
    margin: 0 auto;
    border-radius: 10px;
    background: #000;          /* the original turtle window was black in both themes */
    touch-action: none;        /* dragging on the game moves the paddle, not the page */
    cursor: grab;
}
.pong-controls{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}
.keys{
    text-align: center;
    margin-top: 12px;
    font-size: 13.5px;
    color: var(--muted);
}
kbd{
    font: 500 12px var(--mono);
    padding: 1px 7px;
    border-radius: 5px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    color: var(--text);
}

/* -- Tetris: playable canvas + touch pad ---------------------------------- */
.tetris-canvas{
    display: block;
    width: 100%;
    max-width: 510px;
    aspect-ratio: 510 / 600;
    margin: 0 auto;
    border-radius: 10px;
    background: rgb(24, 89, 117);   /* the original window colour, in both themes */
    touch-action: none;
}
.tetris-pad{
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}
.tetris-pad .btn{
    min-width: 56px;
    font-size: 20px;
    padding: 6px 0;
    touch-action: manipulation;    /* no double-tap zoom while playing */
}

/* -- Live-app screenshot (SigPath) ---------------------------------------- */
.shot{
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    transition: border-color .3s ease, box-shadow .3s ease;
}
.shot:hover{
    border-color: var(--accent);
    box-shadow: 0 0 26px var(--glow-soft);
}
.shot img{
    display: block;
    width: 100%;
    height: auto;
}
.try-row{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

/* -- Screenshot gallery (Router Rumble) ----------------------------------- */
.phone-row{
    display: flex;
    justify-content: center;
    gap: 18px;
    margin: 8px 0 22px;
}
.phone-row img{
    width: min(46%, 230px);
    height: auto;
    border-radius: 18px;
    border: 1px solid var(--line-strong);
}
.gallery{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 8px 0 22px;
}
.gallery figure{ margin: 0; }
.gallery img{
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.gallery figcaption{
    font-size: 13px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}
@media (max-width: 700px){
    .gallery{ grid-template-columns: 1fr; }
}

/* Facts / numbers row under a demo */
.fact-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 26px 0 8px;
}
.fact{
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.fact strong{
    display: block;
    font: 700 22px var(--mono);
    color: var(--accent-ink);
    margin-bottom: 4px;
}
.fact span{ font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* Demos on smaller screens */
@media (max-width: 900px){
    .forks{ grid-template-columns: repeat(2, 1fr); }
    .run-grid{ grid-template-columns: 1fr; }
    .timeline-log{ max-height: 360px; }
    .timeline-log li{ grid-template-columns: 44px 1fr; }
    .timeline-log li .tag{ grid-column: 2; grid-row: 1; }
    .timeline-log li p{ grid-column: 1 / -1; }
}
@media (max-width: 520px){
    .forks{ grid-template-columns: 1fr; }
    .retina-picker{ gap: 8px; grid-template-columns: repeat(2, 1fr); }
    .retina-option{ padding: 6px; font-size: 11.5px; }
    .gate{ grid-template-columns: 1fr auto; }
    .gate-step{ grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce){
    .timeline-log li{ animation: none; }
}


/* 14. ANIMATED BACKGROUND (background.js) ---------------------------------
   A fixed WebGL layer behind every page. It shows through wherever a section
   has no background of its own; cards and panels stay solid, so text is
   always readable. pointer-events: none keeps every click on the page. */

.site-background{
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;

    /* Reading column: the background fades to 35% behind the middle of the page,
       where the text is, and stays at full strength in the side margins.
       On narrow screens the whole width is reading column, so it's 35% everywhere. */
    --reading-mask: linear-gradient(to right,
        #000 calc(50% - 640px),
        rgba(0, 0, 0, 0.35) calc(50% - 480px),
        rgba(0, 0, 0, 0.35) calc(50% + 480px),
        #000 calc(50% + 640px));
    -webkit-mask-image: var(--reading-mask);
    mask-image: var(--reading-mask);
}
.site-background canvas{
    display: block;
    width: 100%;
    height: 100%;
}

/* Text over the background: a soft halo in the page's own background colour, so a
   particle passing behind a word fades out at the word. Works in both themes. */
.home-content .intro,
.text-animation,
.doc p,
.intro-text{
    text-shadow: 0 0 4px var(--bg), 0 0 10px var(--bg), 0 0 18px var(--bg);
}

/* Timeline extras (About page): event label, result badges, project link, follow buttons */
.timeline-kind{
    display: inline-block;
    font: 500 11.5px var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.kind-hackathon .timeline-kind{ color: var(--accent-ink); }
.kind-project .timeline-kind{ color: var(--ok); }
.timeline-badges{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.timeline-badges span{
    font: 500 12px var(--mono);
    color: var(--accent-ink);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 2px 10px;
}
.timeline-link{
    display: inline-block;
    margin-top: 12px;
    font: 500 13.5px var(--mono);
    color: var(--accent-ink);
}
.timeline-link::after{ content: " \2192"; }
.timeline-link:hover{ text-decoration: underline; }
.follow{
    max-width: 640px;
    margin: 56px auto 0;
    text-align: center;
    color: var(--muted);
}

/* Journal: two groups of posts, newest post spans the full width */
.journal-group{
    max-width: 1000px;
    margin: 0 auto 18px;
    font: 500 14px var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.journal-list + .journal-group{ margin-top: 64px; }
.journal-card.latest{ grid-column: 1 / -1; }
