/* ============================================================
   TONI SIIK — Blueprint variant
   Hand-drawn technical drawing. Two modes:
   [data-mode="blueprint"] white ink on cyanotype blue
   [data-mode="ink"]       black ink on drafting paper
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  /* standardized ISO-3098-style technical lettering: one family, sized by class */
  --f-display: 'Rajdhani', sans-serif;  /* large lettering / titles / numerals */
  --f-hand: 'Rajdhani', sans-serif;     /* labels & annotations */
  --f-spec: 'Rajdhani', sans-serif;     /* notes / body */
  --f-typed: 'IBM Plex Mono', monospace;/* typed title-block & stamp only */
  --maxw: 1280px;
  --pad: clamp(18px, 4.5vw, 64px);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- BLUEPRINT (default / dark) ---- */
:root, :root[data-mode="blueprint"] {
  --paper: #123a60;
  --paper-deep: #0d2c4a;
  --ink: #e9f1fa;
  --ink-soft: #a9c4de;
  --ink-faint: #6f93b6;
  --accent: #f2b35e;
  --grid-minor: rgba(233,241,250,0.07);
  --grid-major: rgba(233,241,250,0.15);
  --edge: rgba(233,241,250,0.85);
  --panel: rgba(255,255,255,0.035);
  --photo-blend: luminosity;
  --photo-filter: grayscale(1) contrast(1.08) brightness(1.08);
}

/* ---- INK (light) ---- */
:root[data-mode="ink"] {
  --paper: #f1ece0;
  --paper-deep: #e7e0d0;
  --ink: #20262e;
  --ink-soft: #545b63;
  --ink-faint: #8b8170;
  --accent: #c0492b;
  --grid-minor: rgba(40,80,130,0.09);
  --grid-major: rgba(40,80,130,0.17);
  --edge: rgba(32,38,46,0.9);
  --panel: rgba(40,60,90,0.03);
  --photo-blend: multiply;
  --photo-filter: grayscale(1) contrast(1.16) brightness(1.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-spec);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.012em;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}

/* graph-paper grid + exposure vignette */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 26px 26px, 26px 26px, 130px 130px, 130px 130px;
}
body::after { /* uneven exposure / paper vignette */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 100% 80% at 30% 20%, transparent 40%, var(--paper-deep) 130%);
  opacity: .9; mix-blend-mode: multiply;
}

::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); position: relative; z-index: 2; }
section { position: relative; z-index: 2; }

/* hidden filter host SVG */
.svg-defs { position: absolute; width: 0; height: 0; pointer-events: none; }

/* ============================================================
   SHARED DRAWN PRIMITIVES
   ============================================================ */

/* wobbly hand-drawn border (text stays crisp — only this edge is filtered) */
.edge {
  position: absolute; inset: 0; pointer-events: none;
  border: 1.8px solid var(--edge);
  filter: url(#pencil);
  border-radius: 3px;
}
.edge.dash { border-style: dashed; }

/* corner crop marks */
.crop { position: absolute; width: 13px; height: 13px; border: 1.6px solid var(--ink); filter: url(#pencil); }
.crop.tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.crop.tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; }
.crop.bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; }
.crop.br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }

/* sheet / section labels */
.sheet-tag {
  font-family: var(--f-hand);
  font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); display: inline-flex; align-items: center; gap: 10px;
}
.sheet-tag b { color: var(--accent); font-weight: 400; }

.plate-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(30px, 5vw, 56px); line-height: 1.0; letter-spacing: 0.01em;
  margin-top: 10px; text-transform: uppercase;
}
.plate-title .u { color: var(--accent); }

.note { font-family: var(--f-hand); font-size: 17px; line-height: 1.45; color: var(--ink-soft); }
.spec { font-family: var(--f-spec); color: var(--ink-soft); }
.spec strong, .note strong { color: var(--ink); font-weight: 600; }

/* dimension line: |<----- label ----->| */
.dim { display: flex; align-items: center; gap: 10px; font-family: var(--f-hand); font-size: 14px; color: var(--ink-faint); letter-spacing: .04em; }
.dim::before, .dim::after { content: ""; flex: 1; height: 1.5px; background: var(--ink-faint); filter: url(#pencil); }
.dim .ar { color: var(--ink-faint); font-size: 13px; }
.dim .val { white-space: nowrap; color: var(--ink-soft); }

/* leader callout bubble */
.callout-id {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  font-family: var(--f-display); font-weight: 700; font-size: 19px;
  color: var(--accent); position: relative;
}
.callout-id .edge { border-width: 2px; }

/* placeholder underline */
.ph { border-bottom: 1.5px dashed var(--ink-faint); color: var(--ink-soft); }

/* hand-drawn button */
.btn {
  position: relative; font-family: var(--f-hand); font-size: 18px; letter-spacing: .03em;
  padding: 13px 26px; display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); cursor: pointer; background: none; border: none;
  transition: transform .25s var(--ease), color .25s;
}
.btn .edge { border-width: 2px; }
.btn:hover { transform: translate(-1px,-2px); color: var(--accent); }
.btn.solid { color: var(--paper); }
.btn.solid::before { content: ""; position: absolute; inset: 0; background: var(--accent); filter: url(#pencil); border-radius: 3px; z-index: -1; }
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

/* ============================================================
   TOP BAR — drawing index + mode toggle
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--pad);
  transition: background .4s var(--ease);
}
.topbar.scrolled { background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(6px); }
.topbar .id { font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.topbar .idx { display: flex; gap: 22px; }
.topbar .idx a { font-family: var(--f-hand); font-size: 16px; color: var(--ink-soft); transition: color .2s; }
.topbar .idx a:hover { color: var(--accent); }
@media (max-width: 860px) { .topbar .idx { display: none; } }

/* mode toggle — drawn switch */
.toggle {
  position: relative; display: inline-flex; align-items: center; gap: 0;
  font-family: var(--f-hand); font-size: 14px; cursor: pointer;
  padding: 5px; user-select: none;
}
.toggle .opt { padding: 5px 12px; color: var(--ink-faint); letter-spacing: .05em; text-transform: uppercase; transition: color .25s; z-index: 1; }
.toggle .opt.on { color: var(--accent); }
.toggle .knob {
  position: absolute; top: 5px; bottom: 5px; width: calc(50% - 5px);
  border: 1.6px solid var(--accent); filter: url(#pencil); border-radius: 3px;
  transition: transform .3s var(--ease); z-index: 0;
}
.toggle[data-on="ink"] .knob { transform: translateX(100%); }

/* ============================================================
   HERO / SHEET 01
   ============================================================ */
.hero { min-height: 100svh; display: flex; align-items: center; padding: 110px 0 70px; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(30px,5vw,70px); align-items: center; width: 100%; }

.hero-name { font-family: var(--f-display); font-weight: 700; font-size: clamp(52px, 11vw, 134px); line-height: 0.86; letter-spacing: .01em; text-transform: uppercase; }
.hero-name span { display: block; }
.hero-name .l2 { color: var(--accent); }
.hero-sub { margin-top: 18px; font-family: var(--f-hand); font-size: clamp(15px,1.7vw,20px); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }

.hero-dim { margin: 22px 0 26px; max-width: 460px; }

.hero-lede { font-family: var(--f-spec); font-size: clamp(15px,1.4vw,17px); color: var(--ink-soft); max-width: 46ch; }
.hero-lede strong { color: var(--ink); }

/* the formula */
.formula { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; font-family: var(--f-hand); font-size: clamp(15px,1.7vw,19px); }
.formula .term { position: relative; padding: 8px 14px; color: var(--ink); white-space: nowrap; }
.formula .op { color: var(--accent); font-size: 1.3em; }
.formula .res { color: var(--accent); }

.hero-actions { margin-top: 32px; display: flex; gap: 16px; flex-wrap: wrap; }

/* loop figure */
.fig { position: relative; display: flex; flex-direction: column; align-items: center; }
#loop-svg { width: 100%; max-width: 430px; height: auto; overflow: visible; }
.fig-cap { font-family: var(--f-hand); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 10px; }
.fig-cap b { color: var(--accent); }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .fig { order: -1; max-width: 340px; margin: 0 auto; }
}

/* ============================================================
   SECTIONS
   ============================================================ */
.plate { padding: clamp(70px, 11vw, 130px) 0; }
.plate-head { margin-bottom: clamp(34px, 5vw, 58px); max-width: 22ch; }

/* ABOUT / SHEET 02 */
.about .wrap { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(36px,6vw,80px); align-items: start; }
.portrait-plate { position: relative; }
.portrait-frame { position: relative; padding: 16px; }
.portrait-img { position: relative; aspect-ratio: 4/5; overflow: hidden; background: var(--paper-deep); }
.portrait-img img {
  width: 100%; height: 100%; object-fit: cover; object-position: center top;
  filter: var(--photo-filter); mix-blend-mode: var(--photo-blend); display: block;
}
.portrait-img::after { /* halftone texture */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--ink-faint) 0.7px, transparent 1.1px);
  background-size: 4px 4px; opacity: .16; mix-blend-mode: soft-light;
}
.portrait-tag { position: absolute; font-family: var(--f-hand); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.portrait-tag.top { top: -2px; left: 18px; background: var(--paper); padding: 0 8px; }
.portrait-meta { margin-top: 14px; display: grid; gap: 7px; font-family: var(--f-spec); font-size: 12.5px; }
.portrait-meta .row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-faint); border-bottom: 1.4px dotted var(--ink-faint); padding-bottom: 6px; }
.portrait-meta .row:last-child { border-bottom: 0; }
.portrait-meta .v { color: var(--ink); font-weight: 500; text-align: right; }

.about-lede { font-family: var(--f-hand); font-size: clamp(22px,2.8vw,32px); line-height: 1.35; color: var(--ink); }
.about-lede .u { color: var(--accent); }
.about-body { margin-top: 22px; max-width: 56ch; }
.about-body p + p { margin-top: 14px; }

.about-stats { margin-top: 34px; display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.statbox { position: relative; padding: 18px 16px 16px; }
.statbox .n { font-family: var(--f-display); font-weight: 700; font-size: clamp(30px,4vw,44px); line-height: 1; }
.statbox .n .u { color: var(--accent); font-size: .55em; }
.statbox .l { font-family: var(--f-hand); font-size: 14px; color: var(--ink-soft); margin-top: 8px; letter-spacing: .03em; }

.recog { margin-top: 28px; position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 11px 18px; font-family: var(--f-hand); font-size: 16px; color: var(--ink-soft); }
.recog .star { color: var(--accent); }

@media (max-width: 840px) { .about .wrap { grid-template-columns: 1fr; } .portrait-plate { max-width: 360px; } }

/* EXPERTISE / SHEET 03 — bill of capabilities */
.bom { position: relative; }
.bom-grid { display: grid; grid-template-columns: repeat(4,1fr); }
.bom-col { position: relative; padding: 24px 22px; }
.bom-col .edge { border-width: 1.2px; }
.bom-col h3 { font-family: var(--f-hand); font-size: 18px; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; display: flex; align-items: baseline; gap: 8px; }
.bom-col h3 .it { font-family: var(--f-spec); font-size: 13px; color: var(--ink-faint); }
.bom-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.bom-col li { font-family: var(--f-spec); font-size: 13.5px; color: var(--ink-soft); padding-left: 18px; position: relative; line-height: 1.4; }
.bom-col li::before { content: "×"; position: absolute; left: 2px; top: 0; color: var(--ink-faint); font-family: var(--f-hand); }
@media (max-width: 900px) { .bom-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 520px) { .bom-grid { grid-template-columns: 1fr; } }

/* WORK / SHEET 04 — detail callouts */
.feat { position: relative; margin-bottom: 26px; }
.feat-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; }
.feat-l { padding: clamp(26px,3.5vw,44px); }
.feat-r { position: relative; padding: clamp(26px,3.5vw,44px); display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.feat-r::before { content: ""; position: absolute; left: 0; top: 12%; bottom: 12%; width: 1.5px; background: var(--edge); filter: url(#pencil); }
.detail-tag { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.detail-tag .lab { font-family: var(--f-hand); font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.feat h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(26px,3.4vw,40px); line-height: 1; text-transform: uppercase; }
.feat .code { font-family: var(--f-hand); font-size: 15px; letter-spacing: .12em; color: var(--ink-soft); margin-top: 8px; }
.feat-desc { margin-top: 16px; max-width: 46ch; }
.feat-tags { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.mini { position: relative; font-family: var(--f-hand); font-size: 14px; color: var(--ink-soft); padding: 5px 12px; }
.mini .edge { border-width: 1.2px; }
.metric .n { font-family: var(--f-display); font-weight: 700; font-size: clamp(32px,4.4vw,52px); line-height: 1; }
.metric .n .u { color: var(--accent); font-size: .5em; }
.metric .l { font-family: var(--f-hand); font-size: 14px; color: var(--ink-soft); margin-top: 6px; }

.proj-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; }
.proj { position: relative; padding: 26px 24px; display: flex; flex-direction: column; min-height: 240px; transition: transform .3s var(--ease); }
.proj:hover { transform: translate(-2px,-3px); }
.proj .top { display: flex; justify-content: space-between; align-items: baseline; }
.proj .code { font-family: var(--f-hand); font-size: 15px; letter-spacing: .1em; color: var(--accent); }
.proj .id { font-family: var(--f-spec); font-size: 13px; color: var(--ink-faint); }
.proj h4 { font-family: var(--f-display); font-weight: 700; font-size: 21px; line-height: 1.05; text-transform: uppercase; margin-top: 10px; }
.proj p { margin-top: 12px; font-size: 13.5px; flex: 1; }
.proj .pm { margin-top: 16px; padding-top: 14px; position: relative; display: flex; align-items: baseline; gap: 9px; }
.proj .pm::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1.4px; background: var(--ink-faint); filter: url(#pencil); }
.proj .pm .n { font-family: var(--f-display); font-weight: 700; font-size: 23px; }
.proj .pm .n .u { color: var(--accent); font-size: .6em; }
.proj .pm .l { font-family: var(--f-hand); font-size: 13px; color: var(--ink-soft); }
.proj.support { min-height: auto; }
@media (max-width: 820px) { .feat-inner { grid-template-columns: 1fr; } .feat-r::before { display: none; } .proj-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 540px) { .proj-grid { grid-template-columns: 1fr; } }

/* PATH / SHEET 05 — station axis */
.timeline { position: relative; padding-left: 8px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 1.6px; background: var(--edge); filter: url(#pencil); }
.tl { position: relative; padding-left: 40px; padding-bottom: 38px; }
.tl:last-child { padding-bottom: 0; }
.tl .stn { position: absolute; left: 0; top: 3px; width: 17px; height: 17px; border-radius: 50%; transform: translateX(-7px); }
.tl .stn .edge { border-width: 1.8px; }
.tl .stn::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--ink-faint); }
.tl.current .stn::after { background: var(--accent); }
.tl .date { font-family: var(--f-hand); font-size: 15px; letter-spacing: .05em; color: var(--accent); }
.tl .role { font-family: var(--f-display); font-weight: 700; font-size: 21px; text-transform: uppercase; margin-top: 4px; }
.tl .org { font-family: var(--f-hand); font-size: 15px; color: var(--ink-soft); margin-top: 2px; }
.tl .desc { margin-top: 10px; max-width: 60ch; font-size: 13.5px; }

/* RUNNING / SHEET 06 — surveyed cross-section */
.run-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; flex-wrap: wrap; margin-bottom: 38px; }
.run-intro { font-family: var(--f-hand); font-size: 18px; line-height: 1.45; color: var(--ink-soft); max-width: 44ch; }
.run-intro strong { color: var(--ink); }
.section-card { position: relative; padding: 26px clamp(20px,3vw,38px); }
.section-card .lbl { display: flex; justify-content: space-between; font-family: var(--f-hand); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px; }
#route-svg { width: 100%; height: auto; display: block; overflow: visible; }
.run-stats { margin-top: 28px; display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.run-stat { position: relative; padding: 18px 16px; text-align: center; }
.run-stat .n { font-family: var(--f-display); font-weight: 700; font-size: clamp(24px,3vw,34px); }
.run-stat .l { font-family: var(--f-hand); font-size: 13px; color: var(--ink-soft); margin-top: 7px; letter-spacing: .03em; }
.run-disc { margin-top: 26px; display: grid; grid-template-columns: repeat(2,1fr); gap: 22px; }
.disc { position: relative; padding: 22px 24px; }
.disc h4 { font-family: var(--f-display); font-weight: 700; font-size: 18px; text-transform: uppercase; }
.disc p { margin-top: 8px; font-size: 13.5px; }
@media (max-width: 740px) { .run-stats { grid-template-columns: repeat(2,1fr); } .run-disc { grid-template-columns: 1fr; } }

/* CONTACT + TITLE BLOCK */
.contact { padding: clamp(70px,11vw,130px) 0 40px; }
.contact-inner { position: relative; padding: clamp(34px,5vw,70px); }
.contact h2 { font-family: var(--f-display); font-weight: 700; font-size: clamp(36px,6.5vw,76px); line-height: .92; text-transform: uppercase; }
.contact h2 .u { color: var(--accent); }
.contact-sub { margin-top: 18px; max-width: 48ch; font-size: 15px; }
.contact-actions { margin-top: 30px; display: flex; gap: 16px; flex-wrap: wrap; }

/* engineering title block */
.titleblock { margin-top: 48px; position: relative; display: grid; grid-template-columns: 2fr 1fr 1fr; font-family: var(--f-typed); }
.tb-cell { position: relative; padding: 12px 16px; min-height: 64px; }
.tb-cell .edge { border-width: 1.2px; border-radius: 0; }
.tb-cell .k { font-family: var(--f-hand); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.tb-cell .v { font-size: 14px; color: var(--ink); margin-top: 5px; }
.tb-cell.big .v { font-family: var(--f-display); font-weight: 700; font-size: 19px; text-transform: uppercase; }
.tb-cell a.v:hover { color: var(--accent); }
.tb-span2 { grid-column: span 2; }
@media (max-width: 640px) { .titleblock { grid-template-columns: 1fr 1fr; } .tb-span2 { grid-column: span 2; } }

/* footer */
.foot { padding: 26px var(--pad) 40px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-family: var(--f-hand); font-size: 14px; color: var(--ink-soft); }
.foot a:hover { color: var(--accent); }

/* fixed mini title block, bottom-right */
.stamp { position: fixed; right: 14px; bottom: 12px; z-index: 80; font-family: var(--f-typed); font-size: 11px; color: var(--ink-faint); text-align: right; pointer-events: none; letter-spacing: .05em; }
.stamp b { color: var(--ink-soft); }
@media (max-width: 700px) { .stamp { display: none; } }

/* ============================================================
   ANIMATION
   ============================================================ */
.draw path, .draw line, .draw circle, .draw polyline { }
.rev { opacity: 1; }
.js .rev { opacity: 0; }
.js .rev.in { animation: revealIn .8s var(--ease) both; }
.js .rev.d1 { animation-delay: .07s; }
.js .rev.d2 { animation-delay: .14s; }
.js .rev.d3 { animation-delay: .21s; }
.js .rev.d4 { animation-delay: .28s; }
@keyframes revealIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* frozen-clock / no-animation safety: JS adds this if the animation timeline isn't advancing */
.rev-static .rev { opacity: 1 !important; transform: none !important; animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .js .rev { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; }
}

/* ---------- line-art project marks (added) ---------- */
.proj .proj-mark{ display:block; width:30px; height:30px; margin-bottom:12px; color:inherit; }
.proj .proj-mark svg{ width:100%; height:100%; display:block; overflow:visible; }
