/* Colours and spacing in one place so themes are easy to add later. */
:root {
  --bg: #0a0a0b;
  --fg: #ece9e2;
  --dim: rgba(236, 233, 226, 0.58);
  --faint: rgba(236, 233, 226, 0.32);
  --line: rgba(236, 233, 226, 0.24);
  --accent: #9ff0c8;
  --comment: #6b7a70;
  --gap: 24px;
  --inset: calc(var(--gap) + 26px);
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 300;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

#field { position: fixed; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

.frame { position: fixed; inset: var(--gap); border: 1px solid var(--line); pointer-events: none; }

/* Top row: name and role left, navigation right. */
.top {
  position: fixed;
  top: calc(var(--gap) + 22px);
  left: var(--inset);
  right: var(--inset);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 32px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
}
.top a { pointer-events: auto; }

/* Name block styled as NatSpec: comment lines around the name. */
.natspec { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--comment); }

.h-name { margin: 0; font: inherit; }
.name {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(28px, 4.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.cursor { color: var(--accent); animation: blink 1.06s steps(2, start) infinite; }

.role {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

nav { display: flex; gap: 28px; padding-top: 10px; }
nav a { font-family: var(--mono); font-size: 12px; color: var(--dim); transition: color 0.2s; }
nav a:hover, nav a.on { color: var(--fg); }
nav a::before { content: "/"; color: var(--faint); margin-right: 4px; }
nav a.on::before { color: var(--accent); }

/* Bottom row: flex so the intro and the readout can never overlap.
   On narrow screens they wrap onto separate lines. */
.bottom {
  position: fixed;
  left: var(--inset);
  right: var(--inset);
  bottom: calc(var(--gap) + 20px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 40px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
}
.bottom p { margin: 0; }

/* About card: looks like a block record, same hairlines as the frame. */
.bio {
  flex: 0 1 380px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.72);
}
.bio-head, .bio-foot {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  color: var(--faint);
}
.bio-head { border-bottom: 1px dashed var(--line); }
.bio-foot { border-top: 1px dashed var(--line); }
.bio dl {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 5px 12px;
  margin: 0;
  padding: 12px 14px;
}
.bio dt { color: var(--faint); }
.bio dt::after { content: ":"; }
.bio dd { margin: 0; color: var(--fg); }
.bio .live { color: var(--accent); }
.bio .live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--accent);
  animation: blink 1.6s steps(2, start) infinite;
}
.bio .signed { color: var(--accent); }
.bio .signed::before { content: "✓ "; }
@keyframes blink { to { visibility: hidden; } }

.ledger {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.9;
  text-align: right;
  color: var(--dim);
  white-space: pre;
}
.ledger b { font-weight: 400; color: var(--fg); }
.ledger i { font-style: normal; color: var(--accent); }

/* Panels: hidden until their nav link is chosen. */
.panels {
  position: fixed;
  top: calc(var(--gap) + 130px);
  bottom: calc(var(--gap) + 44px + var(--bottom-h, 150px));
  right: var(--inset);
  width: min(46vw, 560px);
  z-index: 1;
  pointer-events: none;
}
.panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 4px 8px 4px 28px;
  border-left: 1px solid var(--line);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.35s, transform 0.35s;
  visibility: hidden;
  scrollbar-width: thin;
}
.panel:focus { outline: none; }
.panel.open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }

.panel h2 {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.projects { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.projects li { border-top: 1px solid var(--line); }
.projects a {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 4px 12px;
  padding: 16px 0 18px;
}
.projects .year { font-family: var(--mono); font-size: 11px; color: var(--faint); padding-top: 5px; }
.projects .title { font-size: 20px; font-weight: 400; transition: color 0.2s; }
.projects .title::after { content: "↗"; margin-left: 8px; font-size: 13px; color: var(--faint); }
.projects .desc { grid-column: 2 / 4; font-size: 13px; line-height: 1.6; color: var(--dim); }
.projects .tags { grid-column: 2 / 4; font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 4px; }
.projects a:hover .title { color: var(--accent); }

.stack { margin: 0; }
.stack dt { font-family: var(--mono); font-size: 11px; color: var(--faint); padding-top: 16px; border-top: 1px solid var(--line); }
.stack dd { margin: 6px 0 18px; font-size: 18px; line-height: 1.5; }

.contact { list-style: none; margin: 0; padding: 0; }
.contact li { border-top: 1px solid var(--line); }
.contact a { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; font-size: 18px; }
.contact a span { font-family: var(--mono); font-size: 12px; color: var(--dim); align-self: center; }
.contact a:hover { color: var(--accent); }

/* Tablets and phones: tighter frame, panel covers the full width. */
@media (max-width: 900px) {
  :root { --gap: 12px; --inset: calc(var(--gap) + 16px); }
  .top { top: calc(var(--gap) + 16px); }
  nav { gap: 18px; padding-top: 4px; }
  .panels { left: var(--inset); width: auto; top: calc(var(--gap) + 150px); }
  /* With a panel open on a narrow screen, only the animation switcher stays
     at the bottom, so the panel has room and nothing overlaps. */
  body.panel-open .bio, body.panel-open .ledger { display: none; }
  .panel { padding-left: 0; border-left: 0; background: rgba(10, 10, 11, 0.9); }
  .bio { flex-basis: 100%; font-size: 11px; }
  .ledger { margin-left: 0; text-align: left; }
}

.projects .badge { grid-column: 2 / 4; font-family: var(--mono); font-size: 11px; color: var(--accent); }

/* Animation switcher sits in the bottom row between intro and readout. */
.modes { display: flex; gap: 4px; pointer-events: auto; }
.modes button {
  font: 11px var(--mono);
  color: var(--faint);
  background: none;
  border: 1px solid transparent;
  padding: 5px 10px;
  cursor: pointer;
}
.modes button:hover { color: var(--dim); }
.modes button.on { color: var(--fg); border-color: var(--line); }
@media (max-width: 900px) { .modes { order: 3; flex-basis: 100%; margin-left: -10px; } }

