/* Sonoran Design Labs — "One Word"
   Bone paper, black ink. The only colour is the sun inside the O. */

/* Self-hosted fonts (latin subsets, woff2). Archivo is variable: weight 700–900, width 100–125%. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 700 900;
  font-stretch: 100% 125%;
  font-display: swap;
  src: url("fonts/Archivo-700-900.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/IBMPlexMono-500.woff2") format("woff2");
}

:root {
  --paper: #edeae2;
  --ink:   #0c0b09;
  --ink-2: #5d5a53;
  --rule:  rgba(12, 11, 9, 0.18);
  --sun:   #ff9a00;          /* overridden live by sun.js */
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --grot:  "Archivo", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(1rem, 4vw, 3rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: hidden;            /* the word intentionally exceeds the viewport */
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* Top bar ------------------------------------------------------------- */
.bar {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 1rem var(--gutter);
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.bar__id { font-weight: 500; }
.bar__clock { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* The word ------------------------------------------------------------ */
.word-stage {
  position: relative;
  margin: clamp(2.5rem, 9vh, 7rem) 0 clamp(3rem, 10vh, 8rem);
}
.word {
  margin: 0;
  position: relative; left: 50%; transform: translateX(-50%);
  width: max-content;
  font-family: var(--grot);
  font-weight: 850;
  font-stretch: 112%;
  font-size: 20vw;               /* ~104vw wide: S and N break the edges on purpose */
  line-height: 0.8;
  letter-spacing: -0.045em;
  white-space: nowrap;
  user-select: none;
}
.word > span { display: inline-block; position: relative; line-height: 1; }
.word .o--sun { isolation: isolate; }
.bl { display: inline-block; width: 0; height: 0; vertical-align: baseline; }

/* The sun: a disc behind the O that fills from the bottom. */
.sun {
  position: absolute; z-index: -1;
  border-radius: 50%;
  background: linear-gradient(to top, var(--sun) var(--fill, 0%), transparent var(--fill, 0%));
  transition: background 1s linear;
}

/* Annotations hung off the letterforms (percent of the word box) ------- */
.notes {
  list-style: none; margin: 0; padding: 0;
  position: absolute; inset: 0;
  width: 100%;
  font-size: 0.72rem; line-height: 1.35;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2);
  pointer-events: none;
}
.note { position: absolute; white-space: nowrap; }
.note--tl { left: var(--gutter); bottom: calc(100% + 0.9rem); }
.note--tr { right: var(--gutter); bottom: calc(100% + 0.9rem); text-align: right; }
.note--bl { left: var(--gutter); top: calc(100% + 0.9rem); color: var(--ink); }
.note--bc { left: 50%; transform: translateX(-50%); top: calc(100% + 0.9rem); font-variant-numeric: tabular-nums; }
.note--br { right: var(--gutter); top: calc(100% + 0.9rem); text-align: right; }
.note--bl span, .note--br span { display: block; }

/* Index --------------------------------------------------------------- */
.index { margin: 0 var(--gutter); border-top: 1px solid var(--ink); }
.row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem 2rem;
  padding: 1.6rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}
.row__key { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; }
.num { display: inline-block; width: 2.2em; color: var(--ink-2); font-weight: 400; }
.row__val { max-width: 40rem; }
.lede {
  margin: 0;
  font-family: var(--grot);
  font-weight: 700; font-stretch: 100%;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.12; letter-spacing: -0.02em;
  color: var(--ink);
}
.meta { margin: 0.6rem 0 0; color: var(--ink-2); }
.meta a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: var(--rule); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }
.links a { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-color: var(--rule); }
.links a:hover { text-decoration-color: var(--ink); }

/* Form ---------------------------------------------------------------- */
.form { margin-top: 1.75rem; display: grid; gap: 1.4rem; max-width: 34rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.field input, .field textarea {
  width: 100%;
  padding: 0.55rem 0;
  border: 0; border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1rem/1.4 var(--mono);
  outline: none;
}
.field textarea { resize: vertical; min-height: 5.5rem; }
.field input:focus, .field textarea:focus { border-bottom-width: 2px; padding-bottom: calc(0.55rem - 1px); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.form__status { margin: 0; }
.form__status:empty { display: none; }
.form__status.is-ok { color: var(--ink); }
.form__status.is-err { color: #b3320f; }
.send {
  justify-self: start;
  appearance: none; border: 0; border-radius: 0;
  padding: 0.8rem 1.2rem;
  background: var(--ink); color: var(--paper);
  font: 500 0.75rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
}
.send:hover { background: var(--sun); color: var(--ink); }
.send:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Colophon ------------------------------------------------------------ */
.colophon {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
  margin: 0 var(--gutter); padding: 1.2rem 0 2.5rem;
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* Small screens: keep the word on one line, stack the annotations ------ */
@media (max-width: 720px) {
  .word-stage { margin-top: 2rem; margin-bottom: 2rem; }
  .notes { position: static; display: grid; gap: 0.35rem; margin-top: 1.25rem; padding: 0 var(--gutter); }
  .note { position: static; transform: none; text-align: left; white-space: normal; }
  .note--tl { order: 1; } .note--bl { order: 2; } .note--br { order: 3; }
  .note--bc { order: 4; margin-top: 0.4rem; } .note--tr { order: 5; }
  .note--bl span, .note--br span { display: inline; }
  .note--br span + span::before { content: "· "; }
  .row { grid-template-columns: 1fr; gap: 0.6rem; padding: 1.3rem 0 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sun { transition: none; }
}
