/* cinematic-site-builder — surfaces, grain, glass, light
   Rules of thumb:
   - Glass is for a small number of elevated things (nav, one interface mock,
     a pricing card). Not every box. Once you can see three glass panels at
     once, you have too many.
   - Grain is a texture layer at 4 to 7 percent opacity. If you can see it
     from across the room, it is too strong.
   - The light is one slow radial glow behind the hero. One. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--on-paper);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; line-height: 1.02; letter-spacing: var(--track-tight); }
h1 { font-size: var(--t-hero); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); letter-spacing: var(--track-snug); line-height: 1.2; }
p  { margin: 0; }
.lead { font-size: var(--t-lead); line-height: 1.45; max-width: var(--measure); }

/* Dark and light bands. Sections inherit colour from the band. */
.band-dark  { background: var(--ink);   color: var(--on-ink); }
.band-dark .mute { color: var(--on-ink-mute); }
.band-paper { background: var(--paper); color: var(--on-paper); }
.band-paper .mute { color: var(--on-paper-mute); }

.wrap { width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: var(--section); }

/* Grain: an SVG turbulence filter, tiled. No image download needed. */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: .07; mix-blend-mode: soft-light;
  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='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.grain > * { position: relative; z-index: 1; }

/* Atmospheric light: one slow, drifting radial glow. */
.light { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.light::before, .light::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px);
  will-change: transform;
}
.light::before {
  width: 62vw; height: 62vw; max-width: 900px; max-height: 900px;
  left: 50%; top: -20%; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(79,181,140,.28), rgba(79,181,140,0) 70%);
  animation: drift 22s ease-in-out infinite alternate;
}
.light::after {
  width: 40vw; height: 40vw; max-width: 620px; max-height: 620px;
  right: -12%; bottom: -18%;
  background: radial-gradient(closest-side, rgba(237,233,223,.07), rgba(237,233,223,0) 70%);
  animation: drift2 30s ease-in-out infinite alternate;
}
@keyframes drift  { from { transform: translate(-50%, 0) scale(1); } to { transform: translate(-46%, 6%) scale(1.08); } }
@keyframes drift2 { from { transform: translate(0, 0); } to { transform: translate(-6%, -8%); } }

/* Fine ruled texture for the dark hero. Kept faint and masked to the centre;
   it is a texture, not a grid UI. */
.ruled::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(237,233,223,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(237,233,223,.045) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}

/* Glass surfaces */
.glass {
  background: var(--glass-dark);
  border: 1px solid var(--line-dark);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 30px 80px -30px rgba(0,0,0,.6);
}
.band-paper .glass {
  background: var(--glass-light);
  border-color: var(--line-light);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 30px 60px -36px rgba(23,28,25,.35);
}

/* Thin-border panel (non-glass). The default box. */
.panel { border: 1px solid var(--line-light); border-radius: var(--radius-lg); background: rgba(255,255,255,.35); }
.band-dark .panel { border-color: var(--line-dark); background: var(--ink-2); }

/* Buttons. Square-ish. Two, and only two, styles. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .8rem 1.35rem;
  font: 600 .95rem/1 var(--font-body); letter-spacing: -0.01em;
  border-radius: var(--radius); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); }
.btn-ghost { background: transparent; border-color: var(--line-dark-2); color: inherit; }
.btn-ghost:hover { border-color: var(--on-ink); }
.band-paper .btn-ghost { border-color: var(--line-light); }
.band-paper .btn-ghost:hover { border-color: var(--on-paper); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem var(--gutter);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(13,21,18,.72); border-bottom: 1px solid var(--line-dark);
  color: var(--on-ink);
}
.nav a { text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; font-size: var(--t-small); }
.nav-links a { opacity: .8; } .nav-links a:hover { opacity: 1; }
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* Hairline rule between stacked items (lists that are not cards) */
.rule-list > * + * { border-top: 1px solid var(--line-light); }
.band-dark .rule-list > * + * { border-top-color: var(--line-dark); }

/* Tables to cards on mobile */
.table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.table th, .table td { text-align: left; padding: .9rem .5rem; border-bottom: 1px solid var(--line-light); vertical-align: top; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table tr { display: block; padding: .6rem 0; }
  .table td { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; border: 0; padding: .3rem 0; }
  .table td::before { content: attr(data-label); color: var(--on-paper-mute); }
  .table tr + tr { border-top: 1px solid var(--line-light); }
}

/* Reduced motion: kill everything that moves on its own. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Mobile: no blur-heavy effects, no drifting light. */
@media (max-width: 720px) {
  .light::before, .light::after { animation: none; filter: blur(40px); }
  .glass { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}

/* ---------- Cinematic additions (v2) ----------
   A hero is cinematic when it has a subject, a light direction, and depth.
   .scene: a full-bleed SVG or image behind the hero content.
   .vignette: darkens the edges so the eye goes to the middle.
   .sweep: one light pass across a glass panel on load.
   .tilt: puts the interface panel in perspective, like a windshield. */
.scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.scene svg, .scene img, .scene video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, transparent 40%, rgba(6,12,10,.75) 100%);
}
.sweep { position: relative; overflow: hidden; }
.sweep::after {
  content: ""; position: absolute; inset: -40% -60%; z-index: 2; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255,240,214,.16) 50%, transparent 60%);
  transform: translateX(-70%); opacity: 0;
}
.sweep.is-in::after { animation: sweep 1.6s var(--ease-out) .9s 1 forwards; }
@keyframes sweep { 0% { transform: translateX(-70%); opacity: 1; } 100% { transform: translateX(70%); opacity: 0; } }
.tilt { transform: perspective(1400px) rotateX(7deg); transform-origin: 50% 0; }
[data-hero].tilt { transform: perspective(1400px) rotateX(16deg) translateY(40px); }
[data-hero].tilt.is-in { transform: perspective(1400px) rotateX(7deg) translateY(0); transition-duration: var(--dur-slow); }
@media (max-width: 720px) {
  .tilt, [data-hero].tilt, [data-hero].tilt.is-in { transform: none; }
  .sweep::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sweep::after { display: none; }
  [data-hero].tilt { transform: perspective(1400px) rotateX(7deg); }
}
