/* ============================================================
   Cypherware · shared stylesheet
   Warm, hand-crafted technical: charcoal + cream + teal + amber
   ============================================================ */

:root {
  --bg: #171310;
  --bg-raised: #1e1915;
  --bg-card: #221c17;
  --border: #332a22;
  --border-bright: #4a3d30;
  --fg: #f4ede1;
  --fg-muted: #b5a892;
  --fg-faint: #837863;
  --ink: #f4ede1;               /* illustration line color */
  --accent: #2dd4bf;            /* teal · company */
  --accent-dim: rgba(45, 212, 191, 0.14);
  --accent-2: #7dd3fc;
  --torq: #f5a623;              /* amber · torq brand */
  --torq-dim: rgba(245, 166, 35, 0.14);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --maxw: 1100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); color: var(--accent); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------------------------------------
   Header / nav
   ------------------------------------------------------------ */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(23, 19, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.logo:hover { text-decoration: none; }
.logo svg.logomark { display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}
.nav-links a {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--fg); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-links a.cta {
  color: var(--bg);
  background: var(--accent);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-links a.cta:hover { filter: brightness(1.1); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 1.2rem;
  padding: 4px 10px;
  cursor: pointer;
}

/* ------------------------------------------------------------
   Hero · soft dotted-grid paper
   ------------------------------------------------------------ */
.hero {
  position: relative;
  padding: 96px 0 84px;
  overflow: hidden;
  background-image: radial-gradient(var(--border) 1.4px, transparent 1.4px);
  background-size: 30px 30px;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 25%, transparent 0%, var(--bg) 80%);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }

.hero-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 820px) {
  .hero-split { grid-template-columns: 1fr; }
  .hero-split .hero-art, .hero-split .torus-wrap { order: -1; }
}

.kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}
.kicker.torq-k { color: var(--torq); }

h1 {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 5.5vw, 3.7rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  font-weight: 600;
  max-width: 15em;
}
h1 .accent { color: var(--accent); }
h1 .torq-accent { color: var(--torq); }

/* hand-drawn squiggle underline */
.squiggle {
  padding-bottom: 0.12em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='9' viewBox='0 0 120 9'%3E%3Cpath d='M2 6 C12 1 22 8 32 5 C42 2 52 8 62 5 C72 2 82 8 92 5 C102 2 112 7 118 4' fill='none' stroke='%23f5a623' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left bottom / auto 8px;
}
.squiggle-teal {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='9' viewBox='0 0 120 9'%3E%3Cpath d='M2 6 C12 1 22 8 32 5 C42 2 52 8 62 5 C72 2 82 8 92 5 C102 2 112 7 118 4' fill='none' stroke='%232dd4bf' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.lede {
  margin-top: 24px;
  font-size: 1.2rem;
  color: var(--fg-muted);
  max-width: 38em;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
}

.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-torq { background: var(--torq); color: var(--bg); }
.btn-torq:hover { filter: brightness(1.1); }
.btn-ghost {
  color: var(--fg);
  border: 1.5px solid var(--border-bright);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--fg-muted); }

/* ------------------------------------------------------------
   Handwritten annotations & hand-drawn art bits
   ------------------------------------------------------------ */
.hand-note {
  font-family: var(--hand);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--torq);
  line-height: 1.2;
  transform: rotate(-2deg);
  display: inline-block;
}
.hand-note.teal { color: var(--accent); }

.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: min(420px, 85vw); height: auto; }

.spot { flex-shrink: 0; }
.spot svg { width: 76px; height: 76px; display: block; }

.art-caption {
  text-align: center;
  margin-top: 6px;
}

/* SVG hand style helpers (applied via svg attrs, these cover text) */
svg text.hand { font-family: var(--hand); font-weight: 600; }

/* ------------------------------------------------------------
   Sections
   ------------------------------------------------------------ */
section.block { padding: 88px 0; }
section.block.alt { background: var(--bg-raised); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  letter-spacing: -0.01em;
  font-weight: 600;
  line-height: 1.18;
}
.section-head { max-width: 42em; margin-bottom: 48px; }
.section-head p { margin-top: 16px; color: var(--fg-muted); font-size: 1.08rem; }

.section-head-split {
  display: flex;
  align-items: center;
  gap: 32px;
  justify-content: space-between;
}

h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0;
}

/* ------------------------------------------------------------
   Cards / pillars
   ------------------------------------------------------------ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: border-color 0.2s ease, transform 0.25s ease;
}
.card:hover { border-color: var(--border-bright); transform: translateY(-3px) rotate(-0.4deg); }
.card .spot { margin-bottom: 18px; }
.card .tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.card h3 { margin-bottom: 10px; }
.card p { color: var(--fg-muted); font-size: 0.98rem; }
.card .more { display: inline-block; margin-top: 14px; font-size: 0.92rem; font-weight: 600; }

/* ------------------------------------------------------------
   Metrics / stats
   ------------------------------------------------------------ */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  text-align: center;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 20px;
}
.stat .num {
  font-family: var(--mono);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--torq);
  letter-spacing: -0.02em;
}
.stat .label { margin-top: 8px; color: var(--fg-muted); font-size: 0.95rem; }

/* ------------------------------------------------------------
   Code blocks
   ------------------------------------------------------------ */
.codeblock {
  background: #14100d;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.7;
}
.codeblock .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--fg-faint);
  font-size: 0.78rem;
}
.codeblock .bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-bright); }
.codeblock pre { padding: 20px; overflow-x: auto; }
.codeblock code { color: var(--fg); }
.c-kw { color: #d8a0df; }
.c-fn { color: #8fd3f0; }
.c-str { color: #a5d6a7; }
.c-cm { color: var(--fg-faint); font-style: italic; }
.c-ty { color: #f2cf87; }
.c-mac { color: var(--accent); }

/* ------------------------------------------------------------
   Torq comparison bars
   ------------------------------------------------------------ */
.compare { display: flex; flex-direction: column; gap: 26px; }
.compare-row .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.compare-row .head .who { font-weight: 600; }
.compare-row .head .val { font-family: var(--mono); color: var(--fg-muted); font-size: 0.85rem; }
.compare-row .track {
  height: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.compare-row .fill { height: 100%; border-radius: 999px; }
.fill-torq { background: linear-gradient(90deg, var(--torq), #fbbf24); width: 14%; }
.fill-other { background: var(--border-bright); width: 96%; }
.compare-note { color: var(--fg-faint); font-size: 0.85rem; margin-top: 6px; }

/* ------------------------------------------------------------
   Feature list rows
   ------------------------------------------------------------ */
.feature-rows { display: flex; flex-direction: column; gap: 0; }
.feature-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}
.feature-row:last-child { border-bottom: 1px solid var(--border); }
.feature-row .name {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}
.feature-row p { color: var(--fg-muted); font-size: 0.98rem; }

/* ------------------------------------------------------------
   Torus / big art
   ------------------------------------------------------------ */
.torus-wrap { display: flex; flex-direction: column; align-items: center; }
.torus-mark { width: min(360px, 75vw); height: auto; }

/* ------------------------------------------------------------
   CTA band
   ------------------------------------------------------------ */
.cta-band {
  text-align: center;
  padding: 88px 0;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 90% at 50% 100%, var(--accent-dim), transparent 70%),
    var(--bg-raised);
}
.cta-band h2 { margin-bottom: 14px; }
.cta-band p { color: var(--fg-muted); max-width: 34em; margin: 0 auto 32px; }
.cta-doodle { margin-top: 18px; }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
footer.site {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  color: var(--fg-faint);
  font-size: 0.9rem;
}
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.foot .links { display: flex; gap: 22px; list-style: none; }
.foot .links a { color: var(--fg-muted); }
.foot .mono { font-family: var(--mono); font-size: 0.82rem; }

/* ------------------------------------------------------------
   Prose pages (research / about)
   ------------------------------------------------------------ */
.prose { max-width: 46em; }
.prose h2 { margin: 56px 0 16px; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--fg-muted); margin-bottom: 18px; }
.prose strong { color: var(--fg); }
.prose ul { margin: 0 0 18px 1.2em; color: var(--fg-muted); }
.prose li { margin-bottom: 8px; }

.prose-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 56px 0 16px;
}
.prose-head:first-child { margin-top: 0; }
.prose-head h2 { margin: 0; }
.prose-head .spot svg { width: 62px; height: 62px; }

.pillar-anchor { scroll-margin-top: 90px; }

/* ------------------------------------------------------------
   Reveal animation
   ------------------------------------------------------------ */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .grid-3, .stats { grid-template-columns: 1fr 1fr; }
  .section-head-split { flex-direction: column; align-items: flex-start; gap: 16px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 12px 0; }
  .nav-links a.cta { display: inline-block; margin-top: 8px; }

  .hero { padding: 64px 0 56px; }
  section.block { padding: 64px 0; }
  .grid-3, .grid-2, .stats { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 1fr; gap: 8px; }
}
