/* LicketySync site theme. MPL-2.0.
   Warm and playful: cream paper, ink outlines, rounded everything.
   System fonts only; nothing here loads from anywhere else.
   Contrast (WCAG 2), the lowest ratio of each pair, rounded down,
   light / dark; AA needs 4.5 for text and 3 for focus rings:
     text on bg, bg-alt, card, note, soon      13.6 / 10.7
     muted on bg, bg-alt, card                  6.6 /  8.3
     link on bg, bg-alt, card, note, soon       5.6 /  7.4
     accent on bg, bg-alt, card, soon           5.2 /  5.4
     button-text on button                     10.0 / 10.6
     bg on text (the current menu pill)        14.5 / 15.2
     focus ring on bg, bg-alt, card, note, soon 5.9 /  8.4
   Recheck these when a colour changes. */

:root {
  color-scheme: light dark;
  --bg: #FFF8EE;
  --bg-alt: #FFEFD9;
  --card: #FFFFFF;
  --text: #2A2135;
  --muted: #5C5066;
  --link: #0B6B66;
  --link-hover: #084F4B;
  --accent: #B5381F;
  --line: #EBD9C2;
  --ink-line: #2A2135;
  --focus: #1D4ED8;
  --note: #E3F6F1;
  --soon: #FFF1C7;
  --button: #FFC94A;
  --button-text: #2A2135;
  --coral: #FF7A5C;
  --sun: #FFC94A;
  --mint: #8EDCC8;
  --sky: #9CC9FF;
  --radius: 1.25rem;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT", "Arial Rounded MT Bold", Calibri, var(--font-body);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1D1823;
    --bg-alt: #272030;
    --card: #2D2536;
    --text: #F7EFE5;
    --muted: #CDBFD0;
    --link: #7ED9CF;
    --link-hover: #A9E8E0;
    --accent: #FF8E77;
    --line: #42374D;
    --ink-line: #F7EFE5;
    --focus: #FFD166;
    --note: #1E3A37;
    --soon: #3D3420;
    --button: #FFD166;
    --sun: #FFD166;
  }
}

/* Base */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 var(--font-body);
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--link-hover); text-decoration-thickness: 0.14em; }

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

h1, h2, h3, h4 {
  font-family: var(--font-round);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); font-weight: 800; margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.85rem); font-weight: 800; margin: 2.75rem 0 0.9rem; }
h3 { font-size: 1.25rem; font-weight: 700; margin: 2rem 0 0.5rem; }
h4 { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.4rem; }

p, ul, ol, dl, table, blockquote, pre { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: 0.35rem; }
li::marker { color: var(--accent); }

strong { font-weight: 700; }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }
code {
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 0.45em;
}
pre {
  background: var(--bg-alt);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
}
pre code { background: none; padding: 0; }

blockquote {
  margin-left: 0;
  padding: 0.9rem 1.25rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-left: 0.4rem solid var(--coral);
  border-radius: var(--radius);
}
blockquote > :last-child { margin-bottom: 0; }

hr {
  border: 0;
  height: 0.35rem;
  width: 4rem;
  margin: 2.5rem auto;
  border-radius: 999px;
  background: var(--line);
}

/* Tables wrap at word boundaries. Pages put each one in a .table-box
   (the table_box component), which scrolls sideways on its own when a
   table is wider than the column, so the page never does. */
.table-box { margin: 0 0 1.1rem; overflow-x: auto; }
.table-box > table { margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.7rem;
  border-bottom: 2px solid var(--line);
  overflow-wrap: break-word;
}
@media (max-width: 40rem) {
  table { font-size: 0.9rem; }
  th, td { padding: 0.45rem 0.5rem; }
}
th { font-family: var(--font-round); }

/* Layout */

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

.prose-wrap {
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 40rem) {
  .wrap, .prose-wrap { padding-inline: 1.5rem; }
}

main { display: block; flex: 1 0 auto; padding-block: 2.5rem 4.5rem; }

.skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 30;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 1rem; color: var(--bg); }

/* Ribbon: the one-line status on every page but Home */

.ribbon {
  margin: 0;
  padding: 0.45rem 0;
  background: var(--soon);
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
}
.ribbon a { color: inherit; font-weight: 700; }

/* Header */

.site-header { position: relative; background: var(--bg-alt); }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.015em;
}
.brand:hover { color: var(--text); }
.brand svg { width: 2.5rem; height: 2.5rem; flex: none; transition: transform 0.25s ease; }
.brand:hover svg { transform: translateX(0.2rem) scale(1.05); }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.nav-list li + li { margin-top: 0; }
.nav-list a {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.nav-list a:hover { background: var(--card); border-color: var(--line); }
.nav-list a[aria-current="page"] { background: var(--text); color: var(--bg); }

.nav-wide { padding-bottom: 1rem; }

/* On a phone the pills fold into a Menu button: a <details>, no script.
   The brand floats left and the button right, so they share a row while
   they fit and stack when the text is large; the open list clears both
   and pushes the page down, so nothing is ever hidden under it. */
.menu { display: none; }
.menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border: 2px solid var(--ink-line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary svg { width: 1.1rem; height: 1.1rem; }
.menu > summary path { stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; fill: none; }
.menu[open] > summary { background: var(--text); color: var(--bg); }
.menu > nav {
  clear: both;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--card);
  border: 2px solid var(--ink-line);
  border-radius: var(--radius);
  box-shadow: 0 0.4rem 0 var(--line);
}
.menu .nav-list { flex-direction: column; }
.menu .nav-list a { display: block; padding: 0.55rem 0.9rem; font-size: 1rem; }

@media (max-width: 47.99rem) {
  .nav-wide { display: none; }
  .bar { display: flow-root; }
  .brand { float: left; min-height: 2.75rem; margin-right: 1rem; }
  .menu { display: block; }
  .menu > summary { float: right; min-height: 2.75rem; }
}

/* Footer */

.site-footer {
  background: var(--bg-alt);
  padding-block: 2.5rem;
  font-size: 0.95rem;
}
.footer-inner {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 48rem) {
  .footer-inner { grid-template-columns: 1fr auto; align-items: start; }
}
.footer-brand { display: flex; gap: 0.75rem; align-items: center; margin: 0; }
.footer-brand svg { width: 2.25rem; height: 2.25rem; flex: none; }
.footer-brand strong { font-family: var(--font-round); font-size: 1.15rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.footer-links li + li { margin-top: 0; }
.fine { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.875rem; }
.fine a { color: inherit; }

/* Manual pages */

.page-head { margin-bottom: 2rem; }
.kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.page-head h1::after,
.prose h2::after,
.home h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 0.3rem;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: var(--coral);
}
.page-head h1::after { width: 4rem; height: 0.4rem; background: var(--sun); }
.lede { margin: 1.25rem 0 0; color: var(--muted); font-size: 1.2rem; line-height: 1.55; }

.toc,
.more {
  margin: 0 0 2.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.toc > summary { cursor: pointer; font-family: var(--font-round); font-weight: 800; }
.toc ol { margin: 0.75rem 0 0.25rem; }

/* "More" (the more component): detail a reader can open, quiet until
   then. The summary is bold text, not a heading; the focus ring is the
   site's own. */
.more { margin: 1.25rem 0; }
.more > summary { cursor: pointer; font-weight: 700; }
.more > summary:hover { color: var(--link); }
.more[open] > summary { margin-bottom: 0.75rem; }
.more-body > :last-child { margin-bottom: 0.25rem; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
}
.pager a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.pager a:hover { border-color: var(--ink-line); transform: translateY(-2px); }
.pager-label { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.pager-title { display: block; color: var(--link); font-family: var(--font-round); font-weight: 800; font-size: 1.15rem; }
.pager-next { grid-column: 2; text-align: right; }
@media (max-width: 30rem) {
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}

/* Building blocks for page authors (see PLAN.md) */

.note {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--note);
  border-radius: var(--radius);
}
.note > img { flex: none; width: 4rem; }
.note > :last-child, .note > div > :last-child { margin-bottom: 0; }
.note-soon { background: var(--soon); align-items: center; }

.illustration { margin: 2rem 0; text-align: center; }
.illustration img { display: inline-block; }
.illustration figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.95rem; }

.button,
.actions a {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border: 2px solid var(--ink-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.button-primary,
.actions a:first-child {
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 0.25rem 0 var(--ink-line);
}
.button:hover,
.actions a:hover { color: var(--text); transform: translateY(-2px); }
.button-primary:hover,
.actions a:first-child:hover { color: var(--button-text); box-shadow: 0 0.4rem 0 var(--ink-line); }

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  margin: 1.5rem 0 2.5rem;
  padding: 0;
  list-style: none;
}
.cards > li + li { margin-top: 0; }
.card {
  padding: 1.25rem 1.35rem 0.4rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.card h3 { margin-top: 0; }
.card .illustration { margin: 0 0 0.75rem; text-align: left; }

/* Three compact cards across, for the 44rem prose column (the three keys,
   say); stacked on a phone. */
.cards-3 { grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 40rem) {
  .cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.cards-3 > .card { padding: 1rem 1rem 0.25rem; }
.cards-3 h3 { font-size: 1.1rem; }
.cards-3 p { font-size: 0.95rem; }

/* "How bad:", "What to do:" and the like, at the start of a line. */
.lead-in {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font-round);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.5;
  vertical-align: 0.05em;
}

/* Home */

.home > p, .home > ul, .home > ol { max-width: 44rem; }

.hero {
  display: grid;
  gap: 1.5rem 2.5rem;
  align-items: center;
  grid-template-columns: 1fr;
  margin-bottom: 2rem;
}
@media (min-width: 52rem) {
  .hero { grid-template-columns: 1.05fr 0.95fr; }
}
.hero h1 {
  font-size: clamp(2.4rem, 1.5rem + 3.6vw, 4rem);
  line-height: 1.05;
  margin-bottom: 1.25rem;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-text > p { font-size: 1.2rem; max-width: 34rem; }
.hero .illustration { margin: 0; }
.status {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.3rem 0.9rem;
  border-radius: 1.1rem;
  background: var(--soon);
  border: 2px solid var(--ink-line);
  font-weight: 700;
  font-size: 0.9rem;
}
.actions p { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 0; }

.panel {
  margin: 3rem 0;
  padding: 0.5rem 1.25rem 1.25rem;
  background: var(--bg-alt);
  border-radius: 2rem;
}
@media (min-width: 40rem) {
  .panel { padding: 0.75rem 2.25rem 1.75rem; }
}
.panel > h2 { margin-top: 1.5rem; }
.panel > p { max-width: 44rem; }

.contents-list a.card-link {
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 1.15rem;
}
.contents-list p { color: var(--muted); }
@media (max-width: 40rem) {
  .contents-list { gap: 0.5rem; }
  .contents-list .card { padding: 0.6rem 1rem; border-radius: 1rem; }
  .contents-list p { display: none; }
}

/* 404 */

.notfound { text-align: center; }
.notfound .illustration { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .brand:hover svg, .pager a:hover, .button:hover, .actions a:hover { transform: none; }
}
