/* Turpial Software — site.css
   Tokens from design/brand/tokens.json. Night (dark) is the default; Day (light) via .theme-day. */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/space-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
/* Metric-matched fallbacks so the swap doesn't shift layout */
@font-face { font-family: "Space Grotesk Fallback"; src: local("Arial"), local("Helvetica"), local("Liberation Sans"); ascent-override: 89.7%; descent-override: 26.6%; line-gap-override: 0%; size-adjust: 109.7%; }
@font-face { font-family: "JetBrains Mono Fallback"; src: local("Courier New"), local("Courier"), local("Liberation Mono"); ascent-override: 75.4%; descent-override: 22.2%; line-gap-override: 0%; size-adjust: 134.6%; }

/* ---------- Tokens ---------- */
:root {
  /* Night */
  --ground: #0E1116;
  --panel: #171B22;
  --line: #2A303A;
  --ink: #E8EAED;
  --muted: #9AA3AF;
  --brand: #FF8A3D;
  --on-brand: #0E1116;
  --brand-text: #FF8A3D;
  --hood: #0E1116;
  --wing-white: #FFFFFF;
  --badge: #E8EAED;
  /* Control outline used by the approved designs for inputs, chips and cards (≥3:1 on panel) */
  --edge: #7A8494;

  --sans: "Space Grotesk", "Space Grotesk Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "JetBrains Mono Fallback", ui-monospace, SFMono-Regular, Menlo, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 44px;
  --space-6: 56px;

  --radius-none: 0;
  --radius-full: 9999px;

  --wrap: 1200px;
  color-scheme: dark;
}
.theme-day {
  --ground: #FAFAF7;
  --panel: #FFFFFF;
  --line: #DDE1E7;
  --ink: #0E1116;
  --muted: #5B6472;
  --brand-text: #A8400A;
  --badge: #FFFFFF;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; border-radius: var(--radius-none); }
button { cursor: pointer; }
a { color: var(--muted); text-decoration: none; }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--space-4); padding-right: var(--space-4); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 50; padding: 12px 16px; background: var(--brand); color: var(--on-brand); font-weight: 700; }
.skip:focus { top: 16px; color: var(--on-brand); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 700; line-height: 1.2;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn-primary:hover { color: var(--on-brand); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { color: var(--ink); }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Header ---------- */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); }
.site-header .wrap { padding-top: 16px; padding-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.lockup { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.lockup:hover { color: var(--ink); }
.lockup img { width: 40px; height: 40px; }
.lockup-text { display: flex; flex-direction: column; gap: 2px; }
.lockup-word { font-size: 20px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.lockup-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); line-height: 1.4; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.nav a:not(.btn) { font-family: var(--mono); font-size: 13px; display: inline-flex; align-items: center; min-height: 44px; }
.theme-day .nav a[aria-current="page"] { color: var(--ink); }

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--line); }
.section > .wrap { padding-top: 88px; padding-bottom: 88px; display: flex; flex-direction: column; gap: 40px; }
.section-head { display: flex; flex-direction: column; gap: 12px; }
.label { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; max-width: 760px; }
.lede { max-width: 620px; font-size: 17px; line-height: 1.55; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding-top: 88px; padding-bottom: 88px; display: flex; flex-wrap: wrap; align-items: center; gap: 56px; }
.hero-copy { flex: 1 1 500px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero-kicker { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; color: var(--brand-text); }
.hero h1 { font-size: clamp(40px, 5.2vw, 64px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.02; text-wrap: balance; }
.hero-sub { max-width: 560px; font-size: 18px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 8px; }

/* ---------- Console ---------- */
.console { flex: 1 1 420px; min-width: 0; background: var(--panel); border: 1px solid var(--line); font-family: var(--mono); font-size: 14px; line-height: 1.8; }
.console-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.console-dots { display: flex; gap: 6px; }
.console-dots span { width: 10px; height: 10px; background: var(--line); }
.console-dots span:last-child { background: var(--brand); }
.console-log { padding: 18px 20px 8px; height: 236px; overflow-y: auto; display: flex; flex-direction: column; margin: 0; list-style: none; }
.console-log li { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.console-log .p { flex-shrink: 0; color: var(--muted); }
.console-log .cmd { color: var(--ink); }
.console-log .cmd .p { color: var(--brand-text); }
.console-form { display: flex; align-items: center; gap: 10px; padding: 8px 20px 14px; }
.console-form label { color: var(--brand-text); }
.console-input-wrap { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.console-form input {
  width: 100%; min-width: 0; min-height: 40px; padding: 0 4px;
  background: transparent; border: 0; border-bottom: 1px solid var(--edge);
  color: var(--ink); font-family: inherit; font-size: 14px; caret-color: var(--brand);
}
.console-form input::placeholder { color: var(--muted); opacity: 1; }
.console-cursor { position: absolute; right: 6px; color: var(--brand); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .console-cursor { animation: blink 1.1s steps(1) infinite; } }
@media (prefers-reduced-motion: reduce) { .console-cursor { display: none; } }
.console-form input:focus ~ .console-cursor, .console-form input:not(:placeholder-shown) ~ .console-cursor { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.console-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 20px; }
.console-quick button { min-height: 36px; padding: 0 12px; background: var(--ground); border: 1px solid var(--edge); color: var(--ink); font-family: inherit; font-size: 13px; }
.console-quick button:hover { border-color: var(--ink); }

/* ---------- Skills ---------- */
.skills { display: flex; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); }
.skill-tabs { flex: 0 1 280px; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.skill-tabs button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 72px; padding: 0 24px; border: 0; border-bottom: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: 0.1em; text-align: left;
}
.skill-tabs button span + span { font-size: 12px; font-weight: 500; }
.skill-tabs button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.skill-tabs button:focus-visible { outline-offset: -4px; }
.skill-detail { flex: 1 1 480px; min-width: 0; padding: 40px; display: flex; flex-direction: column; gap: 28px; }
.skill-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.skill-head h3 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.skill-class { font-family: var(--mono); font-size: 13px; color: var(--brand-text); }
.skill-text { max-width: 620px; font-size: 17px; line-height: 1.55; color: var(--muted); }
.stats { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.stat { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); align-items: center; gap: 16px; }
.stat-label { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.bar { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.bar span { height: 12px; background: var(--line); }
.bar span.on { background: var(--brand); }

/* ---------- Quests ---------- */
.quests { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.quest {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 24px; min-height: 220px;
  background: var(--panel); border: 1px solid var(--edge); color: var(--ink);
  font-family: inherit; text-align: left;
}
.quest:hover { border-color: var(--ink); }
.quest-top { display: flex; width: 100%; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.quest-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.quest-text { font-size: 15px; line-height: 1.55; color: var(--muted); }
.quest[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.quest[aria-pressed="true"] .quest-text { color: var(--on-brand); }
.quest:focus-visible { outline-offset: 3px; }
.party { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border: 1px solid var(--line); font-family: var(--mono); font-size: 14px; }
.party-line { color: var(--muted); }
.party a { color: var(--brand-text); }

/* ---------- How ---------- */
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.level { background: var(--panel); border: 1px solid var(--line); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.level-num { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--brand-text); }
.level h3 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.level p { font-size: 15px; line-height: 1.55; color: var(--muted); }

/* ---------- Contact ---------- */
.contact { padding-top: 88px; padding-bottom: 96px; display: flex; flex-wrap: wrap; gap: 56px; }
.contact-copy { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.contact-kicker { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; color: var(--brand-text); }
.contact-copy h2 { font-size: clamp(36px, 4.4vw, 56px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.02; }
.contact-copy p { max-width: 460px; font-size: 18px; line-height: 1.5; color: var(--muted); }
.link-brand { color: var(--brand-text); text-decoration: underline; }
.link-brand:hover { color: var(--ink); }
.contact-panel { flex: 1 1 520px; min-width: 0; background: var(--panel); border: 1px solid var(--line); padding: 36px; }
.form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px;
  background: var(--ground); border: 1px solid var(--edge); color: var(--ink);
  font-family: inherit; font-size: 16px;
}
textarea.input { padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 140px; }
.input[aria-invalid="true"] { border-color: var(--brand); }
.err { font-size: 13px; color: var(--brand-text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; background: var(--ground); border: 1px solid var(--edge); color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 500; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.check { display: flex; align-items: flex-start; gap: 12px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.check label { font-size: 14px; line-height: 1.5; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.form-error { padding: 14px 16px; border: 1px solid var(--brand); font-size: 14px; line-height: 1.5; color: var(--ink); }
.btn-submit { align-self: flex-start; min-height: 52px; padding: 0 28px; font-size: 16px; border: 0; }
.success { display: flex; flex-direction: column; gap: 16px; min-height: 420px; justify-content: center; }
.success-kicker { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; color: var(--brand-text); }
.success h3 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.success p { font-size: 16px; line-height: 1.55; color: var(--muted); }
.success .btn { align-self: flex-start; }
.nojs { display: flex; flex-direction: column; gap: 16px; font-size: 16px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--ground); }
.site-footer .wrap { padding-top: 40px; padding-bottom: 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.footer-id { display: flex; align-items: center; gap: 12px; }
.footer-id img { width: 32px; height: 32px; flex-shrink: 0; }
.footer-id div { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.footer-id strong { color: var(--ink); }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; font-family: var(--mono); font-size: 13px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.linkbtn { min-height: 44px; padding: 0; background: transparent; border: 0; color: var(--muted); font-family: inherit; font-size: 13px; }
.linkbtn:hover { color: var(--ink); }
.footer-copy { color: var(--muted); }
.theme-day .site-footer { background: var(--panel); }
.theme-day .site-footer .wrap { padding-top: 32px; padding-bottom: 32px; font-size: 13px; color: var(--muted); }
.theme-day .site-footer a { color: var(--brand-text); text-decoration: underline; }
.theme-day .site-footer a:hover { color: var(--ink); }
.theme-day .site-footer .linkbtn { text-decoration: underline; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 24px; right: 24px; z-index: 20;
  width: min(340px, calc(100% - 48px));
  background: var(--panel); border: 1px solid var(--brand);
  padding: 16px 18px; display: flex; align-items: flex-start; gap: 14px;
}
.toast img { width: 40px; height: 40px; flex-shrink: 0; }
.toast-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.toast-kicker { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--brand-text); }
.toast-msg { font-size: 15px; font-weight: 700; line-height: 1.4; }
.toast-close { width: 44px; height: 44px; margin: -10px -10px 0 0; background: transparent; border: 0; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.toast-close:hover { color: var(--ink); }

/* ---------- Cookie banner ---------- */
.cookie {
  position: fixed; left: 24px; bottom: 24px; z-index: 19;
  width: min(440px, calc(100% - 48px));
  background: var(--panel); border: 1px solid var(--edge);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.cookie-kicker { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--brand-text); }
.cookie p { font-size: 14px; line-height: 1.5; color: var(--ink); }
.cookie p a { color: var(--brand-text); text-decoration: underline; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cookie .btn-ghost { border-color: var(--ink); }

/* ---------- Legal pages (Day) ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 72px 24px 96px; display: flex; flex-direction: column; gap: 40px; font-size: 16px; line-height: 1.65; }
.legal-head { display: flex; flex-direction: column; gap: 12px; }
.legal h1 { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.legal-intro { color: var(--muted); }
.legal section { display: flex; flex-direction: column; gap: 12px; }
.legal h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.legal ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.legal a { color: var(--brand-text); text-decoration: underline; }
.legal a:hover { color: var(--ink); }

/* ---------- 404 ---------- */
.lost { min-height: 60vh; padding-top: 88px; padding-bottom: 88px; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.lost .console { flex: none; max-width: 640px; width: 100%; }
.lost .console-log { height: auto; padding-bottom: 20px; }
.lost h1 { font-size: clamp(36px, 4.4vw, 56px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .wrap { padding-left: var(--space-3); padding-right: var(--space-3); }
  .hero, .section > .wrap, .contact { padding-top: 56px; padding-bottom: 56px; }
  .hero { gap: 40px; }
  .skill-tabs { flex: 1 1 100%; border-right: 0; }
  .skill-tabs button { min-height: 56px; }
  .skill-detail { padding: 24px var(--space-3); }
  .stat { grid-template-columns: 1fr; gap: 8px; }
  .contact-panel { padding: 24px var(--space-3); }
  .console-log { padding: 14px 14px 6px; }
  .console-form { padding: 8px 14px 12px; }
  .console-quick { padding: 0 14px 16px; }
  .legal { padding: 48px 16px 72px; }
  .legal h1 { font-size: 36px; }
  .toast { top: 16px; right: 16px; width: calc(100% - 32px); }
  .cookie { left: 16px; bottom: 16px; width: calc(100% - 32px); }
}
