/* Torqwave's website: Studio Obsidian dark aesthetic with official Torqwave Hot Orange (#ff5c1f)
   brand identity (matching Art/ridges.py HOT = #ff5c1f), plus a clean accessible light mode. */

:root {
  color-scheme: dark light;
  --bg: #07090e;
  --bg-2: #0c1018;
  --panel: rgba(16, 21, 32, 0.86);
  --panel-solid: #101520;
  --panel-hi: #161d2c;
  --line: #1f293a;
  --line-hi: #314059;
  --text: #cbd5e1;
  --strong: #f8fafc;
  --dim: #8a97ab;
  --faint: #64728a;
  --brand: #ff5c1f;
  --brand-hi: #ff7a45;
  --brand-soft: rgba(255, 92, 31, 0.13);
  --brand-glow: rgba(255, 92, 31, 0.28);
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
  --good: #34e8a8;
  --warn: #f4ca53;
  --shot: #06080c;
  --code: #131926;
  --bar: rgba(7, 9, 14, 0.82);
  --grid: rgba(255, 255, 255, 0.026);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f8;
    --bg-2: #eceef2;
    --panel: rgba(255, 255, 255, 0.94);
    --panel-solid: #ffffff;
    --panel-hi: #f9fafb;
    --line: #dcdfe6;
    --line-hi: #c1c7d2;
    --text: #272d37;
    --strong: #0c0f14;
    --dim: #5d6675;
    --faint: #7d8694;
    --brand: #d9480f;
    --brand-hi: #e8590c;
    --brand-soft: rgba(217, 72, 15, 0.10);
    --brand-glow: rgba(217, 72, 15, 0.18);
    --good: #188a55;
    --warn: #a86b08;
    --shot: #0e1116;
    --code: #eceef3;
    --bar: rgba(246, 246, 248, 0.86);
    --grid: rgba(12, 15, 20, 0.032);
    --shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font: 16px/1.62 "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(900px 520px at 14% -6%, var(--brand-soft), transparent 62%),
    radial-gradient(840px 540px at 88% 4%, rgba(56, 189, 248, 0.06), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px, 100% 100%;
  background-attachment: fixed, fixed, scroll, scroll, fixed;
}

a { color: var(--brand-hi); text-underline-offset: 3px; transition: color 0.15s ease; }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; }

/* Sticky frosted navigation bar */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
.top-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px 20px;
  flex-wrap: wrap;
}
.mark {
  display: inline-flex;
  align-items: center;
  color: var(--strong);
  font: 800 18px/1 "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  letter-spacing: 0.12em;
  text-decoration: none;
}
.mark::before {
  content: "";
  width: 4px;
  height: 18px;
  margin-right: 10px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), #ff9248);
  box-shadow: 0 0 12px var(--brand-glow);
}
.mark span { color: var(--brand); }
.mark:hover { color: var(--strong); }
.ver-pill {
  font: 700 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  color: var(--brand-hi);
  background: var(--brand-soft);
  border: 1px solid rgba(255, 92, 31, 0.35);
  border-radius: 999px;
  padding: 4px 9px;
  text-decoration: none;
}
.top-nav {
  display: flex;
  gap: 2px 4px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}
.top-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.top-nav a:hover { color: var(--strong); background: var(--brand-soft); }
.top-nav a[aria-current] {
  color: var(--strong);
  font-weight: 650;
  background: var(--brand-soft);
  box-shadow: inset 0 -2px 0 var(--brand);
  border-radius: 8px 8px 2px 2px;
}
.top-nav a.get {
  background: linear-gradient(135deg, var(--brand), #ff7a33);
  color: #fff;
  font-weight: 700;
  margin-left: 8px;
  padding: 7px 14px;
  box-shadow: 0 4px 18px var(--brand-glow);
}
.top-nav a.get:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }

/* Page container & Hero */
.page { max-width: 1200px; margin: 0 auto; padding: 48px 20px 80px; }

.hero {
  position: relative;
  padding: 20px 0 12px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--brand-hi);
  background: var(--brand-soft);
  border: 1px solid rgba(255, 92, 31, 0.36);
  margin-bottom: 18px;
}
.hero-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}
.hero h1 {
  margin: 0;
  color: var(--strong);
  font: 850 clamp(44px, 7.5vw, 76px)/0.98 "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  letter-spacing: -0.03em;
}
.hero h1 span {
  color: var(--brand);
  text-shadow: 0 0 42px var(--brand-glow);
}
.hero .tag {
  margin: 18px 0 0;
  color: var(--strong);
  font-size: clamp(20px, 2.8vw, 27px);
  font-weight: 500;
  max-width: 820px;
  line-height: 1.32;
  letter-spacing: -0.015em;
}
.hero .sub {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 16.5px;
  max-width: 780px;
}

.title h1 {
  margin: 0;
  color: var(--strong);
  font: 800 clamp(30px, 4.5vw, 44px)/1.1 "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.025em;
}
.title p { margin: 12px 0 0; color: var(--dim); max-width: 840px; }
.crumbs { margin: 0 0 12px; font-size: 14px; color: var(--dim); }
.crumbs a { text-decoration: none; }

.actions { margin: 28px 0 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-weight: 650;
  font-size: 15px;
  border: 1px solid var(--line-hi);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary {
  background: linear-gradient(135deg, var(--brand), #ff7a33);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 26px var(--brand-glow);
}
.button.primary:hover { color: #fff; filter: brightness(1.07); box-shadow: 0 12px 32px var(--brand-glow); }
.button.plain {
  color: var(--strong);
  background: var(--panel);
  border-color: var(--line-hi);
}
.button.plain:hover {
  color: var(--brand-hi);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.meta { color: var(--dim); font-size: 14px; margin: 10px 0 0; max-width: 880px; }

.chips { margin: 26px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chips a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--panel);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chips a:hover { border-color: var(--brand); color: var(--brand-hi); background: var(--brand-soft); }
.chips a b { color: var(--brand-hi); font-weight: 700; margin-left: 5px; }

/* Studio-framed screenshots */
figure { margin: 32px 0 0; }
figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--line-hi);
  border-radius: 14px;
  background: var(--shot);
  box-shadow: var(--shadow);
}
figcaption { margin-top: 10px; color: var(--dim); font-size: 14px; }

/* Headings & Section dividers */
.page h2 {
  margin: 84px 0 8px;
  color: var(--strong);
  font: 800 clamp(24px, 3vw, 31px)/1.18 "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page h2::before {
  content: "";
  width: 4px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), #ff9248);
  flex: none;
  box-shadow: 0 0 12px var(--brand-glow);
}
.page h2 small { color: var(--dim); font-weight: 500; font-size: 15px; letter-spacing: 0; }
.page h3.sub { margin: 36px 0 4px; color: var(--strong); font-size: 18px; }
.page h3.sub small { color: var(--dim); font-weight: 400; font-size: 14px; margin-left: 6px; }
.lede { margin: 0 0 6px; color: var(--dim); font-size: 16.5px; max-width: 860px; }

/* KPI Strip & Cards */
.numbers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.numbers div {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.numbers div::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 0;
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), #ff9248);
}
.numbers div:hover { border-color: rgba(255, 92, 31, 0.45); transform: translateY(-2px); }
.numbers b {
  display: block;
  color: var(--strong);
  font: 800 32px/1.05 "SF Pro Display", -apple-system, sans-serif;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.numbers span { color: var(--dim); font-size: 13.5px; line-height: 1.38; display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.card::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 0;
  width: 56px;
  height: 2.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
  opacity: 0.7;
}
.card h3 { margin: 0 0 8px; color: var(--strong); font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 14.5px; color: var(--text); }
.card p + p { margin-top: 9px; }
.card .more { font-size: 13.5px; font-weight: 600; }
a.card { text-decoration: none; color: var(--text); display: block; }
a.card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}
a.card .count {
  color: var(--brand-hi);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 18px; }
.pair figure { margin-top: 22px; }
ul.plain { margin: 16px 0 0; padding-left: 20px; max-width: 880px; }
ul.plain li { margin: 7px 0; }

/* Feature areas on front page */
.area {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 32px;
  align-items: start;
  margin-top: 24px;
}
.area.flip > .words { order: 2; }
.area .words > p { margin: 0 0 10px; }
.area ul { margin: 10px 0 0; padding-left: 20px; }
.area li { margin: 8px 0; font-size: 15px; }
.area figure { margin: 0; }
.area .read { margin-top: 16px; font-size: 14.5px; font-weight: 500; }
@media (max-width: 840px) { .area { grid-template-columns: 1fr; } .area.flip > .words { order: 0; } }

/* Audio Clip Cards */
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; margin-top: 18px; }
.clip {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.clip:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.clip .kind {
  color: var(--brand-hi);
  font: 700 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.clip h3, .clip h4 { margin: 0; color: var(--strong); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.clip p { margin: 6px 0 0; font-size: 13.5px; color: var(--dim); line-height: 1.48; }
.clip p.what { color: var(--text); }
.clip .fill { flex: 1; min-height: 12px; }
.clip ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--dim); }
audio { width: 100%; height: 38px; display: block; border-radius: 8px; }
.clip.playing {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), 0 14px 36px var(--brand-glow);
}

/* Tables & Quality measurement blocks */
table.facts, .doc table {
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
table.facts th, table.facts td, .doc th, .doc td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
table.facts th, .doc th { background: var(--panel-hi); color: var(--strong); font-weight: 650; }
table.facts td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 14px; }
.shots figure { margin: 0; }
.shots figcaption { margin: 6px 0 8px; color: var(--strong); font-size: 14px; font-weight: 650; }
.shots img { border-radius: 8px; box-shadow: none; }
.demo { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 22px; }
.demo h3 { margin: 0 0 6px; color: var(--strong); font-size: 20px; }
.demo dl { margin: 10px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; font-size: 14.5px; }
.demo dt { color: var(--dim); font-weight: 600; }
.demo dd { margin: 0; }
.note { border-left: 3px solid var(--warn); background: var(--panel); padding: 12px 16px; margin: 16px 0 0; font-size: 14.5px; border-radius: 0 10px 10px 0; max-width: 900px; }
blockquote.said { margin: 14px 0 0; padding: 14px 18px; border-left: 3px solid var(--brand); background: var(--panel); border-radius: 0 10px 10px 0; font-size: 14.5px; }
blockquote.said p { margin: 0; }
blockquote.said footer { margin-top: 8px; color: var(--dim); font-size: 13px; }
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; margin-top: 18px; }
.quotes blockquote.said { margin: 0; }

/* User Guide & Markdown docs */
.with-side { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 40px; padding: 0 20px; }
.side { position: sticky; top: 58px; align-self: start; max-height: calc(100vh - 58px); overflow-y: auto; padding: 30px 0; font-size: 14.5px; }
.side summary { color: var(--brand-hi); font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: 0.10em; cursor: pointer; list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.side ol { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: page; }
.side li { counter-increment: page; }
.side li a, .side p a { display: block; padding: 6px 11px; border-radius: 8px; color: var(--text); text-decoration: none; transition: background 0.15s ease, color 0.15s ease; }
.side li a::before { content: counter(page) "  "; color: var(--faint); font-variant-numeric: tabular-nums; white-space: pre; }
.side li a:hover, .side p a:hover { background: var(--brand-soft); color: var(--strong); }
.side a.here { background: var(--brand-soft); color: var(--strong); font-weight: 650; box-shadow: inset 3px 0 0 var(--brand); }
.side p { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

.doc { min-width: 0; padding: 32px 0 72px; max-width: 840px; }
.doc.alone { margin: 0 auto; padding: 32px 20px 72px; max-width: 880px; }
.doc h1 { margin: 0 0 14px; color: var(--strong); font: 800 clamp(28px, 4.4vw, 38px)/1.12 "SF Pro Display", -apple-system, sans-serif; letter-spacing: -0.025em; }
.doc h2 { margin: 48px 0 12px; color: var(--strong); font-size: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--line); line-height: 1.25; }
.doc h3 { margin: 32px 0 8px; color: var(--strong); font-size: 18.5px; }
.doc h4 { margin: 24px 0 6px; color: var(--strong); font-size: 16px; }
.doc p, .doc li { overflow-wrap: break-word; }
.doc h1 + p { color: var(--dim); font-size: 14.5px; }
.doc h1 + p a { text-decoration: none; }
.doc li { margin: 5px 0; }
.doc img { display: block; margin: 20px 0 8px; border: 1px solid var(--line-hi); border-radius: 12px; background: var(--shot); box-shadow: var(--shadow); }
.doc p > em:only-child { color: var(--dim); font-size: 14px; font-style: normal; }
.doc code { background: var(--code); border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 6px; font: 13.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.doc pre { background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.doc pre code { background: none; border: 0; padding: 0; overflow-wrap: normal; }
.doc blockquote { margin: 18px 0; padding: 4px 18px; border-left: 3px solid var(--brand); color: var(--dim); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 52px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.pager:empty { display: none; }
.pager a { text-decoration: none; }
.pager .next { margin-left: auto; text-align: right; }

@media (max-width: 860px) {
  .with-side { grid-template-columns: 1fr; gap: 0; }
  .side { position: static; max-height: none; padding: 14px 0 0; }
  .side details { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px 12px; }
  .side summary::after { content: " ▾"; }
  .doc { padding-top: 18px; }
}

.foot { border-top: 1px solid var(--line); color: var(--dim); font-size: 14px; background: var(--bar); }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 24px 20px 36px; display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; align-items: center; }
.foot p { margin: 4px 0; }
