/* ==========================================================================
   Bucket Apps — coming soon
   Palette roles: primary / ink / paper / accent / muted.
   Midnight (dark) is the default; Clay (light) is a five-value swap.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- The five roles: Midnight (default) --- */
  --primary: #F2B138;
  --ink:     #12161B;
  --paper:   #F7F8F9;
  --accent:  #5B8DEF;
  --muted:   #6B7683;

  /* Ground/type orientation for Midnight: ink is the ground, paper is the type.
     Clay flips this pair in the light block below. */
  --surface: var(--ink);
  --text:    var(--paper);

  /* --- Derived tones. Every one of these leans on --text/--surface, so they
     re-point automatically when the roles swap; no per-theme restatement. --- */
  --text-soft:  color-mix(in srgb, var(--text) 82%, var(--surface));
  --text-quiet: color-mix(in srgb, var(--muted) 55%, var(--text));
  --app-description: var(--text-soft);
  --rule:       color-mix(in srgb, var(--text) 14%, transparent);

  /* --- Type ---
     Both stacks are local-only. The page downloads no fonts at all.

     Display — each platform lands on the best screen serif it already ships:
       macOS/iOS  Charter      (installed with the OS)
       Windows    Constantia   (ClearType Collection, Vista onward)
       Linux      Bitstream Charter or Charis SIL, else the default serif
       Android    Noto Serif, via the generic
     ui-serif is deliberately not first. It would reach New York on Apple — the
     closest thing to a screen-first literary serif on any platform — but on
     Windows it tends to resolve to Times New Roman and lose Constantia, which
     is the worse half of that trade.
     None of these families has a variable weight axis; they are Regular and
     Bold only. So .wordmark's 600 resolves to the family's 700, and the lockup
     sits heavier than it would under a variable face. Drop it to 400 if that
     ever reads as too much.

     Sans — Helvetica ships on macOS and iOS only, so the rest of the chain
     names the best local stand-in per platform rather than leaving the browser
     to guess: Nimbus Sans is URW's Helvetica clone and what fontconfig already
     aliases Helvetica to on most Linux boxes, and Arial — Windows' answer — is
     metrically identical to Helvetica, so line breaks hold everywhere and only
     the terminals differ. At the 13–17px this stack runs at, that is invisible.

     The trade accepted here: with no webfont, the display face genuinely
     differs per platform at 3.9rem, where it is most visible. Newsreader was
     the alternative and is recorded in BUC-5. */
  --font-display: Charter, "Bitstream Charter", "Charis SIL",
                  Constantia, "Iowan Old Style", Georgia, serif;
  --font-ui: "Helvetica Neue", Helvetica, "Nimbus Sans", Arial, "Liberation Sans", sans-serif;

  /* --- Space --- */
  --gutter: clamp(1.5rem, 6vw, 6rem);
  --measure: 46rem;
}

/* Clay: the same five roles, different values — plus the ink/paper flip.
   In Midnight, ink is the GROUND and paper is the TYPE; in Clay it is the other
   way round, so --surface/--text are repointed here rather than aliased once.
   Doing the flip in this block (not in an @supports light-dark() block) keeps
   the light theme genuinely light in every browser that understands
   prefers-color-scheme, with no dark-on-dark fallback. */
:root[data-theme="light"] {
  color-scheme: light;
  --primary: #C85A34;
  --ink:     #221C18;
  --paper:   #FAF6F0;
  --accent:  #2F7A68;
  --muted:   #8B7D72;

  --surface: var(--paper);
  --text:    var(--ink);
  --app-description: #4B4038;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --primary: #C85A34;
    --ink:     #221C18;
    --paper:   #FAF6F0;
    --accent:  #2F7A68;
    --muted:   #8B7D72;

    --surface: var(--paper);
    --text:    var(--ink);
    --app-description: #4B4038;
  }
}

/* --------------------------------------------------------------- reset --- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  background-color: var(--surface);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;      /* fallback */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter);
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

ul { list-style: none; padding: 0; }

::selection { background: var(--primary); color: var(--surface); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------- layout ---
   Auto block margins centre the content vertically and push the footer down.
   When the content outgrows a short viewport the margins collapse to 0 and the
   page simply scrolls — nothing is clipped. Auto inline margins centre the
   measure horizontally: body is a column flex container, so on the cross axis a
   fixed-width item would otherwise sit flush left on wide viewports. */

.content {
  width: 100%;
  max-width: var(--measure);
  margin-block: auto;
  margin-inline: auto;
}

.footer {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-top: clamp(2.5rem, 6vw, 4rem);
}

/* --------------------------------------------------------------- lockup --- */

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.lockup {
  display: flex;
  align-items: center;
  gap: clamp(0.65rem, 1.6vw, 1rem);
  color: var(--primary);
}

.mark {
  width: clamp(2.5rem, 6vw, 3rem);
  height: auto;
  flex: none;
}

.wordmark {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.005em;
}

.theme-toggle {
  width: 2.75rem;
  height: 2.75rem;
  display: none;
  place-items: center;
  flex: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.theme-toggle[data-active-theme] { display: grid; }

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle:active { transform: scale(0.95); }

.theme-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle[data-active-theme="dark"] .theme-icon-sun,
.theme-toggle[data-active-theme="light"] .theme-icon-moon {
  display: block;
}

/* ----------------------------------------------------------- brand line ---
   Display scale, but set in the text colour: Clay's primary is only ~4:1 on
   Clay paper, so primary stays on the mark, the wordmark and the accents. */

.brand-line {
  max-width: 17ch;
  margin-top: clamp(2.25rem, 6vw, 3.5rem);
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.3rem + 3.6vw, 3.9rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

/* ----------------------------------------------------------------- apps ---
   Each app hangs under a hairline with a short bar overhanging its left end —
   the mark's rim-over-body step, reused as structure. */

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
  margin-top: clamp(2.75rem, 7vw, 4.5rem);
}

.app {
  position: relative;
  border-top: 1px solid var(--rule);
  padding-top: 1.1rem;
}

.app::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 1.75rem;
  height: 3px;
  border-radius: 1.5px;
  background: var(--accent);
}

.app-name {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.app-teaser {
  margin-top: 0.35rem;
  max-width: 30ch;
  color: var(--app-description);
}

/* -------------------------------------------------------- status, footer --- */

.status,
.footer p {
  color: var(--text-quiet);
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}

.status {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  max-width: 34ch;
}

.footer p {
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------- movement --- */

.reveal {
  animation: rise 600ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.brand-header { animation-delay: 0ms; }
.brand-line { animation-delay: 90ms; }
.apps       { animation-delay: 180ms; }
.status     { animation-delay: 270ms; }
.footer     { animation-delay: 360ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .theme-toggle { transition: none; }
}
