/* QuantityHost: one stylesheet, mobile-first. "Rose & Champagne Gold" in light and dark.
   The theme follows the system until the visitor uses the header toggle (data-theme on <html>).
   Colours live only in the token blocks below; tests/ui/design-tokens.test.mjs checks their contrast. */

@font-face {
  font-family: "Cormorant";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/assets/fonts/cormorant-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Light theme and everything that is not a colour. */
:root {
  color-scheme: light;

  --bg: #fdf2f8;
  --surface: #ffffff;
  --surface-2: #fce7f3;
  --fg: #831843;
  --muted: #475569;
  --border: #fbcfe8;
  --border-strong: #a8658a;
  --primary: #db2777;
  --primary-hover: #be185d;
  --on-primary: #ffffff;
  --link: #be185d;
  --accent: #8a5a06;
  --gold: #ca8a04;
  --focus: #1d4ed8;
  --error: #b91c1c;
  --hero-a: rgb(244 114 182 / 0.35);
  --hero-b: rgb(202 138 4 / 0.2);
  --shadow-1: 0 1px 2px rgb(131 24 67 / 0.08), 0 2px 8px rgb(131 24 67 / 0.06);
  --shadow-2: 0 2px 4px rgb(131 24 67 / 0.08), 0 12px 32px rgb(131 24 67 / 0.12);

  --radius-sm: 0.75rem;
  --radius: 1.25rem;
  --radius-lg: 1.75rem;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Cormorant", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* Result-row and chevron icons: the same 24px / 1.75px-stroke family as assets/img/icons.svg, drawn with a mask so they take the text colour. */
  --ico-wine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 22h8M12 15v7M7 3h10l.5 6a5.5 5.5 0 0 1-11 0L7 3Z'/%3E%3C/svg%3E");
  --ico-beer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 11h1a3 3 0 0 1 0 6h-1M9 12v6M13 12v6M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5ZM5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8'/%3E%3C/svg%3E");
  --ico-martini: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 22h8M12 11v11M19 3H5l7 8 7-8Z'/%3E%3C/svg%3E");
  --ico-champagne: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2h8l-.9 8.1a3.1 3.1 0 0 1-6.2 0L8 2ZM12 13.2V21M8.5 21h7M10.5 6h.01M13 8h.01'/%3E%3C/svg%3E");
  --ico-sparkles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.94 14.06 9 17l-.94-2.94L5 13l3.06-.94L9 9l.94 3.06L13 13l-3.06 1.06ZM18 6l-.5 1.5L16 8l1.5.5L18 10l.5-1.5L20 8l-1.5-.5L18 6ZM17 15l-.35 1.15L15.5 16.5l1.15.35L17 18l.35-1.15 1.15-.35-1.15-.35L17 15Z'/%3E%3C/svg%3E");
  --ico-glass: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79ZM6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0'/%3E%3C/svg%3E");
  --ico-snowflake: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20M4.93 7l14.14 10M4.93 17 19.07 7M9 4l3 2 3-2M9 20l3-2 3 2M3.5 9.5l3.3.6-.6 3.3M20.5 14.5l-3.3-.6.6-3.3'/%3E%3C/svg%3E");
  --ico-users: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.13a4 4 0 0 1 0 7.75M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3C/svg%3E");
  --ico-utensils: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2M7 2v20M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E");
  --ico-cake: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1M2 21h20M7 8v3M12 8v3M17 8v3M7 4h.01M12 4h.01M17 4h.01'/%3E%3C/svg%3E");
  --ico-wallet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4'/%3E%3C/svg%3E");
  --ico-armchair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0ZM5 18v2M19 18v2'/%3E%3C/svg%3E");
  --ico-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Dark theme: its own tonal set, not an inversion. Keep the two blocks below identical (a test checks). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #1c0f18;
    --surface: #281622;
    --surface-2: #35202e;
    --fg: #fce7f3;
    --muted: #d6bccb;
    --border: #4d2d41;
    --border-strong: #a07a92;
    --primary: #f472b6;
    --primary-hover: #f9a8d4;
    --on-primary: #3b0a22;
    --link: #f9a8d4;
    --accent: #fbbf24;
    --gold: #fbbf24;
    --focus: #93c5fd;
    --error: #fca5a5;
    --hero-a: rgb(244 114 182 / 0.22);
    --hero-b: rgb(251 191 36 / 0.12);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
    --shadow-2: 0 2px 4px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #1c0f18;
  --surface: #281622;
  --surface-2: #35202e;
  --fg: #fce7f3;
  --muted: #d6bccb;
  --border: #4d2d41;
  --border-strong: #a07a92;
  --primary: #f472b6;
  --primary-hover: #f9a8d4;
  --on-primary: #3b0a22;
  --link: #f9a8d4;
  --accent: #fbbf24;
  --gold: #fbbf24;
  --focus: #93c5fd;
  --error: #fca5a5;
  --hero-a: rgb(244 114 182 / 0.22);
  --hero-b: rgb(251 191 36 / 0.12);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* The sticky header must not cover a focused control or an in-page link target. */
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main {
  flex: 1;
  padding-block: 2rem 4rem;
}

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

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  vertical-align: -0.2em;
}

/* Typography */

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 1.5em 0 0.5em;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);
  margin-top: 0;
}

h2 {
  font-size: clamp(1.7rem, 1.4rem + 1.3vw, 2.25rem);
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

p,
ul,
ol {
  margin: 0 0 1em;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

.lead {
  max-width: 62ch;
  font-size: 1.15em;
  color: var(--muted);
  text-wrap: pretty;
}

.meta {
  color: var(--muted);
  font-size: 0.9em;
}

/* Layout */

.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 48rem) {
  .container {
    padding-inline: 1.5rem;
  }
}

.prose {
  max-width: 70ch;
}

.prose li::marker {
  color: var(--primary);
}

/* A short gold rule under section headings. */
.prose h2::after,
.tool-section h2::after,
.steps h2::after,
.related h2::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  margin-top: 0.4rem;
  border-radius: 2px;
  background: var(--gold);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(calc(-100% - 1.5rem));
  z-index: 100;
  padding: 0.6rem 1.1rem;
  background: var(--surface);
  color: var(--fg);
  border: 2px solid var(--focus);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  transform: none;
}

/* Header and footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.5rem;
}

.site-header__end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.site-logo__mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.2), transparent 60%), var(--primary);
  color: var(--on-primary);
}

.site-logo__mark .icon {
  width: 1.3rem;
  height: 1.3rem;
  vertical-align: baseline;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.9rem;
  border-radius: 999px;
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav-list a:hover {
  background: var(--surface-2);
  color: var(--link);
}

/* The current page: tinted pill, link colour and an underline, so it is not colour alone. */
.nav-list a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--fg);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}

.theme-toggle:hover {
  background: var(--surface-2);
}

/* Until theme.js shows it, the toggle keeps its space (and leaves the tab order), so the header doesn't shift or rewrap. */
.theme-toggle[hidden] {
  display: inline-grid;
  visibility: hidden;
}

.theme-toggle .icon {
  width: 1.3rem;
  height: 1.3rem;
  vertical-align: baseline;
}

/* Show the icon of the theme the button switches to. */
.theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.95em;
  padding-block: 2rem;
}

.site-footer__inner {
  display: grid;
  gap: 1.25rem 2rem;
}

@media (min-width: 48rem) {
  .site-footer__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .site-footer__legal {
    grid-column: 1 / -1;
  }
}

.site-footer__brand p {
  max-width: 46ch;
  margin: 0.5rem 0 0;
}

.site-footer__legal {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Home */

.hero {
  margin-bottom: 3rem;
  padding: clamp(1.75rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 3.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(60% 90% at 8% 0%, var(--hero-a), transparent 70%),
    radial-gradient(50% 80% at 100% 100%, var(--hero-b), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-2);
}

.hero h1 {
  max-width: 20ch;
  font-size: clamp(2.5rem, 1.5rem + 5vw, 4.5rem);
  line-height: 1.02;
}

.hero .lead {
  margin-bottom: 1.5rem;
}

.hero__actions {
  margin-bottom: 1.75rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
}

.chips .icon {
  color: var(--link);
}

.tool-section,
.related {
  margin-top: 2.5rem;
}

.tool-section h2,
.related h2 {
  margin-top: 0;
}

/* Tool cards: the title link is stretched over the whole card. */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.tool-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-2);
}

.tool-card__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--link);
}

.tool-card__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
  vertical-align: baseline;
}

.tool-card__title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--fg);
  text-decoration: none;
  /* The card draws the focus ring (below); keep a transparent outline for forced-colors mode. */
  outline-color: transparent;
}

.tool-card__title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.tool-card__title:focus-visible::after {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.tool-card__desc {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.tool-card__arrow {
  color: var(--link);
  transition: transform var(--dur-base) var(--ease-out);
}

.tool-card:hover .tool-card__arrow {
  transform: translateX(4px);
}

/* How it works */

.steps {
  margin-top: 3.5rem;
}

.steps__list {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

@media (min-width: 48rem) {
  .steps__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.steps__list li {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.steps__list h3 {
  margin: 0.9rem 0 0.35rem;
}

.steps__list p {
  margin: 0;
  color: var(--muted);
}

.steps__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
}

.steps__icon .icon {
  vertical-align: baseline;
}

.not-found {
  max-width: 40rem;
  margin-inline: auto;
  padding-block: 2rem;
  text-align: center;
}

.not-found__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.page-head {
  margin-bottom: 0.5rem;
}

/* Components */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: var(--shadow-1);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.button:hover,
button:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

.button:active,
button:active {
  transform: scale(0.98);
}

.button .icon {
  vertical-align: baseline;
  transition: transform var(--dur-base) var(--ease-out);
}

.button:hover .icon {
  transform: translateX(3px);
}

.button--secondary {
  background: transparent;
  color: var(--link);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.button--secondary:hover {
  background: var(--surface-2);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input:not([type="radio"], [type="checkbox"]),
select,
textarea {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 2.75rem;
  padding: 0.5rem 0.8rem;
  max-width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

input:not([type="radio"], [type="checkbox"]):hover,
select:hover {
  border-color: var(--primary);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

tr:last-child > th,
tr:last-child > td {
  border-bottom: 0;
}

th {
  background: var(--surface-2);
}

/* Read by screen readers, not shown */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Calculator pages */

.tool {
  display: grid;
  gap: 1.5rem;
  margin-block: 1.5rem 2.5rem;
}

@media (min-width: 48rem) {
  .tool {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: start;
  }
}

/* Pin the result only when it fits: a taller panel would hide its buttons and note. */
@media (min-width: 48rem) and (min-height: 50rem) {
  .tool-result {
    position: sticky;
    top: 5.5rem;
  }
}

.tool-form,
.tool-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: clamp(1.1rem, 3vw, 1.75rem);
}

/* The result rows lay out by the panel's own width, not the viewport's. */
.tool-result {
  container-type: inline-size;
  background:
    linear-gradient(90deg, var(--primary), var(--gold)) top / 100% 4px no-repeat,
    var(--surface);
  box-shadow: var(--shadow-2);
}

/* On a phone the result sits below the form; this link gets there without scrolling. */
.jump-link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}

@media (min-width: 48rem) {
  .jump-link {
    display: none;
  }
}

.field {
  margin: 0 0 1.1rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field input[type="number"],
.field select {
  width: 100%;
}

.field legend {
  font-weight: 600;
  margin-bottom: 0.4rem;
  padding: 0;
}

.field__hint {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9em;
}

.field__error {
  margin: 0.3rem 0 0;
  color: var(--error);
  font-size: 0.9em;
  font-weight: 600;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  min-height: 2.75rem;
  margin: 0;
  cursor: pointer;
}

.choice input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--primary);
}

/* Radio groups become segmented chips; the native radio stays, invisible, over the chip
   so keyboard and screen-reader behaviour are unchanged. Without :has() the plain radios stay. */
@supports selector(:has(*)) {
  .choices {
    gap: 0.5rem;
  }

  .choices .choice {
    position: relative;
    padding: 0.35rem 1.1rem;
    border: 1.5px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 500;
    transition:
      background-color var(--dur-fast) var(--ease-out),
      border-color var(--dur-fast) var(--ease-out),
      color var(--dur-fast) var(--ease-out);
  }

  .choices .choice input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .choices .choice:hover {
    border-color: var(--primary);
  }

  .choices .choice:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
  }

  /* A tick as well as the colour, so the selected chip is not colour alone. */
  .choices .choice:has(input:checked)::before {
    content: "\2713" / "";
  }

  .choices .choice:has(input:focus-visible) {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
  }
}

/* Checkboxes become switches (same native input, drawn by CSS). */
.field--checks .choice {
  min-height: 2.75rem;
  gap: 0.85rem;
}

.field--checks .choice input {
  appearance: none;
  position: relative;
  flex: none;
  width: 2.9rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out);
}

.field--checks .choice input::before {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-base) var(--ease-out);
}

.field--checks .choice input:checked {
  background: var(--primary);
}

.field--checks .choice input:checked::before {
  transform: translateX(1.25rem);
}

.tool-form__mix {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-strong);
}

.tool-form__mix summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.tool-form__mix summary::-webkit-details-marker {
  display: none;
}

.tool-form__mix summary::after {
  content: "";
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  -webkit-mask: var(--ico-chevron) center / contain no-repeat;
  mask: var(--ico-chevron) center / contain no-repeat;
  transition: transform var(--dur-base) var(--ease-out);
}

.tool-form__mix[open] summary::after {
  transform: rotate(180deg);
}

.mix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Three across only when each label fits on one line, so the inputs line up. */
@media (min-width: 30rem) {
  .mix-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.mix-grid input {
  width: 100%;
}

/* A sub-heading inside the planner's fine-tuning panel, one per section of the list. */
.tool-form__group {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

input[aria-invalid="true"] {
  border-color: var(--error);
  outline: 2px solid var(--error);
}

/* Must follow the rule above: it would otherwise replace the focus ring on an invalid field. */
input[aria-invalid="true"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.tool-result h2 {
  margin-top: 0;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem);
}

.tool-result__summary {
  color: var(--muted);
  font-size: 0.95em;
}

.tool-error {
  color: var(--error);
  font-weight: 600;
}

.result-list {
  margin: 0 0 1rem;
}

/* Marks numbers that no longer match the inputs without lowering their contrast;
   the alert above them says why. */
.result-list.is-stale,
.result-groups.is-stale {
  padding-left: 0.75rem;
  border-left: 4px solid var(--error);
}

/* The party planner's list: a heading, then that section's rows. The last row's rule closes the
   section, so the headings do not need a gap of their own above the first row. */
.result-section {
  margin-bottom: 1.25rem;
}

.result-section h3 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.result-section .result-list {
  margin-bottom: 0;
}

/* Label above the figure; side by side once the panel is wide enough (see below). */
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--border);
}

@container (min-width: 28rem) {
  .result-row {
    grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
    gap: 0.75rem;
  }
}

.result-row dt {
  font-weight: 600;
}

.result-row dt::before {
  content: "";
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.5rem;
  vertical-align: -0.2em;
  background: var(--link);
  -webkit-mask: var(--row-icon, var(--ico-sparkles)) center / contain no-repeat;
  mask: var(--row-icon, var(--ico-sparkles)) center / contain no-repeat;
}

.result-row dd {
  margin: 0;
}

.result-row strong {
  display: block;
  font-size: 1.45em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.result-row span {
  color: var(--muted);
  font-size: 0.9em;
}

.result-row--drinks {
  --row-icon: var(--ico-glass);
}

.result-row--wine {
  --row-icon: var(--ico-wine);
}

.result-row--beer,
.result-row--kegs,
.result-row--half,
.result-row--quarter,
.result-row--sixth,
.result-row--cans {
  --row-icon: var(--ico-beer);
}

.result-row--ice,
.result-row--bags,
.result-row--coolers {
  --row-icon: var(--ico-snowflake);
}

.result-row--guests,
.result-row--perGuest,
.result-row--perGuestCatering {
  --row-icon: var(--ico-users);
}

.result-row--venueCatering,
.result-row--photoVideo,
.result-row--attire,
.result-row--flowersDecor,
.result-row--music,
.result-row--contingency,
.result-row--hairBeauty,
.result-row--rings,
.result-row--transport,
.result-row--stationery,
.result-row--officiantLicence,
.result-row--favours {
  --row-icon: var(--ico-wallet);
}

.result-row--tables,
.result-row--chairs {
  --row-icon: var(--ico-armchair);
}

.result-row--mixed,
.result-row--liters,
.result-row--mixers,
.result-row--cups {
  --row-icon: var(--ico-glass);
}

.result-row--limes,
.result-row--lemons,
.result-row--bread,
.result-row--napkins,
.result-row--linens,
.result-row--trash,
.result-row--trashBags {
  --row-icon: var(--ico-sparkles);
}

.result-row--appetizers,
.result-row--protein,
.result-row--sides,
.result-row--plates,
.result-row--cutlery {
  --row-icon: var(--ico-utensils);
}

.result-row--desserts,
.result-row--recommended,
.result-row--option {
  --row-icon: var(--ico-cake);
}

.result-row--liquor {
  --row-icon: var(--ico-martini);
}

.result-row--champagne,
.result-row--pours,
.result-row--bottles,
.result-row--magnums {
  --row-icon: var(--ico-champagne);
}

.result-row--mix {
  --row-icon: var(--ico-sparkles);
}

.result-row--drinks strong {
  font-size: 1.15em;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.tool-actions[hidden] {
  display: none;
}

.tool-actions__status {
  color: var(--muted);
  font-size: 0.9em;
}

.tool-actions__status input {
  width: 100%;
  margin-top: 0.25rem;
}

.tool-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9em;
}

.assumptions th {
  width: 40%;
  font-weight: 600;
}

/* Guest-count reference tables: a wide table scrolls inside its own region on a narrow screen. */
.table-scroll {
  overflow-x: auto;
  margin-bottom: 1.5em;
}

.table-scroll table {
  min-width: 34rem;
  margin-bottom: 0;
}

.reference thead th {
  white-space: nowrap;
}

/* Wedding checklist: server-rendered tickboxes; checklist-page.js saves the ticks. */
.checklist__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-block: 1rem;
}

.checklist__bar .tool-actions {
  margin-bottom: 0;
}

.checklist__progress {
  margin: 0;
  font-weight: 600;
}

.checklist__section {
  margin-block: 1.5rem;
}

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

.checklist__items li {
  border-bottom: 1px solid var(--border);
}

.checklist__item {
  align-items: flex-start;
  padding-block: 0.65rem;
}

.checklist__item input {
  flex: none;
  margin-top: 0.1rem;
}

.checklist__item:has(input:checked) span {
  color: var(--muted);
  text-decoration: line-through;
}

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

  .tool-card:hover,
  .button:active,
  button:active {
    transform: none;
  }
}

/* Windows High Contrast: backgrounds and shadows are replaced by system colours, so
   controls that are drawn with them need real borders and system colours. */
@media (forced-colors: active) {
  .button,
  button {
    border: 2px solid ButtonText;
  }

  .field--checks .choice input {
    forced-color-adjust: none;
    background: Canvas;
    border: 2px solid ButtonText;
  }

  .field--checks .choice input::before {
    background: ButtonText;
    box-shadow: none;
  }

  .field--checks .choice input:checked {
    background: Highlight;
    border-color: Highlight;
  }

  .field--checks .choice input:checked::before {
    background: HighlightText;
  }

  .choices .choice:has(input:checked) {
    border-color: Highlight;
    border-width: 3px;
  }

  .tool-card {
    border-color: CanvasText;
  }
}

@media print {
  /* Paper is white whichever theme is on screen. All three selectors, so a chosen dark theme can't win on specificity. */
  :root,
  :root:not([data-theme="light"]),
  :root[data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --fg: #000000;
    --muted: #333333;
    --border: #999999;
    --link: #000000;
    --gold: #000000;
    --primary: #000000;
    --shadow-1: none;
    --shadow-2: none;
  }

  .skip-link,
  .site-header nav,
  .site-footer nav,
  .theme-toggle,
  .button,
  .tool-form,
  .tool-actions,
  .no-print {
    display: none;
  }

  .site-header {
    position: static;
  }

  /* Print the result as a shopping list: summary, quantities, assumptions. */
  .tool {
    display: block;
    margin-block: 0.5rem 1rem;
  }

  .tool-result {
    position: static;
    border: 0;
    padding: 0;
    background: none;
    box-shadow: none;
  }

  .tool-result__summary,
  .result-row span {
    color: #333333;
  }

  .result-row,
  .assumptions tr {
    break-inside: avoid;
  }

  .assumptions th {
    background: none;
  }

  /* The party planner prints as a shopping list: a heading per section, then one line per item
     with an empty box to tick. The row icons stay on screen. */
  .result-section {
    margin-bottom: 0.75rem;
    break-inside: avoid-page;
  }

  .result-section h3 {
    break-after: avoid;
  }

  .result-section .result-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding-block: 0.3rem;
    border-bottom-color: #cccccc;
  }

  .result-section .result-row dt {
    flex: 1;
  }

  .result-section .result-row dt::before {
    width: 0.9rem;
    height: 0.9rem;
    border: 1.5px solid #000000;
    background: none;
    -webkit-mask: none;
    mask: none;
    vertical-align: -0.1em;
  }

  /* Quantity, then the size that defines it ("23 bags" means 2 kg bags), small, on the same line. */
  .result-section .result-row dd {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }

  .result-section .result-row strong {
    display: inline;
    font-size: 1em;
  }

  .result-section .result-row span {
    font-size: 0.8em;
  }

  /* The checklist prints as a list with an empty box per task; the ticks you made print too. */
  .checklist__section {
    margin-block: 0.75rem;
    break-inside: avoid-page;
  }

  .checklist__section h2 {
    break-after: avoid;
  }

  .checklist__items li {
    break-inside: avoid;
    border-bottom-color: #cccccc;
  }

  .checklist__item {
    padding-block: 0.3rem;
    min-height: 0;
  }

  .checklist__item:has(input:checked) span {
    color: #000000;
  }

  .site-header,
  .site-footer {
    background: none;
    box-shadow: none;
  }

  .site-logo__mark {
    background: none;
    color: #000000;
  }

  main {
    padding-block: 1rem;
  }
}
