/* Nomme on the web.
 *
 * The same palette as the app (lib/core/theme/nomme_colors.dart) and the
 * same display face (Fraunces, assets/fonts in the app), so the page and
 * the screens it shows look like one product. DESIGN.md at the repo root
 * documents every token and component here.
 *
 * Loaded by every page: the start page, join, the document pages, 404 and
 * every generated collection page (with collection.css on top). A rule
 * here reaches thousands of pages; keep the shared selectors stable.
 */

/* --- display face ------------------------------------------------- */

/* Fraunces, variable (wght 100-900, opsz, SOFT, WONK), Latin subset from
 * Fontsource, SIL OFL 1.1 (fonts/OFL-Fraunces.txt). */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Georgia stretched to Fraunces' metrics, so the swap does not reflow
 * the headline. Measured: Fraunces 640 sets at 80.2% of Georgia Bold's
 * width; ascent 0.978 em and descent 0.255 em, divided by that. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia Bold"), local("Georgia-Bold"), local("Georgia");
  font-weight: 100 900;
  size-adjust: 80.2%;
  ascent-override: 122%;
  descent-override: 31.8%;
  line-gap-override: 0%;
}

:root {
  /* colour: the brand, unchanged */
  --cream: #f5f1e9;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --ink-muted: #5f5b55;      /* 6.0:1 on cream (was #6e6a64, 4.9:1) */
  --hairline: #e6e0d6;
  --forest: #2c5546;
  --forest-deep: #24463a;
  --leaf: #3e7d5a;           /* fills and icons only: 4.3:1 on cream */
  --leaf-surface: #e8efe6;
  --coral: #e2725b;          /* fields and the match; ink on it, never white */
  --on-forest: #f5f1e9;
  --on-forest-muted: #cfdcd3;

  /* type */
  --font-display: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  /* a 1.333 scale from a 17px body; display steps are fluid */
  --step--1: .8125rem;                                   /* 13px  */
  --step-0: 1.0625rem;                                   /* 17px  */
  --step-1: 1.4167rem;                                   /* 22.7px */
  --step-2: clamp(1.9rem, 1.35rem + 2.2vw, 3.15rem);     /* 30-50px */
  --step-3: clamp(2.5rem, 1.25rem + 4.1vw, 4.75rem);     /* 40-76px */

  /* space: 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 112px;
  --gutter: clamp(16px, 4vw, 40px);

  --measure: 1120px;
  --radius: 20px;
  --radius-screen: 28px;
  --radius-pill: 999px;

  /* only what truly floats (a menu, a dialog); nothing at rest */
  --shadow-float: 0 18px 40px -18px rgba(31, 29, 26, .45);

  --focus: var(--forest);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 .5em; text-wrap: balance; }
h1, h2 {
  font-family: var(--font-display);
  font-weight: 640;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
h1 { font-size: var(--step-3); line-height: 1.0; letter-spacing: -0.03em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--forest); text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--ink); }

/* Keyboard focus, visible on every ground. A field sets --focus to the
 * colour that contrasts with it. */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

/* A short tag naming a section. Not above a page's h1, sentence case,
 * forest for 7.9:1 on cream. The start page uses none; it stays for the
 * pages that still carry one. */
.eyebrow { /* taste-skill-ignore: shared legacy tag, never above an h1 */
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--forest);
  margin-bottom: .75rem;
}

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

/* --- header ------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--cream);
}

header .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
}

/* The brand is one drawn word.
 *
 * It used to be the logo glyph standing next to "omme" set in system-ui,
 * which meant the name rendered in Segoe UI on Windows, SF Pro on a Mac
 * and Roboto on Android. A wordmark is drawn once and looks the same
 * everywhere, and the leaf belongs to the n rather than being a picture
 * placed beside it.
 *
 * Sized in em so the footer's smaller font-size still scales it, and
 * cropped tight so the height is the mark and not a canvas around it. */
.brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.4rem;
  color: var(--ink);
  text-decoration: none;
}
.brand img { height: 1.35em; width: auto; display: block; }

nav.links {
  display: flex;
  gap: 26px;
  margin-inline: auto;
  font-size: 1rem;
}
nav.links a { color: var(--ink-muted); text-decoration: none; padding-block: 10px; }
nav.links a:hover { color: var(--ink); }

/* --- buttons ------------------------------------------------------ */

/* One shape for every action: the pill. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  background: var(--forest);
  color: #fff;
  font: 600 1rem/1.2 var(--font-body);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background-color .15s, transform .15s var(--ease-out);
}
.button:hover { background: var(--forest-deep); color: #fff; }
.button:active { transform: scale(.97); }
.button.ghost {
  background: transparent;
  color: var(--forest);
  box-shadow: inset 0 0 0 2px var(--forest); /* taste-skill-ignore: a stroke, not a shadow */
}

/* Store badges: the store's own two-line label, ink on the light
 * grounds. */
.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.badge {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-height: 56px;
  padding: 9px 22px 10px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  line-height: 1.2;
  transition: background-color .15s, transform .15s var(--ease-out);
}
.badge small { font-size: var(--step--1); opacity: .85; }
.badge span { font-weight: 700; font-size: var(--step-0); letter-spacing: -0.01em; }
.badge[aria-disabled="true"] { opacity: .45; cursor: default; }
a.badge:hover { background: var(--forest); color: #fff; }
a.badge:active { transform: scale(.97); }

.button.unavailable,
.badge.unavailable {
  background: transparent;
  color: var(--ink-muted);
  box-shadow: inset 0 0 0 1px var(--hairline); /* taste-skill-ignore: a stroke */
  cursor: default;
}

/* --- sections ----------------------------------------------------- */

section { padding: 84px 0; }
section.tight { padding: 56px 0; }
section.alt { background: var(--surface); }

/* --- document pages ----------------------------------------------- */

.doc { max-width: 760px; }
.doc h2 { font-size: 1.6rem; margin-top: 2.2em; }
.doc h3 { font-size: 1.15rem; margin-top: 1.8em; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: .5em; }
.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0 1.6em;
  font-size: .95rem;
}
.doc th, .doc td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.doc th { font-weight: 700; }
.updated { color: var(--ink-muted); font-size: .92rem; }

.callout {
  background: var(--leaf-surface);
  border-radius: 16px;
  padding: 20px 24px;
  margin: 1.5em 0;
}
.callout p:last-child { margin-bottom: 0; }

/* Language switch on the document pages and join. */
.langs { display: inline-flex; gap: 6px; }
.langs button {
  border: 0;
  box-shadow: inset 0 0 0 1px var(--hairline); /* taste-skill-ignore: a stroke */
  background: var(--surface);
  color: var(--ink-muted);
  padding: 7px 14px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}
.langs button[aria-pressed="true"] {
  background: var(--forest);
  box-shadow: none; /* taste-skill-ignore */
  color: #fff;
}
[data-lang] { display: none; }
[data-lang].on { display: block; }

/* --- footer ------------------------------------------------------- */

footer {
  background: var(--surface);
  padding: 44px 0;
  font-size: 1rem;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; }
footer nav { display: flex; flex-wrap: wrap; gap: 20px; margin-inline: auto; }
footer a { color: var(--ink-muted); text-decoration: none; }
/* 44 px rows: these were 25 px tall and sat close together on a phone. */
footer nav a { display: inline-flex; align-items: center; min-height: 44px; }
footer nav { row-gap: 0; }
footer a:hover { color: var(--ink); }

@media (max-width: 860px) {
  nav.links { display: none; }
}

/* ===================================================================
 * The start page (index.html): colour chapters.
 * Cream is the hero, then the match told in four fields (your phone,
 * their phone, the match, the list), then the fact block, the lists by
 * language on forest, and the close on coral.
 * =================================================================== */

.chapter { padding: 0; }
.field-cream  { background: var(--cream); color: var(--ink); }
.field-white  { background: var(--surface); color: var(--ink); }
.field-leaf   { background: var(--leaf-surface); color: var(--ink); }
.field-coral  { background: var(--coral); color: var(--ink); --focus: var(--ink); }
.field-forest { background: var(--forest); color: var(--on-forest); --focus: var(--on-forest); }
.field-forest a { color: var(--on-forest); }
.field-forest a:hover { color: #fff; }
.field-coral a { color: var(--ink); }
.field-coral a.badge, .field-forest a.badge { color: #fff; }

/* --- hero --------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding-top: 32px;
  padding-bottom: 72px;
}
.hero h1 { margin-bottom: .32em; }
.hero h1 .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.hero h1 .line > span { display: block; white-space: nowrap; }
.hero .lede { font-size: var(--step-1); line-height: 1.4; max-width: 30ch; margin-bottom: 0; }
.hero .stores { margin-top: 28px; }
.hero .offer { margin: 16px 0 0; font-size: 1rem; max-width: 46ch; }
.hero-art { margin: 0; }
.hero-art img { width: 100%; height: auto; display: block; }

/* --- the match, in four fields ------------------------------------ */

.match {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.match > li {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: var(--space-7) clamp(20px, 2.2vw, 36px) var(--space-7);
  min-height: 84svh;
}
.match { margin: 0; padding: 0; }
.match h2 { font-size: clamp(1.9rem, 1rem + 1.9vw, 2.5rem); margin: 0 0 var(--space-6); }
.match .shot {
  margin: auto 0 var(--space-6);
  align-self: center;
  width: min(100%, 250px);
  transition: transform .25s var(--ease-out);
}
.match li:nth-child(1) .shot { transform: rotate(-3deg); }
.match li:nth-child(2) .shot { transform: rotate(2.5deg); }
.match li:nth-child(3) .shot { transform: rotate(-1.5deg); }
.match li:nth-child(4) .shot { transform: rotate(2deg); }
.match li:hover .shot { transform: translateY(-6px) rotate(0deg); }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-screen);
}
.match .clause {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  font-size: var(--step-1);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-3);
}
.match .note { margin: 0; max-width: 32ch; }
.field-forest .note { color: var(--on-forest); }

/* --- what is Nomme ------------------------------------------------ */

.what-block {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 32px 48px;
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
}
.what-block h2 { margin: 0; }
.what { font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem); line-height: 1.5; margin: 0 0 var(--space-5); max-width: 52ch; }
.what-more { max-width: 60ch; margin: 0; }

/* --- lists by language -------------------------------------------- */

.browse-block { padding-top: var(--space-9); padding-bottom: var(--space-9); }
.browse-block h2 { max-width: 18ch; margin-bottom: var(--space-7); }
.browse { list-style: none; margin: 0; padding: 0; }
.browse > li {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 8px 32px;
  align-items: baseline;
  padding: 14px 0;
}
.browse .hub {
  font-family: var(--font-display);
  font-weight: 640;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: var(--step-1);
  letter-spacing: -0.015em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.browse .hub::after {
  content: "";
  width: .38em; height: .38em;
  border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}
.browse .hub:hover::after { transform: translateX(4px) rotate(45deg); }
.browse ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 28px; }
.browse ul a { display: inline-block; padding: 10px 0; text-decoration-color: rgba(245, 241, 233, .45); }

/* --- the close ---------------------------------------------------- */

.close {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 8fr) minmax(0, 2fr);
  gap: 12px;
  padding: 12px 0;
  background: var(--cream);
}
.close .tile { border-radius: var(--radius); min-height: 380px; }
.close .tile-forest { background: var(--forest); border-radius: 0 var(--radius) var(--radius) 0; }
.close .tile-dish {
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--leaf-surface) url("dish-bolognese-480.webp") center / cover no-repeat;
}
.close .tile-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(24px, 5vw, 72px);
}
.close h2 { margin-bottom: .35em; }
.close p { max-width: 44ch; margin: 0; }
.close .stores { margin-top: 24px; }

/* --- motion: on load, the headline rises line by line; sections rise as
 * they enter. Content is visible by default and only hidden once the
 * script has said it will reveal it. ------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  html.motion .hero h1 .line > span { animation: rise .9s var(--ease-out) both; }
  html.motion .hero h1 .line:nth-child(2) > span { animation-delay: .11s; }
  html.motion .hero .rest { animation: fade .7s .35s var(--ease-out) both; }
  html.motion .hero-art { animation: drift 1.1s .2s var(--ease-out) both; }
  html.motion [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
  html.motion [data-reveal].in { opacity: 1; transform: none; }
}
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { opacity: 0; transform: translateY(24px) rotate(1.5deg); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .match { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match > li { min-height: 0; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 12px; padding-bottom: 56px; gap: 20px; }
  .hero .lede { font-size: 1.2rem; }
  .hero .stores { margin-top: 20px; }
  .hero-art { max-width: 520px; }
  .what-block { grid-template-columns: 1fr; padding-top: var(--space-8); padding-bottom: var(--space-8); gap: 20px; }
  .browse-block { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .browse > li { grid-template-columns: 1fr; gap: 0; }
  .close { grid-template-columns: 1fr 1fr; padding: 12px; }
  .close .tile-main { grid-column: 1 / -1; order: -1; border-radius: var(--radius); padding: 40px 24px; min-height: 0; }
  .close .tile { min-height: 140px; }
  .close .tile-forest, .close .tile-dish { border-radius: var(--radius); }
}
@media (max-width: 600px) {
  .match { grid-template-columns: 1fr; }
  .match > li { padding: 48px 20px; }
  .match .shot { width: min(56%, 220px); align-self: flex-start; margin: 0 0 var(--space-5); }
  .match li:nth-child(even) .shot { align-self: flex-end; }
  .match h2 { margin-bottom: var(--space-5); }
}
