/* ============================================================
   Clawdia hero — switchboard / shifting-log (vanilla port)
   Ported from the React exploration (tokens + .hf shell + .lv-copy
   + switchboard variant A + draw-in underline). Loaded AFTER styles.css
   and only by index.html. Tokens are scoped to .hf so they don't leak.
   Dark mode follows the site's prefers-color-scheme (media query at end).
   ============================================================ */

/* ---- Light tokens (default) ---- */
.hf {
  --surface:        #f7f3ec;
  --surface-panel:  #efeae0;
  --surface-sunk:   #ece6da;
  --hairline:       #e0d9cc;
  --hairline-soft:  #ebe5d9;
  --ink:            #1a1814;
  --ink-soft:       #57514a;
  --ink-meta:       #8b8478;
  --accent:         #c8632e;
  --accent-deep:    #9b481e;
  --accent-tint:    #f3e3d6;
  --accent-line:    color-mix(in oklab, var(--accent), var(--surface) 55%);
  --on-accent:      #fbf6ee;
  --glow:           rgba(200,99,46,0.16);
  --shadow:         0 1px 2px rgba(40,30,20,.04), 0 12px 34px -18px rgba(60,40,20,.22);
  /* Card glow: BLURRED + layered so it reads as emitted warm light, not a flat
     tint band (zero-blur spread just looks like a darker ring on a light bg).
     A faint accent rim seats it; a warm-white near-halo sells "lit"; accent
     blooms carry the colour out. --glow-hot drives the impact ripple. */
  --card-glow:      0 0 14px -3px rgba(255,228,198,0.72),
                    0 0 34px -6px rgba(202,100,47,0.26),
                    0 0 70px -22px rgba(202,100,47,0.16);
  --glow-hot:       rgba(255,193,138,0.85);  /* lighter/hotter than the accent — the ripple "heats" the glow */
  /* the "reacting" glow — slightly larger + warmer; .swb-card--react transitions to it */
  --card-glow-hot:  0 0 20px -3px rgba(255,224,190,0.84),
                    0 0 48px -6px rgba(214,118,58,0.32),
                    0 0 98px -22px rgba(214,118,58,0.20);
  /* lifted card — surface LIGHTER than the page + a soft drop shadow so it floats */
  --card-surface:   #fefcf6;
  --card-lift:      0 2px 4px -1px rgba(60,40,20,.06),
                    0 10px 24px -8px rgba(60,40,20,.18),
                    0 26px 56px -22px rgba(60,40,20,.22);
}

/* ============================================================
   Frame shell — reads as a real above-the-fold section
   ============================================================ */
.hf {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Geist', system-ui, sans-serif;
  position: relative;
  /* never clip the switchboard (card glow, wires) — the responsive flex layout
     fits at every width, so there's nothing to scroll, only the glow to show. */
  overflow: visible;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hf * { box-sizing: border-box; }

/* header */
.hf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0 0;
  flex: 0 0 auto;
}
.hf-wordmark {
  font-family: 'Caveat', cursive;
  font-size: 33px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .3px;
  line-height: 1;
}
.hf-nav {
  display: flex;
  align-items: center;
  gap: 34px;
  font-size: 14.5px;
  color: var(--ink-soft);
}
.hf-nav a { color: inherit; text-decoration: none; }
.hf-nav-cta {
  color: var(--ink) !important;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 2px;
}
/* Secondary top-right action — present but quieter than the one accented CTA
   (DESIGN.md: one accent per composition). Stays visible on mobile (below). */
.hf-nav-login {
  color: var(--ink) !important;
  opacity: 0.9;
}
.hf-nav-login:hover { opacity: 1; }

/* body holds the hero composition */
.hf-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ---- shared type ---- */
.hf-display {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.02;
  color: var(--ink);
}
.hf-mark {
  position: relative;
  white-space: nowrap;
}
/* default scribbled underline; draw mode (below) hides this and animates an SVG */
.hf-mark::after {
  content: "";
  position: absolute;
  left: -1%;
  right: -1%;
  bottom: 0.02em;
  height: 0.32em;
  background: var(--accent);
  opacity: .9;
  clip-path: polygon(0% 62%, 8% 40%, 22% 70%, 38% 38%, 54% 72%, 70% 42%, 86% 70%, 100% 46%, 100% 100%, 0% 100%);
}
.hf-sub {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 30em;
}
.hf-sub b { font-weight: 600; color: var(--ink); }

/* ---- CTA: quiet floor anchor, warm glow on hover ---- */
.hf-cta {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: 'Geist', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 15px 26px;
  border-radius: 3px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: box-shadow .35s ease, transform .35s ease, background .2s ease;
  will-change: transform;
}
.hf-cta:hover {
  background: var(--accent-deep);
  box-shadow: 0 0 0 1px var(--glow), 0 8px 24px -6px var(--glow), 0 2px 10px var(--glow);
  transform: translateY(-1px);
}
.hf-cta .arr { transition: transform .35s cubic-bezier(.2,.7,.3,1); }
.hf-cta:hover .arr { transform: translateX(4px); }

.hf-cta-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  text-decoration: none;
  transition: color .2s;
}
.hf-cta-ghost:hover { color: var(--accent); }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }


/* ============================================================
   Left copy column
   ============================================================ */
.lv-body { align-items: center; gap: 52px; padding: 0 0 40px; }
.lv-copy { flex: 0 0 39%; max-width: 470px; }
.lv-h1 { font-size: 58px; margin: 0 0 24px; }
.lv-sub { font-size: 18px; margin: 0 0 32px; max-width: 24em; }
.lv-actions { display: flex; align-items: center; gap: 22px; }

.lv-stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 16px; }


/* ============================================================
   Switchboard (variant A) — converging channels into the Clawdia
   hub, with a shifting activity log (flip in / push down / fade).
   ============================================================ */
.swb-grid {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* the channel column and the hub each grow to a comfortable max, then the
     middle (where the wires/dots animate) absorbs the rest via space-between —
     so neither side is stretched-with-dead-space nor squeezed to min-width. */
  gap: 40px;
  min-height: 360px;
  /* cap the band so the elastic middle stays generous, not extreme — otherwise
     on a wide stacked viewport the two sides get flung to the edges. */
  max-width: 760px;
}

/* ---- source stack (roomy, title over mono meta) ---- */
.swb-sources { flex: 0 1 auto; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 11px; }
.swb-src {
  background: var(--surface-sunk); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 12px 16px; display: flex; flex-direction: column; gap: 3px;
  transition: border-color .35s ease, background .35s ease, transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s ease;
}
.swb-src-t { font-size: 15px; font-weight: 500; color: var(--ink); }
.swb-src-m { font-size: 11.5px; color: var(--ink-meta); }
.swb-src-short { display: none; }  /* shown only in the mobile band */
.swb-src--on {
  border-color: var(--accent); background: var(--accent-tint);
  box-shadow: 0 6px 22px -10px var(--glow);
}
.swb-src--on .swb-src-m { color: var(--accent); }

/* ---- wires: free overlay spanning the grid; hero.js draws each path from a
   channel's right edge to the card's left-center (viewBox tracks the grid px) ---- */
.swb-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
/* thin hairlines that echo the source cards' outline: olive-gray when their
   channel is idle, accent when it's active — same as the card border, and the
   colour cross-fades on the same .35s. Dots (streamed along them) match. */
.swb-wire {
  fill: none; stroke: var(--hairline); stroke-width: 1; opacity: .8;
  transition: stroke .35s ease, opacity .35s ease, stroke-width .35s ease;
}
.swb-wire--on { stroke: var(--accent); opacity: 1; stroke-width: 1.3; }
.swb-dot { fill: var(--hairline); transition: fill .3s ease; }
.swb-dot--on { fill: var(--accent); }

/* ---- the simple Clawdia card (static, never resizes) ---- */
.swb-card {
  position: relative; z-index: 1; width: auto; min-width: 244px;
  background: var(--card-surface); border-radius: 16px;   /* lifted + borderless — lighter than the page, floats on a soft shadow */
  box-shadow: var(--card-glow), var(--card-lift); padding: 22px 26px;
  display: flex; flex-direction: column; gap: 5px;
  transition: box-shadow .5s ease;   /* the slow DIE-DOWN after a hit (the faster swell-up is set on .swb-card--react) */
}
/* the block "reacts" to an incoming signal — its glow grows a touch and warms in
   hue, then settles (hero.js toggles this on each active-dot impact) */
.swb-card--react { box-shadow: var(--card-glow-hot), var(--card-lift); transition: box-shadow .34s ease; }
.swb-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.swb-card-mark { font-family: 'Caveat', cursive; font-size: 40px; font-weight: 600; color: var(--accent); line-height: 1; }
.swb-card-sub { font-size: 12.5px; color: var(--ink-meta); }
.swb-card-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent); box-shadow: 0 0 0 0 var(--glow); animation: swb-pulse 1.8s ease-out infinite;
}
@keyframes swb-pulse { 0%{box-shadow:0 0 0 0 var(--glow)} 70%{box-shadow:0 0 0 11px transparent} 100%{box-shadow:0 0 0 0 transparent} }

/* Shield-hit FX layer — a dedicated SVG BEHIND the card (z-0, like the wires) so
   the impact energy blooms out from behind the panel. hero.js renders one-shot
   effects into it on each active-dot arrival (prototypes A/B/C, switchable live).
   No-JS / reduced-motion never create it — the card just keeps its static glow. */
.swb-fx {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none; z-index: 0;
}
/* effect elements (soft-blurred via the SVG filter so they read as glow): the quick
   contact bloom + the fast, short-reach ripple band. The block's own glow reaction
   lives on .swb-card--react (a box-shadow transition), not here. */
.fx-bloom { fill: var(--glow-hot); }
.fx-wave  { fill: none; stroke: var(--glow-hot); stroke-width: 2.5; stroke-linecap: round; }

/* hub column — Clawdia card stacked over the shifting log. Capped a touch
   narrow so that on side-by-side (wide) layouts the column doesn't hog width:
   the space it gives up pools into the middle, letting the wires breathe. */
.swb-hub { flex: 1 1 auto; max-width: 300px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; }

/* ---- shifting log (flip in on top, push down, fade out) ---- */
.swb-log {
  position: relative; z-index: 1; width: 100%; max-width: 350px; height: 176px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 68%, transparent 98%);
  mask-image: linear-gradient(#000 68%, transparent 98%);
}
/* Rows rest OPEN (frozen-safe). A freshly-mounted row carries `.init` (collapsed)
   for one frame; the controller removes it → the row transitions open, pushing
   siblings down. If transitions never run, rows still end open. */
.swb-log-inner { display: flex; flex-direction: column; }
.swb-row {
  overflow: hidden; max-height: 38px; opacity: 1;
  transition: max-height .5s cubic-bezier(.2,.7,.3,1), opacity .4s ease, transform .4s ease;
  border-bottom: 1px solid var(--hairline-soft);
}
.swb-row.is-active { max-height: 66px; }
/* newest row slides in (transform only → frozen-safe; resting transform is none) */
.swb-row.init { max-height: 0; opacity: 0; transform: translateY(-6px); }

.swb-rowin-active { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.swb-rowin-active .l1 { display: flex; align-items: center; gap: 9px; }
.swb-rowin-active .verb { font-family: 'EB Garamond', serif; font-size: 17px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.swb-rowin-active .detail { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--ink-soft); margin-left: 18px; }
.swb-livedot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; box-shadow: 0 0 0 0 var(--glow); animation: swb-pulse 1.6s ease-out infinite; }
.swb-rowin-done { display: flex; align-items: baseline; gap: 9px; padding: 8px 0; font-size: 13px; color: var(--ink-soft); }
.swb-rowin-done .chk { color: var(--accent); font-weight: 700; flex: 0 0 auto; }
.swb-rowin-done .t { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--ink-meta); margin-left: auto; flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .swb-wire--on, .swb-card-dot, .swb-livedot { animation: none; }
}


/* ============================================================
   Headline underline — draw-in highlighter (.hf-mark-hl).
   The base .hf-mark::after lives above; draw mode hides it and
   animates an SVG path instead (drawn in by hero.js). The accent
   themes via stroke, so light + dark both work.
   ============================================================ */
[data-uline] .hf-mark { position: relative; isolation: isolate; display: inline-block; }

.hf-mark-hl { display: none; }
[data-uline="draw"] .hf-mark::after { display: none; }
[data-uline="draw"] .hf-mark-hl {
  display: block; position: absolute; left: -3%; right: auto; width: 106%; max-width: none; bottom: 0.04em;
  height: 0.62em; z-index: -1; pointer-events: none; overflow: visible;
}
[data-uline="draw"] .hf-mark-hl path {
  stroke: var(--accent); stroke-width: 13; stroke-linecap: round; opacity: .30;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}


/* ============================================================
   Live-site integration — fluid above-the-fold hero
   (the exploration rendered inside a fixed 1280x720 canvas;
   here .hf is a real responsive section).
   ============================================================ */
.hf { height: auto; min-height: min(900px, 94vh); background: transparent; }
/* Cross-page view-transition anchors. The home header dropped its CTA, so the
   "Hire Clawdia" morph re-anchors to the hero's primary button below — it still
   morphs to/from the sub-pages' header .nav-cta (same label), wordmark as before.
   .hf-cta is the only such button on the home page, so the name stays unique. */
.hf-head .hf-wordmark { view-transition-name: site-wordmark; }
.hf-cta { view-transition-name: header-cta; }
/* hero header + body inherit <main>'s container (max-width 1200 + page-gutter)
   instead of adding their own — so the wordmark lines up with .site-header on the
   sub-pages and the site-wordmark view-transition morph doesn't slide. */
.hf-body { padding: 32px 0; }
.lv-h1 { font-size: clamp(40px, 5.4vw, 60px); }

@media (max-width: 1100px) {
  /* stack the copy above the stage before the band can squeeze (#2);
     add a clear gap below the top bar (it was cramped against the headline) */
  .lv-body { flex-direction: column; align-items: stretch; gap: 64px; padding-top: 48px; }
  .lv-copy { flex: none; max-width: 640px; }
  .lv-stage { width: 100%; }
}

@media (max-width: 600px) {
  .hf-head { padding: 22px 0 0; }
  .lv-body { padding: 48px 0 40px; }
  .hf-nav { gap: 16px; font-size: 13px; }
  .hf-nav a:not(.hf-nav-cta):not(.hf-nav-login) { display: none; }
  .lv-actions { flex-wrap: wrap; gap: 14px 18px; }
  .hf-cta, .hf-cta-ghost { white-space: nowrap; }

  /* Concept C — keep the band, give it vertical breathing room. The hub
     dissolves (display:contents) so the card joins the band row and the log
     drops full-width below it. Channels use short labels + roomy gaps; the
     wires re-anchor to the card via hero.js (no fixed coordinates). */
  .swb-hub { display: contents; }
  /* 2-column band: chips | elastic remainder. The card hugs the right edge
     (justify-self:end) so the whole column gap pools to its LEFT as wire room,
     and a viewport-scaled max-width shrinks the card itself on smaller phones.
     The wires re-anchor to the card via hero.js. padding-right keeps the card's
     glow ring inside .hf (which clips overflow). */
  .swb-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 0;
    row-gap: 32px;
    align-items: center;
    grid-template-areas:
      "sources card"
      "log     log";
    padding-right: 18px;
    min-height: 0;
  }
  .swb-sources { grid-area: sources; gap: 28px; }
  .swb-card {
    grid-area: card;
    justify-self: end;
    width: auto;
    max-width: clamp(146px, 40vw, 164px);
    min-width: 0;
    padding: 15px 16px;
  }
  .swb-card-mark { font-size: 29px; }
  .swb-card-sub { font-size: 10.5px; line-height: 1.3; }
  .swb-log { grid-area: log; width: 100%; max-width: none; }
  .swb-src { padding: 11px 12px; gap: 1px; }
  .swb-src-full, .swb-src-m { display: none; }
  .swb-src-short { display: inline; }
  .swb-src-t { font-size: 12.5px; }
}

/* follow the site's system dark mode */
@media (prefers-color-scheme: dark) {
  .hf {
    --surface:#16130e; --surface-panel:#1f1a13; --surface-sunk:#120f0a;
    --hairline:#322a20; --hairline-soft:#271f17;
    --ink:#f2ece0; --ink-soft:#b8b0a2; --ink-meta:#8c8475;
    --accent:#e07a42; --accent-deep:#c8632e; --accent-tint:#2c1d12;
    --accent-line: color-mix(in oklab, var(--accent), var(--surface) 60%);
    --on-accent:#1a1206; --glow:rgba(224,122,66,0.22);
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 18px 44px -20px rgba(0,0,0,.6);
    --card-glow: 0 0 18px -4px rgba(255,176,120,0.28),
                 0 0 40px -6px rgba(224,122,66,0.42),
                 0 0 76px -22px rgba(224,122,66,0.26);
    --glow-hot: rgba(255,205,158,0.92);
    --card-glow-hot: 0 0 24px -4px rgba(255,194,146,0.40),
                     0 0 54px -6px rgba(232,134,78,0.54),
                     0 0 104px -22px rgba(232,134,78,0.34);
    /* lifted card — a lighter warm panel (dark-UI elevation) + depth shadow */
    --card-surface:  #2a2219;
    --card-lift:     inset 0 1px 0 rgba(255,236,210,0.05),
                     0 3px 10px -2px rgba(0,0,0,.5),
                     0 28px 60px -24px rgba(0,0,0,.72);
  }
}
