/* developinginpublic — site styles.
   Ported from the prototype's inline styles. Design rules live in
   designsystem/readme.md; the tokens below are the same files it documents. */

@import "./tokens/colors.css";
@import "./tokens/typography.css";
@import "./tokens/spacing.css";
@import "./tokens/effects.css";

* { box-sizing: border-box; }

/* The page sheet, lifted off the canvas. */
.page {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  box-shadow: var(--shadow-sheet);
}

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

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Site-wide work-in-progress notice, first thing inside the sheet.
   ponytail: hardcoded copy, not a prop — one banner, one message. Give it a
   prop when a second page needs to say something different. */
.wip {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0;
  padding: var(--space-3) var(--gutter-page);
  background: var(--accent-wash-soft);
  border-bottom: 1px solid var(--border-hairline-soft);
  font-size: var(--type-kicker-size);
  color: var(--text-caption);
}
.wip__tag {
  font-family: var(--font-mono);
  letter-spacing: var(--type-kicker-ls);
  text-transform: uppercase;
  color: var(--accent-hi);
  font-weight: 600;
  padding: 3px var(--space-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-wash);
  white-space: nowrap;
}

/* ---- Section scaffolding ---- */

.section { padding: 40px var(--gutter-page) 48px; }
.section--tight { padding: 48px var(--gutter-page) 8px; }
.rule-top { background: var(--hairline-fade) no-repeat top / 100% 1px; }

.kicker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--type-kicker-size);
  letter-spacing: var(--type-kicker-ls);
  text-transform: uppercase;
  color: var(--accent-hi);
  margin-bottom: var(--space-4);
}
.kicker::before {
  content: "";
  width: var(--rule-w);
  height: var(--rule-h);
  background: var(--accent);
}

.h2 {
  font-family: var(--font-display);
  font-weight: var(--type-h2-weight);
  font-size: var(--type-h2-size);
  margin: 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.section-head span { font-size: var(--type-meta-size); color: var(--soft); }

/* ---- Fold one: the latest drop, alone ---- */

/* ponytail: the WIP banner is the only thing above fold one, so its height is
   subtracted by a hand-tuned constant rather than measured in JS. Retune the
   two values if the banner copy changes length. */
:root { --wip-h: 45px; }

.fold-latest {
  min-height: calc(100svh - var(--wip-h));
  /* Two rows: the drop takes all the slack and centres in it, the cue sits on
     the fold line. An auto top margin here would eat the centring instead. */
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--space-8) var(--gutter-page);
}
.latest { align-self: center; display: flex; flex-direction: column; gap: var(--space-5); }
.latest__title {
  font-family: var(--font-display);
  font-weight: var(--type-hero-weight);
  font-size: clamp(30px, 5.2vw, 60px);
  line-height: var(--type-hero-lh);
  letter-spacing: var(--type-hero-ls);
  margin: 0;
  max-width: 18ch;
}
.latest__meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--type-meta-size);
  color: var(--soft);
}
.latest__meta span + span { padding-left: var(--space-4); background: var(--hairline-fade-soft) no-repeat left / 1px 100%; }

.scroll-cue {
  justify-self: start;
  align-self: end;
  padding-top: var(--space-8);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--type-ui-size);
  font-weight: var(--type-ui-weight);
  letter-spacing: var(--type-kicker-ls);
  text-transform: uppercase;
  color: var(--accent-hi);
}
.scroll-cue span { animation: drops-nudge 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .scroll-cue span { animation: none; } }

/* ---- Fold two: the whole log, and nothing else on screen ---- */

/* No banner to subtract here — by the time this fold is in view it has scrolled
   off. Taller than the viewport once there are enough drops; that just scrolls. */
.fold-log { min-height: 100svh; }

/* ---- Controls: sort + filter chips ---- */

.controls {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  padding: var(--control-pad-y) 0;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--type-ui-size);
  font-weight: var(--type-ui-weight);
  cursor: pointer;
  border: 1px solid var(--border-hairline);
  color: var(--text-2);
  background: var(--surface);
  margin-right: var(--space-2);
}
.chip {
  padding: var(--control-pad-y) var(--control-pad-x);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--type-ui-size);
  font-weight: var(--type-ui-weight);
  cursor: pointer;
  border: 1px solid var(--border-hairline);
  color: var(--muted);
  background: transparent;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent-hi);
  background: var(--accent-wash);
}
/* Upcoming is a state, not a topic — set apart from the tag chips beside it. */
.chip--upcoming { border-style: dashed; margin-right: var(--space-2); }
.sort-btn:hover, .chip:hover { border-color: var(--accent); }

/* ---- The log ---- */

.log { display: flex; flex-direction: column; }
.log-row {
  display: grid;
  grid-template-columns: 76px 1fr auto auto;
  gap: var(--space-6);
  align-items: baseline;
  padding: 15px 0;
  background: var(--hairline-fade-soft) no-repeat bottom / 100% 1px;
}
.log-row:hover { color: var(--accent-hi); }
.log-row__kind {
  font-size: var(--type-label-size);
  letter-spacing: var(--type-label-ls);
  text-transform: uppercase;
  color: var(--accent);
}
.log-row__title { font-size: var(--type-row-title-size); font-weight: var(--type-row-title-weight); }
.log-row__tag { font-size: var(--type-meta-size); color: var(--soft); }
.log-row__len {
  font-size: var(--type-meta-size);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
.log-empty { padding: var(--space-6) 0; font-size: 13px; color: var(--soft); }

/* Upcoming rows are listed, not linked — dimmed, with a dashed left tick. */
.log-row--upcoming { color: var(--muted); padding-left: var(--space-4); position: relative; }
.log-row--upcoming::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  border-left: 1px dashed var(--accent);
}
.log-row--upcoming .log-row__len { color: var(--accent); }

/* ---- Hero ---- */

.split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: var(--gap-hero); align-items: center; }
.hero { padding: var(--space-8) var(--gutter-page) 64px; }
/* Fold three: the hero holds the screen on its own, so the footer starts on the next one. */
.fold-hero { min-height: 100svh; }
.hero__stack { display: flex; flex-direction: column; gap: var(--gap-stack); }
.hero__title {
  font-family: var(--font-display);
  font-weight: var(--type-hero-weight);
  font-size: var(--type-hero-size);
  line-height: var(--type-hero-lh);
  letter-spacing: var(--type-hero-ls);
  margin: 0;
  max-width: 20ch;
}
.hero p {
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
}
.hero__actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); flex-wrap: wrap; }

.placeholder {
  width: 100%;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--placeholder-bg);
}
.placeholder span {
  font-family: var(--font-mono);
  font-size: var(--type-meta-size);
  color: var(--soft);
  background: var(--surface);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  padding: var(--btn-pad);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
}
.btn--primary { border: 1px solid var(--accent); color: var(--accent-hi); }
.btn--primary:hover { background: var(--accent-wash); }
.btn--ghost { color: var(--accent); padding: 9px var(--space-3); }
.btn--ghost:hover { background: var(--accent-wash-soft); }

/* ---- Footer ---- */

/* Fold four: contact holds its own screen, with the hero closing the page below it. */
.footer { padding: var(--space-7) var(--gutter-page) 96px; min-height: 100svh; display: grid; align-content: center; }
.footer h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--type-h2-lg-size);
  margin: 0;
}
.footer p { font-size: 13.5px; line-height: 1.6; color: var(--muted); margin: 0; }
.mail-link { color: var(--accent-hi); border-bottom: 1px solid var(--accent); }
.mail-link:hover { color: var(--accent); }

.subscribe { display: flex; flex-direction: column; gap: var(--space-2); }
.subscribe label {
  font-size: var(--type-label-size);
  letter-spacing: var(--type-label-ls);
  text-transform: uppercase;
  color: var(--soft);
}
.subscribe__row { display: flex; gap: var(--space-2); }
.subscribe input {
  flex: 1;
  min-height: var(--input-min-h);
  padding: var(--space-1) 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}
.subscribe button {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-hi);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.subscribe button:hover { background: var(--accent-wash); }

/* ---- Floating theme widget ---- */

.theme-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.picker {
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 14px var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-popover);
}
.picker__heading {
  font-size: var(--type-tag-size);
  letter-spacing: var(--type-tag-ls);
  text-transform: uppercase;
  color: var(--soft);
}
.swatches { display: flex; gap: var(--space-2); }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; padding: 0; border: 2px solid color-mix(in srgb, var(--text) 20%, transparent); }
.swatch[aria-pressed="true"] { border-color: var(--accent); }
.pill {
  padding: 10px var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--type-ui-size);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
}
.pill--mode { border-color: var(--accent); color: var(--accent-hi); }
.pill:hover { border-color: var(--accent); }

/* ---- Article ---- */

.article { padding: var(--space-8) var(--gutter-page) 96px; max-width: 780px; }
.article__meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--type-meta-size);
  color: var(--soft);
  margin-bottom: var(--space-6);
}
.article h1 {
  font-family: var(--font-display);
  font-weight: var(--type-hero-weight);
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: var(--type-hero-ls);
  margin: 0 0 var(--space-5);
}
.prose { font-size: var(--type-body-size); line-height: var(--type-body-lh); color: var(--text-body); }
.prose h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--type-h2-size);
  color: var(--text-heading);
  margin: var(--space-8) 0 var(--space-4);
}
.prose h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  color: var(--text-heading);
  margin: var(--space-7) 0 var(--space-3);
}
.prose a { color: var(--accent-hi); border-bottom: 1px solid var(--accent); }
.prose strong { color: var(--text); font-weight: 500; }
.prose blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 2px solid var(--accent);
}
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: var(--space-2) 0; }
.prose img { max-width: 100%; border-radius: var(--radius-md); display: block; margin: var(--space-6) 0 var(--space-2); }
.prose table { width: 100%; border-collapse: collapse; margin: var(--space-6) 0; font-size: 13.5px; }
.prose th, .prose td { text-align: left; padding: var(--space-2) var(--space-3); background: var(--hairline-fade-soft) no-repeat bottom / 100% 1px; }
.prose th { color: var(--text); font-weight: 500; }

/* Inline code and Shiki blocks. */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.prose pre {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: var(--space-6) 0;
}
.prose pre code { font-family: var(--font-mono); }

/* Shiki emits both themes as custom properties; pick one per mode. */
.prose .shiki, .prose .shiki span { color: var(--shiki-dark); background-color: var(--shiki-dark-bg); }
[data-mode="light"] .prose .shiki, [data-mode="light"] .prose .shiki span {
  color: var(--shiki-light);
  background-color: var(--shiki-light-bg);
}

/* ---- Responsive ---- */

@media (max-width: 720px) {
  :root { --wip-h: 78px; }  /* the banner wraps to two lines here */
  .split { grid-template-columns: 1fr; gap: 32px; }
  .section, .section--tight, .hero, .footer, .article, .fold-latest { padding-left: var(--space-6); padding-right: var(--space-6); }
  .hero__title { font-size: 36px; }
  .latest__title { max-width: none; }
  .log-row { grid-template-columns: 64px 1fr; gap: var(--space-3); }
  /* The dashed tick and dimmed text carry "upcoming" once the meta columns go. */
  .log-row__tag, .log-row__len { display: none; }
}
