/* ============================================================================
   Axis Utility — HTML Manual stylesheet
   Self-contained, no external fonts or network requests (works fully offline).
   Layout and components follow the GranulOre manual pattern.
   ============================================================================ */

:root {
  --bg:            #0c0d10;
  --bg-panel:      #15171c;
  --bg-elev:       #1b1e25;
  --ink:           #e7e9ee;
  --ink-soft:      #a3a8b4;
  --ink-faint:     #6f7682;
  --accent:        #6db1ff;   /* primary links / card titles */
  --accent-l:      #5fa2fc;   /* Left channel */
  --accent-r:      #b84ffb;   /* Right channel */
  --accent-soft:   #57d08a;   /* tips / secondary */
  --line:          #2a2e38;
  --code-bg:       #11131a;
  --warn-bg:       #2a2410;
  --warn-line:     #ffcc44;
  --tip-bg:        #122421;
  --tip-line:      #57d08a;
  --max:           980px;
  --radius:        10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout: fixed sidebar + scrolling content ------------------------- */
.layout { display: flex; align-items: flex-start; }

#sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 264px;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  padding: 22px 18px 60px;
}

.brand-logo {
  display: block;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  line-height: 0;
}
.brand-logo img {
  display: block;
  width: 100%;
  max-width: 228px;
  height: auto;
  opacity: 0.92;
}
.brand-logo:hover img { opacity: 1; }

#sidebar .brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
#sidebar .brand b { color: var(--accent-l); }
#sidebar .brand small {
  display: block;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 12px;
  margin-top: 2px;
}
#sidebar nav { margin-top: 18px; }
#sidebar nav a {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 14px;
}
#sidebar nav a:hover { background: var(--bg-elev); color: var(--ink); }
#sidebar nav a.section {
  margin-top: 14px;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  padding-left: 6px;
  pointer-events: none;
}
#sidebar nav a.sub { padding-left: 22px; font-size: 13px; }
#sidebar nav a.current {
  color: var(--ink);
  font-weight: 600;
  background: var(--bg-elev);
}

/* ---- Manual search (sidebar) ------------------------------------------- */
.manual-search {
  position: relative;
  margin: 16px 0 4px;
}
.manual-search-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
#manual-search-input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236f7682' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 10px center;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
#manual-search-input::placeholder { color: var(--ink-faint); }
#manual-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(109, 177, 255, 0.15);
}
.manual-search-hint {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
}
.manual-search-results {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.manual-search-results[hidden] { display: none; }
.manual-search-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-faint);
}
.manual-search-list {
  list-style: none;
  margin: 0;
  padding: 6px;
}
.manual-search-hit {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}
.manual-search-hit:hover,
.manual-search-hit:focus {
  background: var(--bg-panel);
  outline: none;
}
.manual-search-hit-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.manual-search-hit-page {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.manual-search-hit-snippet {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}

main {
  flex: 1 1 auto;
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 36px 120px;
}

/* ---- Typography -------------------------------------------------------- */
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; }
h2 {
  font-size: 23px;
  margin: 52px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 16px;
}
[id] { scroll-margin-top: 16px; }
h3 { font-size: 18px; margin: 30px 0 8px; color: var(--ink); scroll-margin-top: 16px; }
h4 { font-size: 15px; margin: 20px 0 6px; color: var(--accent-soft); text-transform: uppercase; letter-spacing: .05em; }
p  { margin: 10px 0; color: var(--ink); }
a  { color: var(--accent); }
ul, ol { padding-left: 22px; }
li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
strong { color: #fff; }
.lead { font-size: 18px; color: var(--ink-soft); }
.muted { color: var(--ink-faint); }
.kbd, code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}
kbd { box-shadow: 0 1px 0 var(--line); }

/* ---- Header banner ----------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #1a1d26, #0c0d10);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 10px;
}
.hero .ver {
  display: inline-block;
  background: var(--accent-l);
  color: #0a1628;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
}

.credits-block { margin: 8px 0 20px; }
.credits-logo {
  display: inline-block;
  margin-top: 12px;
  line-height: 0;
}
.credits-logo img {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(100%, 320px);
  opacity: 0.95;
}
.credits-logo:hover img { opacity: 1; }

/* ---- Quick-jump card grid ---------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.cards .card {
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  margin: 0;
}
.cards .card:hover { border-color: var(--accent); }
.cards .card b { color: var(--accent); }
.cards .card span {
  display: block;
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 4px;
}

/* ---- Channel tags & format pills --------------------------------------- */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.tag.l { color: var(--accent-l); border-color: var(--accent-l); }
.tag.r { color: var(--accent-r); border-color: var(--accent-r); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Display-mode pills — coloured borders for visibility */
.pill-row.modes .pill {
  border-width: 1.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
}
.pill-row.modes .pill:nth-child(1) { border-color: #6db1ff; }
.pill-row.modes .pill:nth-child(2) { border-color: #57d08a; }
.pill-row.modes .pill:nth-child(3) { border-color: #b84ffb; }
.pill-row.modes .pill:nth-child(4) { border-color: #ffcc44; }
.pill-row.modes .pill:nth-child(5) { border-color: #ff8a65; }
.pill-row.modes .pill:nth-child(6) { border-color: #5ce1e6; }

/* ---- Tables ------------------------------------------------------------ */
table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; vertical-align: top; }
th { background: var(--bg-elev); color: var(--ink); font-weight: 600; }
tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
td code { font-size: 12.5px; }

/* ---- Callouts ---------------------------------------------------------- */
.note, .tip, .warn {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  border-left: 4px solid var(--line);
  background: var(--bg-panel);
  font-size: 15px;
  line-height: 1.65;
}
.tip  { border-left-color: var(--tip-line);  background: var(--tip-bg); }
.warn { border-left-color: var(--warn-line); background: var(--warn-bg); }

/* Title line only — not every inline <b> */
:is(.tip, .note, .warn) > b:first-child,
:is(.tip, .note, .warn) > p:first-child > b:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.tip  > b:first-child,
.tip  > p:first-child > b:first-child { color: var(--tip-line); }
.warn > b:first-child,
.warn > p:first-child > b:first-child { color: var(--warn-line); }

:is(.tip, .note, .warn) > p:first-child { margin-top: 0; }
:is(.tip, .note, .warn) > p:last-child  { margin-bottom: 0; }
:is(.tip, .note, .warn) ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
:is(.tip, .note, .warn) ul li { margin: 5px 0; }
:is(.tip, .note, .warn) ul li:last-child { margin-bottom: 0; }

/* ---- Figures ----------------------------------------------------------- */
figure { margin: 22px 0; }
figure.center img {
  margin-left: auto;
  margin-right: auto;
}
figure img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
figcaption {
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

/* ---- Screenshot slots (pending assets in assets/) ------------------------ */
.shot-slot { margin: 22px 0; }
.shot-slot img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.shot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  padding: 22px 20px;
  text-align: center;
  background: repeating-linear-gradient(
    -45deg,
    var(--bg-panel),
    var(--bg-panel) 10px,
    var(--bg-elev) 10px,
    var(--bg-elev) 20px
  );
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}
.shot-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.shot-label code {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
}
.shot-brief {
  margin: 0;
  max-width: 42em;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.shot-slot.shot-done .shot-placeholder { display: none; }

.shot-guide-table { font-size: 14px; }
.shot-guide-table td:first-child { white-space: nowrap; }
.shot-guide-table .shot-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.shot-status--done { color: var(--accent-soft); }
.shot-status--need { color: #e8b84a; }

/* ---- Signal flow charts (offline — no Mermaid JS) ----------------------- */
.flowchart-wrap {
  margin: 24px 0;
}
.flowchart-wrap > .signal-flow,
.flowchart-wrap > .flow-mini {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 22px;
}
.flowchart-wrap figcaption {
  margin-top: 10px;
}

.signal-flow { max-width: 100%; }

.flow-io {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid #4b5563;
  background: rgba(243, 244, 246, 0.08);
  color: var(--ink);
  max-width: 220px;
  margin: 0 auto;
}

.flow-vline {
  width: 2px;
  height: 18px;
  background: var(--line);
  margin: 0 auto;
}

.flow-split {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 14px;
  align-items: stretch;
}

.flow-panel {
  border-radius: var(--radius);
  border: 2px solid var(--line);
  padding: 14px 12px 16px;
  min-width: 0;
}
.flow-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 12px;
  text-align: center;
}
.flow-panel--dry {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.1);
}
.flow-panel--dry .flow-panel-title { color: #93c5fd; }
.flow-panel--wet {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}
.flow-panel--wet .flow-panel-title { color: #fcd34d; }

.flow-step {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  color: var(--ink-soft);
}
.flow-step b { color: var(--ink); font-weight: 600; }
.flow-step em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.flow-arrow {
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1;
  padding: 3px 0;
}

.flow-dry-branch .flow-step--decision {
  border-style: dashed;
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.06);
}

.flow-chain {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow-merge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 2px;
}
.flow-merge::before,
.flow-merge::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--line);
  max-width: 120px;
}

.flow-stage {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid;
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.4;
}
.flow-stage small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}
.flow-stage--mix {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}
.flow-stage--out {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}

.flow-tail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}

/* Compact horizontal mini-flows */
.flow-mini {
  margin: 18px 0;
  overflow-x: auto;
}
.flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 4px;
  min-width: min(100%, 520px);
  margin: 0 auto;
}
.flow-pill {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 8px;
  border: 2px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--ink);
}
.flow-pill small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 1px;
}
.flow-pill--dry { border-color: #3b82f6; background: rgba(37, 99, 235, 0.1); }
.flow-pill--wet { border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.flow-pill--mix { border-color: #10b981; background: rgba(16, 185, 129, 0.12); }
.flow-pill--out { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.12); }
.flow-pill--gain { border-color: #6366f1; background: rgba(99, 102, 241, 0.12); }
.flow-pill--swap { border-color: #ec4899; background: rgba(236, 72, 153, 0.1); }
.flow-pill--tap { border-color: #a855f7; background: rgba(168, 85, 247, 0.1); }
.flow-row + .flow-row { margin-top: 10px; }
.flow-chev {
  flex: 0 0 auto;
  color: var(--ink-faint);
  font-size: 16px;
  padding: 0 2px;
  user-select: none;
}

/* ---- Spectrum calibration (manual) ------------------------------------- */
.cal-flow {
  padding: 16px 12px;
  overflow-x: auto;
}
.cal-flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 4px;
  min-width: min(100%, 640px);
  margin: 0 auto;
}
.cal-flow-step {
  flex: 0 1 auto;
  min-width: 88px;
  max-width: 120px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  color: var(--ink);
}
.cal-flow-step small {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.cal-flow-step--gen { border-color: #3b82f6; background: rgba(59, 130, 246, 0.12); }
.cal-flow-step--fft { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.12); }
.cal-flow-step--peak { border-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.cal-flow-step--db { border-color: #06b6d4; background: rgba(6, 182, 212, 0.1); }
.cal-flow-step--pass { border-color: #57d08a; background: rgba(87, 208, 138, 0.12); color: #6ee7b7; }
.cal-flow-arrow {
  flex: 0 0 auto;
  color: var(--ink-faint);
  font-size: 16px;
  font-weight: 700;
  padding: 0 2px;
}
.cal-chart-wrap {
  margin: 22px 0;
  padding: 18px 16px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cal-chart {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  height: auto;
}
.cal-report {
  margin: 16px 0;
  padding: 16px 18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.cal-report code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--ink-soft);
  white-space: pre;
}

.signalflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.signalflow-grid h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink);
}

@media (max-width: 720px) {
  .flow-split { grid-template-columns: 1fr; }
  .flow-merge::before,
  .flow-merge::after { max-width: 40px; }
}

footer {
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 60px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

/* ---- Responsive / print ------------------------------------------------ */
@media (max-width: 860px) {
  .layout { display: block; }
  #sidebar {
    position: static;
    height: auto;
    width: auto;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  main { padding: 24px 18px 80px; }
}
@media print {
  #sidebar { display: none; }
  body { background: #fff; color: #000; }
  main { max-width: none; }
  .hero, .note, .tip, .warn, th { background: #fff !important; }
  a { color: #000; text-decoration: underline; }
  h2 { page-break-after: avoid; }
  figure, table { page-break-inside: avoid; }
}
