/**
 * Desìa — Flexible-content section components.
 *
 * Ported verbatim from the approved prototype (prototype/home.css, rev.3.1).
 * Base reset is scoped under .desia-page (the Builder template wrapper) so it does
 * not affect other theme templates. Header/footer chrome is intentionally NOT here
 * (that is the theme's header.php/footer.php — restyled separately).
 *
 * Consumes tokens from tokens.css. Markup: template-parts/flexible/*.php.
 *
 * @package DesiaTheme
 */

:root {
  --gutter: clamp(var(--space-4), 6vw, var(--space-7));
  --section-y: clamp(var(--space-6), 11vw, calc(var(--space-7) * 1.5));

  /* Display scale — confident, fluid (Lovelace). */
  --text-hero: clamp(3rem, 7.5vw, 5.25rem);
  --text-head: clamp(2.25rem, 5vw, 4rem);
  --text-statement: clamp(2.5rem, 6vw, 5rem);
}

/* ---- base, scoped to Desìa Builder pages -------------------------------- */
.desia-page {
  /* Re-map the semantic colour tokens from the seeds here, scoped: the base-theme
     main.css redefines --color-background/-foreground in its own :root and loads after
     tokens.css, so we restore the Desìa values for this subtree without touching it. */
  --color-background: var(--seed-warm-paper);
  --color-foreground: var(--seed-black);
  --color-surface: var(--seed-white);

  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.desia-page, .desia-page *, .desia-page *::before, .desia-page *::after { box-sizing: border-box; }
.desia-page img { max-width: 100%; display: block; }
.desia-page a { color: inherit; }
.desia-page :is(h1, h2, h3, p, figure, blockquote) { margin: 0; }
.desia-page ::selection { background: var(--color-accent); color: var(--color-surface); }

[data-parallax] {
  overflow: hidden;
}

.js-parallax [data-parallax] img {
  transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1.06);
  transform-origin: center;
  will-change: transform;
}

.u-display {
  font-family: var(--font-display);
  font-weight: var(--seed-weight-regular);
  letter-spacing: -0.014em;
  text-wrap: balance;
}

/* Section kicker — label preceded by the derived "tratto" sign (inline SVG, colourable). */
.u-world-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--font-body);
  font-size: var(--text-caption-size);
  line-height: var(--text-caption-line);
  font-weight: var(--seed-weight-medium);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sign-mark { flex: 0 0 auto; width: 1.6em; height: 0.7em; fill: currentColor; }

/* =========================================================================
   01 — immersive_hero
   ========================================================================= */
.component-immersive-hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100svh;
  padding: calc(var(--space-7) + var(--space-4)) var(--gutter) var(--section-y);
  color: var(--color-surface);
  isolation: isolate;
}
.component-immersive-hero__media { position: absolute; inset: 0; z-index: -2; }
.component-immersive-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.component-immersive-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(26, 26, 24, 0.42);
}
.component-immersive-hero__content { align-self: end; max-width: 19ch; }
.component-immersive-hero__title,
.component-immersive-hero__lede,
.component-immersive-hero__cue { text-shadow: 0 1px 16px rgba(26, 26, 24, 0.45); }
.component-immersive-hero__title {
  max-width: 11.5ch;
  font-family: var(--font-display);
  font-weight: var(--seed-weight-regular);
  font-size: var(--text-hero);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.component-immersive-hero__lede {
  margin-top: var(--space-4);
  max-width: 36ch;
  font-size: clamp(var(--text-body-size), 1.4vw, 1.125rem);
  line-height: 1.55;
}
.component-immersive-hero__cue {
  justify-self: start; align-self: end;
  display: inline-flex; align-items: center; gap: var(--space-3);
  margin-top: var(--space-6);
  font-size: var(--text-note-size); letter-spacing: 0.22em; text-transform: uppercase; text-decoration: none;
}
.component-immersive-hero__cue::after {
  content: ""; width: 3rem; height: 1px; background: currentColor;
  transform-origin: left center; animation: cue-slide 2.4s ease-in-out infinite;
}
@keyframes cue-slide { 0%,100% { transform: scaleX(0.4); } 50% { transform: scaleX(1); } }

/* =========================================================================
   02 — intro_statement
   ========================================================================= */
.component-intro-statement { padding: calc(var(--section-y) * 1.1) var(--gutter); display: grid; justify-items: start; }
.component-intro-statement p {
  max-width: 20ch;
  font-family: var(--font-display);
  font-weight: var(--seed-weight-light);
  font-size: var(--text-statement);
  line-height: 1.12;
  letter-spacing: -0.014em;
  text-wrap: balance;
}
.component-intro-statement .u-em { color: var(--color-accent); }

/* =========================================================================
   03 — territory_statement
   ========================================================================= */
.component-territory-statement {
  display: grid; grid-template-columns: 0.9fr 1.1fr; align-items: center;
  gap: clamp(var(--space-5), 5vw, var(--space-7));
  padding-block: var(--section-y); padding-left: var(--gutter);
}
.component-territory-statement__text { max-width: 42ch; }
.component-territory-statement h2 {
  margin-top: var(--space-4);
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: clamp(1.875rem, 3.4vw, 3rem); line-height: 1.08; letter-spacing: -0.014em; text-wrap: balance;
}
.component-territory-statement p { margin-top: var(--space-4); max-width: 46ch; }
.component-territory-statement__media { align-self: stretch; min-height: 72vh; }
.component-territory-statement__media img { width: 100%; height: 100%; min-height: 72vh; object-fit: cover; }
@media (max-width: 820px) {
  .component-territory-statement { grid-template-columns: 1fr; padding-right: var(--gutter); }
  .component-territory-statement__media, .component-territory-statement__media img { order: -1; min-height: 52vh; }
}

/* =========================================================================
   04 — wine_index_main  (dark "worlds" chapter)
   ========================================================================= */
.component-wine-index-main {
  padding: calc(var(--space-6) + var(--header-h, 4.5rem)) var(--gutter) var(--section-y);
  background: var(--color-foreground); color: var(--color-surface);
}
.component-wine-index-main__head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: var(--space-4); margin-bottom: clamp(var(--space-5), 5vw, var(--space-7));
}
.component-wine-index-main__head h2 {
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: var(--text-head); letter-spacing: -0.014em;
}
.component-wine-index-main__head p { max-width: 34ch; }

.wine-list { display: grid; gap: clamp(var(--space-6), 7vw, var(--space-7)); }
.wine-row {
  display: grid; grid-template-columns: 1.2fr 0.8fr; align-items: center;
  gap: clamp(var(--space-5), 5vw, var(--space-7));
}
.wine-row:nth-child(even) { grid-template-columns: 0.8fr 1.2fr; }
.wine-row:nth-child(even) .wine-row__media { order: 2; }
.wine-row__media { position: relative; aspect-ratio: 5 / 6; overflow: hidden; }
.wine-row__media img { width: 100%; height: 100%; object-fit: cover; }
.wine-row__index { font-family: var(--font-body); font-size: var(--text-note-size); letter-spacing: 0.2em; opacity: 0.55; }
.wine-row__name {
  margin-top: var(--space-2);
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.02; letter-spacing: 0.005em; text-transform: uppercase;
}
.wine-row__grape { margin-top: var(--space-3); font-size: var(--text-caption-size); letter-spacing: 0.08em; text-transform: uppercase; }
.wine-row__grape::before {
  content: ""; display: inline-block; vertical-align: middle;
  width: 1.5rem; height: 2px; margin-right: var(--space-2);
  background: var(--wine-accent, var(--color-accent));
}
.wine-row__note { margin-top: var(--space-4); max-width: 38ch; }
.wine-row__link {
  display: inline-block; margin-top: var(--space-4);
  font-size: var(--text-caption-size); letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.wine-row__bottle {
  width: min(100%, 230px);
  margin-top: var(--space-5);
}
.wine-row__bottle img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
.wine-row[data-wine="nero-ricamo"] { --wine-accent: var(--color-accent-gold); }
.wine-row[data-wine="zona-blu"]    { --wine-accent: var(--color-accent-blue); }
.wine-row[data-wine="perla-rara"]  { --wine-accent: var(--color-accent-pearl); }
.wine-row[data-wine="sa-murra"]    { --wine-accent: var(--color-pop); }
@media (max-width: 760px) {
  .wine-row { grid-template-columns: 1fr; gap: var(--space-4); }
  .wine-row:nth-child(even) .wine-row__media { order: -1; }
}

/* =========================================================================
   05 — cultural_heritage  (light, breaks the dark chapter)
   ========================================================================= */
.component-cultural-heritage { display: grid; grid-template-columns: 1fr 2fr; align-items: stretch; }
.component-cultural-heritage__media { min-height: 78vh; }
.component-cultural-heritage__media img { width: 100%; height: 100%; min-height: 78vh; object-fit: cover; }
.component-cultural-heritage__text { align-self: center; padding: var(--section-y) var(--gutter); max-width: 46ch; }
.component-cultural-heritage .u-world-tag { color: var(--color-accent); }
.component-cultural-heritage h2 {
  max-width: 20ch;
  margin-top: var(--space-4);
  font-family: var(--font-display); font-weight: var(--seed-weight-light);
  font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.08; letter-spacing: -0.012em; text-wrap: balance;
}
.component-cultural-heritage p { margin-top: var(--space-4); line-height: 1.6; }
@media (max-width: 820px) {
  .component-cultural-heritage { grid-template-columns: 1fr; }
  .component-cultural-heritage__media, .component-cultural-heritage__media img { min-height: 54vh; }
}

/* =========================================================================
   06 — wine_index_entry  (Sa Murra — dark, compact)
   ========================================================================= */
.component-wine-index-entry {
  padding: var(--section-y) var(--gutter);
  background: var(--color-foreground); color: var(--color-surface);
}
.component-wine-index-entry__head { max-width: 46ch; margin-bottom: clamp(var(--space-5), 4vw, var(--space-6)); }
.component-wine-index-entry .u-world-tag { color: var(--color-pop); }
.component-wine-index-entry__head h2 {
  margin-top: var(--space-4);
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: var(--text-head); letter-spacing: -0.014em;
}
.component-wine-index-entry__head p { margin-top: var(--space-3); max-width: 50ch; }
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 230px));
  justify-content: start;
  gap: clamp(var(--space-5), 4vw, var(--space-6));
}
.entry-item { display: grid; gap: var(--space-3); align-items: start; }
.entry-item__media { aspect-ratio: 4 / 5; overflow: hidden; background: var(--color-pop); }
.entry-item__media img { width: 100%; height: 100%; object-fit: cover; }
.entry-item__name {
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.05; text-transform: uppercase; letter-spacing: 0.01em;
}
.entry-item__meta { margin-top: var(--space-2); font-size: var(--text-caption-size); }
.entry-item__link,
.entry-item__status {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-caption-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.entry-item__link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.entry-item__link:hover {
  text-decoration: none;
}
.entry-item__status {
  opacity: 0.5;
}

/* =========================================================================
   07 — founder_statement
   ========================================================================= */
.component-founder-statement {
  display: grid; grid-template-columns: 0.75fr 1.25fr; align-items: center;
  gap: clamp(var(--space-5), 5vw, var(--space-7)); padding: var(--section-y) var(--gutter);
}
.component-founder-statement__portrait {
  aspect-ratio: 4 / 5; background: var(--color-surface); border: 1px solid rgba(26,26,24,0.16);
  display: grid; place-items: center; overflow: hidden;
  font-size: var(--text-note-size); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(26,26,24,0.45);
}
.component-founder-statement__portrait img { width: 100%; height: 100%; object-fit: cover; }
.component-founder-statement blockquote {
  max-width: 22ch;
  font-family: var(--font-display); font-weight: var(--seed-weight-light);
  font-size: clamp(2rem, 4.4vw, 3.75rem); line-height: 1.14; letter-spacing: -0.014em; text-wrap: balance;
}
.component-founder-statement cite {
  display: block; margin-top: var(--space-4);
  font-family: var(--font-body); font-style: normal;
  font-size: var(--text-caption-size); letter-spacing: 0.1em; text-transform: uppercase;
}
@media (max-width: 760px) {
  .component-founder-statement { grid-template-columns: 1fr; }
  .component-founder-statement__portrait { max-width: 260px; }
}

/* =========================================================================
   08 — landscape_statement
   ========================================================================= */
.component-landscape-statement {
  position: relative; min-height: 84vh; display: grid; align-items: end;
  padding: var(--section-y) var(--gutter) clamp(var(--space-5), 7vw, var(--space-6));
  color: var(--color-surface); isolation: isolate;
}
.component-landscape-statement__media { position: absolute; inset: 0; z-index: -2; }
.component-landscape-statement__media img { width: 100%; height: 100%; object-fit: cover; }
.component-landscape-statement::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(26,26,24,0.30); }
.component-landscape-statement p {
  max-width: 18ch;
  font-family: var(--font-display); font-weight: var(--seed-weight-light);
  font-size: var(--text-statement); line-height: 1.05; letter-spacing: -0.012em; text-wrap: balance;
}

/* =========================================================================
   09 — visit_contact
   ========================================================================= */
.component-visit-contact { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
.component-visit-contact__media { min-height: 72vh; }
.component-visit-contact__media img { width: 100%; height: 100%; min-height: 72vh; object-fit: cover; }
.component-visit-contact__panel {
  background: var(--color-foreground); color: var(--color-surface);
  padding: var(--section-y) var(--gutter); display: grid; align-content: center; gap: var(--space-4);
}
.component-visit-contact h2 {
  font-family: var(--font-display); font-weight: var(--seed-weight-regular);
  font-size: var(--text-head); line-height: 1.05; letter-spacing: -0.014em; text-wrap: balance;
}
.component-visit-contact address { font-style: normal; line-height: 1.7; opacity: 0.85; }
.cta {
  justify-self: start; display: inline-flex; align-items: center; gap: var(--space-3);
  margin-top: var(--space-2); padding: var(--space-3) var(--space-5);
  background: var(--color-surface); color: var(--color-foreground);
  font-size: var(--text-caption-size); letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  transition: transform .4s cubic-bezier(0.22,1,0.36,1);
}
.cta:hover { transform: translateX(4px); }
@media (max-width: 820px) {
  .component-visit-contact { grid-template-columns: 1fr; }
  .component-visit-contact__media, .component-visit-contact__media img { min-height: 48vh; }
}

/* =========================================================================
   Motion — safe reveal (never gates content if JS/observer doesn't run)
   ========================================================================= */
.js-reveal [data-reveal] { opacity: 0; transform: translateY(18px); }
.js-reveal [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity .9s ease, transform .9s cubic-bezier(0.22,1,0.36,1);
}
@media (prefers-reduced-motion: no-preference) {
  .component-immersive-hero__media img { animation: kenburns 26s ease-out both; }
  .js-parallax .component-immersive-hero__media img { animation: none; }
  .component-immersive-hero__title, .component-immersive-hero__lede { opacity: 0; }
  .component-immersive-hero__title { animation: hero-in 1s cubic-bezier(.22,1,.36,1) .2s forwards; }
  .component-immersive-hero__lede  { animation: hero-in 1s cubic-bezier(.22,1,.36,1) .4s forwards; }
}
@keyframes kenburns { from { transform: scale(1.07); } to { transform: scale(1); } }
@keyframes hero-in  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal], .js-reveal [data-reveal].is-in { opacity: 1; transform: none; transition: none; }
  .js-parallax [data-parallax] img { transform: none; will-change: auto; }
  .component-immersive-hero__cue::after { animation: none; transform: none; }
}
