/* ==========================================================================
   DapYP — signup spread
   ERA SETTINGS: everything you'd change for a new era lives in :root.
   (Portrait file and copy live in index.html, marked "ERA".)
   ========================================================================== */
:root {
  /* Palette: one paper, one ink, one accent. */
  --paper: #f4efe4;          /* warm off-white */
  --ink: #2b1b14;            /* deep espresso — text, rules, icons */
  --ink-soft: #4d463c;       /* secondary text on paper (≈8.7:1) */
  --accent: #dcc35e;         /* mitten yellow, sampled from the portrait — the only accent */

  /* Portrait framing (object-position). Keep the face + both mittens in view. */
  --portrait-focus-desktop: 50% 30%;
  --portrait-focus-mobile: 50% 31%;
  --portrait-ratio-mobile: 1 / 1;   /* mobile crop shape */
  --portrait-zoom-mobile: 1.3;      /* push in on mobile… */
  --portrait-zoom-origin-mobile: 57.5% 40%;  /* …around the face */

  /* Type */
  --font-masthead: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --font-text: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --font-mono: "Courier Prime", "Courier New", ui-monospace, monospace;

  /* Chalk cursor (tip = click point at 3,29). */
  --cursor-chalk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='translate(4 28) rotate(-45)'%3E%3Cpath d='M0 -4.2H16.5A4.2 4.2 0 0 1 16.5 4.2H0Q-1.8 0 0 -4.2Z' fill='%23fff' stroke='%232b1b14' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M0.6 -3.4Q-0.9 0 0.6 3.4L2.6 3.4Q1.4 0 2.6 -3.4Z' fill='%23e2dccf'/%3E%3Cpath d='M5.5 -1.4H15' stroke='%23dcd6ca' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M8 1.6H12.5' stroke='%23e6e1d6' stroke-width='1' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E") 3 29, auto;

  --gutter: clamp(20px, 4vw, 64px);
  --footer-h: 88px;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  /* faint paper tooth */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .09 0 0 0 0 .07 0 0 0 0 .05 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--ink); }
img, svg { display: block; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Spread (mobile first) ---------- */
.spread { position: relative; min-height: 100svh; display: flex; flex-direction: column; }

.page--left {
  flex: 1;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "folio" "masthead" "portrait" "signup";
  align-content: start;
  padding: 18px var(--gutter) 8px;
}

/* Folio line: thin-thick rule, mono small caps */
.folio {
  grid-area: folio;
  display: flex; justify-content: space-between; gap: 1rem;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 3px 0 -1px var(--paper), 0 4px 0 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Masthead: the badge logo */
/* Everything on the cream panel centers on the folio's midpoint. */
.masthead {
  grid-area: masthead;
  margin: 18px 0 4px;
  line-height: 0;
}
.masthead__logo {
  width: min(72%, 300px);
  height: auto;
  margin-inline: auto;
}

/* Seal: a paper sticker slapped across the photo's edge */
.seal {
  grid-area: portrait;
  justify-self: end; align-self: start;
  position: relative; z-index: 3;
  width: clamp(72px, 21vw, 96px); height: auto;
  margin-top: -18px; margin-right: 2px;
  transform: rotate(-12deg);
  filter: drop-shadow(1px 2px 0 rgb(43 27 20 / 0.35));
}
.seal__bg { fill: var(--paper); }
.seal__rim { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.seal__text { font-family: var(--font-mono); font-size: 13.5px; font-weight: 700; fill: var(--ink); }
.seal__plane { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }

/* Portrait */
.portrait {
  grid-area: portrait;
  position: relative;
  margin: 14px calc(var(--gutter) * -1) 0;   /* bleed edge to edge on mobile */
  background: #20160f;
  overflow: hidden;
}
.portrait__img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--portrait-ratio-mobile);
  object-fit: cover;
  object-position: var(--portrait-focus-mobile);
  transform: scale(var(--portrait-zoom-mobile));
  transform-origin: var(--portrait-zoom-origin-mobile);
}
.portrait__credit {
  position: absolute; left: 8px; bottom: 8px;
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper);
  background: rgb(43 27 20 / 0.8);
  padding: 8px 3px;
  writing-mode: vertical-rl; transform: rotate(180deg);
}

/* ---------- Signup ---------- */
.signup {
  grid-area: signup; justify-self: center;
  position: relative; z-index: 2;
  width: 100%; max-width: 30rem;
  padding: 22px 0 8px;
  text-align: center;
}
.signup__copy {
  margin: 0 auto 18px;
  font-style: italic;
  font-size: clamp(1.1875rem, 4.8vw, 1.5rem);
  line-height: 1.32;
  text-wrap: balance;
}

/* Field + button: one row, centered as a unit */
.signup__form { display: flex; align-items: stretch; gap: 10px; width: 100%; max-width: 26rem; margin-inline: auto; }
.signup__input {
  flex: 1; min-width: 0;
  height: 52px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 1.0625rem;   /* ≥16px: no iOS zoom */
  letter-spacing: 0.02em;
  -webkit-appearance: none; appearance: none;
}
.signup__input::placeholder { color: var(--ink-soft); opacity: 1; }
.signup__input:focus { outline: none; border-bottom-width: 3px; border-bottom-color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.signup__input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.signup__input[aria-invalid="true"] { border-bottom-style: dashed; }

.signup__send {
  flex: none;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}
.signup__send:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.signup__send:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.signup__send:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.signup__send svg { transition: transform 0.25s ease; }
.signup__send:hover svg { transform: translate(1px, -1px) rotate(-6deg); }
.signup__form[aria-busy="true"] .signup__send svg { animation: plane-wobble 0.7s ease-in-out infinite; }
.signup__form[aria-busy="true"] .signup__send { cursor: progress; }
@keyframes plane-wobble { 50% { transform: translate(2px, -2px) rotate(-10deg); } }

.signup__error {
  margin: 10px 0 0;
  font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink);
}
.signup__error::before { content: "✎ "; }
.signup__consent {
  margin: 12px 0 0;
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.5; color: var(--ink-soft);
}

.signup__done { outline: none; }
.signup__done p { display: inline-block; margin: 6px 0 0; font-size: 1.25rem; font-style: italic; }
.signup__done mark { background: var(--accent); color: var(--ink); padding: 0 0.2em; font-style: normal; font-family: var(--font-masthead); font-weight: 700; }

/* ---------- Footer: social row ---------- */
.colophon { position: relative; z-index: 2; padding: 12px var(--gutter) max(16px, env(safe-area-inset-bottom)); }
.social {
  list-style: none; margin: 0 auto; padding: 0;
  display: flex; justify-content: center; gap: 12px;
}
.social a {
  display: grid; place-items: center;
  width: 48px; height: 48px;           /* comfortable tap area */
  border-radius: 50%;
  color: var(--ink);
  transition: background-color 0.15s ease;
}
.social a:hover { background: var(--accent); }
.social a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.social svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.social svg .fill { fill: currentColor; stroke: none; }
.social svg path.fill { stroke: currentColor; stroke-width: 1; }

/* ---------- Paper-plane send-off ---------- */
.flight { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.flight__plane {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  color: var(--ink);
  will-change: transform;
  filter: drop-shadow(0 1.5px 1.5px rgb(43 27 20 / 0.45));
}
/* A paper plane: cream body, fine espresso edge (≈2px once it opens up to full glide size). */
.flight__plane path { fill: var(--paper); stroke-width: 0.9; }

/* The confirmation eases in; under reduced motion a still plane sits beside it. */
.signup__done:not([hidden]) { animation: done-in 0.45s ease-out both; }
@keyframes done-in { from { opacity: 0; transform: translateY(4px); } }
.signup__done-plane {
  display: none;
  vertical-align: -0.3em;
  margin-left: 0.4em;
  fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round;
  transform: rotate(-8deg);
}
@media (prefers-reduced-motion: reduce) {
  .signup__done-plane { display: inline-block; }
}

/* ---------- Desktop: a two-page spread ---------- */
@media (min-width: 900px) {
  :root { --footer-h: 80px; }
  .page--left {
    min-height: calc(100svh - var(--footer-h));
    grid-template-columns: minmax(0, 1fr) minmax(0, 46%);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "folio    portrait"
      "masthead portrait"
      "signup   portrait";
    column-gap: var(--gutter);
    padding: 28px 0 0 var(--gutter);
  }
  .masthead { margin: 28px 0 8px; }
  .masthead__logo { width: clamp(340px, 36vw, 520px); max-width: 100%; }
  .seal {
    justify-self: start; align-self: end;
    width: clamp(88px, 7.5vw, 116px);
    margin: 0 0 12% 0;
    transform: translateX(-50%) rotate(-12deg);   /* straddles the fold */
  }
  .portrait { margin: -28px 0 0; height: 100%; min-height: 560px; }
  /* gutter fold: a soft shadow where the two pages meet */
  .portrait::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 28px; z-index: 1;
    background: linear-gradient(90deg, rgb(0 0 0 / 0.28), transparent);
    pointer-events: none;
  }
  .portrait__img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    aspect-ratio: auto;
    object-position: var(--portrait-focus-desktop);
    transform: none;
  }
  .portrait__credit { left: auto; right: 12px; bottom: 14px; }
  .signup { align-self: center; padding: 40px 0 48px; max-width: 34rem; }
  .signup__copy { font-size: clamp(1.375rem, 1.9vw, 1.75rem); margin-bottom: 26px; }
  .colophon { height: var(--footer-h); display: grid; place-items: center; padding: 0 var(--gutter); }
}

/* Chalk cursor: desktop with a real pointer only. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  html, body { cursor: var(--cursor-chalk); }
  a, button, label[for] { cursor: pointer; }
  input[type="email"] { cursor: text; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
