/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ──────────────────────────────────────── */
:root {
  --bg:        #2C2B28;   /* warm-dark — the field */
  --bg-lift:   #262522;   /* 5 % darker — lift-from state */
  --vignette:  #34322E;   /* warm centre — pool of light */
  --offwhite:  #F7F4EF;   /* primary text */
  --sand:      #E0D9CE;   /* accent / labels / focus */
  --slate:     #C2BAB0;   /* muted hairlines */
  --ink:       #2C2B28;
  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Inter', system-ui, sans-serif;
  --col:    560px;
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Base ───────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
}

body {
  background-color: var(--bg-lift);
  color: var(--offwhite);
  font-family: var(--sans);
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  animation: bgLift 800ms var(--ease) forwards;
}

@keyframes bgLift {
  to { background-color: var(--bg); }
}

/* selection */
::selection         { background: var(--sand); color: var(--ink); }
::-moz-selection    { background: var(--sand); color: var(--ink); }

/* ── Background composition: vignette + grain ───────── */

/* Vignette — the only allowed gradient. A warm pool of light. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 80% 80% at 50% 40%,
    var(--vignette) 0%,
    transparent 70%
  );
  opacity: 0;
  animation: vignetteRise 800ms var(--ease) forwards;
  will-change: opacity;
}

@keyframes vignetteRise {
  to { opacity: 1; }
}

/* Paper grain — a static material, not motion. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch' seed='3'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
  opacity: 0;
  transform: translateZ(0);
  animation: grainRise 800ms var(--ease) forwards;
}

@keyframes grainRise {
  to { opacity: 0.06; }
}

/* ── Layout ─────────────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-top: clamp(180px, 28vh, 320px);
}

/* ── Logo ───────────────────────────────────────────── */
.logo-wrap {
  display: flex;
  justify-content: center;
  width: var(--col);
  max-width: calc(100% - 48px);
}

.logo {
  display: block;
  max-height: 280px;
  width: auto;
  /* initial — JS adds .visible at 800 ms */
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity   1200ms var(--ease),
    transform 1200ms var(--ease);
}

.logo.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Quote ──────────────────────────────────────────── */
.quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--offwhite);
  text-align: center;
  max-width: 38ch;
  padding: 0 24px;
  margin-top: 96px;
  /* initial — JS adds .visible at 2000 ms */
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity   1000ms var(--ease),
    transform 1000ms var(--ease);
}

.quote.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scroll cue ─────────────────────────────────────── */
.scroll-cue {
  width: 1px;
  height: 48px;
  background: var(--slate);
  margin-top: clamp(80px, 25vh, 200px);
  animation: breathe 3600ms ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.30; }
  50%       { opacity: 0.65; }
}

/* ── Form section ───────────────────────────────────── */
.form-section {
  width: var(--col);
  max-width: calc(100% - 48px);
  margin-top: 120px;
  padding-bottom: 256px; /* 160 tail + 96 page-end breathing */
}

/* ── Fields ─────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 40px;
}

.field-label {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 8px;
  user-select: none;
  cursor: default;
}

.req-dot {
  color: var(--sand);
  margin-left: 3px;
}

/* Field control wrapper — holds the input + the two-line underline */
.field-control {
  position: relative;
}

/* Idle hairline — slate at 50 % opacity */
.field-control::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--slate);
  opacity: 0.5;
  transition: opacity 300ms ease-out;
  pointer-events: none;
}

/* Focus line — beach sand, draws left → right over the slate hairline */
.field-control::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--sand);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms ease-out;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .field-control:hover::before {
    opacity: 0.8;
  }
}

.field-control:focus-within::after {
  transform: scaleX(1);
}

.field.has-error .field-control::after {
  transform: scaleX(1);
}

.field-input {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--offwhite);
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  padding: 4px 0 10px;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  caret-color: var(--sand);
  resize: none;
  box-shadow: none;
}

.field-input:focus {
  outline: none;
}

.field-textarea {
  min-height: calc(1.6 * 16px * 2 + 14px);
  line-height: 1.6;
  overflow: hidden;
}

.field-error {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 11px;
  color: var(--offwhite);
  margin-top: 6px;
  min-height: 1em;
  display: block;
}

/* ── Envoyer ────────────────────────────────────────── */
.envoyer {
  display: inline-block;
  font-family: var(--sans);
  background: none;
  border: none;
  padding: 0;
  margin-top: 48px;
  cursor: pointer;
  -webkit-appearance: none;
  transition: opacity 180ms ease-out;
}

.envoyer:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.envoyer:active {
  opacity: 0.7;
}

.envoyer-label {
  position: relative;
  display: inline-block;
  padding: 5px 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: var(--offwhite);
  line-height: 1;
}

/* Bracket hairlines — appear on hover, framing the word like an engraving */
.envoyer-label::before,
.envoyer-label::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--sand);
  opacity: 0;
  transition: opacity 280ms ease-out;
}

.envoyer-label::before { top: 0; }
.envoyer-label::after  { bottom: 0; }

@media (hover: hover) and (pointer: fine) {
  .envoyer:hover .envoyer-label::before,
  .envoyer:hover .envoyer-label::after {
    opacity: 1;
  }
}

/* Loading state — text becomes serif italic, beach sand */
.envoyer.sending .envoyer-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--sand);
}

.envoyer.sending .envoyer-label::before,
.envoyer.sending .envoyer-label::after {
  display: none;
}

/* ── Send error ─────────────────────────────────────── */
.send-error {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: var(--offwhite);
  margin-top: 20px;
  display: none;
}

.send-error.visible {
  display: block;
}

/* ── Confirmation ───────────────────────────────────── */
.confirmation {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  color: var(--sand);
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity   600ms var(--ease),
    transform 600ms var(--ease);
}

.confirmation.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Breakpoints ────────────────────────────────────── */

/* 769–1280 px — laptop / landscape tablet */
@media (max-width: 1280px) {
  .logo  { max-height: 224px; }
  .quote { font-size: 28px; }
}

/* ≤ 768 px — large mobile / portrait tablet */
@media (max-width: 768px) {
  .hero  { padding-top: clamp(128px, 22vh, 220px); }
  .logo  { max-height: 168px; }
  .quote {
    font-size: 24px;
    margin-top: 64px;
  }
  .scroll-cue { display: none; }
  .form-section { margin-top: 96px; }
  /* shrink the vignette so the lit pool still falls on the column */
  body::before {
    background: radial-gradient(
      ellipse 110% 60% at 50% 38%,
      var(--vignette) 0%,
      transparent 75%
    );
  }
}

/* ≤ 480 px — small mobile */
@media (max-width: 480px) {
  .logo  { max-height: 140px; }
  .quote { font-size: 22px; padding: 0 20px; margin-top: 56px; }
  .logo-wrap,
  .form-section { max-width: calc(100% - 40px); }
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body                  { animation-duration: 200ms !important; }
  body::before          { animation-duration: 200ms !important; }
  body::after           { animation-duration: 200ms !important; }

  .logo,
  .quote,
  .confirmation {
    transition: opacity 200ms ease-out !important;
    transform: none !important;
  }

  .scroll-cue {
    animation: none;
    opacity: 0.45;
  }
}
