/* ============================================================
   iOi house stylesheet — the single source of truth.
   Neutral base (black/white core) + official iOi palette accents.
   Light and dark themes via [data-theme] on <html>.
   Change this file and every page that links it updates.
   ============================================================ */

:root {
  /* neutral tokens — LIGHT */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --fill: #f0f0f0;
  --ink: #1a1a1a;
  --ink-soft: #3d3d3d;
  --muted: #767676;
  --line: #dcdcdc;
  --line-soft: #ececec;
  --link: #1a5fb4;
  --code-bg: #1e1e1e;
  --code-ink: #f2f2f2;

  /* official iOi palette (same in both themes) */
  --yellow: #FFCB05;
  --blue:   #00B3DF;
  --red:    #EF4124;
  --green:  #00AB8A;
  --purple: #6462AB;
  --orange: #F79225;
  --pink:   #F9BEC9;
  --sand:   #CFC9BC;
  --charcoal:#877C78;

  --radius: 8px;
  --maxw: 940px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #15171a;
  --surface: #1c1f24;
  --surface-2: #22262c;
  --fill: #2a2f36;
  --ink: #eaeaea;
  --ink-soft: #c7ccd2;
  --muted: #9aa1a9;
  --line: #343a42;
  --line-soft: #2a2f36;
  --link: #6db3f2;
  --code-bg: #0e0f11;
  --code-ink: #eaeaea;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; font-family: var(--font); font-size: 17px; color: var(--ink);
  background: var(--bg); line-height: 1.65; -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; }
p { color: var(--ink-soft); }
ul { color: var(--ink-soft); padding-left: 1.3em; }
ul li { margin: 6px 0; }
a { color: var(--link); }

/* theme toggle (injected by theme.js) */
.theme-toggle {
  position: fixed; top: 12px; right: 14px; z-index: 200;
  font: 600 .8rem/1 var(--font); color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.theme-toggle:hover { border-color: var(--muted); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: var(--maxw); margin: 0 auto; padding: 13px 24px; display: flex; align-items: baseline; gap: 12px; }
.topbar__brand, .topbar__title { font-weight: 700; font-size: .98rem; color: var(--ink); }
.topbar__sub { font-size: .82rem; color: var(--muted); }
.topbar__icon { width: 22px; height: 22px; object-fit: contain; display: block; flex: none; align-self: center; }

/* hero */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 52px 24px 8px; }
.hero h1 { font-size: 2.3rem; margin: 0 0 8px; font-weight: 700; letter-spacing: -.01em; }
.hero h1 .rule { display: block; width: 56px; height: 5px; border-radius: 3px; background: var(--red); margin: 16px 0 0; }
.hero p.lede { font-size: 1.14rem; color: var(--ink-soft); margin: 20px 0 0; max-width: 64ch; }
.eyebrow { display: block; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* stat band */
.stats { max-width: var(--maxw); margin: 40px auto 8px; padding: 0 24px; display: grid; gap: 14px; grid-template-columns: repeat(6, 1fr); }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; }
.stat__num { font-size: 1.9rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.stat__label { font-size: .8rem; color: var(--muted); margin-top: 7px; }

/* sections */
.section { max-width: var(--maxw); margin: 44px auto 0; padding: 0 24px; }
.section__title, section > h2 { font-size: 1.5rem; margin: 0 0 10px; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.section__title.eyebrowed { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
section { margin: 0 0 48px; scroll-margin-top: 72px; }
section > h2 .num { color: var(--muted); font-weight: 700; margin-right: 6px; }
section h3 { font-size: 1.12rem; margin: 26px 0 6px; font-weight: 600; }
section strong { color: var(--ink); font-weight: 600; }

/* cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); margin: 18px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--muted); border-radius: var(--radius); padding: 18px 18px 16px; display: flex; flex-direction: column; }
.card h3, .card h4 { margin: 0 0 6px; font-size: 1.06rem; font-weight: 700; }
.card p { margin: 0 0 12px; font-size: .93rem; color: var(--ink-soft); }
.card .metric { margin-top: auto; font-size: .8rem; font-weight: 600; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 10px; }

/* launchpad — clickable project tiles (dashboard) */
.launch { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 18px 0; }
.launch .tile {
  text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-top: 4px solid var(--muted);
  border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s ease, transform .1s ease;
}
.launch a.tile:hover { border-color: var(--muted); transform: translateY(-2px); }
.launch .tile h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.launch .tile p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.launch .tile .open { margin-top: 8px; font-size: .78rem; font-weight: 600; color: var(--link); }
.launch .tile .sub { margin-top: 6px; font-size: .74rem; color: var(--muted); }

/* callout */
.callout { border: 1px solid var(--line); border-left: 4px solid var(--muted); background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0; color: var(--ink-soft); font-size: .97rem; }
.callout strong { color: var(--ink); }

/* toc */
.toc { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 24px; margin: 32px 0 44px; }
.toc h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2; column-gap: 32px; }
.toc li { margin: 6px 0; }
.toc a { color: var(--link); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 18px 0; }
.steps li { position: relative; padding: 2px 0 16px 40px; margin: 0 0 0 12px; border-left: 1px solid var(--line); }
.steps li:last-child { border-left-color: transparent; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: -14px; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); font-weight: 600; font-size: .85rem; display: grid; place-items: center; }
.steps li strong { color: var(--ink); }

/* figure / screenshot */
figure.shot { margin: 22px 0; }
figure.shot .frame { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot.is-missing .frame::before { content: "Screenshot: " attr(data-label); display: flex; align-items: center; justify-content: center; min-height: 200px; padding: 28px; color: var(--muted); font-size: .92rem; font-weight: 600; text-align: center; background: var(--fill); }
figure.shot.is-missing .frame::after { content: "awaiting " attr(data-file); position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: .74rem; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
figure.shot.is-missing img { display: none; }
figcaption { margin-top: 8px; font-size: .85rem; color: var(--muted); text-align: center; }

/* board mockup */
.board { border: 1px solid var(--bc, var(--line)); border-radius: var(--radius); overflow: hidden; background: var(--surface); margin: 20px 0; font-size: .92rem; }
.board__group { font-weight: 600; padding: 10px 16px; background: var(--bc, var(--fill)); color: var(--ink); border-bottom: 1px solid var(--bc, var(--line)); }
.board table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.board td p { margin: 0 0 8px; }
.board td p:last-child { margin-bottom: 0; }
.board th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.board td { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.board tr:last-child td { border-bottom: none; }
.pill { display: inline-block; font-weight: 600; font-size: .78rem; padding: 2px 10px; border-radius: var(--radius); border: 1px solid var(--line); color: var(--ink-soft); background: var(--fill); }
.board td.when { color: var(--ink); font-variant-numeric: tabular-nums; }
.board td.act { font-weight: 600; color: var(--ink); }
.board td.act .reg { font-weight: 400; }
.board tr.hl td { background: var(--surface-2); color: var(--ink); }
.board td small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }
.board td .flag { display: block; margin-top: 8px; font-weight: 700; color: var(--ink); background: var(--fill); border-left: 3px solid var(--green); border-radius: 4px; padding: 6px 10px; line-height: 1.35; }

/* rounded wrapper for bordered tables */
.tround { border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.tround > table { margin: 0; }

/* story strip */
.story { max-width: var(--maxw); margin: 40px auto 0; padding: 18px 24px; }
.story__inner { border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); padding: 16px 20px; color: var(--ink-soft); font-size: .98rem; background: var(--surface-2); }
.story__inner strong { color: var(--ink); }

/* code */
pre.code { background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; font-size: .85rem; line-height: 1.5; font-family: ui-monospace, Menlo, monospace; margin: 16px 0; }
code.inline { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: var(--fill); padding: 1px 6px; border-radius: 4px; color: var(--ink); }
.note-strip { border: 1px dashed var(--muted); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 8px; font-size: .9rem; color: var(--muted); }

/* big banner title */
.banner { background: var(--yellow); color: #1a1a1a; border-radius: 14px; padding: 18px 28px;
          text-align: center; font-weight: 800; font-size: 1.9rem; line-height: 1.15;
          letter-spacing: -.01em; margin: 8px 0 22px; }
@media (max-width: 560px) { .banner { font-size: 1.4rem; padding: 14px 18px; } }

/* planning matrix — 9-column grid (reusable) */
.matrix-wrap { overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch; }
.matrix { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; min-width: 880px; }
.matrix + .matrix { margin-top: 10px; }
.matrix > div { border-radius: 7px; padding: 9px 7px; text-align: center; font-size: .8rem; line-height: 1.3; }
.matrix .m-head { font-weight: 700; font-size: 1rem; color: var(--ink); padding-bottom: 2px; }
.matrix .m-class { color: var(--ink-soft); font-size: .73rem; font-weight: 600; }
.matrix .m-brief { border: 2px solid var(--muted); font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: center; min-height: 48px; background: var(--surface); }
.matrix .m-theme { font-weight: 700; color: #fff; padding: 15px 7px; }
.matrix .m-band { font-weight: 700; color: #fff; padding: 16px 7px; }
.matrix .m-tech { border: 2px solid var(--muted); font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: center; min-height: 46px; background: var(--surface); }

/* progression bar chart (pure CSS, reusable) */
.chart { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px 20px 16px; margin: 20px 0; }
.chart__plot { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; height: 170px; border-bottom: 1px solid var(--line); }
.chart__bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart__bar .stem { width: 3px; min-height: 4px; border-radius: 3px; background: var(--muted); position: relative; }
.chart__bar .stem .pt { position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 11px; height: 11px; border-radius: 50%; background: var(--muted); border: 2px solid var(--surface); }
.chart__bar .tag { font-size: .66rem; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.chart__axis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 8px; }
.chart__axis span { font-size: .72rem; text-align: center; color: var(--ink-soft); font-weight: 600; }
.chart__cap { font-size: .82rem; color: var(--muted); margin: 12px 0 0; }

/* photo gallery */
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); margin: 18px 0; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.gallery img { display: block; width: 100%; height: 165px; object-fit: cover; }
.gallery figcaption { font-size: .8rem; color: var(--muted); padding: 8px 10px; text-align: center; }
.gallery img, figure.shot img { cursor: zoom-in; }

/* lightbox (click a photo to enlarge) */
.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.86); padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 94vw; max-height: 94vh; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 8px; box-shadow: 0 12px 44px rgba(0,0,0,.55); }
.lightbox figcaption { color: #fff; margin-top: 14px; font-size: .92rem; text-align: center; }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, 1fr); } .gallery img { height: 130px; } }

/* green two-column table (Time to Explore) */
.gtable { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 20px 0; }
.gtable th { background: var(--green); color: #fff; text-align: left; font-weight: 700; font-size: .92rem; padding: 13px 14px; vertical-align: top; border: 2px solid var(--green); white-space: nowrap; }
.gtable td { padding: 14px 16px; vertical-align: top; color: var(--ink-soft); border: 2px solid var(--green); }
.gtable td.k { font-weight: 600; color: var(--ink); }
@media (max-width: 620px) { .gtable th { white-space: normal; font-size: .85rem; } }
.gtable ul { margin: 0; padding-left: 1.15em; }
.gtable li { margin: 4px 0; }

/* materials tables (colour set per table via --mc) */
.mtable { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 14px 0; }
.mtable td { border: 2px solid var(--mc, var(--blue)); padding: 11px 16px; text-align: center; color: var(--ink-soft); }
.mtable td.qty { font-weight: 600; color: var(--ink); }

/* two-column section layout */
.cols2grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; align-items: start; }
.cols2grid .col { min-width: 0; }
.cols2grid .block { margin: 0 0 32px; }
.cols2grid .block:last-child { margin-bottom: 0; }
@media (max-width: 720px) { .cols2grid { grid-template-columns: 1fr; } .cols2grid .col:first-child .block:last-child { margin-bottom: 32px; } }

/* two-column bullet list */
.cols2list { columns: 2; column-gap: 40px; }
.cols2list > li { break-inside: avoid; margin-bottom: 10px; }
@media (max-width: 720px) { .cols2list { columns: 1; } }

/* question banners + chips */
.qbanners { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.qbanner { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--ac, var(--blue)); border-radius: 0; padding: 9px 12px; font-size: .9rem; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* outlined box (distinct from filled cards) */
.obox { border: 2px solid var(--ac, var(--purple)); border-radius: 0; padding: 18px; background: transparent; display: flex; flex-direction: column; gap: 6px; }
.obox h3 { margin: 0 0 4px; font-size: 1.06rem; font-weight: 700; }
.obox p { margin: 0; font-size: .93rem; color: var(--ink-soft); }

/* colour legend */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-soft); }
.legend .dot { width: 12px; height: 12px; border-radius: 3px; background: var(--muted); flex: none; }

/* element list inside cards */
.card ul.mini { margin: 4px 0 12px; padding-left: 1.15em; font-size: .9rem; color: var(--ink-soft); columns: 2; column-gap: 20px; }
.card ul.mini li { margin: 3px 0; break-inside: avoid; }
.card .classes { font-size: .74rem; color: var(--muted); margin: 0 0 10px; }

/* wrap + footer */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px 80px; }
.foot { max-width: var(--maxw); margin: 44px auto 0; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) { .stats { grid-template-columns: repeat(3, 1fr); } .hero h1 { font-size: 1.9rem; } .toc ol { columns: 1; } }
@media (max-width: 440px) { .stats { grid-template-columns: repeat(2, 1fr); } }
