/* SAVOR — shared brand tokens & primitives
   Two registers under one system:
     .lab    → dataset, docs, papers, schema
     .tavola → website, search, recipes, exhibits
*/

/* ---------- Type ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT,WONK@9..144,300..900,0..100,0..1&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');
/* Three different hands for marginalia */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600&display=swap'); /* the cook — quick, kitchen-side */
@import url('https://fonts.googleapis.com/css2?family=Reenie+Beanie&display=swap'); /* the scholar — pencil notes */
@import url('https://fonts.googleapis.com/css2?family=Homemade+Apple&display=swap'); /* the translator — slower, italic */

:root {
  /* Display serif — bilingual-feeling, modern w/ character.
     Fraunces is the closest google-served voice to GT Sectra/Tiempos. */
  --serif: 'Fraunces', 'Tiempos Headline', Georgia, serif;
  --sans:  'Montserrat', 'Söhne', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  --hand-cook:       'Caveat', cursive;
  --hand-scholar:    'Reenie Beanie', cursive;
  --hand-translator: 'Homemade Apple', cursive;

  /* ---------- Color ----------
     Italian Tavola palette: tomato, basil, lemon, sea, wine.
     Warm enough for food history, brighter on screen than the archive set. */

  /* Neutrals */
  --paper:       #ffffff;
  --paper-2:     #ffffff;
  --paper-3:     #f7f7f5;
  --bone:        #ffffff;
  --ink:         #1f1810;   /* espresso ink */
  --ink-2:       #4b321f;
  --ink-soft:    #7e6044;
  --rule:        #e3b566;

  /* Pigments — used semantically */
  --terracotta:  #d9361f;   /* tomato red, primary accent */
  --ochre:       #f2a900;   /* golden polenta */
  --olive:       #2f8f46;   /* basil green */
  --aubergine:   #8f2043;   /* Barolo / archive depth */
  --indigo:      #0077b6;   /* Adriatic blue, links and citations */
  --saffron:     #ffd447;   /* lemon highlight */

  /* Lab register — quieter, cooler */
  --lab-bg:      #ffffff;
  --lab-panel:   #ffffff;
  --lab-rule:    #ead9b8;
  --lab-ink:     #14130f;
  --lab-soft:    #776852;
  --lab-accent:  #d9361f;   /* same tomato thread linking the registers */
  --lab-mark:    #005f8f;   /* deeper sea blue for code/data */

  /* Spacing scale (8pt) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --s-9: 96px; --s-10: 128px;

  --maxw: 1280px;
  --content: 720px;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--indigo); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
a:hover { color: var(--terracotta); }
img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--rule); margin: var(--s-6) 0; }

/* ---------- Type primitives ---------- */
.serif { font-family: var(--serif); font-optical-sizing: auto; }
.mono  { font-family: var(--mono); }
.sans  { font-family: var(--sans); }

.h-display {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(48px, 7vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
}
.h-1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 96;
}
.h-2 {
  font-family: var(--serif);
  font-weight: 420;
  font-size: clamp(26px, 2.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36;
}
.h-3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.25;
}
.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lede {
  font-family: var(--serif);
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.4;
  font-weight: 350;
  font-style: italic;
  color: var(--ink-2);
  font-variation-settings: "opsz" 36, "SOFT" 50;
}
.small { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.tiny  { font-size: 11px; letter-spacing: 0.04em; color: var(--ink-soft); }

/* Bilingual title block — RO | IT side by side */
.bilingual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-5);
  align-items: baseline;
}
.bilingual .lang-ro { text-align: right; }
.bilingual .lang-it { text-align: left; }
.bilingual .rule {
  width: 1px;
  background: var(--rule);
  align-self: stretch;
}
.lang-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 4px;
}

/* ---------- Marginalia ---------- */
.margin-note {
  position: relative;
  display: block;
  line-height: 1.25;
}
.margin-note.cook       { font-family: var(--hand-cook); font-size: 22px; color: var(--terracotta); }
.margin-note.scholar    { font-family: var(--hand-scholar); font-size: 24px; color: var(--aubergine); transform: rotate(-1.5deg); }
.margin-note.translator { font-family: var(--hand-translator); font-size: 14px; color: var(--indigo); line-height: 1.6; }

.margin-note .signoff {
  display: block;
  font-size: 0.7em;
  opacity: 0.7;
  margin-top: 4px;
}

/* underline / circle in ink, rough */
.scribble {
  display: inline-block;
  background-image: linear-gradient(transparent 86%, rgba(184,82,58,0.5) 86%, rgba(184,82,58,0.5) 92%, transparent 92%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* ---------- Tag chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-radius: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: none;
  color: var(--ink-2);
  background: transparent;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  opacity: 1;
}
.chip.region    { color: var(--ochre); }
.chip.period    { color: var(--aubergine); }
.chip.course    { color: var(--olive); }
.chip.diet      { color: var(--olive); }
.chip.festive   { color: var(--terracotta); }
.chip.lang      { color: var(--indigo); }
.chip.lab-tag   { color: var(--lab-mark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 0;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--terracotta); border-color: var(--terracotta); color: var(--bone); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s-6); }
.container.wide { max-width: 1480px; }
.container.narrow { max-width: 880px; }

/* ---------- Top nav (Tavola) ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-6);
  padding: 22px var(--s-6);
  max-width: var(--maxw);
  margin: 0 auto;
}
.nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0;
  border: none;
  color: var(--ink);
  flex: 0 0 auto;
  white-space: nowrap;
}
.nav .brand img {
  height: 48px;
  width: auto;
  display: block;
}
.nav .brand img.wordmark {
  height: 56px;
}
.nav .brand[data-page-label]::after {
  content: attr(data-page-label);
  color: var(--ink-2);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.95em;
  line-height: 1;
}
.nav .links { display: flex; gap: var(--s-6); }
.nav .links.only-nav {
  margin-left: auto;
  margin-right: auto;
}
.nav .links a {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: none;
  text-transform: uppercase;
}
.nav .links a:hover { color: var(--terracotta); }
.nav .links a.active { color: var(--terracotta); }
.nav .register {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 8px;
  border: 1px solid var(--rule);
  display: none;
}

@media (max-width: 860px) {
  .container { padding: 0 var(--s-4); }
  .nav {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s-4);
    padding: var(--s-4);
  }
  .nav .links {
    grid-column: 1 / -1;
    gap: var(--s-3);
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .nav .brand img { height: 40px; }
  .nav .brand img.wordmark { height: 44px; }
  .nav .links.only-nav {
    margin-left: 0;
    margin-right: 0;
  }
  .nav .links a { white-space: nowrap; }
  .foot .container { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: var(--s-10);
  padding: var(--s-7) 0 var(--s-6);
  font-size: 13px;
  color: var(--ink-soft);
}
.foot .container {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--s-6);
}
.foot h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 var(--s-3);
}
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.foot a { color: var(--ink-soft); border: none; }
.foot a:hover { color: var(--terracotta); }

/* ---------- Card ---------- */
.card {
  background: var(--bone);
  border: 1px solid var(--rule);
  padding: var(--s-5);
}

/* ---------- Lab register overrides ---------- */
.lab {
  background: var(--lab-bg);
  color: var(--lab-ink);
  font-family: var(--sans);
}
.lab a { color: var(--lab-mark); }
.lab .h-display, .lab .h-1, .lab .h-2 { font-family: var(--sans); font-weight: 500; letter-spacing: -0.02em; }
.lab .h-display { font-size: clamp(40px, 5.4vw, 72px); line-height: 1; font-weight: 500; }
.lab .h-1 { font-size: clamp(28px, 3vw, 40px); font-weight: 500; }
.lab .h-2 { font-size: 22px; font-weight: 600; }
.lab .lede {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 400;
  color: var(--lab-soft);
  font-size: 18px;
  line-height: 1.5;
}
.lab .nav .brand { font-family: var(--sans); font-weight: 400; }
.lab .nav .brand[data-page-label]::after {
  color: var(--lab-soft);
  font-weight: 400;
}

/* ---------- Code blocks ---------- */
pre, code { font-family: var(--mono); font-size: 13px; }
pre {
  background: #14130f;
  color: #e8e2d4;
  padding: var(--s-5);
  overflow-x: auto;
  line-height: 1.55;
  border: 1px solid #2a2620;
}
.lab pre { background: #0f1419; color: #d6deea; border-color: #1f2937; }

/* syntax bits */
.tk-key { color: #c98e2b; }
.tk-str { color: #98b06f; }
.tk-num { color: #e0a847; }
.tk-com { color: #6b6157; font-style: italic; }
.tk-pun { color: #888178; }

/* ---------- Logo block ---------- */
.logo-text {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1em;
  letter-spacing: 0.05em;
}

/* utilities */
.row { display: flex; gap: var(--s-4); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: var(--s-3); }
.spacer-7 { height: var(--s-7); }
.spacer-9 { height: var(--s-9); }
.divider { border-top: 1px solid var(--rule); margin: var(--s-6) 0; }

::selection { background: var(--saffron); color: var(--ink); }
.lab ::selection { background: #cfe0f5; color: var(--lab-ink); }
