/* ==========================================================================
   惊棠工作室 · JASPERTINT STUDIO — shared design system
   Industrial / terminal UI: hard edges, cut corners, mono labels, hazard stripes.
   ========================================================================== */

@font-face {
    font-family: "Barlow Condensed";
    font-weight: 500;
    font-display: swap;
    src: url("fonts/barlow-condensed-500.woff2") format("woff2");
}
@font-face {
    font-family: "Barlow Condensed";
    font-weight: 700;
    font-display: swap;
    src: url("fonts/barlow-condensed-700.woff2") format("woff2");
}
@font-face {
    font-family: "Barlow Condensed";
    font-weight: 800;
    font-display: swap;
    src: url("fonts/barlow-condensed-800.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-weight: 100 800;
    font-display: swap;
    src: url("fonts/jetbrains-mono.woff2") format("woff2");
}
/* Heavy CJK display face, subset to the characters used on this site.
   Regenerate with tools/subset-cjk-font.sh after changing headings. */
@font-face {
    font-family: "JT Hei";
    font-weight: 900;
    font-display: swap;
    src: url("fonts/noto-sans-sc-900-subset.woff2") format("woff2");
}

:root {
    --ink-0: #0a0b0d;
    --ink-1: #111316;
    --ink-2: #181b1f;
    --ink-3: #22262b;
    --ink-4: #30353c;
    --fg: #ecebe6;
    --fg-2: rgba(236, 235, 230, 0.68);
    --fg-3: rgba(236, 235, 230, 0.58);
    --fg-4: rgba(236, 235, 230, 0.16);
    --line: rgba(236, 235, 230, 0.1);
    --line-2: rgba(236, 235, 230, 0.2);
    --slab: #d9d9d3;
    --slab-2: #c9c9c2;
    --slab-ink: #121316;

    --signal: #ffd100;
    --cyan: #23b9e8;
    --alert: #e62815;
    --ok: #3fd18f;

    --accent: var(--signal);
    --accent-ink: #111;

    --bg: var(--ink-1);
    --panel: var(--ink-2);

    --f-display: "Barlow Condensed", "JT Hei", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    --f-heavy: "JT Hei", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", monospace;
    --f-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

    --gutter: clamp(16px, 4vw, 56px);
    --max: 1280px;
    --topbar-h: 56px;
    --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

/* Light "paper" variant, used by ink-painting pages */
.theme-paper {
    --ink-0: #d8d3c8;
    --ink-1: #e7e3da;
    --ink-2: #efece5;
    --ink-3: #d3cec3;
    --ink-4: #bdb7aa;
    --fg: #16171a;
    --fg-2: rgba(22, 23, 26, 0.72);
    --fg-3: rgba(22, 23, 26, 0.64);
    --fg-4: rgba(22, 23, 26, 0.16);
    --line: rgba(22, 23, 26, 0.12);
    --line-2: rgba(22, 23, 26, 0.24);
    --slab: #16171a;
    --slab-2: #24262a;
    --slab-ink: #ecebe6;
    --bg: var(--ink-1);
    --panel: var(--ink-2);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--f-body);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

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

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- ambient background ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 80px 80px,
        linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 80px 80px;
    opacity: 0.35;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 75%);
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.theme-paper .grain { opacity: 0.09; mix-blend-mode: multiply; filter: invert(1); }

/* ---------- utility atoms ---------- */

.mono {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hazard {
    background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, transparent 8px 16px);
}

.hazard-dark {
    background: repeating-linear-gradient(-45deg, var(--accent-ink) 0 8px, var(--accent) 8px 16px);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 8px;
    border: 1px solid var(--line-2);
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--fg-2);
    white-space: nowrap;
}
.tag--solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag--ok::before, .tag--wip::before {
    content: "";
    width: 6px; height: 6px;
    background: var(--ok);
    box-shadow: 0 0 8px var(--ok);
}
.tag--wip::before { background: var(--signal); box-shadow: 0 0 8px var(--signal); }

/* corner brackets for framed elements */
.brackets { position: relative; }
.brackets::before, .brackets::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid var(--accent);
    pointer-events: none;
    z-index: 2;
}
.brackets::before { top: -7px; left: -7px; border-right: 0; border-bottom: 0; }
.brackets::after { bottom: -7px; right: -7px; border-left: 0; border-top: 0; }

/* ---------- buttons ---------- */

.btn {
    --btn-bg: var(--accent);
    --btn-fg: var(--accent-ink);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-height: 50px;
    padding: 0 22px 0 20px;
    border: 0;
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: var(--f-display);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
    overflow: hidden;
    isolation: isolate;
    transition: color 0.3s var(--ease);
}
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--fg);
    transform: translateX(-101%);
    transition: transform 0.35s var(--ease);
}
.btn:hover::before { transform: translateX(0); }
.btn:hover { color: var(--ink-1); }
.btn[disabled] { cursor: progress; opacity: 0.8; }
.btn__en {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    opacity: 0.6;
}
.btn__arrow {
    width: 18px; height: 18px;
    flex: none;
    transition: transform 0.3s var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--fg);
    box-shadow: inset 0 0 0 1px var(--line-2);
}

/* ---------- top bar ---------- */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 var(--gutter);
    background: var(--ink-1);
    background: color-mix(in srgb, var(--ink-1) 90%, transparent);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid var(--line);
}
.topbar::after {
    content: "";
    position: absolute;
    left: 0; bottom: -1px;
    width: 120px; height: 2px;
    background: var(--accent);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: none;
}
.brand__mark {
    width: 30px; height: 30px;
    --mark-j: var(--fg);
    --mark-t: var(--accent);
}
.brand__text { display: grid; line-height: 1.1; }
.brand__cn {
    font-family: var(--f-heavy);
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 0.3em;
}
.brand__en {
    font-family: var(--f-mono);
    font-size: 0.62rem;
    letter-spacing: 0.24em;
    color: var(--fg-3);
}

.nav {
    display: flex;
    align-items: stretch;
    height: 100%;
    margin-left: auto;
}
.nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    text-decoration: none;
    font-size: 0.86rem;
    letter-spacing: 0.16em;
    color: var(--fg-2);
    transition: color 0.2s ease;
}
.nav a small {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--accent);
}
.nav a::after {
    content: "";
    position: absolute;
    left: 18px; right: 18px; bottom: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
}
.nav a:hover { color: var(--fg); }
.nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); }

.sysclock {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid var(--line);
    height: 24px;
    font-family: var(--f-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    color: var(--fg-3);
    white-space: nowrap;
}
.sysclock__dot {
    width: 6px; height: 6px;
    background: var(--ok);
    box-shadow: 0 0 8px var(--ok);
    animation: blink 2.4s steps(1) infinite;
}
.sysclock time { color: var(--fg); font-variant-numeric: tabular-nums; }

@keyframes blink { 50% { opacity: 0.25; } }

.backlink {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    color: var(--fg-2);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.backlink:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.backlink svg { width: 14px; height: 14px; }

.crumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: var(--fg-3);
    white-space: nowrap;
    overflow: hidden;
}
.crumbs b { color: var(--fg); font-weight: 600; }

@media (max-width: 860px) {
    .sysclock { display: none; }
    .nav a { padding: 0 10px; font-size: 0.8rem; letter-spacing: 0.08em; }
    .nav a::after { left: 10px; right: 10px; }
    .nav a small { display: none; }
    .crumbs { display: none; }
}
@media (max-width: 520px) {
    .brand__en { display: none; }
    .brand__cn { font-size: 0.86rem; letter-spacing: 0.2em; }
    .nav a { padding: 0 8px; }
    .nav a::after { left: 8px; right: 8px; }
}

/* ---------- layout ---------- */

.shell {
    width: 100%;
    max-width: calc(var(--max) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.section { position: relative; padding: clamp(72px, 11vw, 140px) 0; }

.sec-head {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: 0 clamp(16px, 3vw, 32px);
    margin-bottom: clamp(36px, 6vw, 64px);
}
.sec-head__num {
    grid-row: span 2;
    font-family: var(--f-display);
    font-weight: 800;
    font-size: clamp(4.5rem, 12vw, 9rem);
    line-height: 0.78;
    color: transparent;
    -webkit-text-stroke: 1px var(--line-2);
    letter-spacing: -0.02em;
}
.sec-head__label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
    margin-bottom: 6px;
}
.sec-head__label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line-2), transparent);
}
.sec-head__title {
    font-family: var(--f-heavy);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: 0.06em;
}

.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
}
@media (max-width: 520px) {
    .sec-head__num { font-size: 3.6rem; }
    .sec-head__title { font-size: 1.7rem; }
}

/* data sheet (key/value table) */
.sheet { display: grid; border-top: 1px solid var(--line-2); }
.sheet__row {
    display: grid;
    grid-template-columns: minmax(96px, 30%) 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.sheet dt {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--fg-3);
    padding-top: 4px;
}
.sheet dd { font-size: 0.94rem; color: var(--fg); }

/* ---------- ticker ---------- */

.ticker {
    position: relative;
    overflow: hidden;
    background: var(--accent);
    color: var(--accent-ink);
    height: 40px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.ticker__track {
    display: flex;
    flex: none;
    animation: ticker 38s linear infinite;
}
.ticker__track span {
    display: inline-flex;
    align-items: center;
    gap: 26px;
    padding-right: 26px;
    font-family: var(--f-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}
.ticker__track span::after { content: "◆"; font-size: 0.5rem; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- footer ---------- */

.footer {
    position: relative;
    border-top: 1px solid var(--line);
    padding: 40px 0 calc(40px + env(safe-area-inset-bottom));
}
.footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px 32px;
}
.footer__brand { display: flex; align-items: center; gap: 14px; }
.footer__brand .brand__mark { width: 36px; height: 36px; }
.footer__copy {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--fg-3);
    line-height: 1.8;
}
.footer__top {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: var(--fg-2);
    text-decoration: none;
}
.footer__top:hover { color: var(--accent); }
.footer__top span {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    border: 1px solid var(--line-2);
}

/* ---------- reveal on scroll (only when JS is running) ---------- */

.js .rv {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: var(--d, 0s);
}
.js .rv.in { opacity: 1; transform: none; }

.js .rv-wipe { position: relative; }
.js .rv-wipe::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    background: var(--accent);
    transform-origin: right;
    transition: transform 0.7s var(--ease);
    transition-delay: calc(var(--d, 0s) + 0.15s);
    pointer-events: none;
}
.js .rv-wipe.in::after { transform: scaleX(0); }

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