/*
 * HedenstamX Lab. Same "engineering drawing" tokens as how-a-building-breathes/src/theme.ts;
 * keep the two in step if the palette changes.
 */

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2');
}
/* Metric-matched fallbacks keep the layout still while the fonts arrive. */
@font-face {
  font-family: 'HX Mono Fallback';
  src: local('Courier New'), local('Courier');
  ascent-override: 102.5%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'HX Display Fallback';
  src: local('Arial');
  size-adjust: 76%;
  ascent-override: 100%;
  descent-override: 20%;
  line-gap-override: 0%;
}

:root {
  --bg: #0b1114;
  --panel: #10161a;
  --line: #24303a;
  --text: #c9d4da;
  --muted: #6e808b;
  --cold: #6fb7e9;
  --cool: #3db2a4;
  --warm: #e3a33b;
  --hot: #d4483a;
  --mono: 'IBM Plex Mono', 'HX Mono Fallback', ui-monospace, monospace;
  --display: 'Barlow Condensed', 'HX Display Fallback', 'Arial Narrow', sans-serif;
  --gutter: clamp(1rem, 4vw, 5rem);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  line-height: 1.6;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 1px solid var(--warm);
  outline-offset: 3px;
}
::selection {
  background: var(--line);
  color: var(--text);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.75rem;
}
.skip:focus {
  top: 0.5rem;
}

/* ── Top bar ───────────────────────────── */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.75rem;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.link {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.link:hover {
  color: var(--text);
  border-color: var(--line);
}

/* ── Sheet: the page drawn as a drawing with a double border and zone ticks ── */
.sheet {
  position: relative;
  flex: 1;
  width: min(100% - 2 * var(--gutter), 76rem);
  margin: clamp(1.5rem, 4vw, 3.5rem) auto;
  border: 1px solid var(--line);
  padding: 0.75rem;
}
.sheet-inner {
  border: 1px solid var(--line);
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 3.5vw, 3rem) clamp(1rem, 3vw, 2rem);
}
.zones {
  position: absolute;
  inset: 0 0.75rem auto;
  height: 0.75rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  font-size: 0.5625rem;
  line-height: 0.75rem;
  color: var(--muted);
  text-align: center;
}
.zones span + span {
  border-left: 1px solid var(--line);
}

/* ── Intro ─────────────────────────────── */
.kicker {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(3.25rem, 9vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.lead {
  max-width: 44ch;
  margin: 1.5rem 0 0;
  font-size: 0.9375rem;
}
.intro {
  display: grid;
  gap: 2rem;
  align-items: end;
  padding-bottom: clamp(2rem, 5vw, 4rem);
}
.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  font-size: 0.8125rem;
}
.summary div {
  padding: 0.625rem 0.875rem;
  min-width: 0;
}
.summary div + div {
  border-left: 1px solid var(--line);
}
.summary dt {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.summary dd {
  margin: 0.25rem 0 0;
}
@media (min-width: 60rem) {
  .intro {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
  .summary {
    justify-self: end;
    width: min(100%, 24rem);
  }
}

/* ── Register ──────────────────────────── */
.register-h {
  margin: 0;
  padding: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.register,
.register-head {
  --cols: 10.5rem 5rem minmax(0, 1fr) 6.5rem minmax(0, 1.2fr) 7rem;
}
.register-head {
  display: grid;
  grid-template-columns: var(--cols);
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.register {
  margin: 0;
  padding: 0;
  list-style: none;
}
.register li {
  border-bottom: 1px solid var(--line);
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  gap: 1.5rem;
  align-items: center;
  padding: 1rem;
  text-decoration: none;
}
a.row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--warm);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s cubic-bezier(0.6, 0, 0.2, 1);
}
a.row:hover::before,
a.row:focus-visible::before {
  transform: scaleY(1);
}
a.row:focus-visible {
  outline-offset: -1px;
}
.cell {
  min-width: 0;
}
.drawing {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.subject {
  font-size: 0.8125rem;
  color: var(--text);
}
.type {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.status {
  justify-self: end;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.arrow {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.6, 0, 0.2, 1);
}
a.row:hover .arrow,
a.row:focus-visible .arrow {
  transform: translateX(4px);
}
.is-planned .title,
.is-planned .status {
  color: var(--muted);
}

/* Thumbnails: tiny drawings, drawn in once on load */
.thumb {
  display: block;
  border: 0;
}
.thumb-svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke-width: 1.1;
}
.t-frame {
  stroke: var(--line);
}
.t-muted {
  stroke: var(--muted);
}
.t-ink {
  stroke: var(--text);
}
.t-warm {
  stroke: var(--warm);
}
.t-hot {
  stroke: var(--hot);
}
.t-cold {
  stroke: var(--cold);
}
.t-dashed {
  stroke-dasharray: 3 4;
}
@media (prefers-reduced-motion: no-preference) {
  .thumb-svg [pathLength] {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 1.2s cubic-bezier(0.6, 0, 0.3, 1) forwards;
  }
  .thumb-svg [pathLength]:nth-child(2) { animation-delay: 0.15s; }
  .thumb-svg [pathLength]:nth-child(3) { animation-delay: 0.3s; }
  .thumb-svg [pathLength]:nth-child(4) { animation-delay: 0.45s; }
  .thumb-svg [pathLength]:nth-child(5) { animation-delay: 0.6s; }
  .thumb-svg [pathLength]:nth-child(n + 6) { animation-delay: 0.75s; }
  .t-dashed {
    opacity: 0;
    animation: fade 0.6s 0.6s forwards;
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes fade {
  to {
    opacity: 1;
  }
}
a.row .t-ink,
a.row .t-muted {
  transition: stroke 0.3s;
}
a.row:hover .t-muted {
  stroke: var(--text);
}

@media (max-width: 47.99rem) {
  .register-head {
    display: none;
  }
  .register {
    border-top: 1px solid var(--line);
  }
  .row {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    grid-template-areas:
      'thumb drawing'
      'thumb title'
      'thumb type'
      'thumb subject'
      'thumb status';
    gap: 0.25rem 1rem;
    align-items: start;
    padding: 1rem 0.75rem;
  }
  .thumb { grid-area: thumb; }
  .drawing { grid-area: drawing; }
  .title { grid-area: title; font-size: 1.5rem; }
  .type { grid-area: type; }
  .subject { grid-area: subject; }
  .status { grid-area: status; justify-self: start; margin-top: 0.25rem; }
}

/* ── Title block footer ────────────────── */
.titleblock {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
}
.tb-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tb-row + .tb-row {
  border-top: 1px solid var(--line);
}
.tb-cell {
  padding: 0.75rem 1rem;
  min-width: 0;
}
.tb-cell + .tb-cell {
  border-left: 1px solid var(--line);
}
.tb-k {
  display: block;
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tb-v {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}
.tb-big {
  font-size: clamp(1rem, 2.2vw, 1.375rem);
}
@media (min-width: 48rem) {
  .tb-row.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tb-row.split {
    grid-template-columns: 2fr 1fr;
  }
}
@media (max-width: 47.99rem) {
  .tb-row.four .tb-cell:nth-child(3) {
    border-left: 0;
  }
  .tb-row.four .tb-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .tb-row.split {
    grid-template-columns: 1fr;
  }
  .tb-row.split .tb-cell + .tb-cell {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 1rem;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ── 404 ───────────────────────────────── */
.notfound {
  min-height: 40svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.notfound p {
  max-width: 44ch;
}
