/* ---------------------------------------------------------------------------
   Zhen Wang — personal site
   One stylesheet for the overview page and every detail page.

   Palette: "Doujin Ink" — warm press paper, blue-black ink, a periwinkle /
   sakura accent pair. The ACG register lives in exactly two places: the hue
   pair and the warmth of the paper. The warm half is rationed — identity line,
   section-rule segment, eyebrow, selection — and never touches body text, so
   the page reads as print-sober to a physics PI and still looks like it was
   made by someone with taste rather than a Bootstrap default.
   Every text pair below is >= 4.5:1 in both themes.
--------------------------------------------------------------------------- */

:root {
    color-scheme: light dark;

    /* paper & ink */
    --page-bg:      #faf8f4;   /* warm press paper — 2.4% warm shift, not sepia */
    --card-bg:      #fffdf9;   /* cards lift OFF the paper instead of sinking into gray */
    --card-bg-alt:  #f1f2fe;   /* cool tint: lead card, hovered card */
    --ink:          #16181f;   /* blue-black: headings, titles, strong (16.7:1) */
    --ink-soft:     #4a5060;   /* body copy (7.6:1) */
    --muted:        #646a7b;   /* dates, captions, stack lines (5.1:1) */
    --line:         #dfd8ca;   /* warm hairline, decorative only */
    --bar:          #898da6;   /* resting card bar */

    /* signature cool — links, orgs, structure */
    --iris:         #454ecb;   /* 6.2:1 on paper, 6.5:1 on card */
    --iris-deep:    #3b43b8;   /* hover / text on a cool tint */
    --iris-hi:      #5b6cf0;   /* NON-TEXT only: rings, strokes, glow */
    --iris-line:    #dce0fa;

    /* signature warm — rationed */
    --sakura:       #c0295a;   /* 5.3:1 on paper: eyebrow, identity line, rule segment */
    --sakura-soft:  #fbe3e9;

    /* support — one hue, one job */
    --brass:        #8a6a24;
    --brass-line:   #ad8134;

    --code-bg:      #f1eee6;
    --sakura-wash:  rgba(192, 41, 90, 0.06);
    --brass-wash:   rgba(173, 129, 52, 0.07);
    --ink-wash-a:   rgba(87, 68, 207, 0.05);
    --ink-wash-b:   rgba(192, 41, 90, 0.04);

    /* status + validator-widget surfaces */
    --on-accent:    #ffffff;
    --ok:           #0a6e52;
    --ok-soft:      #e2f4ec;
    --bad:          #bc1138;
    --bad-soft:     #fce4eb;
    --pv-surf:      #f4f2ea;
    --pv-log:       #efece3;
    --pv-chip:      #e8e5db;
    --pv-line:      #737c9e;
    --fx-cool-rgb:  69, 78, 203;
    --fx-warm-rgb:  192, 41, 90;

    --radius: 10px;
    --sidebar-w: 320px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-bg:      #121521;   /* blue-violet night, not neutral black */
        --card-bg:      #1a1e2c;
        --card-bg-alt:  #1e2440;
        --ink:          #edeff7;
        --ink-soft:     #a9b2c8;
        --muted:        #8a93aa;
        --line:         #2c3242;
        --bar:          #636c8c;

        --iris:         #9fb1ff;
        --iris-deep:    #b8c4ff;
        --iris-hi:      #b8c4ff;
        --iris-line:    #2a3356;

        --sakura:       #e98ea8;   /* chroma pulled, hue kept — full sakura on navy reads as stream overlay */
        --sakura-soft:  #2e1e29;

        --brass:        #e2b974;
        --brass-line:   #c9a05c;

        --code-bg:      #1f2433;
        --sakura-wash:  rgba(233, 142, 168, 0.09);
        --brass-wash:   rgba(226, 185, 116, 0.08);
        --ink-wash-a:   rgba(159, 177, 255, 0.07);
        --ink-wash-b:   rgba(233, 142, 168, 0.05);

        --on-accent:    #121521;
        --ok:           #4fdcae;
        --ok-soft:      #10261d;
        --bad:          #ff8097;
        --bad-soft:     #2c1620;
        --pv-surf:      #171b28;
        --pv-log:       #11141e;
        --pv-chip:      #222838;
        --pv-line:      #656f99;
        --fx-cool-rgb:  159, 177, 255;
        --fx-warm-rgb:  233, 142, 168;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    display: flex;
    font-family: 'Hiragino Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-soft);
    background-color: var(--page-bg);
    /* two static low-alpha washes: paint only, no image, no request */
    background-image:
        radial-gradient(1100px 620px at 10% -12%, rgba(var(--fx-cool-rgb), 0.055), transparent 62%),
        radial-gradient(820px 520px at 100% 2%, rgba(var(--fx-warm-rgb), 0.038), transparent 64%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

::selection { background: var(--iris-line); color: var(--ink); }

a { color: var(--iris); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sakura); }

:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; border-radius: 3px; }

/* --- sidebar (overview page) -------------------------------------------- */

.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: sticky;
    top: 0;
    flex: none;
    padding: 56px 38px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
}

.profile-img {
    width: 148px;
    height: 148px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 22px;
    border: 1px solid var(--iris-line);
    box-shadow: 0 6px 22px -14px rgba(var(--fx-cool-rgb), 0.55);
}

.sidebar h1 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.sidebar-info {
    margin-top: 14px;
    padding-bottom: 18px;
    font-size: 0.88rem;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.major-highlight {
    display: block;
    margin-top: 5px;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--sakura);   /* the one identity line gets the warm accent */
}

.sidebar-links { margin-top: 22px; display: flex; flex-direction: column; gap: 13px; }

.sidebar-link {
    width: fit-content;
    font-size: 0.88rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.16s ease, border-color 0.16s ease;
}
.sidebar-link:hover, .sidebar-link:focus-visible { color: var(--iris); border-bottom-color: var(--iris-line); }

.sidebar-focus {
    margin-top: 26px;
    padding: 2px 0 2px 12px;
    border-left: 2px solid var(--brass-line);
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

/* --- main column -------------------------------------------------------- */

.main { flex: 1; min-width: 0; padding: 56px 72px 90px; max-width: 980px; }

section { margin-bottom: 46px; }

h2 {
    position: relative;
    margin: 0 0 24px;
    padding-bottom: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
}
/* a colophon bar, not a gradient wash: hard stops, cool then warm then hairline */
h2::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--iris) 0, var(--iris) 2.25rem,
        var(--sakura) 2.25rem, var(--sakura) 3.25rem,
        var(--line) 3.25rem, var(--line) 100%);
}

.intro { font-size: 1.04rem; margin: 0 0 16px; }
.intro strong { color: var(--ink); }
.intro-aside { font-size: 0.92rem; color: var(--muted); margin: 0; }

/* --- "Now" list --------------------------------------------------------- */

.now-list { list-style: none; margin: 0; padding: 0; }
.now-list li { position: relative; padding-left: 18px; margin-bottom: 11px; font-size: 0.95rem; }
.now-list li::before {
    content: "";
    position: absolute;
    left: 0; top: 0.66em;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--sakura);
}
.now-when {
    display: inline-block;
    min-width: 108px;
    margin-right: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

/* --- overview cards ----------------------------------------------------- */

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

.card {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--bar);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: inherit;
    text-decoration: none;
    transition: border-left-color 0.18s ease, border-color 0.18s ease,
                background-color 0.18s ease, transform 0.18s ease;
}
.card:hover, .card:focus-visible {
    transform: translateY(-2px);
    border-left-color: var(--iris);
    border-color: var(--iris-line);
    background-color: var(--card-bg-alt);
}
.card-lead { grid-column: 1 / -1; border-left-color: var(--iris); }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.card-title { font-size: 1.08rem; font-weight: 700; color: var(--ink); }
.card-date { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.card-org { display: block; margin: 3px 0 0; font-size: 0.88rem; font-weight: 600; color: var(--iris); }
.card-line { margin: 10px 0 0; font-size: 0.92rem; }
.card-line strong { color: var(--ink); }
.card-more { display: inline-block; margin-top: 12px; font-size: 0.82rem; font-weight: 700; color: var(--iris); }
.card:hover .card-more, .card:focus-visible .card-more { color: var(--iris-deep); }

/* --- skills ------------------------------------------------------------- */

.skills-grid { display: grid; grid-template-columns: 136px 1fr; gap: 12px 16px; font-size: 0.9rem; }
.skills-label { font-weight: 700; color: var(--ink); }

/* --- detail pages ------------------------------------------------------- */

body.detail { display: block; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    padding: 14px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--page-bg);
}

.home-link { font-weight: 700; font-size: 0.92rem; color: var(--ink); text-decoration: none; }
.home-link:hover { color: var(--iris); }

.topnav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.84rem; }
.topnav a { color: var(--muted); text-decoration: none; padding-bottom: 2px; border-bottom: 1px solid transparent; }
.topnav a:hover { color: var(--iris); border-bottom-color: var(--iris-line); }
.topnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--sakura); font-weight: 600; }

.page { max-width: 760px; margin: 0 auto; padding: 48px 28px 80px; }

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sakura);
}

.page h1 { margin: 0 0 10px; font-size: 2.1rem; line-height: 1.18; letter-spacing: -0.02em; color: var(--ink); }

.role { margin: 0 0 22px; font-size: 0.95rem; font-weight: 600; color: var(--iris); }

.lede {
    margin: 0 0 28px;
    padding-left: 16px;
    border-left: 2px solid var(--sakura);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--ink);
}

.factbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    margin: 0 0 34px;
    padding: 0;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.factbar > div { background: var(--card-bg); padding: 13px 16px; }
.factbar dt {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.factbar dd { margin: 3px 0 0; font-size: 0.9rem; font-weight: 600; color: var(--ink); }

.page section { margin-bottom: 34px; }
.page h2 {
    margin-bottom: 14px;
    padding: 0 0 0 12px;
    border-left: 3px solid var(--iris);
    font-size: 1.12rem;
    letter-spacing: 0;
    text-transform: none;
}
.page h2::after { display: none; }
.page p { margin: 0 0 14px; }
.page ul { margin: 0; padding-left: 20px; }
.page li { margin-bottom: 10px; }
.page li strong, .page p strong { color: var(--ink); }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--code-bg);
    color: var(--ink);
}

.limits {
    padding: 18px 22px;
    border: 1px dashed var(--bar);
    border-radius: var(--radius);
}
.limits h2 { border-left-color: var(--muted); }

.stack-line {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
    font-style: italic;
    color: var(--muted);
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 44px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
    font-weight: 600;
}
.pager a { text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager-next { margin-left: auto; text-align: right; }

.sitefoot {
    padding: 22px 32px 40px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}

/* --- progressive enhancement (app.js) ----------------------------------- */

.reveal { opacity: 0; transform: translateY(10px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity 0.45s ease, transform 0.45s ease; }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 900px) {
    body { flex-direction: column; background-attachment: scroll; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 34px 24px 26px;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .profile-img { width: 104px; height: 104px; }
    .main { padding: 34px 24px 70px; max-width: 100%; }
    .card-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: 1fr; gap: 2px 0; }
    .skills-label { margin-top: 12px; }
    .page { padding: 32px 20px 64px; }
    .page h1 { font-size: 1.7rem; }
    .lede { font-size: 1.02rem; }
    .topbar { padding: 12px 20px; gap: 12px; }
    .now-when { display: block; min-width: 0; margin-bottom: 1px; }
}

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

/* --- in-page section nav (overview sidebar) ------------------------------ */

.sidebar-sections {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
}
.sidebar-sections a {
    width: fit-content;
    padding-left: 10px;
    border-left: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.16s ease, border-color 0.16s ease;
}
.sidebar-sections a:hover { color: var(--iris); }
.sidebar-sections a.is-current {
    color: var(--ink);
    font-weight: 600;
    border-left-color: var(--sakura);
}

@media (max-width: 900px) {
    .sidebar-sections { flex-direction: row; flex-wrap: wrap; gap: 10px 16px; }
    .sidebar-sections a { padding-left: 0; border-left: none; }
    .sidebar-sections a.is-current { border-bottom: 2px solid var(--sakura); }
}

/* --- prerequisite graph widget ------------------------------------------ */

.graph-intro { font-size: 0.95rem; margin: 0 0 16px; }
.graph-intro strong { color: var(--ink); }

.dag-wrap { margin: 0; }

.dag-scroll {
    overflow-x: auto;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card-bg);
}

#dag { display: block; width: 100%; min-width: 720px; height: auto; }

.dag-edge {
    fill: none;
    stroke: var(--bar);
    stroke-width: 1.1;
    opacity: 0.55;
    transition: stroke 0.15s ease, opacity 0.15s ease, stroke-width 0.15s ease;
}
.dag-edge.is-on { stroke: var(--iris); stroke-width: 1.9; opacity: 1; }

.dag-node { cursor: pointer; transition: opacity 0.15s ease; }
.dag-node rect {
    fill: var(--card-bg);
    stroke: var(--bar);
    stroke-width: 1;
    transition: fill 0.15s ease, stroke 0.15s ease;
}
.dag-node text {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    fill: var(--ink-soft);
    pointer-events: none;
}
.dag-node:focus-visible { outline: none; }
.dag-node:focus-visible rect { stroke: var(--iris); stroke-width: 2.2; }

#dag.is-active .dag-node { opacity: 0.3; }
#dag.is-active .dag-edge { opacity: 0.12; }
#dag.is-active .dag-edge.is-on { opacity: 1; }
#dag .dag-node.is-anc, #dag .dag-node.is-target { opacity: 1; }

.dag-node.is-anc rect { fill: var(--card-bg-alt); stroke: var(--iris); }
.dag-node.is-anc text { fill: var(--ink); }
.dag-node.is-target rect { fill: var(--iris); stroke: var(--iris); }
.dag-node.is-target text { fill: var(--page-bg); }

.dag-wrap figcaption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 0.84rem;
    color: var(--muted);
}
.dag-readout strong { color: var(--ink); font-weight: 600; }
.dag-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
.dag-link:hover { text-decoration: underline; }

@media (max-width: 900px) {
    .dag-scroll { padding: 8px; }
    .dag-wrap figcaption { font-size: 0.8rem; }
}

/* --- evaluation table (course planner page) ----------------------------- */

.table-wrap { overflow-x: auto; margin: 0 0 16px; }

.evaltable {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.evaltable caption {
    caption-side: bottom;
    margin-top: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--muted);
    text-align: left;
}
.evaltable th, .evaltable td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.evaltable thead th {
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom-color: var(--bar);
}
.evaltable tbody th { font-weight: 600; color: var(--ink-soft); }
.evaltable td { color: var(--ink-soft); }
.evaltable td strong { color: var(--ink); }
.evaltable tbody tr:last-child th, .evaltable tbody tr:last-child td { border-bottom: none; }

/* --- motion details ------------------------------------------------------ */

/* the colophon bar under each heading draws itself in as the section arrives */
.reveal h2::after { transform: scaleX(0); transform-origin: left center; }
.reveal.is-in h2::after { transform: scaleX(1); transition: transform 0.5s ease 0.06s; }

/* links read as links at rest, and commit on hover */
a { text-decoration-color: var(--iris-line); }
a:hover { text-decoration-color: currentColor; }

/* below 900px the sidebar scrolls away, so there is no other way back up */
.to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10;
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--iris);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.to-top.is-shown { opacity: 1; transform: none; }

@media (max-width: 900px) {
    .to-top { display: block; }
}


/* --- plan validator widget (course planner page) -------------------------
   Ported from the build the design pass produced. Its course data, unit rules
   and error strings were checked against the planner source: same 12 courses,
   same groups, same 12/19/22 unit rules, and the one-shot plan reproduces the
   real validator's five errors word for word. */

.pv {
    position: relative; overflow: hidden; margin: 22px 0 4px;
    padding: 16px 18px 14px; border: 1px solid var(--line);
    border-radius: 8px; background: var(--pv-surf); color: var(--ink);
}
.pv::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(180deg, var(--iris), var(--sakura));
}
.pv::after {
    content: ""; position: absolute; right: -30px; top: -56px; width: 190px; height: 170px;
    background: repeating-linear-gradient(118deg, var(--iris) 0 1px, transparent 1px 10px);
    opacity: 0.16; pointer-events: none;
}
.pv > * { position: relative; z-index: 1; }
.pv-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pv-eyebrow {
    margin: 0; font: 600 0.68rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--iris);
}
.pv-title { margin: 6px 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.pv-sub { margin: 0; max-width: 64ch; font-size: 0.84rem; line-height: 1.55; color: var(--ink-soft); }

.pv-ctl { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.pv-btn {
    font: 600 0.78rem/1 inherit; font-family: inherit; padding: 9px 13px; cursor: pointer;
    border: 1px solid var(--iris); border-radius: 6px;
    background: var(--iris); color: var(--on-accent);
    transition: transform 0.14s ease, background-color 0.14s ease;
}
.pv-btn-ghost { background: transparent; color: var(--iris); }
.pv-btn:hover { transform: translateY(-1px); }
.pv-btn-ghost:hover { background: var(--card-bg-alt); }

.pv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.pv-term { margin: 0; }
.pv-th {
    display: flex; align-items: baseline; gap: 5px; margin: 0 0 5px;
    font: 600 0.66rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.pv-q { color: var(--iris); font-weight: 700; }
.pv-u { margin-left: auto; text-transform: none; font-variant-numeric: tabular-nums; }
.pv-term.over .pv-u { color: var(--bad); font-weight: 700; }

.pv-slot {
    display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px;
    min-height: 108px; padding: 7px; border: 1px dashed var(--pv-line);
    border-radius: 7px; transition: border-color 0.16s ease, background-color 0.16s ease;
}
.pv-term.ok  .pv-slot { border-style: solid; border-color: var(--ok);  background: var(--ok-soft); }
.pv-term.bad .pv-slot { border-style: solid; border-color: var(--bad); background: var(--bad-soft); }

.pv-c {
    display: inline-flex; align-items: center; gap: 3px;
    font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 6px 7px; border: 1px solid var(--line); border-radius: 5px;
    background: var(--pv-chip); color: var(--ink); white-space: nowrap;
}
.pv-c i { font-style: normal; font-size: 0.62rem; color: var(--muted); }
button.pv-c { cursor: pointer; }
button.pv-c:hover { border-color: var(--iris); color: var(--iris); }
.pv-c.flag { border-color: var(--bad); color: var(--bad); }
.pv-c.flag i { color: var(--bad); }

.pv-out { margin-top: 12px; }
.pv-verdict {
    margin: 0; padding: 8px 10px; border-radius: 6px 6px 0 0;
    font: 700 0.78rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.03em;
    background: var(--pv-chip); color: var(--ink-soft);
    border: 1px solid var(--line); border-bottom: 0;
}
.pv-pass { background: var(--ok-soft);  color: var(--ok);  border-color: var(--ok); }
.pv-fail { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.pv-log {
    margin: 0; padding: 9px 12px; list-style: none; border-radius: 0 0 6px 6px;
    background: var(--pv-log); border: 1px solid var(--line); border-top: 0;
    font: 0.74rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--ink-soft);
}
.pv-log li { margin: 0 0 3px; overflow-wrap: break-word; }
.pv-log li:last-child { margin-bottom: 0; }
.pv-log b { color: var(--ink); font-weight: 700; }
.pv-log .e { color: var(--bad); font-weight: 700; }
.pv-log .g { color: var(--ok); font-weight: 700; }
.pv-log .w { color: var(--brass); font-weight: 700; }
.pv-log .i { color: var(--iris); font-weight: 700; }
.pv-foot { margin: 11px 0 0; font-size: 0.76rem; line-height: 1.55; color: var(--muted); }
.pv-foot b { color: var(--ink); }

@media (max-width: 860px) { .pv-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
    .pv { padding: 14px 14px 12px; }
    .pv-grid { grid-template-columns: 1fr; gap: 7px; }
    .pv-slot { min-height: 0; }
    .pv-title { font-size: 0.95rem; }
    .pv::after { display: none; }
    .pv-ctl { display: grid; grid-template-columns: 1fr 1fr; }
    .pv-ctl .pv-btn-ghost { grid-column: 1 / -1; }
    .pv-btn { padding: 9px 6px; }
}

@media (prefers-reduced-motion: no-preference) {
    .pv-c.in { animation: pv-in 0.17s cubic-bezier(.2,.8,.25,1) both; }
    @keyframes pv-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .entry, .sidebar-link, .sidebar-link::before, .pv-btn, .pv-slot, a { transition-duration: 1ms; }
    .pv-btn:hover { transform: none; }
}
@media (forced-colors: active) {
    body { background-image: none; }
    h2::after { background: CanvasText; }
    .entry { border-left-color: CanvasText; }
    .pv::after { display: none; }
    :focus-visible { outline-color: Highlight; }
}

/* completed-courses strip inside the validator widget */
.pv-done-label {
    margin: 14px 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.pv-done { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-c-done { opacity: 0.72; border-style: dashed; }

/* --- diagrams ------------------------------------------------------------ */

.diagram { margin: 0 0 10px; }

.diagram-scroll {
    overflow-x: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card-bg);
}
.diagram svg { display: block; width: 100%; min-width: 660px; height: auto; }

.diagram text {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    fill: var(--ink);
    text-anchor: middle;
}
.diagram .d-sub { font-size: 11.5px; font-weight: 400; fill: var(--muted); }
.diagram .d-center { text-anchor: middle; }

.d-stage rect { fill: var(--card-bg-alt); stroke: var(--iris); stroke-width: 1.3; }
.d-io rect { fill: none; stroke: var(--bar); stroke-width: 1.1; stroke-dasharray: 5 4; }
.d-agent rect { fill: var(--sakura-wash); stroke: var(--sakura); stroke-width: 1.2; stroke-dasharray: 6 4; }
.d-note rect { fill: none; stroke: var(--brass-line); stroke-width: 1.2; }
.d-arrow path { fill: none; stroke: var(--bar); stroke-width: 1.6; }
.d-arrow.d-dash path { stroke-dasharray: 4 4; stroke-width: 1.2; }
.d-head { fill: var(--bar); stroke: none; }

.diagram figcaption,
.dag-wrap figcaption { margin-top: 10px; font-size: 0.84rem; color: var(--muted); }
.diagram figcaption { max-width: 60ch; }

/* a short framing note, used where a page has to state a boundary up front */
.note {
    margin: 0 0 26px;
    padding: 12px 16px;
    border-left: 2px solid var(--brass-line);
    background: var(--brass-wash);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.h1-cn { font-size: 0.62em; font-weight: 600; color: var(--sakura); margin-left: 6px; white-space: nowrap; }

/* --- the ACG layer: one quiet mark per detail page ----------------------- */

body.detail { position: relative; }
body.detail::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(760px 420px at 100% 0%, var(--ink-wash-a), transparent 60%),
        radial-gradient(620px 380px at 0% 18%, var(--ink-wash-b), transparent 62%);
}
body.detail[data-ink="seal"] .page > article > .eyebrow::after,
body.detail[data-ink="water"] .page > article > .eyebrow::after { content: none; }

/* a vermilion seal mark beside the page title — the one decorative object */
.page h1 { position: relative; }
body.detail[data-ink] .page h1::after {
    content: "";
    position: absolute;
    top: -14px;
    right: -4px;
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--sakura);
    border-radius: 5px;
    opacity: 0.5;
    background:
        linear-gradient(var(--sakura), var(--sakura)) center/14px 1.5px no-repeat,
        linear-gradient(var(--sakura), var(--sakura)) center/1.5px 14px no-repeat;
    transform: rotate(6deg);
}
@media (max-width: 900px) { body.detail[data-ink] .page h1::after { display: none; } }

/* --- timeline ------------------------------------------------------------ */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 26px;
    position: relative;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: linear-gradient(var(--iris), var(--sakura) 55%, var(--line));
    opacity: 0.5;
}

.tl-item { position: relative; margin-bottom: 20px; }
.tl-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--bar);
}
.tl-now::before { border-color: var(--sakura); background: var(--sakura); }

.tl-when {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}
.tl-what { margin: 2px 0 0; font-size: 1rem; font-weight: 700; color: var(--ink); }
.tl-what a { text-decoration: none; }
.tl-what a:hover { text-decoration: underline; }
.tl-note { margin: 3px 0 0; font-size: 0.9rem; max-width: 68ch; }

@media (max-width: 900px) {
    .timeline { padding-left: 22px; }
    .tl-item::before { left: -20px; }
    .tl-what { font-size: 0.96rem; }
}

/* schematic plot inside a diagram */
.d-plot .d-axis { fill: none; stroke: var(--bar); stroke-width: 1.2; }
.d-plot .d-curve { fill: none; stroke: var(--iris); stroke-width: 2; }
.d-plot .d-guide { fill: none; stroke: var(--sakura); stroke-width: 1; stroke-dasharray: 4 4; }
.d-plot .d-rot { transform: rotate(-90deg); transform-origin: 674px 132px; }

.role-mine {
    margin-top: -14px;
    font-weight: 500;
    color: var(--ink-soft);
}

/* --- screenshot gallery -------------------------------------------------- */

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    margin-top: 6px;
}
.shot {
    display: block;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
    cursor: zoom-in;
    transition: transform 0.16s ease, border-color 0.16s ease;
}
.shot img { display: block; width: 100%; height: auto; }
.shot:hover, .shot:focus-visible { transform: translateY(-2px); border-color: var(--iris); }

.shot-view {
    position: fixed;
    inset: 0;
    z-index: 40;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: color-mix(in srgb, var(--page-bg) 94%, transparent);
    backdrop-filter: blur(6px);
}
.shot-big {
    max-width: min(1100px, 100%);
    max-height: 76vh;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.shot-view figcaption {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 860px;
    margin: 0 auto;
    font-size: 0.88rem;
    color: var(--ink-soft);
}
.shot-close {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 12px;
    background: var(--card-bg);
    color: var(--iris);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}
.shot-close:hover { border-color: var(--iris); }

/* --- interactive diagram bits -------------------------------------------- */

.d-stage[data-stage] { cursor: pointer; }
.d-stage[data-stage] rect { transition: fill 0.18s ease, stroke-width 0.18s ease; }
.d-stage[data-stage].is-on rect { fill: var(--sakura-wash); stroke: var(--sakura); stroke-width: 2; }
.d-token { fill: var(--sakura); stroke: var(--card-bg); stroke-width: 1.5; }

.stage-panel {
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--iris);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--card-bg);
    font-size: 0.9rem;
    min-height: 68px;
}
.stage-panel b { color: var(--ink); }

.diagram-ctl {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0 0;
}
.diagram-ctl button {
    border: 1px solid var(--iris);
    border-radius: 6px;
    padding: 6px 13px;
    background: transparent;
    color: var(--iris);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.diagram-ctl button[aria-pressed="true"], .diagram-ctl button:hover {
    background: var(--iris);
    color: var(--on-accent);
}

@media (prefers-reduced-motion: reduce) { .d-token { display: none; } }

.d-plot .d-curve.is-hot { stroke: var(--sakura); }

/* --- sidebar blocks: internships ----------------------------------------- */

.side-block {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.side-h {
    margin: 0 0 12px;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.side-h::after { display: none; }

.joblist { list-style: none; margin: 0; padding: 0; }

.job {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 15px;
}
.job-mark {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--card-bg);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--iris);
}
.job-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }

.job-body { display: flex; flex-direction: column; min-width: 0; }
.job-org {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.3;
}
.job-org:hover { color: var(--iris); }
.job-unit { font-size: 0.76rem; color: var(--iris); }
.job-role { font-size: 0.78rem; color: var(--ink-soft); }
.job-when { font-size: 0.73rem; color: var(--muted); margin-top: 1px; }

/* --- one card per row ---------------------------------------------------- */

.card-rows { grid-template-columns: 1fr; }
.card-rows .card-lead { grid-column: auto; }

/* --- About, opening the column ------------------------------------------- */

.about-top { margin-bottom: 42px; }
.about-top .intro { font-size: 1.06rem; }
.about-top .intro-aside { margin-top: 12px; font-size: 0.95rem; }

@media (max-width: 900px) {
    .side-block { margin-top: 20px; }
    .joblist { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 18px; }
}

/* the internships list, when it sits in the main column */
#internships .joblist { display: grid; gap: 14px; }
#internships .job { margin: 0; gap: 14px; }
#internships .job-mark { width: 40px; height: 40px; font-size: 0.86rem; }
#internships .job-org { font-size: 1rem; }
#internships .job-unit { font-size: 0.86rem; font-weight: 600; }
#internships .job-role { font-size: 0.9rem; }
#internships .job-when { font-size: 0.8rem; }

/* the lab I am in right now gets the one piece of emphasis on the page */
.card-current {
    border-left-width: 4px;
    border-left-color: var(--sakura);
    background: linear-gradient(100deg, var(--sakura-wash), transparent 42%), var(--card-bg);
}
.card-current .card-title { color: var(--sakura); font-size: 1.16rem; letter-spacing: -0.01em; }
.card-current .card-org { color: var(--ink); }
.card-current:hover, .card-current:focus-visible { border-left-color: var(--sakura); }

.chip-now {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--sakura);
    color: var(--on-accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 1px;
}

/* a company mark sits on its own neutral tile, unaltered and never recoloured */
.job-logo {
    width: 54px;
    height: 54px;
    padding: 7px;
    background: #ffffff;
    border-color: var(--line);
}
.job-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

#internships .job { align-items: center; }
#internships .job-mark { width: 60px; height: 60px; }

/* --- one list for everything, filterable --------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.filters button {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 14px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.filters button:hover { border-color: var(--iris); color: var(--iris); }
.filters button[aria-pressed="true"] {
    background: var(--iris);
    border-color: var(--iris);
    color: var(--on-accent);
}

.rows { display: grid; gap: 14px; }

.row {
    display: flex;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--bar);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.18s ease, border-left-color 0.18s ease,
                background-color 0.18s ease, transform 0.18s ease;
}
.row:hover, .row:focus-visible {
    transform: translateY(-2px);
    border-left-color: var(--iris);
    border-color: var(--iris-line);
    background: var(--card-bg-alt);
}
.row[hidden] { display: none; }

.row-current {
    border-left-width: 4px;
    border-left-color: var(--sakura);
    background: linear-gradient(100deg, var(--sakura-wash), transparent 42%), var(--card-bg);
}
.row-current:hover, .row-current:focus-visible { border-left-color: var(--sakura); }
.row-current .row-title { color: var(--sakura); }

.row-mark {
    flex: none;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card-bg);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--iris);
}
.row-mark.job-logo { background: #ffffff; padding: 7px; }

.row-body { display: flex; flex-direction: column; min-width: 0; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.row-title { font-size: 1.08rem; font-weight: 700; color: var(--ink); }
.row-when { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.row-org { margin-top: 2px; font-size: 0.88rem; font-weight: 600; color: var(--iris); }
.row-line { margin-top: 8px; font-size: 0.92rem; color: var(--ink-soft); }
.row-line strong { color: var(--ink); }

.row-chip {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 8px;
    border: 1px solid var(--iris-line);
    border-radius: 999px;
    background: var(--card-bg-alt);
    color: var(--iris);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.rows-foot { margin: 14px 0 0; font-size: 0.85rem; color: var(--muted); }

@media (max-width: 900px) {
    .row { padding: 15px 16px; gap: 12px; }
    .row-mark { width: 44px; height: 44px; font-size: 0.78rem; }
    .row-title { font-size: 1rem; }
}

.honors { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--muted); }

/* --- the SIDERIUS feature on the overview -------------------------------- */

.feature {
    position: relative;
    margin: 0 0 46px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--sakura);
    border-radius: var(--radius);
    background: linear-gradient(110deg, var(--sakura-wash), transparent 55%), var(--card-bg);
}
.feature-eyebrow {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sakura);
}
.feature h2 {
    margin: 0 0 4px;
    padding: 0;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    text-transform: none;
}
.feature h2::after { display: none; }
.feature-sub { margin: 0 0 14px; font-size: 0.95rem; font-weight: 600; color: var(--iris); }
.feature p { margin: 0 0 12px; font-size: 0.97rem; }
.feature-roles { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; padding: 0; list-style: none; }
.feature-roles li {
    padding: 4px 11px;
    border: 1px solid var(--iris-line);
    border-radius: 999px;
    background: var(--card-bg);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}
.feature-links { display: flex; flex-wrap: wrap; gap: 10px; }
.feature-links a {
    padding: 7px 14px;
    border: 1px solid var(--iris);
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.feature-links a.primary { background: var(--iris); color: var(--on-accent); }
.feature-links a:hover { background: var(--iris-deep); border-color: var(--iris-deep); color: var(--on-accent); }

/* where my part sits in the loop diagram */
.d-mine rect { stroke: var(--sakura) !important; stroke-width: 2.2 !important; }
.d-mine-tag { fill: var(--sakura) !important; font-weight: 700 !important; }
.page-links { margin: 0 0 30px; }

/* --- schematic waveform demo -------------------------------------------- */

.wave-ctl { margin: 0 0 10px; }
.wave-axes path { fill: none; stroke: var(--line); stroke-width: 1; }
.wave-label { font-size: 12px !important; font-weight: 600 !important; fill: var(--muted) !important; text-anchor: start !important; }
.wave-right { text-anchor: end !important; }
.wave-set { opacity: 0; transition: opacity 0.35s ease; }
.wave-set.is-on { opacity: 1; }
.wave-line { fill: none; stroke: var(--iris); stroke-width: 2.4; stroke-linejoin: round; }
.wave-der { fill: none; stroke: var(--sakura); stroke-width: 2.2; stroke-linejoin: round; }
