/* core.css — Goosethropic single-page system board.
   One viewport: a 3×3 board. The center cell is the SoC die — a display where
   section panes wipe in. The 8 surrounding cells are chip modules wired to the
   die by js/soc.js. Sober: ink, steel, one red accent, mono silkscreen.
   Load order: tokens.css → fonts.css → this file. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

:root {
  /* GA wedge ∧ cursors — homologated from the hub. Dark halo keeps them legible. */
  --cur: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%3E%3Cpolyline%20points%3D%275%2021%2014%207%2023%2021%27%20fill%3D%27none%27%20stroke%3D%27%23000000%27%20stroke-opacity%3D%27.5%27%20stroke-width%3D%274.5%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3Cpolyline%20points%3D%275%2021%2014%207%2023%2021%27%20fill%3D%27none%27%20stroke%3D%27%23ced1d9%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3Ccircle%20cx%3D%2714%27%20cy%3D%277%27%20r%3D%271.8%27%20fill%3D%27%23e9b23f%27/%3E%3C/svg%3E") 14 7;
  --cur-hot: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%3E%3Cpolyline%20points%3D%275%2021%2014%207%2023%2021%27%20fill%3D%27none%27%20stroke%3D%27%23000000%27%20stroke-opacity%3D%27.5%27%20stroke-width%3D%274.5%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3Cpolyline%20points%3D%275%2021%2014%207%2023%2021%27%20fill%3D%27none%27%20stroke%3D%27%23e0322a%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3Ccircle%20cx%3D%2714%27%20cy%3D%277%27%20r%3D%272%27%20fill%3D%27%23e9b23f%27/%3E%3C/svg%3E") 14 7;
  /* rotor cursors for the orbitable die — R = exp(−Bθ/2) as a circulation arc:
     270° sweep with an arrowhead, gold scalar at the axis. Red while rotating. */
  --cur-rotor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%3E%3Cpath%20d%3D%27M14%205.5%20A8.5%208.5%200%201%201%205.5%2014%27%20fill%3D%27none%27%20stroke%3D%27%23000000%27%20stroke-opacity%3D%27.5%27%20stroke-width%3D%274.5%27%20stroke-linecap%3D%27round%27/%3E%3Cpath%20d%3D%27M5.5%208.8%20L1.9%2016.2%20L9.1%2016.2%20Z%27%20fill%3D%27%23000000%27%20fill-opacity%3D%27.5%27/%3E%3Cpath%20d%3D%27M14%205.5%20A8.5%208.5%200%201%201%205.5%2014%27%20fill%3D%27none%27%20stroke%3D%27%23ced1d9%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27/%3E%3Cpath%20d%3D%27M5.5%209.8%20L2.9%2015.4%20L8.1%2015.4%20Z%27%20fill%3D%27%23ced1d9%27/%3E%3Ccircle%20cx%3D%2714%27%20cy%3D%2714%27%20r%3D%271.8%27%20fill%3D%27%23e9b23f%27/%3E%3C/svg%3E") 14 14;
  --cur-rotor-hot: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%3E%3Cpath%20d%3D%27M14%205.5%20A8.5%208.5%200%201%201%205.5%2014%27%20fill%3D%27none%27%20stroke%3D%27%23000000%27%20stroke-opacity%3D%27.5%27%20stroke-width%3D%274.5%27%20stroke-linecap%3D%27round%27/%3E%3Cpath%20d%3D%27M5.5%208.8%20L1.9%2016.2%20L9.1%2016.2%20Z%27%20fill%3D%27%23000000%27%20fill-opacity%3D%27.5%27/%3E%3Cpath%20d%3D%27M14%205.5%20A8.5%208.5%200%201%201%205.5%2014%27%20fill%3D%27none%27%20stroke%3D%27%23e0322a%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27/%3E%3Cpath%20d%3D%27M5.5%209.8%20L2.9%2015.4%20L8.1%2015.4%20Z%27%20fill%3D%27%23e0322a%27/%3E%3Ccircle%20cx%3D%2714%27%20cy%3D%2714%27%20r%3D%272%27%20fill%3D%27%23e9b23f%27/%3E%3C/svg%3E") 14 14;
}

body {
  background: var(--ink);
  color: var(--steel);
  font-family: var(--body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  cursor: var(--cur), auto;
}
a, button, .mod { cursor: var(--cur-hot), pointer; }

#soc-canvas {
  position: fixed;
  inset: 0;
  width: 100%;                 /* replaced element: inset alone won't stretch it */
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* CRT grit, very quiet */
.scanlines {
  position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0.35;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.14) 2px 3px);
  mix-blend-mode: multiply;
}

/* ---- topbar ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 28px);
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand .lockup {
  display: block;
  height: clamp(56px, 8vh, 78px);
  width: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}
.status {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ash);
}
.rec { width: 7px; height: 7px; background: var(--red); display: inline-block; animation: rec 1.6s steps(1) infinite; }
@keyframes rec { 0%, 62% { opacity: 1; } 63%, 100% { opacity: 0.15; } }

/* ---- stage + board ---- */
.stage {
  position: fixed; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: clamp(70px, 10vh, 96px) clamp(14px, 2.5vw, 30px) clamp(40px, 6vh, 58px);
}
.board {
  position: relative;
  width: min(100%, 1440px);
  height: min(100%, 860px);
  display: grid;
  /* the die dominates; sub-cards stay compact */
  grid-template-columns: 1fr 3.8fr 1fr;
  grid-template-rows: 1fr 3.3fr 1fr;
  gap: clamp(8px, 1.2vmin, 14px);
}

/* ---- chip modules ---- */
.mod {
  position: relative;
  font: inherit; color: inherit; text-align: left;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.004));
  border: 1px solid var(--line);
  padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: border-color 0.22s, background 0.22s, box-shadow 0.22s;
  min-width: 0;
}
.mod .ix { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; color: var(--ash-dim); }
.mod .nm {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(13px, 1.7vmin, 18px); line-height: 0.96; color: #eef0f4;
  letter-spacing: 0.01em; margin-top: auto;
}
.mod .cd { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; margin-top: 4px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod .cd b { color: var(--gold); font-weight: 500; }
.mod::after {  /* accent strip — the chip's select line */
  content: ''; position: absolute; left: 0; top: 0; width: 0; height: 2px;
  background: var(--red); transition: width 0.26s;
}
.mod:hover, .mod:focus-visible {
  border-color: rgba(224, 50, 42, 0.55);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}
.mod.on { border-color: var(--red); box-shadow: inset 0 0 0 1px rgba(224,50,42,0.18); }
.mod.on::after, .mod:hover::after, .mod:focus-visible::after { width: 100%; }
.mod.on .cd b { color: var(--red-hot); }
/* pinned: a gold lock-tick in the corner — click again (or Esc) to release */
.mod.pin::before {
  content: '';
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-dim);
}

/* ---- the die display (center cell) ---- */
.display {
  grid-area: 2 / 2;
  position: relative;
  border: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.16);    /* die under glass — the formation reads through */
  overflow: hidden;
  cursor: var(--cur-rotor), grab;        /* the formation orbits — the rotor spins it */
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.display:active { cursor: var(--cur-rotor-hot), grabbing; }
/* while a drag is live, hold the hot rotor even if the pointer leaves the die */
body.orbiting, body.orbiting * { cursor: var(--cur-rotor-hot), grabbing !important; }
.orbit-hint {
  position: absolute; right: 12px; bottom: 9px; z-index: 3;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--ash-dim); pointer-events: none;
}
.display .silk {
  position: absolute; top: 7px; left: 34px; z-index: 3;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em;
  color: var(--ash-dim); text-transform: uppercase; pointer-events: none;
}
.dk { position: absolute; width: 14px; height: 14px; border: 1px solid var(--steel); opacity: 0.55; z-index: 3; }
.dk.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.dk.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.dk.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.dk.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.sweep {
  position: absolute; left: 0; right: 0; top: -2px; height: 2px; z-index: 4;
  background: linear-gradient(90deg, var(--red), rgba(224,50,42,0.25) 60%, transparent);
  opacity: 0; pointer-events: none;
}
.display.sweeping .sweep { animation: sweep 0.46s cubic-bezier(0.22, 0.9, 0.24, 1) both; }
@keyframes sweep { 0% { top: 0; opacity: 1; } 92% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

/* panes — wipe in under the sweep line */
.pane {
  position: absolute; inset: 0; z-index: 2;
  padding: clamp(20px, 4vmin, 44px) clamp(22px, 4.5vmin, 52px);
  display: flex; flex-direction: column; justify-content: center;
  visibility: hidden;
}
.pane.on { visibility: visible; }
.pane.in { animation: paneIn 0.46s cubic-bezier(0.22, 0.9, 0.24, 1) both; }
.pane.out { animation: paneOut 0.46s cubic-bezier(0.22, 0.9, 0.24, 1) both; visibility: visible; }
@keyframes paneIn  { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes paneOut { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(100% 0 0 0); } }

.pane .eb {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--red);
  display: flex; align-items: center; gap: 11px; margin-bottom: 14px;
}
.pane .eb::before { content: ''; width: 28px; height: 1px; background: var(--red); }
.pane h2 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  line-height: 0.92; letter-spacing: -0.005em; color: #fff;
  font-size: clamp(24px, 4.2vmin, 48px);
  text-wrap: balance;
}
.pane .lede { font-size: clamp(13.5px, 1.6vmin, 16px); line-height: 1.55; max-width: 46ch; margin-top: 14px; }
.pane .accent { color: var(--red); }

/* keep copy in the left column on wide screens — the formation owns the right */
@media (min-width: 981px) {
  .pane .rows, .pane .repos, .pane .lede, .pane .formula { max-width: 62%; }
}
.pane .rows { margin-top: clamp(12px, 2.4vmin, 24px); border-top: 1px solid var(--line-soft); }
.pane .row {
  display: flex; gap: 14px; align-items: baseline;
  padding: clamp(5px, 1vmin, 9px) 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: clamp(12px, 1.45vmin, 13.5px); line-height: 1.4; color: var(--ash);
}
.pane .row b { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.08em; color: var(--gold); flex: 0 0 76px; }
.pane .row i { font-style: normal; color: var(--steel); }
.pane .formula { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--ash); margin-top: 16px; }
.pane .lnk {
  display: inline-block; margin-top: 16px; align-self: flex-start;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-dim); padding-bottom: 2px;
}
.pane .lnk:hover { color: var(--red-hot); border-color: var(--red); }

.pane .repos { margin-top: clamp(12px, 2.4vmin, 22px); display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
.pane .repos a {
  background: rgba(14, 14, 17, 0.85); padding: 10px 13px; text-decoration: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--steel);
  transition: background 0.2s, color 0.2s;
}
.pane .repos a i { display: block; font-style: normal; font-family: var(--body); font-size: 11px; color: var(--ash); margin-top: 3px; }
.pane .repos a:hover { background: var(--panel); color: var(--red-hot); }

.pane .cta { display: flex; gap: 12px; margin-top: clamp(14px, 2.6vmin, 26px); flex-wrap: wrap; }
.btn {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; font-size: 13px; text-decoration: none;
  color: var(--ink); background: var(--red); border: 1px solid var(--red);
  padding: 12px 22px; transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--red-hot); box-shadow: 0 0 26px var(--red-dim); }
.btn.ghost { background: transparent; color: #fff; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--red); color: var(--red); box-shadow: none; }

/* default pane — quiet copy in the lower-left; the bivector goose owns the die */
.pane[data-key="edge"] { justify-content: flex-end; }
.pane[data-key="edge"] .eb { margin-bottom: 10px; }
.pane .stamp {
  font-family: var(--mono); font-size: clamp(10px, 1.3vmin, 12px);
  letter-spacing: 0.14em; line-height: 1.75; color: var(--ash);
  max-width: 56ch; text-transform: uppercase;
}

/* ---- bottom HUD ---- */
.hudline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  padding: 12px clamp(16px, 3vw, 28px);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ash);
}
.hudline .hudmeta { margin-left: auto; letter-spacing: 0.14em; color: var(--ash-dim); }
.hudline a { color: inherit; text-decoration: none; }
.hudline a:hover { color: var(--red-hot); }

/* ---- responsive: column flow under 980px, page scrolls ---- */
@media (max-width: 980px) {
  body { overflow: auto; }
  .stage { position: static; padding: 64px 14px 52px; display: block; }
  .board {
    width: 100%; height: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(86px, auto);
    gap: 10px;
  }
  .display { grid-area: 1 / 1 / 2 / 3; min-height: min(62vh, 460px); order: 0; }
  .mod { grid-area: auto !important; min-height: 86px; }
  /* numbered order — DOM order serves the desktop grid placement */
  .mod[data-key="edge"] { order: 1; }
  .mod[data-key="offer"] { order: 2; }
  .mod[data-key="security"] { order: 3; }
  .mod[data-key="consulting"] { order: 4; }
  .mod[data-key="research"] { order: 5; }
  .mod[data-key="ecosystem"] { order: 6; }
  .mod[data-key="products"] { order: 7; }
  .mod[data-key="contact"] { order: 8; }
  .hudline { position: static; padding: 14px; }
  .hudline .hudmeta { margin-left: auto; }
  .lockup { height: clamp(110px, 26vmin, 180px); }
}
@media (max-width: 460px) {
  .pane { padding: 18px 16px; }
  .pane .row b { flex-basis: 58px; }
  .status { display: none; }
}

/* ---- reduced motion: no sweeps, no blinking, instant panes ---- */
@media (prefers-reduced-motion: reduce) {
  .rec { animation: none; }
  .pane.in, .pane.out { animation: none; }
  .pane.out { visibility: hidden; }
  .display.sweeping .sweep { animation: none; opacity: 0; }
  .mod, .mod::after { transition: none; }
}
