/*
 * Amordle updates.
 *
 * The tokens below are lifted from the game's own shell (src/app/tui-shell.css
 * and src/app/globals.css) rather than approximated, so this site and the game
 * are the same object seen from two places. The type scale is the game's six
 * steps, the spacing scale its seven, and the rules, prompts and hanging
 * markers are the ones the app uses.
 *
 * Hand-written CSS on purpose. A changelog that needs a build step to publish a
 * paragraph is a changelog that stops getting written.
 */

:root {
  --tui-font:
    ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  --background: oklch(0.975 0.006 220);
  --surface: oklch(0.955 0.008 220);
  --surface-inset: oklch(0.99 0.003 220);
  --ink: oklch(0.19 0.018 225);
  --muted: oklch(0.42 0.018 225);
  --border: oklch(0.68 0.02 220);
  --accent: oklch(0.66 0.14 165);
  --accent-text: oklch(0.4 0.12 165);
  --accent-soft: oklch(0.89 0.045 165);
  --focus: oklch(0.58 0.15 165);

  --text-1: 0.6875rem;
  --text-2: 0.75rem;
  --text-3: 0.875rem;
  --text-4: 1.0625rem;
  --text-5: 1.3125rem;
  --text-6: 1.6875rem;

  --space-1: 0.125rem;
  --space-2: 0.25rem;
  --space-3: 0.5rem;
  --space-4: 0.75rem;
  --space-5: 1rem;
  --space-6: 1.5rem;
  --space-7: 2.5rem;
  --marker-gutter: 1.25rem;

  --rule: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.12 0.012 225);
    --surface: oklch(0.16 0.014 225);
    --surface-inset: oklch(0.105 0.01 225);
    --ink: oklch(0.91 0.008 205);
    --muted: oklch(0.67 0.014 210);
    --border: oklch(0.38 0.018 220);
    --accent: oklch(0.76 0.13 165);
    --accent-text: oklch(0.8 0.12 165);
    --accent-soft: oklch(0.25 0.045 165);
  }
}

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

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: var(--tui-font);
  font-size: var(--text-3);
  line-height: 1.7;
}

.frame {
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-7);
}

/* The shell's masthead: a name, a path, and a rule under both. */

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: baseline;
  border-bottom: var(--rule);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
}

.masthead a {
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.masthead a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.masthead .path {
  color: var(--muted);
  font-size: var(--text-2);
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: var(--space-5);
  font-size: var(--text-2);
}

.masthead nav a {
  color: var(--accent-text);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The route header: the ❯ prompt hanging in its own gutter. */

.page-title {
  display: grid;
  grid-template-columns: var(--marker-gutter) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: var(--text-5);
  font-weight: 650;
}

.page-title::before {
  content: '❯';
  color: var(--accent-text);
}

.page-intro {
  margin: 0 0 var(--space-7) var(--marker-gutter);
  padding-left: var(--space-3);
  max-width: 68ch;
  color: var(--muted);
  font-size: var(--text-2);
}

/* The index: one row per post, ruled, the way the app rules its lists. */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  border-top: var(--rule);
  padding: var(--space-5) 0;
}

.post-list li:last-child {
  border-bottom: var(--rule);
}

.post-list h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-4);
  font-weight: 650;
}

.post-list h2 a {
  color: inherit;
  text-decoration: none;
}

.post-list h2 a:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post-list p {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: var(--text-2);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta .tag {
  border: var(--rule);
  padding: var(--space-1) var(--space-3);
}

.meta .tag.is-visual {
  border-color: var(--accent);
  color: var(--accent-text);
}

/* A post. */

.post > * {
  max-width: 68ch;
}

.post h2 {
  margin: var(--space-7) 0 var(--space-4);
  border-top: var(--rule);
  padding-top: var(--space-5);
  font-size: var(--text-4);
  font-weight: 650;
  max-width: none;
}

.post h3 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--text-3);
  font-weight: 650;
}

.post p {
  color: var(--muted);
}

.post strong {
  color: var(--ink);
  font-weight: 650;
}

.post ul {
  margin: 0 0 var(--space-5);
  padding-left: var(--marker-gutter);
  color: var(--muted);
}

.post li {
  margin-bottom: var(--space-3);
}

.post li::marker {
  color: var(--accent-text);
}

.post a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post code {
  background: var(--surface-inset);
  border: var(--rule);
  padding: 0 var(--space-2);
  font-size: 0.95em;
}

.post figure {
  margin: var(--space-6) 0;
  max-width: none;
}

.post video {
  display: block;
  width: 100%;
  border: var(--rule);
  background: var(--surface-inset);
}

.post figcaption {
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: var(--text-2);
}

.callout {
  border: var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: var(--space-5);
  margin: var(--space-6) 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Footer. */

.site-footer {
  margin-top: var(--space-7);
  border-top: var(--rule);
  padding-top: var(--space-4);
  color: var(--muted);
  font-size: var(--text-1);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.site-footer a {
  color: var(--accent-text);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
