/* davelee.ai — terminal-inspired stylesheet */

:root{
  --accent: #f5a524;
  --accent-rgb: 245,165,36;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --unit: 16px;
  --lh: 1.55;
  --base: 14px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --bar-h: 36px;
  --sb-h: 28px;

  --bg: #0b0c0e;
  --bg-2: #111216;
  --bg-3: #16181d;
  --fg: #e8e6df;
  --fg-2: #b6b3aa;
  --fg-3: #6f6c63;
  --line: rgba(232,230,223,0.10);
  --line-strong: rgba(232,230,223,0.22);
  --hover: rgba(255,255,255,0.04);
}

body[data-theme="light"]{
  --bg: #f5f3ec;
  --bg-2: #efece3;
  --bg-3: #e7e3d6;
  --fg: #1a1a1a;
  --fg-2: #4a4843;
  --fg-3: #8a8780;
  --line: rgba(20,20,20,0.10);
  --line-strong: rgba(20,20,20,0.22);
  --hover: rgba(0,0,0,0.03);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin:0; padding:0; }
html { scroll-behavior: smooth; }

body{
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: var(--base);
  line-height: var(--lh);
  font-feature-settings: "calt" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  touch-action: manipulation;
}

body.nav-drawer-open{
  overflow: hidden;
  overscroll-behavior: none;
}

/* CRT scanline overlay */
body[data-crt="on"]::after{
  content:"";
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(0deg,
    rgba(0,0,0,0.18) 0px,
    rgba(0,0,0,0.18) 1px,
    transparent 1px,
    transparent 3px);
  mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: #0b0c0e; }

.dim { color: var(--fg-3); }
.hl  { color: var(--accent); }
.mono-tab { font-variant-numeric: tabular-nums; }
.small { font-size: 11px; }

.kbd{
  display: inline-block;
  color: var(--accent);
  margin-right: 6px;
}

.dot{ display:inline-block; width:7px; height:7px; border-radius:50%; background: var(--fg-3); margin-right:6px; }
.dot.ok{ background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.6); }

/* ─── layout ─── */
.root{
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  padding-top: calc(var(--bar-h) + var(--safe-top));
  padding-bottom: calc(var(--sb-h) + var(--safe-bottom));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.main{
  border-left: 1px solid var(--line);
  min-width: 0;
}

/* ─── topbar ─── */
.topbar{
  position: fixed; top: 0; left: 0; right: 0;
  height: calc(var(--bar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: max(0px, var(--safe-left));
  padding-right: max(0px, var(--safe-right));
  display: grid; grid-template-columns: 240px 1fr 240px; align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  font-size: 11.5px;
}
.tb-left, .tb-mid, .tb-right{ display:flex; align-items:center; gap:8px; padding: 0 14px; }
.tb-left{ min-width: 0; }
.tb-mid{ justify-content: center; }
.tb-right{ justify-content: flex-end; }
.tb-brand{
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 2px;
}
.tb-logo{
  display: block;
  border-radius: 5px;
}
.tb-brand:hover .tb-logo{ box-shadow: 0 0 0 1px var(--accent); }
.tb-left .sep{ color: var(--fg-3); }
.tb-bar{ width: 120px; height: 4px; background: var(--bg-3); border:1px solid var(--line); position:relative; }
.tb-bar-fill{ position:absolute; inset:0; right:auto; background: var(--accent); transition: width .12s linear; }

.tb-menu-btn{
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 34px;
  margin: 0 2px 0 -4px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s;
}
.tb-menu-btn:active{ background: var(--bg-3); }
.tb-menu-btn[data-open="1"]{
  border-color: var(--accent);
  color: var(--accent);
}
.tb-menu-ico{ display: block; opacity: 0.92; }
.tb-crumb{ display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right-short{ display: inline; }
.tb-tweaks-hint{ display: inline; }

/* ─── statusbar ─── */
.statusbar{
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--sb-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  padding-left: max(0px, var(--safe-left));
  padding-right: max(0px, var(--safe-right));
  display: flex; align-items: center;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  z-index: 50;
  font-size: 11px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.statusbar::-webkit-scrollbar{ display: none; }
.sb-cell{ padding: 0 14px; border-right: 1px solid var(--line); display:flex; align-items:center; gap:6px; height:100%; flex-shrink: 0; }
.sb-cell.flex{ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── sidebar ─── */
.sidebar{
  position: sticky; top: calc(var(--bar-h) + var(--safe-top));
  align-self: start;
  height: calc(100vh - var(--bar-h) - var(--sb-h) - var(--safe-top) - var(--safe-bottom));
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; gap: 24px;
  font-size: 11.5px;
  overflow-y: auto;
}

.side-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: -6px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.side-brand:hover .side-brand-name{ color: var(--accent); }
.side-brand-logo{
  display: block;
  flex-shrink: 0;
  border-radius: 8px;
}
.side-brand-name{
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  transition: color .15s;
}

.side-block{ display:flex; flex-direction:column; gap:6px; }
.side-h{
  font-size: 10px; letter-spacing: 0.14em; color: var(--fg-3);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px; margin-bottom: 4px;
}
.side-row{ display:flex; justify-content: space-between; gap:10px; }
.side-row > span:first-child{ width: 52px; }

.side-nav{ list-style: none; margin:0; padding: 0; display:flex; flex-direction:column; gap:1px; }
.side-nav li a{
  display: grid; grid-template-columns: 22px 1fr 24px;
  align-items: center; gap: 8px; padding: 4px 6px;
  color: var(--fg-2);
  border-left: 2px solid transparent;
}
.side-nav li a:hover{ color: var(--fg); background: var(--hover); }
.side-nav li.on a{ color: var(--accent); border-left-color: var(--accent); background: var(--hover); }
.side-nav .bar{
  height: 1px; background: var(--line);
}
.side-nav li.on .bar{ background: var(--accent); }

.side-foot{ margin-top: auto; }

.side-link{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-2);
  transition: color .15s;
}
.side-link:hover{ color: var(--accent); }
.side-link svg{ flex-shrink: 0; }

/* ─── shared section ─── */
section{
  padding: calc(var(--unit) * 4) max(calc(var(--unit) * 2.5), var(--safe-left))
    calc(var(--unit) * 4) max(calc(var(--unit) * 2.5), var(--safe-right));
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--bar-h) + var(--safe-top) + 10px);
}

.section-mark{
  display:flex; flex-direction:column; gap: 14px;
  margin-bottom: calc(var(--unit) * 2);
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s ease, transform .5s ease;
}
.section-mark.in{ opacity: 1; transform: none; }
.sm-line{ display:flex; align-items:center; gap: 12px; font-size: 11px; }
.sm-num{ color: var(--accent); }
.sm-rule{ flex:1; height:1px; background: var(--line); max-width: 80px; }
.sm-kicker{ color: var(--fg-3); letter-spacing: 0.14em; text-transform: uppercase; }
.sm-title{
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 920px;
}
.sm-intro{
  margin: 0;
  color: var(--fg-2);
  max-width: 720px;
  font-size: calc(var(--base) + 1px);
}

/* ─── hero ─── */
.hero{
  position: relative;
  padding-top: calc(var(--unit) * 3);
  padding-bottom: calc(var(--unit) * 3);
  display: flex;
  flex-direction: column;
  gap: calc(var(--unit) * 2);
  min-height: calc(100vh - var(--bar-h) - var(--sb-h) - var(--safe-top) - var(--safe-bottom));
}

.hero-ascii{
  align-self: flex-start;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.hero-ascii pre{
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre;
  min-width: min(100%, max-content);
}

/* Body takes the dominant vertical space; left-aligned with the ASCII + rail. */
.hero-body{
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: min(72rem, 100%);
  min-width: 0;
}
.hero-eyebrow{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  font-size: 11.5px;
  margin-bottom: calc(var(--unit) * 1.2);
}

.hero-headline{
  margin: 0 0 calc(var(--unit) * 1) 0;
  font-family: var(--mono);
  font-size: clamp(34px, 6vw, 76px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--fg);
  min-height: 1.2em;
}
.hero-headline .caret{
  display:inline-block; color: var(--accent);
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-sub{
  margin: 0 0 calc(var(--unit) * 1) 0;
  font-size: clamp(15px, 1.6vw, 19px);
  color: var(--fg);
  max-width: min(48rem, 100%);
}
.hero-support{
  margin: 0 0 calc(var(--unit) * 1.5) 0;
  color: var(--fg-2);
  max-width: min(48rem, 100%);
}

.fade-out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.fade-in  { opacity: 1; transform: none; transition: opacity .5s .15s, transform .5s .15s; }

.hero-ctas{ display:flex; flex-wrap: wrap; gap: 10px; margin-bottom: calc(var(--unit) * 1.5); }

.btn{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-family: var(--mono); font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover{ border-color: var(--accent); color: var(--accent); transform: translateX(2px); }
.btn svg{ flex-shrink: 0; color: currentColor; }
.btn .btn-arrow{ color: var(--accent); }
.btn .btn-meta{ color: var(--fg-3); margin-left: auto; padding-left: 10px; }
.btn.primary{ background: var(--accent); color: #0b0c0e; border-color: var(--accent); }
.btn.primary .btn-arrow,
.btn.primary .btn-meta{ color: #0b0c0e; }
.btn.primary:hover{ filter: brightness(1.05); color: #0b0c0e; }
.btn.ghost{ background: transparent; }

.hero-meta{
  display: grid; grid-template-columns: repeat(4, max-content);
  gap: 18px;
  font-size: 11px;
  color: var(--fg-2);
}

/* Boot log strip pinned to the bottom of the hero, full content width. */
.hero-rail{
  align-self: stretch;
  margin-top: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 11px;
  line-height: 1.5;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 18px;
  min-width: 0;
}
.rail-line{
  white-space: pre;
  animation: railIn .25s ease;
}
@keyframes railIn { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform:none; } }

/* ─── signals strip ─── */
.signals{
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  overflow: hidden;
  display: flex; align-items: center; gap: 18px;
}
.sig-label{ padding: 0 calc(var(--unit) * 2.5); font-size: 11px; white-space: nowrap; }
.sig-track{
  display: flex; gap: 28px;
  white-space: nowrap;
  animation: slide 50s linear infinite;
}
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.sig-chip{
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  padding: 4px 0;
}
.sig-dot{
  width: 5px; height: 5px; background: var(--accent);
}

/* ─── thesis ─── */
.thesis-grid{
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: calc(var(--unit) * 2.5);
  align-items: start;
}
.thesis-copy p{
  font-size: calc(var(--base) + 2px);
  color: var(--fg);
  margin: 0 0 calc(var(--unit) * 1) 0;
  max-width: 640px;
}
.thesis-copy .hl{ color: var(--accent); }

.thesis-cards{
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: calc(var(--unit) * 1.5);
}
.tc{
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  padding: 16px;
  position: relative;
  transition: border-color .2s, transform .2s;
}
.tc:hover{ border-color: var(--accent); transform: translateY(-2px); }
.tc-num{ font-size: 10.5px; color: var(--accent); margin-bottom: 6px; }
.tc h4{ margin: 0 0 8px; font-size: 14px; font-weight: 500; }
.tc p{ margin: 0; color: var(--fg-2); font-size: 12.5px; }

.thesis-loop{
  position: sticky; top: calc(var(--bar-h) + var(--safe-top) + 24px);
  display: flex; flex-direction: column; align-items: center;
}
.loop-wrap{ width: 100%; max-width: 460px; aspect-ratio: 1; }
.loop-svg{ width: 100%; height: 100%; }

.loop-svg .loop-outer{ fill: none; stroke: var(--line); stroke-dasharray: 2 4; }
.loop-svg .loop-ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.loop-svg .loop-inner{ fill: none; stroke: var(--line); stroke-dasharray: 1 3; }
.loop-svg .loop-arc  { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.loop-svg .tick      { stroke: var(--line); stroke-width: 1; }
.loop-svg .tick.maj  { stroke: var(--fg-3); stroke-width: 1.2; }
.loop-svg .pulse-dot { fill: var(--accent); }
.loop-svg .node-ring { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; transition: stroke .2s, r .2s; }
.loop-svg .node-dot  { fill: var(--fg-3); transition: fill .2s, r .2s; }
.loop-svg .node:hover .node-ring,
.loop-svg .node.hov  .node-ring{ stroke: var(--accent); }
.loop-svg .node:hover .node-dot,
.loop-svg .node.hov  .node-dot { fill: var(--accent); }
.loop-svg .node-label{ fill: var(--fg); font: 600 12px var(--mono); }
.loop-svg .node-glyph{ fill: var(--fg-3); font: 10px var(--mono); }
.loop-svg .lc-kicker { fill: var(--fg-3); font: 10px var(--mono); letter-spacing: 0.1em; }
.loop-svg .lc-title  { fill: var(--accent); font: 600 18px var(--mono); }
.loop-svg .lc-sub    { fill: var(--fg-2); font: 11px var(--mono); }

.loop-legend{ margin-top: 8px; font-size: 11px; }

/* ─── work ─── */
.work-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1100px){ .work-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px){  .work-grid { grid-template-columns: 1fr; } }

.work-card{
  position: relative;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s, transform .2s, background .2s;
}
.work-card.hov{
  border-color: var(--accent);
  transform: translateY(-3px);
  background: var(--bg-3);
}

.wc-head{ display: flex; align-items: center; gap: 8px; font-size: 10.5px; }
.wc-idx{ color: var(--accent); }
.wc-tag{
  padding: 1px 6px; border: 1px solid var(--line-strong);
  color: var(--fg-2);
}
.wc-years{ margin-left: auto; }
.wc-surface{
  position: relative;
  height: 100px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.wc-surface .ws{ width: 100%; height: 100%; display:block; }
.ws .ws-line{ fill: none; stroke: var(--fg-3); stroke-width: 1; }
.ws .ws-fill{ fill: var(--fg-3); }
.ws .ws-fill.alt{ fill: var(--accent); }
.work-card.hov .ws .ws-line{ stroke: var(--accent); }
.work-card.hov .ws .ws-fill{ fill: var(--accent); }

.wc-scan{
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(var(--accent-rgb),0.15) 50%, transparent 100%);
  transform: translateY(-100%);
  pointer-events: none;
}
.wc-scan.on{ animation: scan 1.2s ease-in-out infinite; }
@keyframes scan { 0%{transform:translateY(-100%)} 50%{transform:translateY(100%)} 100%{transform:translateY(100%)} }

.wc-title{ margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.005em; }
.wc-desc { margin: 0; color: var(--fg-2); font-size: 12.5px; }
.wc-foot { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 6px; }
.wc-link{ color: var(--accent); font-size: 11.5px; }
.wc-link.dim{ color: var(--fg-3); }

/* ─── proof ─── */
.proof-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px){ .proof-grid{ grid-template-columns: 1fr; } }
.proof-card{
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.pc-head{ display:flex; align-items:center; gap:10px; }
.pc-idx { font-size: 10.5px; }
.pc-bar { flex:1; height:1px; background: var(--line); }
.pc-value{
  font-family: var(--mono);
  font-size: clamp(48px, 6vw, 80px);
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
}
.pc-label{ font-size: 14px; }
.pc-desc { color: var(--fg-2); font-size: 12.5px; margin: 0; }

/* ─── timeline ─── */
.timeline{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.tl-item{
  display: grid;
  grid-template-columns: 140px 28px 1fr;
  align-items: stretch;
  padding: 18px 0;
  border-top: 1px dashed var(--line);
}
.tl-item:first-child{ border-top: 1px solid var(--line); }
.tl-period{ color: var(--accent); font-size: 12px; padding-top: 2px; }
.tl-stem{ position: relative; }
.tl-dot{
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 9px; height: 9px; background: var(--accent);
}
.tl-line{
  position: absolute; left: 50%; top: 18px; bottom: -18px; transform: translateX(-50%);
  width: 1px; background: var(--line);
}
.tl-item:last-child .tl-line{ display: none; }
.tl-body h4{ margin: 0 0 6px; font-size: 14.5px; font-weight: 500; }
.tl-body p { margin: 0; color: var(--fg-2); font-size: 12.5px; max-width: 720px; }

/* ─── about ─── */
.about-body{ max-width: 760px; }
.about-body p{ font-size: calc(var(--base) + 2px); margin: 0 0 16px; }
.about-body .hl{ color: var(--accent); }
.about-tags{ display:flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.atag{
  font-size: 11px; padding: 2px 8px;
  border: 1px solid var(--line-strong);
  color: var(--fg-2);
}

/* ─── writing ─── */
.essay-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction: column; }
.essay-row{
  display: grid;
  grid-template-columns: 50px 90px 1fr 90px;
  gap: 16px; align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  transition: background .15s;
}
.essay-row:last-child{ border-bottom: 1px solid var(--line); }
.essay-row:hover{ background: var(--hover); }
.er-idx{ font-size: 11px; padding-top: 2px; }
.er-status{
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 6px; align-self: start;
  color: var(--accent); border: 1px solid currentColor;
}
.er-body h4{ margin: 0 0 4px; font-size: 14px; font-weight: 500; }
.er-body p { margin: 0; color: var(--fg-2); font-size: 12.5px; }
.er-cta{ font-size: 11px; padding-top: 4px; text-align: right; }

@media (max-width: 720px){
  .essay-row{ grid-template-columns: 1fr; }
  .er-cta{ text-align: left; }
}

/* ─── contact ─── */
.contact-body{ max-width: 720px; }
.contact-lede{ font-size: calc(var(--base) + 2px); color: var(--fg); margin: 0 0 24px; }
.contact-card{
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.cc-prompt{ font-size: 11px; color: var(--fg-3); }
.cc-mail{
  font-size: clamp(22px, 3vw, 34px);
  color: var(--accent);
  word-break: break-all;
}
.cc-actions{ display: flex; flex-wrap: wrap; gap: 10px; }
.cc-meta{ display: flex; flex-wrap: wrap; gap: 18px; font-size: 11.5px; color: var(--fg-2); border-top: 1px solid var(--line); padding-top: 14px; }

/* ─── footer ─── */
.foot{
  padding: 30px max(calc(var(--unit) * 2.5), var(--safe-left))
           30px max(calc(var(--unit) * 2.5), var(--safe-right));
  border-top: 1px solid var(--line);
}
.foot-row{ display:flex; gap: 18px; font-size: 11px; align-items: center; flex-wrap: wrap; }
.foot-row > :last-child{ margin-left: auto; }
.foot-link{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-2);
  transition: color .15s;
}
.foot-link:hover{ color: var(--accent); }
.foot-link svg{ flex-shrink: 0; }
.foot-ascii{
  margin-top: 18px;
  white-space: pre;
  color: var(--fg-3);
  font-size: 11px;
  letter-spacing: 0.4em;
}

/* ─── mobile nav drawer ─── */
.nav-drawer{
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.nav-drawer > *{ pointer-events: auto; }
.nav-drawer-scrim{
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(5,6,8,.58);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(3px);
}
.nav-drawer-sheet{
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1;
  width: min(320px, calc(100vw - 40px));
  background: var(--bg);
  border-right: 1px solid var(--line-strong);
  box-shadow: 14px 0 48px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  padding:
    calc(12px + var(--safe-top))
    max(14px, var(--safe-right))
    max(16px, var(--safe-bottom))
    max(14px, var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: navSheetIn .22s ease-out;
}
@keyframes navSheetIn{
  from{ transform: translateX(-10px); opacity: 0.9; }
  to{ transform: none; opacity: 1; }
}
.nav-drawer-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.nav-drawer-title{
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
}
.nav-drawer-close{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px -10px -6px 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer-close:active{ background: var(--hover); color: var(--fg); }
.nav-drawer-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.nav-drawer-brand span{
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.nav-drawer-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer-list li a{
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 12px;
  margin: 0 -12px;
  border-radius: 8px;
  color: var(--fg-2);
  border-left: 3px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer-list li a:active{ background: var(--hover); }
.nav-drawer-list li.on a{
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--hover);
}
.nav-drawer-meta{
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}
.nav-drawer-row{
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.nav-drawer-foot{
  margin-top: auto;
  padding-top: 20px;
}
.nav-drawer-li{
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--fg);
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer-li:active{ border-color: var(--accent); }
.nav-drawer-li span:nth-child(2){ flex: 1; min-width: 0; word-break: break-all; }

@media (min-width: 981px){
  .nav-drawer{ display: none !important; }
}

/* ─── responsive ─── */
@media (max-width: 980px){
  :root{
    --bar-h: 44px;
    --sb-h: 32px;
  }
  .tb-menu-btn{ display: inline-flex; }
  .root{ grid-template-columns: 1fr; }
  .topbar{ grid-template-columns: 1fr 1fr 1fr; }
  .sidebar{ display:none; }
  .main{ border-left: none; }
  .hero{ min-height: auto; }
  .hero-rail{
    grid-template-columns: 1fr;
    font-size: 10.5px;
  }
  .hero-body{ max-width: 100%; }
  .thesis-grid{ grid-template-columns: 1fr; }
  .thesis-loop{ position: static; }
  .thesis-cards{ grid-template-columns: 1fr; }
  .tl-item{ grid-template-columns: 100px 24px 1fr; }
  .hero-meta{ grid-template-columns: repeat(2, 1fr); }
  .btn{
    min-height: 44px;
    padding: 12px 16px;
    align-items: center;
  }
  .foot-row{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .foot-row > :last-child{ margin-left: 0; align-self: stretch; }
  .signals{ gap: 12px; }
  .sig-label{
    padding-left: max(calc(var(--unit) * 2), var(--safe-left));
    padding-right: max(calc(var(--unit) * 1), var(--safe-right));
  }
}

@media (max-width: 640px){
  .tb-mid-label{ display: none; }
  .tb-bar{ width: 72px; }
  .tb-right-short{ display: none; }
  .tb-tweaks-hint{ font-size: 10.5px; }
  .hero-ascii pre{ font-size: 9.5px; padding: 8px 10px; }
  .hero-headline{ font-size: clamp(28px, 8.5vw, 56px); }
}

@media (max-width: 520px){
  .tb-crumb{ display: none; }
  .tl-item{
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px 0;
  }
  .tl-stem{ display: none; }
  .tl-period{ padding-top: 0; }
  .foot-ascii{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    letter-spacing: 0.12em;
    font-size: 9px;
  }
  .signals{ flex-wrap: wrap; align-items: flex-start; }
}

@media (max-width: 420px){
  .hero-meta{ grid-template-columns: 1fr; }
  .tl-item{ grid-template-columns: 1fr; }
}
