/* Caffè Rosso — "Il Manuale"
 *
 * The content is a manual: brewing procedures and equipment specifications.
 * So the page is set like one. Headings are display type, running text is a
 * proper reading serif, and every measured value — wattage, capacity, weight,
 * ratio — is set in mono so the numbers line up and read as data.
 *
 * The buying guides carry a numbered product list whose specifications were
 * already in the copy as loose one-line paragraphs. They are regrouped into
 * spec cards (see tools/wpstatic/products.py); the wording is untouched.
 *
 * The palette is from the name. "Rosso" is the one distinctive asset this
 * brand has, and no competitor uses it; brown would disappear.
 */

/* ------------------------------------------------------------------ font -- */

/* Archivo for headings: a dense grotesque with the flat, slightly compressed
 * look of Italian signage and technical labelling, and enough weight to hold
 * its own against the red. Source Serif 4 for running text: drawn for long
 * reading on screen, with a large x-height that survives at 1.19rem. Plex
 * Mono for every measured value, so figures align in the spec tables. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-var.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-var.woff2") format("woff2-variations");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-var-italic.woff2") format("woff2-variations");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* ----------------------------------------------------------------- token -- */

:root {
  --rosso: #a4161a;
  --rosso-cupo: #6d0f12;
  --crema: #f7f2ea;
  --carta: #fffdfa;
  --carbone: #1b1714;
  --grafite: #5c534b;
  --filo: #e0d5c6;

  --fondo: var(--crema);
  --pannello: var(--carta);
  --inchiostro: var(--carbone);
  --inchiostro-tenue: var(--grafite);
  --accento: var(--rosso);
  --bordo: var(--filo);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --testo: "Source Serif 4", Georgia, "Times New Roman", serif;
  --dati: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --misura: 34rem;
  --largo: 60rem;
  --gutter: 1.35rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #16130f;
    --pannello: #1e1a16;
    --inchiostro: #f2ebe1;
    --inchiostro-tenue: #b2a698;
    --accento: #f4676c;
    --bordo: #362f27;
  }
}

/* ------------------------------------------------------------------ base -- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--testo);
  font-weight: 400;
  font-size: 1.19rem;
  line-height: 1.62;
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accento);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--rosso-cupo);
}

:focus-visible {
  outline: 3px solid var(--accento);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  padding: 0.6rem 1rem;
  background: var(--accento);
  color: #fff;
  font-family: var(--dati);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------- masthead -- */

.masthead {
  background: var(--pannello);
  border-bottom: 1px solid var(--bordo);
}

.masthead__inner {
  max-width: var(--largo);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1.1rem;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 1;
  color: var(--accento);
  text-decoration: none;
}

.brand__tagline {
  margin: 0;
  font-family: var(--dati);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--inchiostro-tenue);
}

/* ------------------------------------------------------------------ menu -- */

/* The old theme put all eight links in a single flat header row: unscannable
 * past about five, and it left one page unlinked entirely. Three labelled
 * groups make the shape of the site legible at a glance. */

.menu {
  background: var(--pannello);
  border-bottom: 3px solid var(--accento);
}

.menu__inner {
  max-width: var(--largo);
  margin: 0 auto;
  padding: 0 var(--gutter) 1.2rem;
  display: grid;
  gap: 1.1rem 3rem;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, auto));
  justify-content: start;
}

.menu__heading {
  margin: 0 0 0.45rem;
  font-family: var(--dati);
  font-size: 0.64rem;
  font-weight: 400;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--accento);
}

.menu__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.menu__link {
  font-family: var(--testo);
  font-size: 1rem;
  line-height: 1.3;
  text-decoration: none;
  color: var(--inchiostro);
  border-bottom: 1px solid transparent;
}

.menu__link:hover {
  color: var(--accento);
  border-bottom-color: var(--accento);
}

.menu__link.is-current {
  color: var(--accento);
  border-bottom-color: var(--accento);
}

/* ------------------------------------------------------------------ main -- */

.main {
  max-width: var(--misura);
  margin: 0 auto;
  padding: 3.2rem var(--gutter) 5rem;
}

.main__title {
  margin: 0 0 2rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.95rem);
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

/* First paragraph as a standfirst: gives the manual an opening register. */
.prose > p:first-child {
  font-size: 1.32rem;
  line-height: 1.45;
  color: var(--inchiostro-tenue);
  font-style: italic;
}

.prose > * + * {
  margin-top: 1.05em;
}

.prose h2 {
  margin-top: 2.6em;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* A red hairline above each section: the manual's rule. */
.prose h2::before {
  content: "";
  display: block;
  width: 2.4rem;
  height: 3px;
  margin-bottom: 0.85rem;
  background: var(--accento);
}

.prose h3 {
  margin-top: 2em;
  font-family: var(--dati);
  font-weight: 400;
  font-size: 0.83rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accento);
}

.prose ul,
.prose ol {
  padding-left: 1.15rem;
}

.prose li + li {
  margin-top: 0.42em;
}

.prose li::marker {
  color: var(--accento);
}

.prose strong {
  font-weight: 700;
}

.prose img {
  max-width: 100%;
  height: auto;
}

.prose > figure {
  margin: 2.4rem 0;
}

.prose figure img {
  width: 100%;
  border: 1px solid var(--bordo);
}

/* Any measured value in running text reads as data. */
.prose p code,
.prose .valore {
  font-family: var(--dati);
  font-size: 0.9em;
}

/* ------------------------------------------------------------- classifica -- */

/* The ranked product list. Wider than the reading measure, because a spec
 * table wants two columns and a photograph beside it. */
.classifica {
  margin: 3rem calc(50% - 50vw) 0;
  padding: 0 var(--gutter);
  display: grid;
  gap: 1.6rem;
  justify-content: center;
  grid-template-columns: min(var(--largo), calc(100vw - 2 * var(--gutter)));
}

.prodotto {
  background: var(--pannello);
  border: 1px solid var(--bordo);
  border-top: 3px solid var(--accento);
  padding: 1.5rem 1.6rem 1.7rem;
  display: grid;
  gap: 0.4rem 1.8rem;
  grid-template-columns: 1fr;
}

.prodotto__testata {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  grid-column: 1 / -1;
}

.prodotto__rango {
  margin: 0;
  font-family: var(--dati);
  font-size: 1.05rem;
  color: var(--accento);
  font-variant-numeric: lining-nums tabular-nums;
}

.prodotto__nome {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.22rem;
  line-height: 1.22;
  letter-spacing: -0.012em;
}

/* Reset the running-prose rule inside cards: the card border is the divider. */
.prodotto__nome::before {
  content: none;
}

.prodotto__foto {
  margin: 0.6rem 0 0;
}

.prodotto__foto figure {
  margin: 0;
  background: var(--fondo);
  border: 1px solid var(--bordo);
  padding: 0.9rem;
  display: grid;
  place-items: center;
}

.prodotto__foto img {
  max-width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

/* The instrument panel: label left, value right, ruled like a datasheet. */
.scheda {
  margin: 0.9rem 0 0;
  display: grid;
  gap: 0;
  align-content: start;
  border-top: 1px solid var(--bordo);
}

.scheda__riga {
  display: grid;
  grid-template-columns: minmax(7.5rem, 38%) 1fr;
  gap: 0 1rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--bordo);
}

.scheda__voce {
  font-family: var(--dati);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--inchiostro-tenue);
  align-self: center;
}

.scheda__valore {
  margin: 0;
  font-family: var(--dati);
  font-size: 0.85rem;
  line-height: 1.45;
  font-variant-numeric: lining-nums tabular-nums;
  align-self: center;
}

.prodotto__testo {
  grid-column: 1 / -1;
  margin-top: 1rem;
  font-size: 1.02rem;
  line-height: 1.58;
}

.prodotto__testo > * + * {
  margin-top: 0.75em;
}

/* Above 46rem the card becomes photograph beside datasheet. */
@media (min-width: 46rem) {
  .prodotto {
    grid-template-columns: 15rem 1fr;
  }

  .prodotto__foto {
    margin-top: 0.9rem;
  }

  .scheda {
    margin-top: 0.9rem;
  }
}

/* ---------------------------------------------------------------- tables -- */

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--dati);
  font-size: 0.82rem;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--bordo);
  padding: 0.5rem 0.7rem 0.5rem 0;
  text-align: left;
  vertical-align: top;
}

.prose th {
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accento);
}

/* ---------------------------------------------------------------- footer -- */

.footer {
  border-top: 1px solid var(--bordo);
  background: var(--pannello);
  padding: 2.2rem var(--gutter) 3rem;
  font-family: var(--dati);
  font-size: 0.74rem;
  line-height: 1.7;
  color: var(--inchiostro-tenue);
}

.footer p {
  max-width: var(--largo);
  margin: 0 auto 0.4rem;
}

.footer__brand {
  color: var(--accento);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- breakpoints -- */

@media (max-width: 32rem) {
  .menu__inner {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  body {
    font-size: 1.12rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  .menu__link {
    transition: color 140ms ease, border-color 140ms ease;
  }
}
