/* YAT — shared stylesheet.
   Design language per BRAND.md: modern print, not consumer electronics.
   Warm paper, black-and-white foundation, one accent (seal red — also one of
   the panel's six ink colours), editorial type, transit-signage numerals. */

:root {
  --paper:      #fbf9f5;
  --paper-2:    #f3f0e8;
  --paper-3:    #ebe7dc;
  --ink:        #17150f;
  --ink-2:      #4c473e;
  --ink-3:      #857e71;
  --rule:       #ddd6c8;
  --seal:       #b8402c;
  --seal-wash:  #f7eae6;

  --serif: Georgia, "Songti TC", "Noto Serif TC", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI",
          system-ui, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --gap: clamp(1.25rem, 4vw, 3rem);
}

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

/* Any `display:` we set below would otherwise out-specify the UA's
   [hidden] { display: none } and leave hidden elements on screen. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 66rem; margin: 0 auto; padding: 0 var(--gap); }
.narrow { max-width: 44rem; }

/* The gallery is a listing — it earns a wider measure for its grid, and
   keeps every left edge on the same axis by widening the whole page. */
.page-wide .wrap { max-width: 82rem; }

/* ---------- type ---------- */

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.2; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
a:hover { color: var(--seal); border-bottom-color: var(--seal); }

code, kbd, samp { font-family: var(--mono); font-size: 0.86em; }
kbd {
  border: 1px solid var(--rule); background: #fff; padding: 0.05em 0.4em;
  border-radius: 2px; font-size: 0.8em;
}

.lede { font-size: 1.12rem; color: var(--ink-2); }
.small { font-size: 0.82rem; }
.muted { color: var(--ink-3); }
.nums { font-variant-numeric: tabular-nums; }

/* Bilingual pairs: 繁體中文 leads, English sits under it, quieter.
   Both always visible — no toggle, the way HK signage does it. */
.bi { display: block; }
.bi > .zh { display: block; }
.bi > .en {
  display: block;
  font-family: var(--sans);
  font-size: 0.62em;
  line-height: 1.35;
  letter-spacing: 0.005em;
  color: var(--ink-3);
  margin-top: 0.35em;
}
p .en, li .en { color: var(--ink-3); }

/* Signage label: small, letterspaced, uppercase */
.label {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- masthead ---------- */

.masthead { border-top: 5px solid var(--ink); background: var(--paper); }

.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 1.15rem; padding-bottom: 1.15rem;
}

.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  border: 0; color: var(--ink);
}
.wordmark:hover { color: var(--ink); }
.wordmark .mark { width: 1.55rem; height: 1.55rem; color: var(--seal); flex: none; }
.wordmark-text {
  font-family: var(--serif); font-size: 1.6rem; letter-spacing: 0.06em; line-height: 1;
}
.wordmark-sub {
  font-family: var(--serif); font-size: 1.6rem; line-height: 1; color: var(--ink-3);
}

.nav { display: flex; gap: 1.4rem; align-items: baseline; }
.nav a {
  border: 0; font-size: 0.92rem; color: var(--ink-2);
  padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--seal); }

/* the strip under the nameplate — dateline / standing head */
.dateline {
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  background: var(--paper);
}
.dateline-inner {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  justify-content: space-between; align-items: center;
  padding-top: 0.45rem; padding-bottom: 0.45rem;
}
.dateline .label { color: var(--ink-2); }

/* ---------- sections ---------- */

main { padding-bottom: 4rem; }

section { padding-top: clamp(2.75rem, 6vw, 4.5rem); }

.sec-head {
  display: flex; align-items: baseline; gap: 0.9rem;
  border-bottom: 1px solid var(--ink); padding-bottom: 0.45rem; margin-bottom: 1.75rem;
}
.sec-num {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--seal); flex: none; padding-top: 0.35em;
}
.sec-head h2 { font-size: clamp(1.35rem, 3.2vw, 1.75rem); }
.sec-head h2 .en { font-size: 0.5em; }

/* ---------- hero ---------- */

.hero { padding-top: clamp(2.5rem, 6vw, 4rem); }
.hero-title {
  font-size: clamp(2.1rem, 6.2vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.005em;
  max-width: 18ch;
}
.hero-title .en {
  font-size: 0.36em; letter-spacing: 0.02em; margin-top: 0.7em; color: var(--ink-2);
}
.hero-body { max-width: 40rem; margin-top: 1.9rem; }
.hero-grid > .hero-body { margin-top: 0; }

.hero-grid {
  display: grid; gap: 2rem clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  align-items: start;
  margin-top: 1.9rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.9rem; }

/* the standing facts block beside the hero — printed-schedule shape */
.facts {
  display: grid; grid-template-columns: auto 1fr; gap: 0 1rem;
  margin: 0.4rem 0 0; padding-top: 0.7rem;
  border-top: 2px solid var(--ink); font-size: 0.82rem;
}
.facts dt {
  color: var(--ink-3); padding: 0.4rem 0; letter-spacing: 0.02em; white-space: nowrap;
}
.facts dd {
  margin: 0; padding: 0.4rem 0; color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.facts dt { border-bottom: 1px solid var(--rule); }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }

/* ---------- plate (a render, presented like a printed plate) ---------- */

section.tight { padding-top: clamp(1.75rem, 3.5vw, 2.5rem); }

.plate { max-width: 800px; }
.plate-frame {
  border: 1px solid var(--ink);
  background: #fff;
  padding: 9px;
  line-height: 0;
}
.plate-frame img, .plate-frame canvas {
  display: block; width: 100%; height: auto; max-width: 100%;
  background: #fff;
}
.plate-caption {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; justify-content: space-between;
  border-top: 1px solid var(--rule); margin-top: 0.55rem; padding-top: 0.45rem;
  font-size: 0.78rem; color: var(--ink-3); line-height: 1.45;
}

/* ---------- columns ---------- */

.cols {
  display: grid; gap: 2rem clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
@media (min-width: 56rem) {
  .cols-3 { grid-template-columns: repeat(3, 1fr); }
  .cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.col-head {
  font-family: var(--serif); font-size: 1.12rem; margin-bottom: 0.45rem;
  border-top: 2px solid var(--ink); padding-top: 0.6rem;
}
.col-head .en { font-size: 0.62em; }
.cols p { font-size: 0.95rem; color: var(--ink-2); }

/* ---------- the cycle strip (transit signage) ---------- */

.cycle {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--ink); background: #fff;
}
.cycle-step { padding: 1.15rem 1rem; border-right: 1px solid var(--rule); }
.cycle-step:last-child { border-right: 0; }
.cycle-step .n {
  font-family: var(--mono); font-size: 0.72rem; color: var(--seal); display: block;
  margin-bottom: 0.5rem; letter-spacing: 0.1em;
}
.cycle-step .t { font-family: var(--serif); font-size: 1.18rem; display: block; }
.cycle-step .e { font-size: 0.74rem; color: var(--ink-3); display: block; margin-top: 0.15rem; }
.cycle-step .d { font-size: 0.82rem; color: var(--ink-2); margin-top: 0.6rem; line-height: 1.5; }

/* ---------- status list ---------- */

.status { border-top: 1px solid var(--ink); }
.status-row {
  display: grid; grid-template-columns: 1.1rem 1fr auto; gap: 0 0.85rem;
  align-items: baseline; padding: 0.7rem 0; border-bottom: 1px solid var(--rule);
}
.status-row .mark-dot { color: var(--seal); font-size: 0.7rem; line-height: 1.9; }
.status-row[data-state="planned"] .mark-dot { color: var(--ink-3); }
.status-row .what { font-size: 0.95rem; }
.status-row .what .en { display: block; font-size: 0.78rem; color: var(--ink-3); }
.status-row .when {
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3);
  white-space: nowrap; letter-spacing: 0.04em;
}

/* ---------- boxes / notes ---------- */

.note {
  border-left: 3px solid var(--seal); background: var(--seal-wash);
  padding: 0.9rem 1.1rem; font-size: 0.9rem; line-height: 1.55;
}
.note.plain { border-left-color: var(--ink); background: var(--paper-2); }
.note .label { display: block; margin-bottom: 0.3rem; color: var(--ink-2); }

.panel { border: 1px solid var(--rule); background: #fff; padding: 1.15rem 1.25rem; }

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

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-size: 0.92rem; font-weight: 600; line-height: 1.2;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: 0;
  padding: 0.72rem 1.35rem; cursor: pointer; text-align: center;
}
.btn:hover:not(:disabled) { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn:disabled { opacity: 0.34; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.small { font-size: 0.8rem; padding: 0.45rem 0.85rem; }
a.btn { border-bottom: 1px solid var(--ink); }
a.btn:hover { border-bottom-color: var(--seal); }

/* ---------- forms ---------- */

label.field { display: block; margin-bottom: 0.9rem; }
label.field > span { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--ink-2); }
input[type="text"], input[type="password"], select {
  font-family: var(--sans); font-size: 0.95rem; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-radius: 0;
  padding: 0.55rem 0.7rem; width: 100%; max-width: 24rem;
}
input:focus, select:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--seal); outline-offset: 2px;
}

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

.foot { border-top: 5px solid var(--ink); margin-top: 4rem; padding: 2rem 0 3rem; }
.foot-inner { display: grid; gap: 1.75rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
@media (min-width: 56rem) { .foot-inner { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
.foot h3 { font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
           letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
           margin-bottom: 0.6rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.35rem; font-size: 0.9rem; }
.foot a { border-bottom-color: transparent; }
.foot a:hover { border-bottom-color: var(--seal); }
.colophon {
  border-top: 1px solid var(--rule); margin-top: 2rem; padding-top: 1rem;
  font-size: 0.78rem; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; justify-content: space-between;
}

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

@media (max-width: 56rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .facts { max-width: 30rem; }
}

@media (max-width: 46rem) {
  body { font-size: 16px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
  .nav { gap: 1.1rem; flex-wrap: wrap; }
  .cycle { grid-template-columns: 1fr 1fr; }
  .cycle-step:nth-child(2n) { border-right: 0; }
  .cycle-step:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
}

@media (max-width: 30rem) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { justify-content: center; }
  .cycle { grid-template-columns: 1fr; }
  .cycle-step { border-right: 0; border-bottom: 1px solid var(--rule); }
  .cycle-step:last-child { border-bottom: 0; }
}

@media print {
  .nav, .btn { display: none; }
  body { background: #fff; }
}
