/* ==========================================================================
   Vintner — global: reset, base type, grain, focus, scroll
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; color-scheme: dark; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Film grain + warm vignette on the whole page (fixed, ignores pointer) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0.07; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .92  0 0 0 0 .8  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(90vw 70vh at 50% 0%, rgba(255, 255, 255, 0.035), transparent 70%);
}
main, header, footer, section { position: relative; z-index: 2; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-display);
  text-wrap: balance;
  font-variant-numeric: lining-nums;
  font-variation-settings: var(--fv-display);
}
em, .em { font-style: italic; font-family: var(--font-display); font-weight: 340; font-variation-settings: var(--fv-display); }
p { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: fixed; left: var(--gutter); top: -100px; z-index: 1000;
  background: var(--accent); color: var(--on-accent); padding: 0.75rem 1.25rem; transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* Slim scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* No-JS safety: everything stays visible. JS adds .js on <html>. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
html.is-locked { overflow: hidden; }

/* While arriving through a page transition the page is covered from the very first paint (before JS runs), so it never flashes */
html.vt-entering::after { content: ""; position: fixed; inset: 0; z-index: 850; background: var(--accent); pointer-events: none; }

/* The logo on the cover is drawn before JS and with the preloaded italic, at the exact size and place of the curtain logo, so it never changes size when the curtain takes over */
html.vt-entering::before { content: "Castelvecchio"; position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 851; text-align: center; pointer-events: none; font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(2.4rem, 7vw, 5rem); letter-spacing: -0.03em; line-height: normal; color: var(--on-accent); font-variation-settings: var(--fv-display); }
