/* Hallmark · macrostructure: Split Studio · knobs: diptych=brand-left/deck-right ≥60rem, collapse=stack (brand band → deck), divider=colour-shift
 * theme: custom · vibe: "banchina, gran pavese, ghiaccio e blu notte" · paper: oklch(97.5% 0.010 255) · accent: oklch(90.1% 0.183 98)
 * display: Bitter 800 · body: IBM Plex Sans · axes: light / slab-serif / chromatic-other (signal yellow ~98°)
 * idea: "the ship is dressed overall: signal flags S-K-I-P-P-E-R strung over the logo, the form sits in the deep-blue sea"
 * nav: none (single form) · footer: none · contrast: pass (40–41) · slop: pass (42–45) · honest: pass (46) · chrome: pass (47)
 * accent footprint: ~8% at 375 px (submit key + "contatto!"): deliberate, the brand is blue and yellow
 * tokens: pass (48) · responsive: pass (49) · mobile: pass (34, 49, 50–57) · icons: pass (30) · studied: no · context: explicit
 */
/* Hallmark · pre-emit critique: P4 H5 E4 S5 R4 V5 */

@font-face {
  font-family: "Bitter";
  src: url("/fonts/bitter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokens. Hex first for older browsers on a stand tablet, OKLCH below where supported. */
:root {
  --color-paper: #f2f7fe;
  --color-paper-2: #e2eaf6;
  --color-ink: #111c32;
  --color-ink-2: #414d63;
  --color-muted: #596475;
  --color-brand: #3a68b1;
  --color-deep: #152d60;
  --color-deep-2: #223d74;
  --color-deep-3: #324e86;
  --color-on-deep: #f0f6fd;
  --color-on-deep-2: #c0cfe5;
  --color-accent: #ffde18;
  --color-accent-2: #f1cb1c;
  --color-accent-shade: #b48c21;
  --color-accent-ink: var(--color-ink);
  --color-focus: var(--color-accent);
  --color-error: #b7191c;
  --color-error-soft: #ffe8e6;
  --color-error-on-deep: #f8b8b2;
  --color-flag-red: #d02c2a;

  --font-display: "Bitter", "Rockwell", "Roboto Slab", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", sans-serif;

  --text-s: 0.9375rem;
  --text-m: 1.0625rem;
  --text-l: 1.125rem;
  --text-xl: 1.25rem;
  --text-display: clamp(2.25rem, 8vw + 0.5rem, 3.75rem);
  --text-thanks: clamp(2.5rem, 9vw + 0.5rem, 4.25rem);

  --space-3xs: 4px;
  --space-2xs: 8px;
  --space-xs: 12px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 32px;
  --space-xl: 40px;
  --space-2xl: 56px;
  --space-3xl: 72px;

  --control-h: 56px;
  --radius: 2px;
  --press: 4px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@supports (color: oklch(0% 0 0)) {
  :root {
    --color-paper: oklch(97.5% 0.010 255);
    --color-paper-2: oklch(93.5% 0.018 255);
    --color-ink: oklch(23% 0.045 262);
    --color-ink-2: oklch(42% 0.040 262);
    --color-muted: oklch(50% 0.030 258);
    --color-brand: oklch(52.1% 0.126 259.3);
    --color-deep: oklch(31% 0.095 263);
    --color-deep-2: oklch(37% 0.100 263);
    --color-deep-3: oklch(43% 0.100 263);
    --color-on-deep: oklch(97% 0.012 255);
    --color-on-deep-2: oklch(85% 0.035 258);
    --color-accent: oklch(90.1% 0.183 98);
    --color-accent-2: oklch(85% 0.170 95);
    --color-accent-shade: oklch(66% 0.125 86);
    --color-error: oklch(50% 0.190 27);
    --color-error-soft: oklch(95% 0.025 25);
    --color-error-on-deep: oklch(84% 0.075 25);
    --color-flag-red: oklch(56% 0.200 27);
  }
}

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

[hidden] { display: none !important; }

html, body { overflow-x: clip; }

html {
  background: var(--color-deep);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--text-m);
  line-height: 1.5;
  color: var(--color-on-deep);
  background: var(--color-deep);
}

/* Brand band: paper, the only surface the blue logo reads on. */
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s) var(--space-m);
  color: var(--color-ink);
  background: var(--color-paper);
}

.pavese {
  display: block;
  width: clamp(232px, 66vw, 360px);
  height: auto;
}
.pavese .rope { fill: none; stroke: var(--color-ink-2); stroke-width: 1.5; stroke-linecap: round; }
.pavese .ring { fill: var(--color-paper); stroke: var(--color-ink-2); stroke-width: 1.5; }
.pavese .edge { fill: none; stroke: var(--color-ink); stroke-width: 1; }
.pavese .f-paper { fill: var(--color-paper); }
.pavese .f-blue { fill: var(--color-brand); }
.pavese .f-yellow { fill: var(--color-accent); }
.pavese .f-red { fill: var(--color-flag-red); }
.pavese .f-ink { fill: var(--color-ink); }

.logo {
  display: block;
  width: clamp(148px, 42vw, 220px);
  height: auto;
}

/* Deck: the deep-blue panel that carries the form and the thank-you. */
.deck {
  flex: 1 0 auto;
  padding: var(--space-l) var(--space-s) var(--space-2xl);
  padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom));
  color: var(--color-on-deep);
  background: var(--color-deep);
}

.deck > section {
  max-width: 36rem;
}

h1 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-display);
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--color-on-deep);
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
}

.hl { color: var(--color-accent); }

.lede {
  max-width: 46ch;
  margin: 0 0 var(--space-l);
  font-size: var(--text-m);
  line-height: 1.45;
  color: var(--color-on-deep-2);
  text-wrap: pretty;
}

/* Form */
.row { display: grid; gap: 0 var(--space-s); }
@media (min-width: 22.5rem) {
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.field { margin-bottom: var(--space-3xs); }

label {
  display: block;
  margin-bottom: var(--space-2xs);
  font-weight: 600;
  font-size: var(--text-m);
  line-height: 1.2;
  color: var(--color-on-deep);
}

input {
  display: block;
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--space-s);
  font: inherit;
  font-size: var(--text-l); /* >= 16px: iOS does not zoom into the field */
  color: var(--color-ink);
  background: var(--color-paper);
  border: 1px solid var(--color-paper);
  border-radius: var(--radius);
  outline: 3px solid transparent;
  outline-offset: 2px;
  appearance: none;
  transition: background-color 120ms ease;
}

input::placeholder { color: var(--color-muted); opacity: 1; }
input:hover { background: var(--color-paper-2); }
input:focus-visible { outline-color: var(--color-focus); background: var(--color-paper); }
input:disabled { opacity: 0.55; cursor: not-allowed; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-ink);
  box-shadow: inset 0 0 0 100px var(--color-paper-2);
  caret-color: var(--color-ink);
}

input[aria-invalid="true"] {
  border-color: var(--color-error);
  background: var(--color-error-soft);
}

/* The slot keeps one line even when empty, so an error never pushes the form down. */
.field-error {
  min-height: 1.35em; /* one line at line-height 1.35 */
  margin: var(--space-3xs) 0 0;
  font-size: var(--text-s);
  line-height: 1.35;
  font-weight: 500;
  color: var(--color-error-on-deep);
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-banner {
  margin: 0 0 var(--space-s);
  padding: var(--space-xs) var(--space-s);
  font-weight: 600;
  color: var(--color-error);
  background: var(--color-error-soft);
  border-radius: var(--radius);
}
.form-banner:empty { display: none; }

/* Buttons: a physical key. The fill sits on its own darker edge and travels down when pressed. */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-width: 12rem;
  height: var(--control-h);
  margin-top: var(--space-2xs);
  padding: 0 var(--space-l);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  color: var(--color-accent-ink);
  background: var(--color-accent);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 var(--press) 0 var(--color-accent-shade);
  cursor: pointer;
  touch-action: manipulation;
  outline: 3px solid transparent;
  outline-offset: 4px;
  transition: background-color 120ms ease, transform 80ms var(--ease-out), box-shadow 80ms var(--ease-out);
}

button[type="submit"]::after {
  content: "\2192";
  font-weight: 700;
}

button:hover, .btn:hover { background: var(--color-accent-2); }
button:focus-visible, .btn:focus-visible { outline-color: var(--color-focus); }
button:active, .btn:active {
  transform: translateY(var(--press));
  box-shadow: 0 0 0 var(--color-accent-shade);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
button:disabled::after { content: none; }

button.secondary, .btn.secondary {
  color: var(--color-on-deep);
  background: var(--color-deep-2);
  box-shadow: 0 var(--press) 0 var(--color-ink);
}
button.secondary:hover, .btn.secondary:hover { background: var(--color-deep-3); }
button.secondary:active, .btn.secondary:active { box-shadow: 0 0 0 var(--color-ink); }

/* Thank-you */
.thanks h1 {
  font-size: var(--text-thanks);
  margin-top: var(--space-m);
}
.thanks h1:focus { outline: none; }
.thanks .lede { margin-bottom: var(--space-xl); }

.stamp {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: var(--color-accent-ink);
  background: var(--color-accent);
  border-radius: var(--radius);
  transform: rotate(-4deg);
}
.stamp svg { display: block; }

/* Tablet in portrait: logo on the left, the flags strung on the right, so the form starts higher. */
@media (min-width: 40rem) and (max-width: 59.99rem) {
  .brand {
    flex-direction: row-reverse;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
  }
  .logo { width: 200px; }
  .deck { padding-inline: var(--space-l); }
}

/* Wide screens and the stand tablet in landscape: brand on the left, the deck on the right. */
@media (min-width: 60rem) {
  body {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }

  .brand {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: var(--space-l) var(--space-xl) var(--space-3xl);
    gap: 0;
  }

  .pavese { width: min(100%, 360px); }

  .logo {
    width: min(100%, 400px);
    margin-block: auto;
  }

  .deck {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-xl) var(--space-2xl);
  }
}

/* Landscape tablet (1024×768) and short laptops: the submit button stays above the fold. */
@media (min-width: 60rem) and (max-height: 52rem) {
  :root { --text-display: 3rem; }
  .deck { padding-block: var(--space-l); }
  .lede { margin-bottom: var(--space-m); }
  label { margin-bottom: var(--space-3xs); }
}

@media (prefers-reduced-motion: no-preference) {
  .thanks:not([hidden]) .stamp { animation: stamp-in 260ms var(--ease-out) both; }
  @keyframes stamp-in {
    from { opacity: 0; transform: scale(1.3) rotate(-14deg); }
    to { opacity: 1; transform: scale(1) rotate(-4deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  input, button, .btn { transition: none; }
  button:active, .btn:active { transform: none; }
}
