/* Ninewren. Tokens are copied from DESIGN.md in the bastet-labs repo;
   change them there first, then here. */

:root {
  --bg: #EDF2F7;
  --sky-band: #DCE9F5;
  --ink: #15202B;
  --ink-muted: #4E5A66;
  --slate: #24476B;
  --rufous: #B5562E;
  --rufous-text: #A64B27;
  --rule: rgba(36, 71, 107, 0.25);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* ~64ch of body Geist. In rem, not ch, so the smaller footer text lines up. */
  --page: 40rem;
  --wordmark: clamp(3rem, 2rem + 5vw, 5rem);

  /* Fraunces SOFT axis: open decision. Swap the active line to compare. */
  --soft: 30;
  /* --soft: 0; */
  /* --soft: 50; */

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121A22;
    --sky-band: #1A2734;
    --ink: #EDF2F7;
    --ink-muted: #9AA6B2;
    /* Sky. Light-mode Slate is 1.8:1 on Night: never use it here. If this
       changes, mirror it in the favicon SVGs' dark-mode colour. */
    --slate: #8DB3D6;
    --rufous: #D9764E;
    --rufous-text: #D9764E;
    --rule: rgba(141, 179, 214, 0.2);
  }
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem); /* 17–18px */
  line-height: 1.6;
}

/* Sky band: the top of the page (wordmark and positioning line) on the light
   sky, full width; everything below on --bg. Hard edge, no gradient. */
.band { background: var(--sky-band); }

.band > header, main, footer {
  width: 100%;
  max-width: calc(var(--page) + 3rem);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.band > header { padding-top: clamp(4rem, 14vh, 9rem); padding-bottom: clamp(2.5rem, 7vh, 4rem); }
main { flex: 1; padding-top: 0.5rem; padding-bottom: 3rem; }

h1, h2, h3, .display {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" var(--soft), "WONK" 0;
  color: var(--slate);
  line-height: 1.1;
  margin: 0;
}

.wordmark {
  font-size: var(--wordmark);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.lede {
  margin: 1.5rem 0 0;
  max-width: 40ch;
  text-wrap: balance;
  font-size: 1.2em;
  line-height: 1.5;
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Tight for the placeholder phase, where sections are one line. Open this
   back up to clamp(3.5rem, 10vh, 6rem) once real app entries fill the Apps
   section. */
section {
  margin-top: clamp(2rem, 6vh, 3.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
/* The band's edge already divides the page; no rule under it. */
main > section:first-child { border-top: 0; padding-top: 0; }

p { margin: 0 0 1em; }

.muted { color: var(--ink-muted); }

a {
  color: var(--slate);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

/* "What we do": numbered rows, numerals in Fraunces. Small, so rufous-text,
   not Rufous (that's for decoration and display sizes only). */
.practice {
  list-style: none;
  margin: 0;
  padding: 0;
}
.practice li {
  display: grid;
  grid-template-columns: 2.5rem 6rem 1fr;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.practice li:last-child { border-bottom: 0; }
.practice .num {
  font-family: var(--display);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 0.9375rem;
  color: var(--rufous-text);
}
.practice b {
  font-family: var(--display);
  font-variation-settings: "SOFT" var(--soft), "WONK" 0;
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--slate);
}
@media (max-width: 30rem) {
  .practice li { grid-template-columns: 2.25rem 1fr; row-gap: 0.1rem; }
  .practice li > span:last-child { grid-column: 2; }
}

/* App plate: a catalogue entry. The device is a line drawing in Slate, CSS
   only, no image, so it follows the colour scheme. Placeholder screen until
   the first app has a real screenshot to put in it. */
.plate {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 6vw, 3.5rem);
  margin-top: 1.5rem;
}
.phone {
  --w: clamp(8.5rem, 26vw, 10.5rem);
  flex: none;
  position: relative;
  width: var(--w);
  aspect-ratio: 9 / 19.5;
  padding: calc(var(--w) * 0.045);
  border: 1.5px solid var(--slate);
  border-radius: calc(var(--w) * 0.17);
}
/* Side buttons: action + volume on the left, power on the right. */
.phone::before, .phone::after {
  content: "";
  position: absolute;
  width: 2px;
  background: var(--slate);
  border-radius: 1px 0 0 1px;
}
.phone::before {
  left: -3.5px;
  top: 19%;
  height: 7%;
  box-shadow: 0 calc(var(--w) * 0.22) 0 var(--slate), 0 calc(var(--w) * 0.4) 0 var(--slate);
}
.phone::after { right: -3.5px; top: 27%; height: 12%; border-radius: 0 1px 1px 0; }
.screen {
  position: relative;
  height: 100%;
  border-radius: calc(var(--w) * 0.13);
  border: 1px solid color-mix(in srgb, var(--slate) 30%, transparent);
  /* A light left on: something is in there. */
  background: radial-gradient(circle at 50% 46%, var(--sky-band), var(--bg) 70%);
  overflow: hidden;
}
.island {
  position: absolute;
  top: 3.2%;
  left: 50%;
  width: 30%;
  height: 3.9%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #121A22; /* Night in both schemes: the island is hardware */
}
.status {
  position: absolute;
  top: 3.4%;
  left: 10%;
  font-size: calc(var(--w) * 0.062);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}
.home {
  position: absolute;
  bottom: 2.2%;
  left: 50%;
  width: 36%;
  height: 1.2%;
  min-height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--ink);
  opacity: 0.55;
}
.mystery {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 400;
  font-size: calc(var(--w) * 0.62);
  line-height: 1;
  color: var(--rufous); /* display size, so Rufous is allowed */
  padding-bottom: 6%;
}
.plate-num {
  display: block;
  font-family: var(--display);
  font-variant-numeric: lining-nums;
  font-size: 0.9375rem;
  color: var(--rufous-text);
  margin-bottom: 0.35rem;
}
.plate h3 {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.plate p { margin: 0; }

/* House ornament. Rufous is decoration and display only, never body text
   (4.3:1 on Frost). */
.ornament {
  display: block;
  margin: clamp(2rem, 6vh, 3.5rem) 0 0; /* matches section margin-top */
  color: var(--rufous);
  font-size: 1.25rem;
  line-height: 1;
}

/* House illustration: eight wrens on a wire, and a cat sits among them. It
   is the page's one cat touch (DESIGN.md allows two per surface). Fill is
   inherited into the <use> copies; class selectors don't reach them. */
.wire {
  display: block;
  width: 100%;
  max-width: 20rem;
  height: auto;
  margin-top: clamp(2.5rem, 8vh, 4.5rem);
  fill: var(--ink);
}
.wire .cat { fill: var(--rufous); }
/* In the band it perches on the wordmark: "ninewren" is ~3.9em wide. */
.band .wire { width: calc(var(--wordmark) * 3.9); max-width: 100%; margin: 0 0 0.6rem; }

footer {
  padding-bottom: 2.5rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
footer p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  a { transition: text-decoration-thickness 120ms ease; }
  /* The question mark tips its head now and then. */
  .mystery { animation: tilt 9s ease-in-out 2s infinite; transform-origin: 50% 70%; }
  @keyframes tilt {
    0%, 88%, 100% { transform: rotate(0); }
    91% { transform: rotate(-9deg); }
    95% { transform: rotate(4deg); }
  }
}
