/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg: #070b09;
  --bg-panel: #0e1714;
  --grid-line: rgba(143, 255, 166, 0.07);
  --grid-line-soft: rgba(143, 255, 166, 0.04);
  --copper: #c8763f;
  --copper-dim: rgba(200, 118, 63, 0.45);
  --cyan: #51e4ff;
  --led-green: #8fffa6;
  --silk: #eae8e0;
  --silk-dim: #9aa39c;
  --motion: 0.25s;

  /* clock widget sizing — one responsive value drives the whole board */
  --cw: clamp(210px, 28vw, 320px);
  --ch: calc(var(--cw) * 1.07);
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0s; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--silk);
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.55;
  background-image: radial-gradient(circle, rgba(81, 228, 255, 0.06) 1px, transparent 1.6px);
  background-size: 26px 26px;
}

@media (prefers-reduced-motion: no-preference) {
  body { animation: drift 70s linear infinite; }
}
@keyframes drift {
  from { background-position: 0 0; }
  to   { background-position: 260px 260px; }
}

h1, h2, .mark, .eyebrow { font-family: 'Space Mono', monospace; }
.mono, .designator, nav, .spec-sheet, .clock-caption, footer { font-family: 'Inconsolata', monospace; }

a { color: inherit; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.trace-link {
  position: relative;
  text-decoration: none;
  color: var(--silk-dim);
  padding-bottom: 4px;
  transition: color var(--motion) ease;
}
.trace-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  transition: width var(--motion) ease;
}
.trace-link:hover,
.trace-link:focus-visible { color: var(--silk); }
.trace-link:hover::after,
.trace-link:focus-visible::after { width: 100%; }

/* ============================================================
   NAV
   ============================================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(20px, 5vw, 60px);
  background: rgba(7, 11, 9, 0.86);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--grid-line);
}

.mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--silk);
  text-decoration: none;
  font-size: 1rem;
}
.mark svg { width: 20px; height: 20px; flex-shrink: 0; }

.site-nav ul {
  display: flex;
  gap: clamp(14px, 3vw, 30px);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(28px, 5vw, 60px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 60px) clamp(64px, 8vw, 110px);
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 56px; }
  .hero .lede { margin-inline: auto; }
}

.eyebrow {
  color: var(--copper);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  line-height: 1.16;
  margin: 0 0 18px;
  color: var(--silk);
}

.lede {
  color: var(--silk-dim);
  font-size: 1.05rem;
  max-width: 460px;
  margin: 0;
}

/* ============================================================
   CLOCK WIDGET (U1) — now a single SVG board
   ============================================================ */
.clock-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.ssd-board {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.459);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(81, 228, 255, 0.05);
  overflow: hidden;
}

/* The one SVG fills the board; everything lives inside its coordinate space. */
.ssd-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Segment bodies start dark; JS toggles the .on class. */
.seg {
  fill: #11160f;
  stroke: rgba(81, 228, 255, 0.10);
  stroke-width: 0.6;
  transition: fill var(--motion) ease, filter var(--motion) ease;
}
.seg.on {
  fill: var(--silk);
  filter: drop-shadow(0 0 4px rgba(234, 232, 224, 0.55));
}

/* Circuit traces: dim when their segment is off, lit cyan when on. */
.trace {
  fill: none;
  stroke: #0c2630;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--motion) ease, filter var(--motion) ease;
}
.trace.on {
  stroke: var(--cyan);
  filter: drop-shadow(0 0 3px var(--cyan));
}

/* Solder pads at trace ends. */
.pad { fill: #0c2630; transition: fill var(--motion) ease; }
.pad.on { fill: var(--cyan); }

/* The bit terminals: each LED is the SOURCE of one segment's trace.
   It carries the bit value and lights up with the wire it drives. */
.led-box {
  fill: #111111;
  stroke: #0c2630;
  stroke-width: 1.5;
  transition: stroke var(--motion) ease, filter var(--motion) ease;
}
.led-box.on {
  stroke: var(--cyan);
  filter: drop-shadow(0 0 4px var(--cyan));
}
.led-text {
  fill: var(--silk-dim);
  font-family: 'Inconsolata', monospace;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  transition: fill var(--motion) ease;
}
.led-text.on { fill: var(--led-green); }
.led-label {
  fill: var(--copper);
  font-family: 'Inconsolata', monospace;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.clock-caption {
  font-size: 0.85rem;
  color: var(--silk-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

.designator-badge {
  color: var(--copper);
  border: 1px solid var(--copper-dim);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
}

.status-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--led-green);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-green);
  box-shadow: 0 0 8px var(--led-green);
}
@media (prefers-reduced-motion: no-preference) {
  .status-dot { animation: pulse 2.2s ease-in-out infinite; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ============================================================
   WORK / BUILD LOG
   ============================================================ */
section { scroll-margin-top: 70px; }

#work, #about {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px clamp(20px, 5vw, 60px) 100px;
}

.section-head { max-width: 600px; margin-bottom: 32px; }
.section-head h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0 0 10px;
  color: var(--silk);
}
.section-head p { color: var(--silk-dim); margin: 0; }

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: 200px;
  gap: 20px;
}

.socket {
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 26px 22px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
  transition: border-color var(--motion) ease, background var(--motion) ease;
}
.socket:hover, .socket:focus-within {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(81, 228, 255, 0.06), transparent);
}

.socket .designator { color: var(--copper); font-size: 0.85rem; }

/* Generic scaffolding for any socket running a live build: twice the size
   of an empty one (spans two grid columns and two rows), positioned so a
   socket can layer a canvas/image inside it. Socket-specific styling
   (backgrounds, canvas colors, etc.) lives in that socket's own stylesheet,
   e.g. styles/u2-snow.css. */
.socket--live {
  position: relative;
  overflow: hidden;
  grid-column: span 2;
  grid-row: span 2;
  min-height: 400px;
  border-style: solid;
  border-color: var(--cyan);
}

/* on narrow screens the grid is one column wide; don't force a 2-col span */
@media (max-width: 520px) {
  .socket--live { grid-column: auto; }
}

.socket-label {
  font-family: 'Space Mono', monospace;
  color: var(--silk-dim);
  font-size: 1rem;
  margin-top: auto;
}

.socket-sub {
  color: var(--silk-dim);
  font-size: 0.85rem;
  opacity: 0.75;
  margin: 4px 0 0;
}

/* ============================================================
   ABOUT / SPEC SHEET
   ============================================================ */
.spec-sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 8px;
}
.spec-sheet tr { border-bottom: 1px solid var(--grid-line); }
.spec-sheet tr:last-child { border-bottom: none; }
.spec-sheet td { padding: 14px 8px; vertical-align: top; }
.spec-sheet td:first-child {
  color: var(--copper);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  white-space: nowrap;
  padding-right: 24px;
  width: 1%;
}
.spec-sheet td:last-child { color: var(--silk-dim); }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--grid-line);
  padding: 36px clamp(20px, 5vw, 60px);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--silk-dim);
}
footer .mark { font-size: 0.9rem; }
footer ul {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.fine-print { width: 100%; opacity: 0.6; font-size: 0.78rem; margin-top: 8px; }