/* scroll-video-hero v2: tokens, page below the hero, motion system.
   Palette sampled from the footage's grade: warm near-black canvas, gold in rare doses. */

:root {
  --bg: #0A0D13;
  --bg-2: #0D1118;
  --panel: #10151D;
  --panel-2: #151B25;
  --ink: #F4F3EF;
  --ink-soft: #DDDBD4;
  --muted: #98A0AB;
  --gold: #E3051B;
  --gold-2: #FF3B4E;
  --line: rgba(244, 243, 239, .12);
  --line-strong: rgba(244, 243, 239, .34);
  --line-ui: rgba(244, 243, 239, .46);       /* interactive borders: >= 3:1 over --bg and inputs */
  --focus: var(--gold-2);

  --font-display: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --section-y: clamp(72px, 12vh, 140px);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

/* Sideways overflow: `clip` on both html and body. The `hidden` fallback lives on html ONLY: the
   root's overflow propagates to the viewport, whereas `overflow-x: hidden` left on body (engines
   without `clip`: Safari <= 15, iOS <= 15) turns body into a scroll container that never scrolls
   and position: sticky inside it stops sticking to the viewport. */
html {
  overflow-x: hidden;
  overflow-x: clip;
}
body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body);
  /* `backwards`, never `both`: a finished fill-both animation stays active and keeps the whole
     document promoted as a second full-page layer for the life of the page. */
  animation: page-in 1.1s var(--ease-out) backwards;
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration-color: rgba(201, 166, 96, .5); text-underline-offset: .18em; transition: color .3s var(--ease-out), text-decoration-color .3s var(--ease-out); }
a:hover { color: var(--gold-2); text-decoration-color: var(--gold-2); }
img, svg, canvas, video { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--gold);
  color: #1A1410;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: top .25s var(--ease-out);
}
.skip:focus { top: 16px; }

/* One fixed environment behind everything: a slow warm drift, 70 s cycle. It moves only while a
   living section is on screen (JS toggles body.living from the [data-living] observer): under the
   opaque hero, and while the visitor rests, an animated 140% viewport layer would keep the GPU
   drawing a frame every vsync for nothing, and hold a promoted layer of its own. */
.atmos {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(201, 166, 96, .07), transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(120, 80, 40, .09), transparent 70%),
    var(--bg);
}
.atmos::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse 40% 40% at 50% 50%, rgba(227, 197, 128, .05), transparent 70%);
}
body.living .atmos::after { animation: atmos-drift 70s var(--ease-inout) -20s infinite alternate; }
@keyframes atmos-drift {
  from { transform: translate(-6%, -4%) scale(1); }
  to { transform: translate(6%, 5%) scale(1.15); }
}

/* ---------- Header over the hero ---------- */

.top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(16px, 2.6vw, 28px) var(--gutter);
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(8, 6, 4, .8);
}
.top .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: .06em;
}
.top .brand svg { width: 22px; height: 22px; align-self: center; }
.top nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(14px, 2.4vw, 32px); }
.top nav a {
  text-decoration: none;
  font-size: .8125rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.top nav a:hover { color: var(--gold-2); }
@media (max-width: 720px) { .top nav { display: none; } }

/* ---------- Layout ---------- */

main { display: block; }
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
section.block { padding-block: var(--section-y); position: relative; }
section.block + section.block { border-top: 1px solid var(--line); }

.kicker {
  display: inline-block;
  font: 500 .75rem/1.2 var(--font-body);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}
.h2 {
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem);
  line-height: 1.08;
  max-width: 20ch;
  text-wrap: balance;
}
.lede {
  margin-top: 20px;
  font-size: clamp(1.05rem, .95rem + .5vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 58ch;
}
.rule { height: 1px; background: var(--line); }

/* ---------- Materiali: three cards, one gold hairline that breathes ---------- */

.materials .grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  margin-top: clamp(36px, 6vh, 64px);
}
.card {
  position: relative;
  padding: clamp(22px, 3vw, 34px);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform .5s var(--ease-out), border-color .5s var(--ease-out);
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.card .num { font: 500 .75rem/1 var(--font-mono); letter-spacing: .16em; color: var(--gold); }
.card h3 { font-size: 1.55rem; line-height: 1.15; }
.card p { color: var(--muted); max-width: 34ch; padding-bottom: 14px; } /* reserved room above the hairline glow */
.card .hair {
  margin-top: auto;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  transform-origin: left center;
  position: relative;
}
.card .hair::after {
  content: "";
  position: absolute;
  inset: -3px 0;
  background: linear-gradient(90deg, rgba(227, 197, 128, .55), transparent);
  filter: blur(4px);
  opacity: 0;
}
[data-living].onscreen .card:first-child .hair::after { animation: hair-glow 5.2s var(--ease-inout) -1.6s infinite; }
@keyframes hair-glow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* ---------- Il movimento: image + spec ledger, a different skeleton ---------- */

.movement .split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.movement figure {
  margin: 0;
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
}
.movement figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.movement figure figcaption {
  position: absolute;
  left: 16px; bottom: 16px;
  font: 500 .72rem/1.2 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 6px 10px;
  background: rgba(8, 6, 4, .55);
  border: 1px solid rgba(201, 166, 96, .3);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.movement .orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(227, 197, 128, .12), transparent 55%);
  opacity: .8;
}
[data-living].onscreen .movement .orbit,
.movement[data-living].onscreen .orbit { animation: orbit-breathe 6.5s var(--ease-inout) -2s infinite alternate; }
@keyframes orbit-breathe { from { transform: scale(.94); opacity: .5; } to { transform: scale(1.06); opacity: .95; } }
.ledger { list-style: none; margin: clamp(28px, 4vh, 44px) 0 0; padding: 0; }
.ledger li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.ledger li:last-child { border-bottom: 1px solid var(--line); }
.ledger dt, .ledger .k { color: var(--muted); font-size: .95rem; }
.ledger .v { font-family: var(--font-display); font-size: 1.2rem; text-align: right; }

/* ---------- Come si acquista: numbered path ---------- */

.buy .steps {
  counter-reset: step;
  list-style: none;
  margin: clamp(36px, 6vh, 64px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
}
.buy .steps li { position: relative; padding-top: 22px; }
.buy .steps li::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  top: 0; left: 0;
  font: 500 .75rem/1 var(--font-mono);
  letter-spacing: .16em;
  color: var(--gold);
}
.buy .steps li::after {
  content: "";
  position: absolute;
  top: 6px; left: 34px; right: 0;
  height: 1px;
  background: var(--line);
}
.buy .steps h3 { font-size: 1.45rem; margin-top: 8px; }
.buy .steps p { margin-top: 10px; color: var(--muted); max-width: 32ch; }
.buy .concierge {
  margin-top: clamp(32px, 5vh, 56px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.buy .concierge p { flex: 1 1 320px; color: var(--ink-soft); max-width: 52ch; }
.buy .concierge .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold-2);
  position: relative;
  flex: none;
}
.buy .concierge .dot::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--gold-2);
  opacity: 0;
}
[data-living].onscreen .concierge .dot::after { animation: dot-ring 4.4s var(--ease-out) -1s infinite; }
@keyframes dot-ring { 0% { transform: scale(.4); opacity: .8; } 60%, 100% { transform: scale(1.4); opacity: 0; } }

/* ---------- FAQ ---------- */

.faq .list { margin-top: clamp(28px, 5vh, 48px); border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 20px 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  transition: color .3s var(--ease-out);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-body);
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
  transition: transform .4s var(--ease-out);
  flex: none;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--gold-2); }
.faq .a { padding: 0 0 22px; color: var(--muted); max-width: 62ch; }
.faq details[open] .a { animation: faq-in .5s var(--ease-out) both; }
@keyframes faq-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Contact / CTA ---------- */

.contact-block .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(28px, 5vw, 64px);
  padding: clamp(28px, 4vw, 56px);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
}
.contact-block .note { color: var(--muted); margin-top: 16px; max-width: 42ch; }
form.contact { display: grid; gap: 16px; position: relative; }
form.contact .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
form.contact label { display: grid; gap: 8px; font-size: .85rem; letter-spacing: .04em; color: var(--ink-soft); }
form.contact input,
form.contact textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-ui);
  background: rgba(8, 6, 4, .35);
  color: var(--ink);
  font: inherit;
  transition: border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
form.contact input:focus,
form.contact textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 166, 96, .18); }
form.contact textarea { min-height: 120px; resize: vertical; }
form.contact .fine { font-size: .8rem; color: var(--muted); }
form.contact.is-sent { opacity: 0; pointer-events: none; transition: opacity .4s var(--ease-out); position: absolute; inset: 0; }
form.contact[hidden] { display: none; }
.form-done { display: none; }
.form-done:not([hidden]) { display: grid; gap: 12px; align-content: center; min-height: 260px; }
.form-done h3 { font-size: 1.7rem; }
.form-done p { color: var(--ink-soft); max-width: 44ch; }
.form-done .tick { width: 40px; height: 40px; color: var(--gold-2); }
.form-done.in .tick path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: tick-draw .9s var(--ease-out) .1s forwards; }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }
.form-done h3:focus { outline: none; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font: 500 .9375rem/1 var(--font-body);
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .45s var(--ease-out), background-color .35s var(--ease-out), border-color .35s var(--ease-out), color .35s var(--ease-out);
}
.btn.primary { background: var(--gold); color: #1A1410; }
.btn.primary:hover { background: var(--gold-2); color: #1A1410; transform: translateY(-1px); }
.btn.ghost { border-color: var(--line-ui); color: var(--ink); background: rgba(8, 6, 4, .28); }
.btn.ghost:hover { border-color: var(--gold-2); color: var(--gold-2); transform: translateY(-1px); }
@media (pointer: coarse) {
  .btn, .faq summary, .top nav a, .cue { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .faq summary { display: flex; justify-content: space-between; }
}

/* ---------- Footer ---------- */

footer.site {
  border-top: 1px solid var(--line);
  padding: clamp(36px, 6vh, 64px) 0;
  color: var(--muted);
  font-size: .9rem;
}
footer.site .cols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 32px; align-items: baseline; }
footer.site .ref { max-width: 60ch; }
footer.site .brand { font-family: var(--font-display); color: var(--ink); font-size: 1.1rem; letter-spacing: .06em; }

/* ---------- Motion system: entrances, staggers, retirement ----------
   The stagger delays live on the ENTERING state (.reveal.in ...): a transition takes its delay from
   the computed style at the moment it starts, so a delay declared only on the resting state (or
   zeroed by a rule that matches at the same instant as .in) never plays. JS adds .settled 1.4 s
   after .in (entrance 0.9 s + longest delay); the .settled rules retire the delays with the same
   specificity, declared later, so hovers and focus rings never wait. */

.reveal .part {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.reveal.in .part { opacity: 1; transform: none; }
.reveal.in .part:nth-child(2) { transition-delay: .09s; }
.reveal.in .part:nth-child(3) { transition-delay: .18s; }
.reveal.in .part:nth-child(4) { transition-delay: .27s; }
.reveal.in .part:nth-child(5) { transition-delay: .36s; }
.reveal.in .part:nth-child(6) { transition-delay: .45s; }
.reveal.in.settled .part:nth-child(n) { transition-delay: 0s; }
.reveal .grid .card,
.reveal .steps li {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), border-color .5s var(--ease-out);
}
.reveal.in .grid .card,
.reveal.in .steps li { opacity: 1; transform: none; }
.reveal.in .grid .card:nth-child(2), .reveal.in .steps li:nth-child(2) { transition-delay: .12s; }
.reveal.in .grid .card:nth-child(3), .reveal.in .steps li:nth-child(3) { transition-delay: .24s; }
.reveal.in.settled .grid .card:nth-child(n), .reveal.in.settled .steps li:nth-child(n) { transition-delay: 0s; }

/* Hidden tab: pause everything, pseudo-elements included. */
body.paused *, body.paused *::before, body.paused *::after { animation-play-state: paused !important; }

/* Reduced motion, from the media query or pinned live by JS: final states, no drives. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .reveal .part, .reveal .grid .card, .reveal .steps li { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
html.is-pinned *, html.is-pinned *::before, html.is-pinned *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  transition-delay: 0s !important;
}
html.is-pinned .reveal .part,
html.is-pinned .reveal .grid .card,
html.is-pinned .reveal .steps li { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .materials .grid { grid-template-columns: 1fr; }
  .movement .split { grid-template-columns: 1fr; }
  .movement figure { aspect-ratio: 16 / 10; }
  .buy .steps { grid-template-columns: 1fr; }
  .contact-block .panel { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  form.contact .row { grid-template-columns: 1fr; }
  .card { min-height: 0; }
}
/* Decorations never collide with content on short screens. */
@media (max-height: 560px) {
  .atmos::after { display: none; }
}
