/* Villager landing page — colours and type from the Claude Design "v3 Emerald" file */

/* Fonts: hosted in assets/fonts (Latin, regular style). font-display: block means the browser
   waits for the real font instead of showing a stand-in font and swapping, which caused a flicker. */
@font-face {
  font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: block;
  src: url("assets/fonts/instrument-serif.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 300 700; font-display: block;
  src: url("assets/fonts/dm-sans.woff2") format("woff2");
}
@font-face {
  font-family: "La Belle Aurore"; font-style: normal; font-weight: 400; font-display: block;
  src: url("assets/fonts/la-belle-aurore.woff2") format("woff2");
}

:root {
  --cream: #F5F0E8;
  --paper: #FAFAF5;
  --postcard: #EEECE7;
  --sage: #DCE0D3;
  --emerald: #05482B;
  --emerald-dark: #03361f;
  --pistachio: #D6E8B4;
  --line: #c9bfae;
  --line-soft: rgba(5, 72, 43, .16);
  --placeholder: #8a7a6c;
  --shadow: rgba(5, 72, 43, .35);

  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --hand: 'La Belle Aurore', cursive;

  --gutter: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--emerald);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--emerald); text-decoration-color: rgba(5, 72, 43, .4); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--emerald); }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* honeypot field: invisible to people, bots fill it in */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

input::placeholder { color: var(--placeholder); }
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(5, 72, 43, .3);
  outline-offset: 2px;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-wrap: wrap;
  min-height: min(720px, 100svh);
}
.topbar {
  flex: 1 1 100%;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px;
  padding: 28px var(--gutter) 0;
}
.brand {
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: .01em;
  text-decoration: none;
}
.nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px clamp(14px, 2vw, 28px); }
.nav a {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { border-bottom-color: rgba(5, 72, 43, .5); }

.hero-copy {
  flex: 1 1 420px; min-width: 0;
  display: flex; flex-direction: column;
  padding: clamp(32px, 6vh, 72px) var(--gutter) 56px;
}
.hero-inner { display: flex; flex-direction: column; gap: 20px; max-width: 560px; margin: auto 0; }
.eyebrow {
  font-family: var(--hand);
  font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2;
  display: flex; align-items: center; gap: 8px;
}
.eyebrow-heart { width: 20px; transform: rotate(12deg) translateY(-2px); }
h1 {
  font-size: clamp(46px, 6.4vw, 78px); line-height: 1; letter-spacing: .005em;
  text-wrap: balance;
}
.lede { font-size: clamp(16px, 1.4vw, 18px); line-height: 1.6; max-width: 480px; text-wrap: pretty; }
.handwritten { font-family: var(--hand); font-size: 20px; margin-top: -6px; }

/* Waitlist form (used twice) */
.waitlist-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 480px; margin-top: 8px; width: 100%; }
.waitlist-form input[type="email"],
.waitlist-form .combobox input[type="text"] {
  flex: 1 1 220px; min-width: 0; height: 48px;
  touch-action: manipulation; /* no double-tap zoom on phones */
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); padding: 0 20px;
  font: inherit; font-size: 16px; color: var(--emerald);
}
.waitlist-form input[type="email"][aria-invalid="true"] { border-color: #b4452f; }
/* focus ring drawn inside the border, so the field keeps its exact size */
.waitlist-form input[type="email"]:focus,
.waitlist-form input[type="email"]:focus-visible,
.waitlist-form .combobox input[type="text"]:focus,
.waitlist-form .combobox input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--emerald);
  box-shadow: inset 0 0 0 1px var(--emerald);
}

/* Bottom form: two fields in a row, tickbox, button, all centred */
.join-form { flex-direction: column; align-items: center; gap: 18px; max-width: 640px; margin-top: 10px; }
.join-fields { display: flex; gap: 10px; width: 100%; }
.join-fields .field { flex: 1 1 0; min-width: 0; }
.join-fields .field input { width: 100%; }

/* Country field: globe on the left, chevron on the right, list below */
.combobox { position: relative; text-align: left; }
.waitlist-form .combobox input[type="text"] { padding-left: 48px; padding-right: 42px; text-overflow: ellipsis; }
.field-icon, .field-chevron {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--emerald); pointer-events: none;
}
.field-icon { left: 18px; }
.field-chevron { right: 18px; transition: transform .15s; }
.combobox input[aria-expanded="true"] ~ .field-chevron { transform: translateY(-50%) rotate(180deg); }
.combobox-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  margin: 0; padding: 6px; list-style: none;
  max-height: 240px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 8px 20px -8px rgba(5, 72, 43, .35), 0 2px 6px -2px rgba(5, 72, 43, .15);
}
.combobox-list[hidden] { display: none; }
.combobox-list li {
  padding: 9px 14px; border-radius: 10px;
  font-size: 15px; line-height: 1.3; cursor: pointer;
}
.combobox-list li[aria-selected="true"], .combobox-list li:hover { background: var(--sage); }
.combobox-list .empty { color: var(--placeholder); cursor: default; }
.combobox-list .empty:hover { background: none; }

/* Tickbox: the real checkbox is hidden, the box next to it is drawn by hand */
.tick {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  font-size: 15px; line-height: 1.4; text-align: left; cursor: pointer;
}
.tick input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tick-box {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid var(--line); background: var(--paper);
  display: grid; place-items: center; color: var(--pistachio);
  transition: background .15s, border-color .15s;
}
.tick-box svg { opacity: 0; }
.tick input:checked + .tick-box { background: var(--emerald); border-color: var(--emerald); }
.tick input:checked + .tick-box svg { opacity: 1; }
.tick input:focus-visible + .tick-box { outline: 3px solid rgba(5, 72, 43, .3); outline-offset: 2px; }
.tick .soft { color: var(--placeholder); }
.waitlist-form button {
  flex: 0 0 auto; height: 48px; padding: 0 24px;
  touch-action: manipulation; /* no double-tap zoom on phones */
  border-radius: 999px; border: 0;
  background: var(--emerald); color: var(--pistachio);
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: .04em;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.waitlist-form button:hover { background: var(--emerald-dark); }
.waitlist-form button:disabled { opacity: .7; cursor: progress; }

.hero-visual {
  flex: 1 1 420px; min-width: 0;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(48px, 8vh, 88px) 24px;
  min-height: 560px; overflow: hidden;
}
.phone { position: relative; width: 248px; max-width: 100%; }
.phone-shadow { filter: drop-shadow(0 24px 28px var(--shadow)); }
.phone-frame { position: relative; aspect-ratio: 509 / 1053; }
.phone-screen {
  position: absolute; left: 3.4%; right: 3.4%; top: 1.3%; bottom: 1.2%;
  border-radius: 13% / 6.2%; overflow: hidden; background: var(--paper);
}
.phone-screen img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.phone-bezel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- How it works ---------- */
.how { scroll-margin-top: 24px; background: var(--sage); display: flex; flex-direction: column; }
.section-head {
  padding: clamp(64px, 8vw, 96px) var(--gutter) 48px;
  display: flex; flex-direction: column; align-items: center;
}
.section-head h2, .why h2, .join h2 {
  font-size: clamp(34px, 4.2vw, 50px); line-height: 1.05; text-align: center; text-wrap: balance;
}
.cards-wrap { padding: clamp(24px, 3.5vw, 44px) clamp(12px, 3vw, 48px) clamp(64px, 8vw, 104px); }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px clamp(10px, 2vw, 28px);
  max-width: 1200px; margin: 0 auto; align-items: start;
}
.stamp-card {
  max-width: 380px; width: 100%; margin: 0 auto;
  filter: drop-shadow(0 16px 20px rgba(5, 72, 43, .22)) drop-shadow(0 2px 3px rgba(5, 72, 43, .14));
}
/* perforated stamp edge */
.stamp-paper {
  height: 100%; background: var(--paper); padding: 16px;
  mask: linear-gradient(#000 0 0) content-box,
        radial-gradient(circle, #0000 11px, #000 11.5px) -16px -16px / 32px 32px round;
  -webkit-mask: linear-gradient(#000 0 0) content-box,
        radial-gradient(circle, #0000 11px, #000 11.5px) -16px -16px / 32px 32px round;
}
.stamp-inner {
  height: 100%; border: 1px solid var(--line-soft);
  padding: clamp(14px, 2.2vw, 22px) clamp(12px, 2vw, 20px);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.stamp-inner h3 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.1; text-wrap: balance; }
.asterisk { font-family: var(--serif); font-size: 18px; line-height: 1; }
.stamp-inner p { font-size: clamp(12px, 1.2vw, 14px); line-height: 1.45; max-width: 250px; text-wrap: pretty; }

/* ---------- Why it matters ---------- */
.why { padding: clamp(72px, 9vw, 120px) var(--gutter); }
.why-inner {
  max-width: 680px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px;
}
.why-lead { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.35; text-wrap: pretty; }
.why-body { font-size: clamp(15px, 1.3vw, 17px); line-height: 1.65; max-width: 560px; text-wrap: pretty; }

/* ---------- Ticker ---------- */
.ticker {
  background: var(--emerald); color: var(--pistachio);
  padding: 13px 0; overflow: hidden; white-space: nowrap;
  font-family: var(--serif); font-size: 14px; letter-spacing: .16em; text-transform: uppercase;
}
.ticker-track { display: inline-flex; animation: vTicker 48s linear infinite; will-change: transform; }
.ticker-track span { padding: 0 24px; }
.ticker-track i { font-style: normal; }

/* ---------- My story ---------- */
.story { background: var(--sage); padding: clamp(40px, 5vw, 64px) clamp(20px, 6vw, 96px); }
.postcard { width: 100%; max-width: 820px; margin: 0 auto; filter: drop-shadow(0 18px 24px rgba(5, 72, 43, .16)); }
.postcard-paper {
  background: var(--postcard); padding: 20px;
  mask: linear-gradient(#000 0 0) content-box,
        radial-gradient(circle, #0000 13px, #000 13.5px) -20px -20px / 40px 40px round;
  -webkit-mask: linear-gradient(#000 0 0) content-box,
        radial-gradient(circle, #0000 13px, #000 13.5px) -20px -20px / 40px 40px round;
}
.postcard-inner {
  position: relative; display: flex; flex-wrap: wrap;
  margin: clamp(10px, 1.6vw, 18px); border: 1px solid #D5CFC2;
  gap: clamp(20px, 3vw, 36px);
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.6vw, 28px) clamp(18px, 2vw, 24px) clamp(18px, 2.4vw, 28px);
}
.postcard-label {
  position: absolute; top: clamp(16px, 2vw, 24px); left: 50%; transform: translateX(-50%);
  font-family: var(--serif); font-size: clamp(16px, 1.6vw, 20px); line-height: 1;
  letter-spacing: .01em; text-transform: uppercase; white-space: nowrap;
}
.postcard-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: clamp(14px, 1.8vw, 20px); }
.postcard-text h2 {
  margin-top: clamp(24px, 2.8vw, 32px);
  font-size: clamp(28px, 3.2vw, 38px); line-height: 1.1; white-space: nowrap;
}
.letter {
  display: flex; flex-direction: column; gap: 8px;
  font-size: clamp(13px, 1.1vw, 14px); line-height: 1.55; text-wrap: pretty;
}
/* picture column sits against the right edge */
.postcard-side { flex: 0 0 230px; margin-left: auto; display: flex; flex-direction: column; gap: 4px; }
.stamps { display: flex; justify-content: flex-end; align-items: center; margin-right: -6px; }
.postmark { position: relative; width: 130px; margin-right: -26px; z-index: 1; pointer-events: none; }
.stamp { width: 84px; filter: drop-shadow(0 2px 3px rgba(5, 72, 43, .2)); pointer-events: none; }
/* Polaroid: the frame image is drawn in two slices (top with the window, bottom edge) so the
   white band under the photo is shorter than in the original image. */
.polaroid { position: relative; margin: clamp(6px, 1.5vw, 16px) 0 0 auto; width: 100%; aspect-ratio: 900 / 1000; }
.polaroid-frame-top, .polaroid-frame-bottom {
  position: absolute; left: 0; right: 0; pointer-events: none;
  background: url("assets/polaroid-frame-cream.png") no-repeat; background-size: 100% auto;
}
.polaroid-frame-top { top: 0; height: 86%; background-position: top; }
.polaroid-frame-bottom { bottom: 0; height: 14%; background-position: bottom; }
.polaroid-photo {
  position: absolute; left: 6.1%; right: 6.1%; top: 7.8%; bottom: 15%;
  overflow: hidden; background: #e9e4da;
}
.polaroid-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 65%; }
.polaroid figcaption {
  position: absolute; left: 6%; right: 6%; bottom: 2.5%; height: 11%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hand); font-size: clamp(16px, 1.6vw, 20px); line-height: 1;
  transform: rotate(-2deg);
}
.tape { position: absolute; top: -12px; left: 30%; width: 84px; transform: rotate(-3deg); pointer-events: none; }

/* ---------- Join ---------- */
.join { padding: clamp(72px, 9vw, 120px) var(--gutter); }
.join-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px;
}
.join-lead { font-size: clamp(16px, 1.4vw, 18px); line-height: 1.6; text-wrap: pretty; }
.fineprint { font-size: 13px; line-height: 1.5; color: var(--placeholder); margin-top: -6px; }

/* ---------- Footer ---------- */
.footer { background: var(--emerald); color: var(--pistachio); padding: clamp(48px, 6vw, 72px) var(--gutter) 40px; }
.footer-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
}
.footer-hand { font-size: 24px; line-height: 1.3; color: var(--pistachio); margin: 0; }
.footer-heart { width: 40px; }
.footer-contact { font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.footer-contact a { color: var(--pistachio); text-decoration: underline; text-decoration-color: var(--pistachio); }
.copyright { font-size: 12px; letter-spacing: .08em; opacity: .6; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 16px;
  background: var(--paper); border: 1px solid rgba(5, 72, 43, .15);
  box-shadow: 0 8px 20px -8px rgba(5, 72, 43, .35), 0 2px 6px -2px rgba(5, 72, 43, .15);
  font-size: 15px; font-weight: 500; color: var(--emerald);
  animation: vToast .35s ease both; z-index: 50; max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }
.toast-icon {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--emerald); color: var(--pistachio);
  display: grid; place-items: center;
}
.toast.is-error .toast-icon { background: #b4452f; color: var(--paper); }

/* ---------- Motion ---------- */
@keyframes vReveal { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes vTicker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes vToast { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Reveal-on-scroll runs only in browsers that support scroll-driven animations.
   Tilted cards keep their rotation by animating a wrapper instead. */
@supports (animation-timeline: view()) {
  .reveal:not(.stamp-card) {
    animation: vReveal .9s ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }
  .stamp-card.reveal .stamp-paper {
    animation: vReveal .9s ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Phone width ---------- */
@media (max-width: 760px) {
  .cards { grid-template-columns: 1fr; }
  /* phones: field and button each take the full width, so their position never depends on content */
  .waitlist-form input[type="email"], .waitlist-form button { flex: 1 1 100%; }
  /* bottom form: fields stack, button spans the width */
  .join-fields { flex-direction: column; }
  .join-form button { flex: none; width: 100%; }
  .hero-visual { min-height: 460px; }
  .phone { width: 200px; }
  .postcard-label { position: static; transform: none; text-align: center; width: 100%; }
  .postcard-text h2 { margin-top: 0; white-space: normal; }
  .postcard-side { flex: 0 1 230px; margin: 0 auto; }
}
