/* ANDREI DESIGN — LINIA
   paper → graphite → brass. The light warms as the page descends. */

:root {
  --paper:        #F2EDE4;
  --paper-dim:    #E4DBCB;
  --graphite:     #14120F;
  --graphite-2:   #23201B;
  --graphite-3:   #3A352E;
  --brass:        #C8873C;
  --brass-lit:    #E3A961;
  --cold:         #8FA3B0;

  /* overwritten at runtime by the sampled final-frame hex, so the film has no seam */
  --seam:         #1A1713;

  /* inline so the grain costs no request and cannot 404 into a flat-looking film */
  --grain-src: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");

  --measure:      66ch;
  --gutter:       clamp(1.25rem, 5vw, 5rem);
  --rule:         1px solid color-mix(in srgb, currentColor 18%, transparent);

  --ease:         cubic-bezier(.22, 1, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--graphite);
  color: var(--paper);
  font-family: 'Archivo', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .display {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.015em;
  text-wrap: balance;          /* Romanian runs 10–20% longer than English */
  margin: 0;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

::selection { background: var(--brass); color: var(--graphite); }

:focus-visible {
  outline: 2px solid var(--brass-lit);
  outline-offset: 3px;
}

.u-quiet { color: color-mix(in srgb, currentColor 62%, transparent); }

.u-label {
  font-size: .75rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 500;
  font-variation-settings: 'wdth' 88;
}

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

/* ── fixed chrome ───────────────────────────────────────────────────────────
   Everything runs through currentColor so the adaptive-header class flips the
   whole bar in one go when the film underneath goes light. */

.chrome {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem var(--gutter);
  color: var(--paper);
  transition: color .45s var(--ease);
  pointer-events: none;
  mix-blend-mode: difference;
}
.chrome.on-light { color: var(--graphite); mix-blend-mode: normal; }
.chrome a, .chrome button { pointer-events: auto; }

.mark {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none;
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: 1.05rem; letter-spacing: .01em;
}
.mark svg { width: 1.55rem; height: 1.55rem; flex: none; }
.mark em { font-style: normal; font-variation-settings: 'opsz' 96; }

/* chapter readout doubles as narrative + progress */
.readout { display: flex; align-items: center; gap: .75rem; transition: opacity .5s var(--ease); }
.readout .u-label { white-space: nowrap; }
.readout-bar {
  width: clamp(48px, 12vw, 132px); height: 1px;
  background: color-mix(in srgb, currentColor 28%, transparent);
  position: relative;
}
.readout-bar i {
  position: absolute; inset: 0 auto 0 0;
  background: currentColor; transform-origin: left;
  transform: scaleX(0);
}
@media (max-width: 700px) { .readout .u-label { display: none; } }

/* ── the film ───────────────────────────────────────────────────────────────
   850vh driver (~170vh per chapter) with a sticky stage inside it. */

.film { position: relative; height: 850vh; background: var(--graphite); }

.stage {
  position: sticky; top: 0;
  height: 100svh; overflow: hidden;
  background: var(--graphite);
}

.stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

#ambient { z-index: 2; pointer-events: none; }

/* grain + vignette sell the single-shot feel; both fade out with the seam */
.grain, .vignette, .seamfade {
  position: absolute; inset: 0; pointer-events: none;
}
.grain {
  z-index: 3; opacity: .16; mix-blend-mode: overlay;
  background-image: var(--grain-src);
  background-size: 180px 180px;
}
.vignette {
  z-index: 4;
  background: radial-gradient(120% 90% at 50% 45%, transparent 42%, rgba(0,0,0,.55) 100%);
}
.seamfade {
  z-index: 6; opacity: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--seam) 100%);
}

/* poster: shown only when there is genuinely no film manifest yet */
.poster {
  position: absolute; inset: 0; z-index: 1;
  background-size: cover; background-position: center;
}

/* loader */
.loader {
  position: absolute; inset: auto var(--gutter) 2.2rem var(--gutter);
  z-index: 20; display: flex; align-items: center; gap: .9rem;
  transition: opacity .6s var(--ease), visibility 0s .6s;
}
/* display stays flex so the bar fades instead of snapping out. opacity alone
   leaves it in the a11y tree, though — without visibility a screen reader keeps
   announcing "SE ÎNCARCĂ FILMUL 0%" for the life of the page. */
.loader[hidden] { display: flex; opacity: 0; pointer-events: none; visibility: hidden; }
.loader-bar { flex: 1; height: 1px; background: rgba(242,237,228,.2); position: relative; }
.loader-bar i {
  position: absolute; inset: 0 auto 0 0; background: var(--brass);
  transform-origin: left; transform: scaleX(0); transition: transform .2s linear;
}

/* ── beat overlays ──────────────────────────────────────────────────────────
   Opacity animates on the CHILDREN. Putting it on .beat would make the panel an
   opacity root and silently kill the backdrop-filter behind the glass. */

.beat {
  position: absolute; z-index: 10;
  left: var(--gutter); right: var(--gutter);
  bottom: clamp(4rem, 12vh, 9rem);
  /* explicit units, not ch — ch resolves against the container's Archivo, which
     has nothing to do with how wide the Bodoni headline inside actually runs */
  max-width: min(34rem, 78vw);
  will-change: transform;
}
.beat[data-anchor="center"] {
  top: 50%; bottom: auto; translate: 0 -50%;
  left: 50%; right: auto; transform-origin: center;
  max-width: min(22ch, 82vw);
  text-align: center;
  margin-inline-start: max(calc(-11ch), -41vw);
}
.beat-panel {
  padding: 1.4rem 1.5rem;
  background: rgba(20,18,15,.34);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid rgba(242,237,228,.14);
  opacity: 0;
}
.beat-text { opacity: 0; }
.beat h2 {
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 3.1rem);
  font-variation-settings: 'opsz' 72;
}

/* hero wordmark — must be readable at scroll 0 */
.hero {
  position: absolute; z-index: 11; inset: 0;
  display: grid; place-content: center; place-items: center;
  padding: 0 var(--gutter); text-align: center;
  pointer-events: none;
}
.hero-mark {
  font-size: clamp(2.4rem, 1rem + 9vw, 9.5rem);
  font-variation-settings: 'opsz' 96;
  letter-spacing: .01em;
  display: flex; flex-wrap: wrap; justify-content: center;
  column-gap: .3em;
  /* the film underneath is busy at every scale; the wordmark needs its own floor */
  text-shadow: 0 2px 40px rgba(10, 9, 7, .55);
}
.hero-mark .word { display: flex; }
.hero-mark .word > span { display: inline-block; overflow: hidden; }
.hero-mark .word > span i { display: inline-block; font-style: normal; }

.hero-sub {
  margin-top: 1.6rem;
  max-width: 36ch;
  padding: .85rem 1.25rem;
  color: var(--paper);
  background: rgba(20, 18, 15, .38);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  border: 1px solid rgba(242, 237, 228, .12);
}
.hero-scroll {
  position: absolute; left: 50%; bottom: 2.2rem; translate: -50% 0;
  display: grid; justify-items: center; gap: .5rem;
}
.hero-scroll i {
  width: 1px; height: 2.4rem; background: currentColor; transform-origin: top;
  animation: drop 2.6s var(--ease) infinite;
}
@keyframes drop { 0%,100% { transform: scaleY(.2); opacity: .3 } 50% { transform: scaleY(1); opacity: 1 } }

/* ── content below the film ─────────────────────────────────────────────────
   Starts at the sampled seam colour, then melts to paper. */

.after { position: relative; z-index: 30; background: var(--seam); }

.melt { height: 42vh; background: linear-gradient(to bottom, var(--seam), var(--paper)); }

.on-paper { background: var(--paper); color: var(--graphite); }

.section { padding: clamp(4rem, 11vh, 9rem) var(--gutter); }

.section-head {
  display: grid; gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: clamp(2rem, 5vh, 3.5rem);
  border-bottom: var(--rule);
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}
@media (min-width: 900px) {
  .section-head { grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; align-items: start; }
  .section-head > .u-label { padding-top: .55rem; }   /* sits on the headline's cap height */
}
.section-head h2 { font-size: clamp(2rem, 1.2rem + 3.4vw, 4.6rem); font-variation-settings: 'opsz' 88; }
/* line-height .95 on a 4.6rem Bodoni leaves no room for the paragraph under it */
.section-head p { margin: 1.1rem 0 0; max-width: 46ch; }

/* work grid — cards are deliberately typographic; real imagery drops in later */
.work { display: grid; gap: 1px; background: color-mix(in srgb, currentColor 14%, transparent); }
@media (min-width: 760px)  { .work { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .work { grid-template-columns: repeat(3, 1fr); } }

.work-item {
  background: var(--paper);
  padding: clamp(1.5rem, 3vw, 2.4rem);
  display: grid; gap: .9rem; align-content: start;
  min-height: clamp(15rem, 30vh, 22rem);
  text-decoration: none;
  transition: background .4s var(--ease);
}
.work-item:hover, .work-item:focus-visible { background: var(--paper-dim); }
.work-item h3 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); font-variation-settings: 'opsz' 40; }
.work-item .u-label { color: var(--brass); }
.work-item p { margin: 0; font-size: .95rem; }
.work-item[data-placeholder] { opacity: .55; }
.work-item[data-placeholder] h3::after {
  content: ''; display: block; margin-top: .7rem;
  height: 1px; width: 3rem; background: currentColor;
}

/* services — numbered rows, the line motif again */
.rows { border-top: var(--rule); }
.row {
  display: grid; gap: .5rem 2rem;
  padding: clamp(1.6rem, 4vh, 2.8rem) 0;
  border-bottom: var(--rule);
}
@media (min-width: 860px) {
  .row { grid-template-columns: 4rem 18rem minmax(0, 1fr); align-items: baseline; }
}
.row .u-label { color: var(--brass); }
.row h3 { font-size: clamp(1.3rem, 1.05rem + .9vw, 1.9rem); font-variation-settings: 'opsz' 32; }
.row p { margin: 0; max-width: 52ch; }

/* process — mirrors the film's five chapters */
.steps { display: grid; gap: 1px; background: color-mix(in srgb, currentColor 16%, transparent); }
@media (min-width: 700px)  { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .steps { grid-template-columns: repeat(5, 1fr); } }
.step { background: var(--graphite); padding: clamp(1.4rem, 3vw, 2rem); display: grid; gap: .8rem; align-content: start; }
.step .u-label { color: var(--brass-lit); }
.step h3 { font-size: 1.5rem; font-variation-settings: 'opsz' 32; }
.step p { margin: 0; font-size: .93rem; color: color-mix(in srgb, var(--paper) 70%, transparent); }

/* ── brief form ─────────────────────────────────────────────────────────── */

.brief { display: grid; gap: 1.5rem; max-width: 46rem; }
.field { display: grid; gap: .5rem; }
.field label { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 1rem; color: inherit;
  background: transparent;
  border: 0; border-bottom: 1px solid color-mix(in srgb, currentColor 34%, transparent);
  padding: .7rem 0;
  border-radius: 0;
  transition: border-color .3s var(--ease);
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-bottom-color: var(--brass);
}
.field select option { background: var(--paper); color: var(--graphite); }
.field-pair { display: grid; gap: 1.5rem; }
@media (min-width: 700px) { .field-pair { grid-template-columns: 1fr 1fr; } }

/* honeypot — hidden from humans, present for bots. Not display:none, which some
   bots skip; off-screen and out of the tab order. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.btn {
  justify-self: start;
  font: inherit; font-weight: 500; letter-spacing: .04em;
  padding: .9rem 2.2rem;
  background: var(--graphite); color: var(--paper);
  border: 1px solid var(--graphite); border-radius: 0;
  cursor: pointer;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--brass); border-color: var(--brass); color: var(--graphite); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.form-note { margin: 0; font-size: .9rem; min-height: 1.4em; }
.form-note[data-state="error"] { color: #A3341F; }
.form-note[data-state="ok"]    { color: #2F6B3A; }

/* ── footer ─────────────────────────────────────────────────────────────── */

.foot { background: var(--graphite); color: var(--paper); padding: clamp(3rem, 8vh, 6rem) var(--gutter) 2rem; }
.foot-grid { display: grid; gap: 2.5rem; padding-bottom: 3rem; border-bottom: var(--rule); }
@media (min-width: 860px) { .foot-grid { grid-template-columns: 2fr 1fr 1fr; } }
.foot h2 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 3.4rem); font-variation-settings: 'opsz' 72; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.foot a { text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .3s var(--ease); }
.foot a:hover { border-bottom-color: currentColor; }
.socials { display: flex; gap: 1rem; }
.socials a { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: var(--rule); border-bottom: var(--rule); }
.socials svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.foot-base {
  display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between;
  padding-top: 2rem; font-size: .82rem;
}

/* ── motion policy ──────────────────────────────────────────────────────────
   The film itself is 1:1 user-driven and STAYS under reduced-motion — collapsing
   it to a poster reads as a broken hero, not a courtesy. Only autonomous motion
   (ambient particles, the scroll hint) is disabled. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hero-scroll i { animation: none; }
  #ambient { display: none; }
}
