/* ============================================================
   T1 Process Training — design tokens
   ============================================================ */
:root {
  color-scheme: dark;
  --bg:            #060b14;
  --bg-grad-a:     #081226;
  --bg-grad-b:     #050910;
  --surface-1:     #0f1b2d;
  --surface-2:     #13233a;
  --surface-3:     #182b45;
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text-primary:  #f4f7fb;
  --text-secondary:#aab6c9;
  --text-muted:    #7c8aa0;

  --series-1: #3987e5; /* blue   — stringer */
  --series-2: #d95926; /* orange — backend  */
  --series-3: #199e70; /* aqua   — layup    */

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 30px -18px rgba(0,0,0,0.7);
  --shadow-pop: 0 24px 60px -20px rgba(0,0,0,0.75);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 82% -10%, rgba(57,135,229,0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(25,158,112,0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b) 55%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: proportional-nums;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }
::selection { background: rgba(57,135,229,0.35); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--series-1); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(6,11,20,0.78);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 10px; }
.brand:hover { background: rgba(255,255,255,0.04); }
.brand-mark svg { width: 28px; height: 28px; display: block; }
.brand-mark .mark-a { fill: var(--series-1); }
.brand-mark .mark-b { fill: var(--series-3); }
.brand-name { font-size: 15.5px; color: var(--text-secondary); white-space: nowrap; }
.brand-name b { color: var(--text-primary); font-weight: 700; }

.header-search {
  flex: 1; max-width: 480px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 14px; transition: border-color .15s, background .15s;
}
.header-search:focus-within { border-color: var(--series-1); background: var(--surface-2); }
.header-search .search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.header-search input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 14px; min-width: 0; }
.header-search input::placeholder { color: var(--text-muted); }
.header-search kbd { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }

.header-nav { display: flex; gap: 4px; flex-shrink: 0; }
.header-nav.mobile { display: none; padding: 8px 16px 12px; border-top: 1px solid var(--border); }
.nav-btn {
  display: flex; align-items: center; gap: 7px;
  background: none; border: 1px solid transparent; color: var(--text-secondary);
  font-size: 13.5px; font-weight: 600; padding: 9px 13px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.nav-btn svg { width: 16px; height: 16px; }
.nav-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.nav-btn.is-active { color: #fff; background: var(--surface-3); border-color: var(--border-strong); }
.menu-toggle { display: none; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-primary); width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center; cursor: pointer; }
.menu-toggle svg { width: 18px; height: 18px; }

@media (max-width: 900px) {
  .header-nav:not(.mobile) { display: none; }
  .menu-toggle { display: flex; }
  .header-nav.mobile.is-open { display: flex; flex-direction: column; }
  .header-nav.mobile .nav-btn { justify-content: flex-start; width: 100%; }
}
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .header-search { order: 3; max-width: none; width: 100%; }
  .brand-name small { display: none; }
}

/* ============================================================
   Layout / main
   ============================================================ */
main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px; }
.view-head { max-width: 720px; margin-bottom: 28px; }
.view-head h2 { font-size: clamp(24px, 3vw, 32px); margin: 8px 0 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11.5px; font-weight: 700; color: var(--series-1); margin: 0; }
.lede { color: var(--text-secondary); font-size: 15.5px; line-height: 1.6; }
.muted-note { color: var(--text-muted); font-size: 12.5px; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.25fr 1fr 0.9fr; gap: 24px;
  padding: 40px 8px 36px; align-items: center;
}
.hero h1 { font-size: clamp(32px, 4.4vw, 50px); line-height: 1.08; margin: 10px 0 14px; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat-col { display: flex; flex-direction: column; gap: 14px; }
.stat-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 22px; box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 700; }
.stat-value { font-size: 26px; font-weight: 800; margin: 6px 0 2px; font-family: var(--font-mono); letter-spacing: -0.01em; }
.stat-sub { font-size: 12.5px; color: var(--text-muted); }
.progress-track { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); margin-top: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--series-3), var(--series-1)); width: 0%; transition: width .4s ease; border-radius: 4px; }

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .hero-copy { grid-column: 1 / -1; order: 1; }
  .hero-3d-stage { order: 2; }
  .hero-stat-col { order: 3; flex-direction: row; }
  .stat-card { flex: 1; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 20px; }
  .hero-stat-col { flex-direction: row; }
}
@media (max-width: 560px) {
  .hero-stat-col { flex-direction: column; }
}

/* ---------- Hero 3D module visual ---------- */
.hero-3d-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0; }
.module-3d-scene { position: relative; width: 210px; height: 210px; perspective: 1200px; }
.module-3d-orbit {
  position: absolute; inset: -26px; border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.10);
  background: radial-gradient(closest-side, rgba(57,135,229,0.10), transparent 70%);
  animation: orbit-spin 16s linear infinite;
}
.module-3d-spin { position: absolute; inset: 0; transform-style: preserve-3d; animation: module-spin-z 40s linear infinite; }
.module-3d-tilt {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(var(--tiltx, 0deg)) rotateY(var(--tilty, 0deg));
  transition: transform .25s ease-out;
}
.module-layer {
  position: absolute; left: 50%; top: 50%; width: 148px; height: 148px; margin: -74px 0 0 -74px;
  border-radius: 10px; transform-style: preserve-3d;
}
.layer-frame {
  transform: translateZ(0px);
  background: linear-gradient(135deg, #aab4c4, #6b7484);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 28px 46px -14px rgba(0,0,0,0.7);
}
.layer-backsheet { transform: translateZ(18px); background: linear-gradient(135deg, #1c2130, #0b0d13); border-radius: 8px; }
.layer-eva-b { transform: translateZ(34px); background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; }
.layer-cells {
  transform: translateZ(50px); border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 16px, transparent 16px 18px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 16px, transparent 16px 18px),
    linear-gradient(135deg, #1e4f8f, #0a2547);
  box-shadow: 0 0 30px -6px rgba(57,135,229,0.65);
}
.layer-eva-t { transform: translateZ(66px); background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; }
.layer-glass {
  transform: translateZ(82px); border-radius: 10px;
  background: linear-gradient(135deg, rgba(140,195,255,0.28), rgba(140,195,255,0.06));
  border: 1px solid rgba(160,205,255,0.4);
  box-shadow: 0 0 34px -6px rgba(57,135,229,0.55);
}
@keyframes module-spin-z { from { transform: rotateX(58deg) rotateZ(0deg); } to { transform: rotateX(58deg) rotateZ(360deg); } }
@keyframes orbit-spin { to { transform: rotate(360deg); } }

.module-3d-caption { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: .02em; }
.module-3d-legend { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 0; padding: 0; font-size: 11.5px; color: var(--text-secondary); }
.module-3d-legend li { list-style: none; display: flex; align-items: center; gap: 8px; }
.module-3d-legend .sw { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset; }

@media (prefers-reduced-motion: reduce) {
  .module-3d-spin, .module-3d-orbit { animation: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-weight: 650; font-size: 14px; padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--series-1), #2a6fc4); color: #fff; box-shadow: 0 10px 26px -12px rgba(57,135,229,0.65); }
.btn-primary:hover { box-shadow: 0 14px 30px -12px rgba(57,135,229,0.8); }
.btn-ghost { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn.is-active { background: var(--series-1); border-color: var(--series-1); color: #fff; }

/* ---------- Pointer-tilt card system (3D depth on hover) ---------- */
.process-card, .lesson-card, .gallery-card, .station-node, .stat-card {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)) translateZ(var(--tz, 0px));
  transition: transform .15s ease-out, border-color .15s, background .15s, box-shadow .2s;
  will-change: transform;
}
.process-card:hover, .lesson-card:hover, .gallery-card:hover, .stat-card:hover { --ty: -4px; --tz: 6px; box-shadow: var(--shadow-pop); }
.process-card::after, .lesson-card::after, .gallery-card::after, .stat-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.09), transparent 45%);
  opacity: 0; transition: opacity .2s;
}
.process-card:hover::after, .lesson-card:hover::after, .gallery-card:hover::after, .stat-card:hover::after { opacity: 1; }

/* ---------- Area chips ---------- */
.area-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 8px 26px; }
.chip {
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip.is-active { background: var(--series-1); border-color: var(--series-1); color: #fff; }

/* ---------- Flow diagram (home strip) ---------- */
.flow-wrap { margin: 0 8px 30px; overflow-x: auto; padding-bottom: 4px; perspective: 1400px; }
.flow-diagram { display: flex; align-items: center; gap: 0; min-width: 620px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 22px; box-shadow: var(--shadow-card); transform: rotateX(2.5deg); transition: transform .4s ease, box-shadow .4s ease; }
.flow-wrap:hover .flow-diagram { transform: rotateX(0deg); box-shadow: var(--shadow-pop); }
.flow-node { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; background: none; transition: background .15s, border-color .15s; flex-shrink: 0; }
.flow-node:hover { background: var(--surface-2); border-color: var(--border); }
.flow-node .node-badge { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: var(--font-mono); font-size: 13px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-secondary); }
.flow-node.is-module .node-badge, .flow-node.is-endcap .node-badge { background: linear-gradient(135deg, var(--series-3), #0e6c4d); color: #fff; border-color: transparent; }
.flow-node .node-label { font-size: 13px; font-weight: 700; }
.flow-node .node-sub { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.flow-connector { flex: 1; min-width: 26px; height: 3px; background: repeating-linear-gradient(90deg, var(--series-1) 0 6px, transparent 6px 11px); border-radius: 2px; margin: 0 2px; }

/* ---------- Process cards (home) ---------- */
.process-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 0 8px 44px; }
@media (max-width: 900px) { .process-cards { grid-template-columns: 1fr; } }
.process-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 22px 20px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
}
.process-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--card-accent, var(--series-1)); }
.process-card[data-process="stringer"] { --card-accent: var(--series-1); }
.process-card[data-process="layup"] { --card-accent: var(--series-3); }
.process-card[data-process="backend"] { --card-accent: var(--series-2); }
.process-card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.process-card-head .num { font-family: var(--font-mono); font-size: 22px; color: var(--text-muted); font-weight: 700; }
.process-card h3 { font-size: 20px; }
.process-card p.desc { color: var(--text-secondary); font-size: 13.5px; line-height: 1.55; }
.station-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.station-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 5px 10px 5px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.station-pill:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-3); transform: translateY(-1px); }
.station-pill svg { width: 13px; height: 13px; flex-shrink: 0; opacity: .8; color: var(--card-accent, var(--series-1)); }
.process-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.process-card-foot .link { color: var(--card-accent, var(--series-1)); font-weight: 700; cursor: pointer; background: none; border: none; font-size: 12.5px; }
.process-card-foot .link:hover { text-decoration: underline; }

/* ---------- Fast access / filters ---------- */
.fast-access { margin: 0 8px; }
.fast-access-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row select {
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: 999px; cursor: pointer;
}
.result-count { color: var(--text-muted); font-size: 12.5px; margin: 10px 0 16px; }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lesson-card {
  text-align: left; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 18px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s, background .15s;
}
.lesson-card:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }
.lesson-card-tags { display: flex; justify-content: space-between; align-items: center; }
.tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; }
.tag-type { background: rgba(57,135,229,0.15); color: #7db3f5; }
.tag-level { color: var(--text-muted); font-weight: 700; }
.lesson-card h4 { font-size: 15.5px; line-height: 1.35; }
.lesson-card p.summary { font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); margin-top: auto; padding-top: 4px; }
.lesson-card-foot .station-tag { font-weight: 600; color: var(--text-secondary); }
.lesson-card-foot .open-arrow { color: var(--series-1); font-weight: 700; }
.lesson-card.is-reviewed { border-color: rgba(25,158,112,0.45); }
.reviewed-check { display: inline-flex; align-items: center; gap: 4px; color: var(--status-good); font-size: 11px; font-weight: 700; }
.empty-state { text-align: center; color: var(--text-muted); padding: 60px 20px; font-size: 14px; }

/* ============================================================
   Process line view
   ============================================================ */
.line-stage-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.stage-tab {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; cursor: pointer;
  color: var(--text-secondary); text-align: left; min-width: 160px; transition: all .15s;
}
.stage-tab b { display: block; color: var(--text-primary); font-size: 14.5px; }
.stage-tab small { font-size: 11.5px; color: var(--text-muted); }
.stage-tab.is-active { border-color: var(--stage-accent, var(--series-1)); background: var(--surface-2); box-shadow: 0 0 0 1px var(--stage-accent, var(--series-1)) inset; }
.stage-tab[data-process="stringer"] { --stage-accent: var(--series-1); }
.stage-tab[data-process="layup"] { --stage-accent: var(--series-3); }
.stage-tab[data-process="backend"] { --stage-accent: var(--series-2); }

.line-canvas { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 30px 26px; box-shadow: var(--shadow-card); }
.line-canvas .stage-focus { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; max-width: 640px; margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.station-rail { display: flex; gap: 18px; overflow-x: auto; padding: 10px 4px 18px; perspective: 1400px; }
.station-node {
  flex-shrink: 0; width: 190px; background: linear-gradient(165deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 16px; cursor: pointer;
  transform-style: preserve-3d; position: relative; overflow: hidden;
}
.station-node:hover { border-color: var(--border-strong); --ty: -5px; --tz: 12px; box-shadow: var(--shadow-pop); }
.station-visual { width: 100%; height: 92px; border-radius: 11px; margin-bottom: 12px; overflow: hidden; }
.station-visual img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.station-node:hover .station-visual img { transform: scale(1.06); }
.station-icon-tile {
  width: 100%; height: 92px; border-radius: 11px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.station-icon-tile::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 60px at 28% 18%, rgba(255,255,255,0.20), transparent 60%); }
.station-icon-tile svg { width: 32px; height: 32px; color: #fff; position: relative; z-index: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35)); transition: transform .3s ease; }
.station-node:hover .station-icon-tile svg { transform: scale(1.1) translateY(-1px); }
.station-icon-tile.tile-stringer { background: linear-gradient(150deg, #3987e5, #1c4a86); }
.station-icon-tile.tile-layup    { background: linear-gradient(150deg, #199e70, #0e5a40); }
.station-icon-tile.tile-backend  { background: linear-gradient(150deg, #d95926, #8a3814); }
.station-icon-tile.sm-icon-tile  { height: 200px; margin: 14px 0; border-radius: 12px; }
.station-icon-tile.sm-icon-tile svg { width: 58px; height: 58px; }

.station-node .idx { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.station-node .short { font-family: var(--font-mono); font-size: 20px; font-weight: 800; margin: 6px 0 10px; color: var(--stage-accent, var(--series-1)); }
.station-node .name { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; }
.station-node .risk { font-size: 11.5px; color: var(--text-muted); }
.station-node .risk b { color: var(--status-warning); font-weight: 700; }

/* ============================================================
   Trends view
   ============================================================ */
.trends-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-bottom: 30px; perspective: 1400px; }
@media (max-width: 900px) { .trends-grid { grid-template-columns: 1fr; } }
.chart-card, .coverage-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s ease, border-color .2s;
  animation: trend-card-in .55s cubic-bezier(.16,.84,.44,1) both;
}
.coverage-card { animation-delay: .08s; }
.chart-card::before, .coverage-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--series-1), var(--series-3), var(--series-2));
}
.chart-card::after, .coverage-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.09), transparent 45%);
  opacity: 0; transition: opacity .25s;
}
.chart-card:hover, .coverage-card:hover { transform: translateY(-5px) rotateX(1.4deg); box-shadow: var(--shadow-pop); }
.chart-card:hover::after, .coverage-card:hover::after { opacity: 1; }
.chart-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; flex-wrap: wrap; gap: 6px; }
.chart-card-head h3, .coverage-card h3 { font-size: 15.5px; }

.coverage-row { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.coverage-item .coverage-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.coverage-item .coverage-label b { color: var(--text-primary); }
.coverage-item .coverage-label span { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.coverage-bar-track { height: 8px; border-radius: 5px; background: rgba(255,255,255,0.07); overflow: hidden; }
.coverage-bar-fill {
  height: 100%; border-radius: 5px; transform-origin: left center;
  animation: coverage-fill-in .85s cubic-bezier(.16,.84,.44,1) both;
  animation-delay: .3s;
  box-shadow: 0 0 12px -2px currentColor;
}
.coverage-item:nth-child(2) .coverage-bar-fill { animation-delay: .42s; }
.coverage-item:nth-child(3) .coverage-bar-fill { animation-delay: .54s; }
@keyframes coverage-fill-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.case-examples h3 { font-size: 15.5px; margin-bottom: 14px; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; perspective: 1200px; }
.case-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px;
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease, border-color .2s;
  animation: trend-card-in .5s cubic-bezier(.16,.84,.44,1) both;
}
.case-card:nth-child(2) { animation-delay: .08s; }
.case-card:nth-child(3) { animation-delay: .16s; }
.case-card:nth-child(4) { animation-delay: .24s; }
.case-card:hover { transform: translateY(-5px) rotateX(2deg); box-shadow: var(--shadow-pop); border-color: var(--border-strong); }
.case-card .case-count { font-family: var(--font-mono); font-size: 28px; font-weight: 800; color: var(--series-2); transition: transform .3s ease; }
.case-card:hover .case-count { transform: scale(1.08); }
.case-card .case-label { font-size: 14px; font-weight: 700; margin: 4px 0 6px; }
.case-card .case-context { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

@keyframes trend-card-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* --- svg line chart --- */
.viz-root { color-scheme: dark; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-svg-wrap { position: relative; }
.chart-svg-wrap svg polyline {
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: chart-draw-line 1.2s cubic-bezier(.16,.84,.44,1) forwards;
  animation-delay: .15s;
}
.chart-svg-wrap svg polyline:nth-of-type(2) { animation-delay: .3s; }
.chart-svg-wrap svg polyline:nth-of-type(3) { animation-delay: .45s; }
@keyframes chart-draw-line { to { stroke-dashoffset: 0; } }
.chart-svg-wrap svg circle.pt {
  opacity: 0; animation: chart-dot-in .45s ease forwards; animation-delay: .95s;
  transition: r .15s ease, filter .15s ease; cursor: pointer;
}
.chart-svg-wrap svg circle.pt:hover { r: 6; filter: drop-shadow(0 0 6px currentColor); }
@keyframes chart-dot-in { to { opacity: 1; } }
.chart-svg-wrap svg text {
  opacity: 0; animation: chart-dot-in .5s ease forwards; animation-delay: 1.05s;
}
.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; box-shadow: var(--shadow-pop); opacity: 0; transition: opacity .1s;
  transform: translate(-50%, -110%); white-space: nowrap; z-index: 5;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip .tt-week { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  .chart-card, .coverage-card, .case-card, .coverage-bar-fill,
  .chart-svg-wrap svg polyline, .chart-svg-wrap svg circle.pt, .chart-svg-wrap svg text {
    animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; transform: none !important;
  }
}

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,7,13,0.72); backdrop-filter: blur(3px);
  display: flex; justify-content: flex-end; z-index: 100;
  animation: fade-in .15s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-1); border-left: 1px solid var(--border-strong); height: 100%; width: min(520px, 100%);
  overflow-y: auto; padding: 30px 28px 60px; position: relative;
  animation: slide-in .2s ease;
  box-shadow: var(--shadow-pop);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.modal-close {
  position: absolute; top: 22px; right: 22px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; font-size: 14px;
}
.modal-close:hover { background: var(--surface-3); color: var(--text-primary); }

/* lesson modal content */
.lm-eyebrow-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.lm-title { font-size: 24px; line-height: 1.25; margin: 8px 0 10px; padding-right: 34px; }
.lm-summary { color: var(--text-secondary); font-size: 14.5px; line-height: 1.6; margin-bottom: 18px; }
.lm-meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.lm-meta-pill { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); }
.lm-review-btn { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center; margin-bottom: 24px; }
.lm-section { margin-bottom: 22px; }
.lm-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.lm-section h4 .dot { width: 7px; height: 7px; border-radius: 50%; }
.lm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lm-list li { font-size: 13.5px; line-height: 1.55; color: var(--text-primary); padding-left: 18px; position: relative; }
.lm-list li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.lm-section.symptoms h4 .dot { background: var(--status-warning); }
.lm-section.causes h4 .dot { background: var(--status-critical); }
.lm-section.checks h4 .dot { background: var(--series-1); }
.lm-section.actions h4 .dot { background: var(--status-good); }
.lm-verify { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--text-primary); }
.lm-caution { background: rgba(250,178,25,0.09); border: 1px solid rgba(250,178,25,0.35); border-radius: 12px; padding: 14px 16px; font-size: 13px; color: #f5d488; line-height: 1.55; display: flex; gap: 10px; }
.lm-related { display: flex; flex-direction: column; gap: 8px; }
.lm-related-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.lm-related-item:hover { border-color: var(--border-strong); }
.lm-related-item small { color: var(--text-muted); display: block; margin-top: 2px; }

/* station modal content */
.sm-eyebrow { color: var(--series-1); }
.sm-title { font-size: 26px; margin: 8px 0 8px; padding-right: 34px; }
.sm-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 18px; }
.sm-pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.sm-section { margin-bottom: 22px; }
.sm-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 10px; }
.sm-focus { font-size: 14px; line-height: 1.6; }

/* ============================================================
   Assistant widget
   ============================================================ */
.assistant { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.assistant-launcher {
  display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 16px 8px 8px; cursor: pointer;
  box-shadow: var(--shadow-pop); color: var(--text-primary);
}
.assistant-avatar { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--series-3); }
.assistant-avatar svg { width: 18px; height: 18px; }
.assistant-dot { position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--status-good); border: 2px solid var(--surface-1); }
.assistant-launcher-text { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.assistant-launcher-text b { font-size: 13.5px; }
.assistant-launcher-text small { font-size: 11px; color: var(--text-muted); }

.assistant-panel {
  width: min(370px, 88vw); max-height: min(560px, 70vh); background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden;
  animation: pop-in .16s ease;
}
.assistant-panel[hidden] { display: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.assistant-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 14px; border-bottom: 1px solid var(--border); }
.assistant-panel-head b { font-size: 14px; display: block; }
.assistant-panel-head small { font-size: 11px; color: var(--text-muted); }
.assistant-panel-head .modal-close { position: static; width: 28px; height: 28px; font-size: 12px; }
.assistant-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.assistant-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 12px; }
.assistant-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.assistant-chip { font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; }
.assistant-chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.assistant-results { display: flex; flex-direction: column; gap: 8px; }
.assistant-result-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; cursor: pointer; }
.assistant-result-item:hover { border-color: var(--border-strong); }
.assistant-result-item .ari-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.assistant-result-item .ari-meta { font-size: 11px; color: var(--text-muted); }
.assistant-result-item .ari-why { font-size: 11.5px; color: var(--text-secondary); margin-top: 5px; }
.assistant-no-result { font-size: 12.5px; color: var(--text-muted); padding: 6px 2px; }
.assistant-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.assistant-input-row input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 10px 14px; color: var(--text-primary); font-size: 13px; outline: none; }
.assistant-input-row input:focus { border-color: var(--series-1); }
.assistant-input-row button { width: 38px; height: 38px; border-radius: 50%; background: var(--series-1); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.assistant-input-row button svg { width: 16px; height: 16px; }
.assistant-footnote { font-size: 10.5px; color: var(--text-muted); text-align: center; padding: 0 16px 12px; }

@media (max-width: 520px) {
  .assistant { right: 12px; bottom: 12px; left: 12px; align-items: stretch; }
  .assistant-launcher { align-self: flex-end; }
  .assistant-panel { width: 100%; }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer { max-width: 1240px; margin: 0 auto; padding: 30px 24px 46px; border-top: 1px solid var(--border); }
.footer-disclaimer { font-size: 12px; color: var(--text-muted); line-height: 1.6; max-width: 820px; }
.footer-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; font-family: var(--font-mono); }

/* ============================================================
   Defect & reference gallery (home)
   ============================================================ */
.defect-gallery { margin: 0 8px 44px; }
.gallery-lede { margin: -6px 0 18px; max-width: 640px; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gallery-card {
  display: flex; flex-direction: column; text-align: left; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; position: relative;
  cursor: pointer; padding: 0; box-shadow: var(--shadow-card); transition: border-color .15s, transform .15s;
}
.gallery-card:hover { border-color: var(--border-strong); }
.gallery-card img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--surface-2); transition: transform .4s ease; }
.gallery-card:hover img { transform: scale(1.08); }
.gallery-card-body { padding: 12px 14px 14px; }
.gallery-card-body b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.gallery-card-body p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 980px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Station / lesson reference images + spec tables
   ============================================================ */
.sm-image, .lm-image {
  width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); margin: 14px 0; display: block; background: var(--surface-2);
}
.specs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.specs-table td:first-child { color: var(--text-secondary); }
.specs-table td:last-child { font-family: var(--font-mono); text-align: right; white-space: nowrap; color: #fff; }
.specs-table .specs-group-row td {
  font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border-strong); padding-top: 12px;
}
.specs-caution { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }
[data-view-panel] { animation: fade-in .2s ease; }

/* ============================================================
   Account: header user chip
   ============================================================ */
.user-chip { display: flex; align-items: center; gap: 10px; margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--border); }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.user-chip-admin { font-size: 12px; font-weight: 700; color: var(--series-1); text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.user-chip-admin:hover { border-color: var(--border-strong); background: var(--surface-2); }
.user-chip-signout { font-size: 12px; font-weight: 600; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 6px 4px; white-space: nowrap; }
.user-chip-signout:hover { color: var(--text-primary); }
@media (max-width: 900px) { .user-chip:not(.mobile) { display: none; } }
.user-chip.mobile { display: none; border-left: none; padding: 12px 16px 4px; margin: 6px 0 0; border-top: 1px solid var(--border); }
@media (max-width: 900px) { .user-chip.mobile { display: flex; } }

/* ============================================================
   Account: sign-in / sign-up page
   ============================================================ */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: linear-gradient(160deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 32px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand svg { width: 30px; height: 30px; }
.auth-brand span { font-size: 16px; color: var(--text-secondary); }
.auth-brand b { color: var(--text-primary); font-weight: 700; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; background: none; border: none; color: var(--text-secondary); font-size: 13px; font-weight: 700; padding: 9px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.auth-tab:hover { color: var(--text-primary); }
.auth-tab.is-active { background: var(--series-1); color: #fff; }
.auth-title { font-size: 21px; font-weight: 800; color: var(--text-primary); margin: 0 0 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 22px; line-height: 1.5; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.auth-field label span { text-transform: none; font-weight: 500; color: var(--text-muted); }
.auth-field input { width: 100%; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; color: var(--text-primary); font-size: 14.5px; outline: none; box-sizing: border-box; }
.auth-field input:focus { border-color: var(--series-1); }
.auth-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.auth-submit { width: 100%; margin-top: 6px; justify-content: center; }
.auth-error { font-size: 13px; color: #f0a08f; background: rgba(217,89,38,0.12); border: 1px solid rgba(217,89,38,0.35); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; display: none; }
.auth-error.is-visible { display: block; }
.auth-foot { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 18px; line-height: 1.5; }

/* ============================================================
   Admin: performance dashboard
   ============================================================ */
.admin-summary-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0 4px; }
.admin-summary-card { background: linear-gradient(160deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 16px 20px; min-width: 140px; }
.admin-table-wrap { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: auto; margin-top: 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.admin-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-name { color: var(--text-primary); font-weight: 700; white-space: nowrap; }
.admin-id { font-family: var(--font-mono); color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.admin-email { color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.admin-bar-track { width: 84px; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.admin-bar-fill { height: 100%; background: linear-gradient(90deg, var(--series-3), var(--series-1)); border-radius: 4px; }
.admin-pct { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.admin-area-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin: 1px 4px 1px 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.admin-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); font-size: 14px; }
.admin-page-main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 70px; }
