/* SpectrumOS Thailand Workshop — shared styles. Light + dark themes via [data-theme]. */

:root {
  --purple: #A100FF;
  --pink: #E50695;
  --orange: #F4A100;
  --grad: linear-gradient(135deg, #A100FF, #E50695, #F4A100);
  --sans: "Roboto", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1000px;
}

/* ---------- light theme (default) ---------- */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7fb;
  --fg: #16161d;
  --muted: #56566a;
  --border: #e3e3ec;
  --card: #ffffff;
  --code: #f2f1f8;
  --highlight: #f0ecf9;
  --link: #8300d6;
  --tag: #f1ecfb;
  --code-fg: #6b21b8;
  --pre-fg: #2b2b33;
  --bar-bg: rgba(255,255,255,0.82);
  --gate-shadow: 0 18px 50px rgba(20,10,40,0.10);
  --error: #d11f5f;
  --hero-glow-op: 0.16;
}

/* ---------- dark theme ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e14;
  --fg: #ededf2;
  --muted: #a2a2b2;
  --border: #2b2b37;
  --card: #17171f;
  --code: #1b1b23;
  --highlight: #23232e;
  --link: #c4c4d4;
  --tag: #22222d;
  --code-fg: #d9c7ff;
  --pre-fg: #e0e0e0;
  --bar-bg: rgba(14,14,20,0.88);
  --gate-shadow: 0 18px 50px rgba(0,0,0,0.55);
  --error: #ff6b8a;
  --hero-glow-op: 0.20;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 74px; }
body { background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 18px; line-height: 1.7; -webkit-font-smoothing: antialiased; transition: background 0.25s ease, color 0.25s ease; }
body.locked { overflow: hidden; }
a { color: var(--link); }

.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- controls: theme toggle + language link ---------- */
.controls { display: flex; align-items: center; gap: 8px; }
.ctl { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; text-decoration: none; line-height: 1; transition: color 0.15s, border-color 0.15s; }
.ctl:hover { color: var(--fg); border-color: var(--purple); }
.theme-toggle { padding: 6px 9px; }
.theme-toggle svg { width: 15px; height: 15px; display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- password gate ---------- */
.gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, rgba(161,0,255,0.10), transparent 60%), var(--bg); padding: 24px; }
.gate-card { width: 100%; max-width: 380px; border: 1px solid var(--border); background: var(--card); border-radius: 14px; padding: 34px 30px; text-align: center; box-shadow: var(--gate-shadow); }
.gate-card.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }
.gate-brand { font-weight: 700; letter-spacing: -0.3px; font-size: 15px; }
.gate-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.gate-title { font-size: 30px; font-weight: 700; letter-spacing: -1px; margin: 22px 0 6px; }
.gate-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.gate input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--fg); font-family: var(--mono); font-size: 15px; letter-spacing: 3px; text-align: center; padding: 13px 14px; border-radius: 9px; outline: none; }
.gate input:focus { border-color: var(--purple); }
.gate button.gate-submit { width: 100%; margin-top: 12px; border: 0; cursor: pointer; color: #fff; font-family: var(--sans); font-weight: 700; font-size: 15px; letter-spacing: 0.4px; padding: 13px 14px; border-radius: 9px; background: var(--grad); }
.gate button.gate-submit:hover { filter: brightness(1.08); }
.gate-error { color: var(--error); font-size: 13px; margin-top: 14px; }
.gate-controls { justify-content: center; margin-top: 20px; }

/* ---------- header ---------- */
.header-bar { position: static; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 30px; border-bottom: 1px solid var(--border); background: var(--bar-bg); backdrop-filter: saturate(140%) blur(10px); }
.header-right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font-weight: 700; letter-spacing: -0.3px; font-size: 16px; }
.brand-sea { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 11px; border-radius: 7px; }
.topnav a:hover { color: var(--fg); background: var(--highlight); }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 30px; }
section { padding: 60px 0 6px; }
.section-num { font-family: var(--mono); font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.section-num .grad { font-weight: 700; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.14; }
h2 { font-size: 38px; font-weight: 700; letter-spacing: -0.8px; }
h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.lead { color: var(--muted); font-size: 20px; max-width: 70ch; margin-top: 12px; line-height: 1.7; }
p { margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 15.5px; }
ul.clean { margin: 12px 0; padding-left: 18px; }
ul.clean li { margin: 6px 0; }
ul.clean li::marker { color: var(--purple); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); padding: 74px 0 52px; }
.hero::after { content: ""; position: absolute; top: -140px; right: -120px; width: 420px; height: 420px; border-radius: 50%; background: var(--purple); filter: blur(90px); opacity: var(--hero-glow-op); pointer-events: none; }
.hero .inner { position: relative; z-index: 1; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.hero h1 { font-size: 68px; font-weight: 700; letter-spacing: -2px; line-height: 1.04; }
.hero .tagline { font-size: 22px; color: var(--fg); margin-top: 20px; max-width: 62ch; }
.hero .tagline b { color: var(--fg); }
.hero-stats { display: flex; gap: 16px; margin-top: 34px; flex-wrap: wrap; }
.hero-stat { flex: 1; min-width: 150px; border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 18px 20px; }
.stat-num { font-size: 34px; font-weight: 700; line-height: 1; }
.stat-label { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

/* ---------- quote ---------- */
.quote { border-left: 3px solid transparent; border-image: var(--grad) 1; background: var(--card); border-radius: 0 10px 10px 0; padding: 18px 22px; margin: 30px 0 0; max-width: 66ch; }
.quote p { font-size: 20px; font-style: italic; margin: 0; color: var(--fg); }
.quote .attr { font-size: 13px; color: var(--muted); margin-top: 8px; font-style: normal; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; margin-top: 8px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 20px 22px; }
.card h3 { margin-bottom: 5px; }
.card p:last-child { margin-bottom: 0; }

/* ---------- insight callout ---------- */
.insight { border: 1px solid var(--border); border-left: 3px solid var(--purple); background: var(--highlight); border-radius: 0 10px 10px 0; padding: 18px 22px; margin: 26px 0; }
.insight.pink { border-left-color: var(--pink); }
.insight.orange { border-left-color: var(--orange); }
.insight strong { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; }
.insight .grad { font-weight: 700; }
.insight p { margin: 0; font-size: 16px; }

/* ---------- numbered steps ---------- */
.steps { display: grid; gap: 14px; margin-top: 10px; counter-reset: step; }
.step { position: relative; border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 20px 22px 20px 64px; }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 20px; top: 20px; font-family: var(--mono); font-size: 13px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.step h3 { margin-bottom: 5px; }

/* keep long <pre>/code lines from forcing page-wide horizontal scroll on small screens:
   grid/flex items default to min-width:auto and won't shrink below their content */
.step, .card, .mode, .os, .beat, .tl .body { min-width: 0; }
pre { max-width: 100%; }

/* ---------- code ---------- */
code { font-family: var(--mono); font-size: 0.86em; background: var(--tag); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--code-fg); }
pre { background: var(--code); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 15px; line-height: 1.7; margin: 12px 0; }
pre code { background: none; border: 0; padding: 0; color: var(--pre-fg); font-size: inherit; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--highlight); font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--fg); font-weight: 500; }
td.mut, td { color: var(--muted); }
td code { white-space: nowrap; }

.brief-quote { font-style: italic; color: var(--fg); margin: 8px 0 12px; font-size: 14.5px; }

footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 34px 0 64px; color: var(--muted); font-size: 15px; }
footer .strip { height: 3px; width: 96px; border-radius: 3px; background: var(--grad); margin-bottom: 18px; }
footer b { color: var(--fg); }

/* ---------- sticky topbar + progress tracker ---------- */
#topbar { position: sticky; top: 0; z-index: 50; }

.progress-rail { border-bottom: 1px solid var(--border); background: var(--bar-bg); backdrop-filter: saturate(140%) blur(10px); }
.prog-inner { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.prog-meta { display: flex; align-items: baseline; gap: 10px; min-width: 232px; }
.prog-label { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.prog-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.prog-count b { font-weight: 700; }
.prog-track { position: relative; flex: 1; min-width: 120px; height: 14px; border-radius: 999px; background: linear-gradient(90deg, rgba(58,160,255,0.12), rgba(255,59,31,0.12)); border: 1px solid var(--border); }
.prog-fill { position: relative; display: block; height: 100%; width: 0; border-radius: 999px; overflow: hidden; background: var(--grad); transition: width 0.55s cubic-bezier(.34,1.3,.5,1), box-shadow 0.5s ease, background 0.5s ease; }
.prog-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 38%, rgba(255,246,214,0.85) 50%, transparent 62%); background-size: 240% 100%; mix-blend-mode: overlay; opacity: 0.3; animation: ember 1.8s linear infinite; }
.prog-track.hot .prog-fill::after { opacity: 0.65; animation-duration: 0.9s; }
@keyframes ember { 0% { background-position: 130% 0; } 100% { background-position: -130% 0; } }
.prog-spark { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); font-size: 21px; line-height: 1; pointer-events: none; transition: left 0.55s cubic-bezier(.34,1.3,.5,1); filter: drop-shadow(0 0 5px rgba(255,130,40,0.75)); }
.prog-track.hot .prog-spark { animation: flare 0.55s ease-in-out infinite alternate; }
@keyframes flare { from { transform: translate(-50%, -50%) scale(1) rotate(-5deg); } to { transform: translate(-50%, -58%) scale(1.22) rotate(5deg); } }
.prog-track.blazing { animation: blaze 0.85s ease-in-out infinite alternate; }
@keyframes blaze { from { box-shadow: 0 0 2px rgba(255,90,20,0.2); } to { box-shadow: 0 0 20px rgba(255,95,25,0.6); } }
.prog-status { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; color: var(--muted); white-space: nowrap; }
.prog-name { width: 148px; background: var(--bg); border: 1px solid var(--border); color: var(--fg); font-family: var(--sans); font-size: 13px; padding: 7px 11px; border-radius: 7px; outline: none; }
.prog-name:focus { border-color: var(--purple); }
.prog-name::placeholder { color: var(--muted); }
.prog-export { background: var(--grad); border: 0; color: #fff; font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 7px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.prog-export:hover { filter: brightness(1.09); }
.prog-reset { background: none; border: 1px solid var(--border); color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 6px 11px; border-radius: 7px; cursor: pointer; }
.prog-reset:hover { color: var(--fg); border-color: var(--purple); }

.trackable { position: relative; padding-right: 52px; }
.check { position: absolute; top: 16px; right: 16px; width: 25px; height: 25px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--bg); cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; transition: border-color 0.15s, background 0.15s; }
.check:hover { border-color: var(--purple); }
.check .tick { width: 6px; height: 11px; border: solid transparent; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-1px); transition: border-color 0.15s; }
.trackable.done { border-color: rgba(161,0,255,0.42); }
.trackable.done > .check { background: var(--grad); border-color: transparent; }
.trackable.done > .check .tick { border-color: #fff; }
.trackable.done h3 { color: var(--muted); }

.about-lead { font-size: 22px; color: var(--fg); max-width: 72ch; line-height: 1.6; margin-top: 12px; }
.about-lead b { color: var(--fg); }

.ask { border-left: 2px solid var(--pink); background: var(--code); border-radius: 0 8px 8px 0; padding: 11px 15px; margin: 12px 0; }
.ask .ask-label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--pink); margin-bottom: 5px; }
.ask p { margin: 0; font-size: 16px; font-style: italic; color: var(--fg); }
.or-line { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
.where { font-size: 14.5px; color: var(--muted); margin: 10px 0 0; }
.where b { color: var(--fg); font-family: var(--mono); }
.os-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 2px; }
.os { border: 1px solid var(--border); background: var(--code); border-radius: 8px; padding: 12px 15px; }
.os .os-name { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--pink); margin-bottom: 5px; }
.os p { margin: 0; font-size: 15.5px; }
.os code { font-size: 0.82em; }

.modes { display: grid; gap: 12px; margin-top: 10px; }
.mode { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 16px 18px; }
.mode-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mode-head h4 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.cmd { font-family: var(--mono); font-size: 14px; background: var(--tag); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; color: var(--code-fg); white-space: nowrap; }
.stagerow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 13px; }
.stg { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.stg.on { color: #fff; border-color: transparent; background: var(--grad); font-weight: 700; }
.stg-sep { color: var(--border); font-size: 12px; }
.mode-note { margin: 11px 0 0; }
.mode-note code { font-size: 0.84em; }

/* ---------- responsive (kept last so these overrides win the cascade) ---------- */
@media (max-width: 760px) {
  .hero h1 { font-size: 44px; letter-spacing: -1.2px; }
  .topnav { display: none; }
  .grid.cols-2, .grid.cols-3, .os-grid { grid-template-columns: 1fr; }
  section { padding: 44px 0 4px; }
  .header-bar { padding: 12px 16px; }
  .wrap { padding: 0 18px; }
  h2 { font-size: 30px; }
  .lead, .about-lead { font-size: 18px; }
  .prog-inner { flex-wrap: wrap; }
  .prog-meta { min-width: 0; flex-basis: 100%; }
  .prog-track { flex-basis: 100%; order: 2; }
  .prog-name { flex: 1 1 140px; order: 3; }
  .prog-export, .prog-reset { order: 3; }
}

