/* ==================================================================
   Jiang, Yuhang — personal site
   Swiss grid × vertical editorial × technical drawing
   Palette: Gundam (white / navy / gold), light + dark
   ================================================================== */

:root{
  --paper:#fcfdfe;
  --ink:#0e1c33;
  --dim:#546482;
  --accent:#c8940c;             /* gold — large / decorative only */
  --accent-t:#966c07;           /* gold for small text — 4.68:1 on --paper */
  --accent2:#0f4c9c;            /* navy blue — structure */
  --line:rgba(14,28,51,.14);
  --mark:rgba(14,28,51,.26);
  --wash:rgba(15,76,156,.05);

  --spine:64px;
  --topbar:44px;
  --pad:clamp(18px,3vw,44px);
  --maxw:1480px;
}
[data-theme="dark"]{
  --paper:#050b18;
  --ink:#e9f0fb;
  --dim:#7b8dad;
  --accent:#f0b323;
  --accent-t:#f0b323;           /* 10.5:1 on the dark ground */
  --accent2:#5b9bf5;
  --line:rgba(233,240,251,.13);
  --mark:rgba(233,240,251,.24);
  --wash:rgba(91,155,245,.06);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  padding-top:var(--topbar);
  background:var(--paper);
  color:var(--ink);
  font-family:Archivo,"Helvetica Neue",Arial,sans-serif;
  font-size:16px;
  line-height:1.58;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  transition:background .3s,color .3s;
}
a{color:inherit; text-decoration:none}
::selection{background:var(--accent2); color:var(--paper)}
:focus-visible{outline:2px solid var(--accent2); outline-offset:3px}
[hidden]{display:none !important}
img{max-width:100%}

/* the annotation layer — monospace carries every label */
.mono{
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:12px; letter-spacing:.13em; text-transform:uppercase; font-weight:500;
}
.mono-s{
  font-family:"IBM Plex Mono",ui-monospace,Consolas,monospace;
  font-size:11px; letter-spacing:.18em; text-transform:uppercase; font-weight:500;
}

/* ==================================================================
   REGISTRATION MARKS — the grid read as points, not rules
   ================================================================== */
.marks{position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden;
  transition:opacity .3s}
.marks b{position:absolute; width:9px; height:9px; margin:-5px 0 0 -5px}
.marks b::before,.marks b::after{content:""; position:absolute; background:var(--mark)}
.marks b::before{left:4px; top:0; width:1px; height:9px}
.marks b::after{top:4px; left:0; height:1px; width:9px}
[data-marks="off"] .marks{opacity:0}

/* ==================================================================
   TOP BAR — persistent site navigation, one row
   ================================================================== */
.topbar{
  position:fixed; top:0; left:0; right:0; z-index:50; height:var(--topbar);
  background:var(--paper); border-bottom:1px solid var(--line);
  display:flex; align-items:stretch;
}
.topbar .brand{
  display:flex; align-items:center; gap:11px; padding:0 15px; flex:none;
  border-right:1px solid var(--line);
}
.topbar .brand .mk{
  width:25px; height:25px; flex:none; display:grid; place-items:center;
  background:var(--accent2); color:var(--paper);
  font-family:"IBM Plex Mono",monospace; font-size:10.5px; font-weight:600;
  letter-spacing:.02em; transition:background .15s;
}
.topbar .brand:hover .mk{background:var(--accent-t)}
.topbar .brand .who{color:var(--ink); font-weight:600; white-space:nowrap}
.topbar .sitenav{
  display:flex; align-items:stretch; flex:1; overflow-x:auto;
  scrollbar-width:none; -ms-overflow-style:none;
}
.topbar .sitenav::-webkit-scrollbar{display:none}
.topbar .sitenav a{
  /* grow to share the whole bar, never shrink below the label */
  flex:1 0 auto;
  display:flex; align-items:center; justify-content:center;
  padding:0 15px; color:var(--dim);
  white-space:nowrap; border-right:1px solid var(--line);
  transition:color .15s,background .15s;
}
.topbar .sitenav a:last-child{border-right:none}
.topbar .sitenav a:hover{color:var(--ink); background:var(--wash)}
.topbar .sitenav a.on{background:var(--accent2); color:var(--paper)}
.topbar .tools{flex:none; display:flex; align-items:center; padding:0 11px;
  border-left:1px solid var(--line)}

/* ==================================================================
   SPINE — fixed vertical rail (page contents / filters)
   ================================================================== */
.spine{
  position:fixed; left:0; top:var(--topbar); bottom:0; width:var(--spine); z-index:30;
  background:var(--paper); border-right:1px solid var(--line);
  display:flex; flex-direction:column; align-items:center; padding:14px 0 12px;
}
.vnav{flex:1; display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:24px; padding:20px 0;
  overflow-y:auto; overflow-x:hidden; min-height:0}
.vnav a,.vnav button{
  writing-mode:vertical-rl; text-orientation:mixed;
  font-family:"IBM Plex Mono",monospace; font-size:12px; letter-spacing:.18em;
  text-transform:uppercase; font-weight:500; color:var(--dim);
  background:none; border:none; padding:6px 0; cursor:pointer;
  display:flex; align-items:center; gap:9px; transition:color .15s;
}
.vnav i{width:6px; height:6px; border:1px solid var(--dim); flex:none;
  transform:rotate(45deg); transition:.15s}
.vnav a:hover,.vnav button:hover{color:var(--ink)}
.vnav .on{color:var(--accent-t)}
.vnav .on i{background:var(--accent-t); border-color:var(--accent-t)}

.spine .loc{writing-mode:vertical-rl; color:var(--dim); flex:none;
  font-family:"IBM Plex Mono",monospace; font-size:11px; letter-spacing:.2em;
  text-transform:uppercase}
.theme-toggle{
  width:30px; height:30px; border:1px solid var(--line); background:var(--paper);
  color:var(--dim); cursor:pointer; font-size:14px; line-height:1;
  display:grid; place-items:center; transition:color .15s,border-color .15s;
}
.theme-toggle:hover{color:var(--accent-t); border-color:var(--accent-t)}
:root .icon-moon{display:none}
[data-theme="dark"] .icon-sun{display:none}
[data-theme="dark"] .icon-moon{display:inline}

/* ==================================================================
   SHEET
   ================================================================== */
.sheet{margin-left:var(--spine); position:relative; z-index:1}
.inner{max-width:var(--maxw); margin:0 auto; padding:0 var(--pad)}
.g12{display:grid; grid-template-columns:repeat(12,1fr)}

.crop{position:absolute; width:14px; height:14px; z-index:2}
.crop::before,.crop::after{content:""; position:absolute; background:var(--accent)}
.crop::before{width:14px; height:1px; top:0}
.crop::after{height:14px; width:1px; left:0}
.crop.tr{right:0; transform:scaleX(-1)}

/* dimension callout:  |———— label ————| */
.dim-line{display:flex; align-items:center; gap:10px; color:var(--dim)}
.dim-line .cap{width:1px; height:10px; background:var(--accent); flex:none}
.dim-line .ln{flex:1; height:1px; background:var(--line)}
.dim-line .lbl{flex:none; white-space:nowrap}

/* ==================================================================
   MASTHEAD
   ================================================================== */
.top{padding:clamp(48px,7vw,96px) 0 0; position:relative}
.slug{grid-column:1 / -1; color:var(--accent-t); padding-bottom:24px;
  display:flex; align-items:center; gap:11px}
.slug::before{content:""; width:26px; height:2px; background:var(--accent); flex:none}
.wordmark{grid-column:1 / span 8; padding-right:24px}
.wordmark h1{margin:0; font-weight:700; text-transform:uppercase;
  font-size:clamp(46px,9.4vw,128px); line-height:.86; letter-spacing:-.045em}
.wordmark h1 em{font-style:normal; display:block; color:var(--accent2)}
.wordmark .dim-line{margin-top:24px; max-width:600px}

.vname{grid-column:10 / span 2; display:flex; padding-top:6px}
.vname span{
  writing-mode:vertical-rl; text-orientation:upright;
  font-family:"Noto Serif SC",serif; font-weight:700;
  font-size:clamp(30px,4.6vw,62px); line-height:1.06; letter-spacing:.1em;
  color:var(--accent);
  border-left:1px solid var(--line); padding-left:18px;
}

.reading{padding:clamp(34px,4.5vw,58px) 0 0}
.prose{grid-column:1 / span 6; padding-right:32px}
.prose p{margin:0 0 19px; font-size:clamp(17px,1.45vw,22px); line-height:1.5;
  font-weight:500; letter-spacing:-.011em}
.prose .a1{color:var(--accent-t)}
.prose .a2{color:var(--accent2)}

.notes{grid-column:8 / span 4; border-left:1px solid var(--line); padding-left:22px}
.notes dl{margin:0}
.notes .plate{margin:0 0 24px}
.notes .plate img{width:150px; max-width:100%; height:auto; display:block;
  border:1px solid var(--line)}
.notes .plate figcaption{margin-top:9px; color:var(--dim)}
.notes .n{margin-bottom:18px}
.notes dd .ln2{display:block; margin-top:6px; padding-left:12px;
  border-left:1px solid var(--line); font-size:13.5px; font-weight:400;
  line-height:1.5; color:var(--dim)}
.notes dd .ln2 b{color:var(--accent2); font-weight:600}
.notes .n dt{color:var(--dim); margin-bottom:5px}
.notes .n dd{margin:0; font-size:14.5px; line-height:1.55; font-weight:500}
.notes a{border-bottom:1px solid var(--accent); padding-bottom:1px}
.notes a:hover{color:var(--accent-t)}
.notes .ext::after{content:" \2197"; color:var(--accent); font-size:.85em}

/* ==================================================================
   SECTION BAND
   ================================================================== */
section{padding-top:clamp(56px,6.5vw,100px); scroll-margin-top:24px}
.band{grid-column:1 / -1; display:flex; align-items:center; gap:16px;
  padding-bottom:26px}
.band .no{font-size:clamp(32px,3.4vw,48px); font-weight:700; line-height:1;
  letter-spacing:-.04em; color:transparent; -webkit-text-stroke:1px var(--accent);
  flex:none}
.band h2{margin:0; font-size:clamp(18px,1.75vw,24px); font-weight:600;
  letter-spacing:-.02em; flex:none}
.band .ln{flex:1; height:1px; background:var(--line)}
.band .ct{flex:none; color:var(--dim)}

/* ==================================================================
   NEWS — ticked timeline
   ================================================================== */
.tl{grid-column:1 / -1; border-left:1px solid var(--line); margin-left:6px}
.tl .ev{display:grid; grid-template-columns:126px 1fr 140px; gap:22px;
  padding:16px 0 16px 24px; position:relative; transition:background .15s}
.tl .ev::before{content:""; position:absolute; left:-1px; top:25px;
  width:14px; height:1px; background:var(--accent)}
.tl .ev::after{content:""; position:absolute; left:-3px; top:22px;
  width:5px; height:5px; background:var(--paper); border:1px solid var(--accent);
  transform:rotate(45deg)}
.tl .ev:hover{background:var(--wash)}
.tl .ts{color:var(--accent2); padding-top:3px}
.tl .msg{font-size:16.5px; line-height:1.5; max-width:66ch}
.tl .msg a{border-bottom:1px solid var(--accent)}
.tl .msg a:hover{color:var(--accent-t)}
.tl .msg em{font-style:italic; color:var(--accent-t)}
.tl .tag{color:var(--dim); text-align:right; padding-top:3px}

/* ==================================================================
   RESEARCH — spec strip
   ================================================================== */
.spec{grid-column:1 / -1; display:grid; grid-template-columns:repeat(12,1fr);
  border-top:1px solid var(--line); border-bottom:1px solid var(--line)}
.spec .u{grid-column:span 4; padding:20px 22px 28px; border-right:1px solid var(--line);
  display:flex; flex-direction:column; gap:15px; min-height:132px;
  transition:background .15s}
.spec .u:nth-child(3n){border-right:none}
.spec .u:nth-child(-n+3){border-bottom:1px solid var(--line)}
.spec .u:hover{background:var(--wash)}
.spec .u .id{color:var(--accent-t); display:flex; align-items:center; gap:9px}
.spec .u .id::after{content:""; flex:1; height:1px; background:var(--line)}
.spec .u h3{margin:0; font-size:clamp(18px,1.8vw,26px); line-height:1.14;
  letter-spacing:-.026em; font-weight:600}

/* ==================================================================
   PUBLICATIONS
   ================================================================== */
.pubs{grid-column:1 / -1; list-style:none; margin:0; padding:0;
  border-bottom:1px solid var(--line)}
.pubs > li{display:grid; grid-template-columns:68px 1fr 220px; gap:24px;
  padding:26px 0; border-top:1px solid var(--line); transition:background .15s}
.pubs > li:hover{background:var(--wash)}
.pubs .no{font-size:32px; font-weight:700; line-height:.9; letter-spacing:-.04em;
  color:transparent; -webkit-text-stroke:1px var(--accent2)}
.pubs h3{margin:0 0 10px; font-size:clamp(18px,1.65vw,24px); line-height:1.24;
  letter-spacing:-.023em; font-weight:600; max-width:46ch}
.pubs .who{margin:0 0 12px; font-size:15px; color:var(--dim); line-height:1.5}
.pubs .who b{color:var(--ink); font-weight:600}
.pubs .lk{margin:0}
.pubs .lk a{margin-right:16px; color:var(--dim); border-bottom:1px solid var(--line);
  padding-bottom:2px; display:inline-block; margin-bottom:4px}
.pubs .lk a:hover{color:var(--accent-t); border-bottom-color:var(--accent-t)}
.pubs .at{color:var(--dim); line-height:1.95}
.pubs .at .v{color:var(--accent-t); display:block}

details.more{margin-top:16px}
details.more summary{cursor:pointer; list-style:none; color:var(--dim);
  font-family:"IBM Plex Mono",monospace; font-size:12px; letter-spacing:.13em;
  text-transform:uppercase; font-weight:500; display:inline-block}
details.more summary::-webkit-details-marker{display:none}
details.more summary::before{content:"\25B8 "; color:var(--accent-t)}
details.more[open] summary::before{content:"\25BE "}
details.more summary:hover{color:var(--ink)}
.abs{margin:14px 0 0; max-width:68ch}
.abs p{font-size:15px; line-height:1.68; color:var(--dim); margin:0}
.abs em,.pubs h3 em,.tl .msg em{font-style:italic}
.abs sub,.abs sup{font-size:.75em}
.abs .lbl{color:var(--accent-t); font-family:"IBM Plex Mono",monospace; font-size:12px;
  letter-spacing:.13em; text-transform:uppercase; display:block; margin-bottom:7px}
.abs figure{margin:20px 0 0}
.abs img{width:100%; display:block; border:1px solid var(--line)}
.abs figcaption{margin-top:9px; font-size:13px; line-height:1.55; color:var(--dim)}
.abs figcaption .fno{color:var(--accent-t); font-family:"IBM Plex Mono",monospace;
  font-size:11.5px; letter-spacing:.13em; text-transform:uppercase; margin-right:8px}
.gallery{display:grid; gap:20px}

/* ------------------------------------------------------------------
   FILTER ROW — the discoverable control. The spine mirrors it on
   desktop as a sticky shortcut, and steps aside below 820px.
   ------------------------------------------------------------------ */
.chips{
  grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:stretch;
  border:1px solid var(--line); background:var(--wash); margin-bottom:30px;
}
.chips-lbl{
  display:flex; align-items:center; padding:0 15px; flex:none;
  background:var(--accent2); color:var(--paper);
}
.chips button{
  flex:1 0 auto;
  font-family:"IBM Plex Mono",ui-monospace,Consolas,monospace;
  font-size:12px; letter-spacing:.13em; text-transform:uppercase; font-weight:500;
  display:flex; align-items:center; justify-content:center; gap:9px;
  padding:12px 16px; cursor:pointer;
  background:transparent; color:var(--ink);
  border:none; border-left:1px solid var(--line);
  transition:background .15s,color .15s;
}
.chips button:first-of-type{border-left:none}
.chips button:hover{background:var(--paper)}
.chips button.active{background:var(--accent2); color:var(--paper)}
.chips button .ct{font-size:10.5px; color:var(--dim); letter-spacing:.06em}
.chips button.active .ct{color:var(--paper); opacity:.72}

.spinecap{writing-mode:vertical-rl; color:var(--dim); flex:none;
  font-family:"IBM Plex Mono",monospace; font-size:11px; letter-spacing:.2em;
  text-transform:uppercase; display:flex; align-items:center; gap:9px}
.spinecap::after{content:""; width:1px; height:18px; background:var(--accent)}

/* ==================================================================
   RECORD LISTS — work, projects, competitions, other experiences
   ================================================================== */
.where{margin:0 0 12px; font-size:14.5px; color:var(--dim)}
.where b{color:var(--accent2); font-weight:600}
.rlist{list-style:none; margin:13px 0 0; padding:0}
.rlist > li{position:relative; padding-left:19px; margin-bottom:9px;
  font-size:15px; line-height:1.62; color:var(--dim)}
.rlist > li:last-child{margin-bottom:0}
.rlist > li::before{content:""; position:absolute; left:0; top:11px;
  width:7px; height:1px; background:var(--accent)}
.rlist b{color:var(--ink); font-weight:600}
.rlist a{color:var(--accent2); border-bottom:1px solid var(--line); padding-bottom:1px}
.rlist a:hover{color:var(--accent-t); border-bottom-color:var(--accent-t)}

/* a lead-in line under a section band */
.lead{grid-column:1 / -1; max-width:62ch; margin:0 0 26px; font-size:16.5px;
  line-height:1.6; color:var(--dim)}

/* chips of plain items — personal life */
.taglist{list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:9px}
.taglist li{font-size:15.5px; line-height:1.3; border:1px solid var(--line);
  padding:9px 14px; transition:border-color .15s,color .15s}
.taglist li:hover{border-color:var(--accent-t); color:var(--accent-t)}
.taglist li em{font-style:italic}

/* two/three-up cell blocks reusing the spec strip */
.spec .u.tall{min-height:0; padding-bottom:24px}
.spec .u .sub{color:var(--dim); font-size:14.5px; line-height:1.55}

.note{grid-column:1 / -1; color:var(--dim); font-size:14.5px; padding-top:20px}
.note b{color:var(--ink); font-weight:600}

/* ==================================================================
   FOOTER
   ================================================================== */
footer{margin-top:clamp(56px,6vw,96px); border-top:1px solid var(--line);
  padding:22px 0 54px}
footer .a{grid-column:1 / span 5; color:var(--dim); line-height:2}
footer .b{grid-column:7 / span 3; color:var(--dim); line-height:2}
footer .c{grid-column:11 / span 2; text-align:right; color:var(--dim); line-height:2}
footer .c b{color:var(--accent); font-weight:500}

/* ==================================================================
   RESPONSIVE
   ================================================================== */
@media(max-width:1100px){
  .wordmark{grid-column:1 / span 9}
  .vname{grid-column:11 / span 2}
  .prose{grid-column:1 / span 7}
  .notes{grid-column:9 / span 4}
  .spec .u{grid-column:span 6}
  .spec .u:nth-child(3n){border-right:1px solid var(--line)}
  .spec .u:nth-child(2n){border-right:none}
  .spec .u:nth-child(-n+4){border-bottom:1px solid var(--line)}
  .pubs > li{grid-template-columns:60px 1fr 190px; gap:20px}
}
@media(max-width:980px){ .topbar .brand .who{display:none} }

/* the two-column intro gets cramped well before the spine has to go */
@media(max-width:940px){
  .wordmark,.vname,.prose,.notes{grid-column:1 / -1}
  .wordmark{padding-right:0}
  .prose{padding-right:0}
  .vname{margin-top:28px}
  .vname span{writing-mode:horizontal-tb; text-orientation:mixed; border-left:none;
    border-top:1px solid var(--line); padding:15px 0 0; letter-spacing:.16em}
  .notes{border-left:none; border-top:1px solid var(--line); padding:24px 0 0;
    margin-top:28px}
  .notes .plate{float:left; margin:0 22px 14px 0}
  .pubs > li{grid-template-columns:56px 1fr; gap:18px}
  .pubs .at{grid-column:2; text-align:left; padding-top:2px}
  .tl .ev{grid-template-columns:118px 1fr; gap:16px}
  .tl .tag{grid-column:2; text-align:left; padding-top:0}
}
@media(max-width:820px){
  :root{--spine:0px}
  .marks{display:none}
  .spine{position:sticky; left:auto; top:var(--topbar); bottom:auto; width:auto; height:auto;
    flex-direction:row; align-items:center; gap:14px; padding:9px 12px;
    border-right:none; border-bottom:1px solid var(--line); overflow-x:auto}
  .vnav{flex-direction:row; gap:16px; justify-content:flex-start; padding:0; flex:1}
  .vnav a,.vnav button{writing-mode:horizontal-tb; padding:0; white-space:nowrap}
  .spine .loc{display:none}
  .spine-filter{display:none}   /* the chips row is the filter on mobile */
  .chips{display:grid; grid-template-columns:repeat(2,1fr)}
  .chips-lbl{grid-column:1 / -1; padding:10px 15px}
  .chips button{border-left:1px solid var(--line);
    border-top:1px solid var(--line); justify-content:flex-start}
  .chips button:nth-of-type(odd){border-left:none}
  .topbar .tools{position:relative}
  .topbar .tools::before{content:""; position:absolute; right:100%; top:0; bottom:0;
    width:30px; pointer-events:none;
    background:linear-gradient(to right,transparent,var(--paper))}
  .sheet{margin-left:0}
  /* drop the rules and let the label wrap — nowrap was forcing overflow */
  .dim-line{display:block; padding-left:12px; border-left:2px solid var(--accent)}
  .dim-line .cap,.dim-line .ln{display:none}
  .dim-line .lbl{white-space:normal; display:block; line-height:1.75}
  .notes .plate{float:none; margin:0 0 22px}
  .tl .ev{grid-template-columns:1fr; gap:6px}
  .tl .tag{text-align:left}
  .spec .u{grid-column:1 / -1; border-right:none !important;
    border-bottom:1px solid var(--line) !important; min-height:0}
  .pubs > li{grid-template-columns:1fr; gap:12px}
  .pubs .at{text-align:left}
  footer .a,footer .b,footer .c{grid-column:1 / -1; text-align:left; padding-bottom:14px}
}
@media(prefers-reduced-motion:reduce){*{transition:none !important}}
