/* ============================================================
   postcard.day — styles
   Tokens from 05-vibe-system.md (binding).
   Mobile-first; breakpoints at 360 / 768 / 1280.
   ============================================================ */

:root {
  /* Color tokens (05-vibe-system §Color palette) */
  --ink: #1A1714;
  --ink-soft: #3D3530;
  --ink-mute: #6B6056;
  --linen: #F2EDE3;
  --linen-deep: #E8E0D1;
  --kraft: #C9A77A;
  --kraft-shadow: #A8895E;
  --coral-stamp: #D45D4A;
  --coral-stamp-deep: #A8412F;
  --postmark: #2F4A3A;

  /* Type families */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Homemade Apple', 'Bradley Hand', cursive;

  /* Rhythm */
  --baseline: 8px;
  --card-shadow: 0 12px 28px -8px rgba(58, 38, 18, 0.35), 0 2px 6px rgba(58, 38, 18, 0.18);

  /* Tap target */
  --tap: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--linen);
  /* Subtle window-light wash from upper-left */
  background-image:
    radial-gradient(ellipse at 18% 12%, rgba(255, 248, 234, 0.45), transparent 60%),
    url('/assets/linen-fiber-noise.svg');
  background-size: auto, 256px 256px;
  background-repeat: no-repeat, repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--linen);
  padding: 12px 18px;
  z-index: 999;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  outline: 2px solid var(--coral-stamp);
  outline-offset: 2px;
}

/* Screen reader only */
.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;
}

/* ============================================================
   Header / wordmark
   ============================================================ */

.site-header {
  padding: 24px 32px 0;
}

.wordmark {
  display: inline-block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}

.wordmark:focus-visible {
  outline: 2px solid var(--coral-stamp);
  outline-offset: 4px;
  border-radius: 2px;
}

@media (max-width: 767px) {
  .site-header { padding: 16px 16px 0; }
  .wordmark { font-size: 24px; }
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 32px 24px;
  text-align: center;
}

.hero-one-liner {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 56px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 24px;
  text-wrap: balance;
}

.hero-one-liner em {
  font-style: italic;
  font-weight: 400;
}

/* Only "tonight" and "tomorrow morning" are italic; everything else
   in <h1> is roman. Selector below is binding via markup — the rest of
   the <h1> remains in roman because we wrap accents in <em>. */

.hero-subhead {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0 0 56px;
  text-wrap: balance;
}

@media (max-width: 1279px) {
  .hero-one-liner { font-size: 48px; }
}
@media (max-width: 767px) {
  .hero { padding: 32px 16px 16px; }
  .hero-one-liner { font-size: 36px; margin-bottom: 18px; }
  .hero-subhead { font-size: 18px; margin-bottom: 36px; }
}
@media (max-width: 360px) {
  .hero-one-liner { font-size: 32px; }
  .hero-subhead { font-size: 16px; }
}

/* ============================================================
   Sample received postcard
   ============================================================ */

.sample-card {
  margin: 0 auto 56px;
  max-width: 480px;
  transform: rotate(6deg);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 12px 28px rgba(58, 38, 18, 0.35));
}

.sample-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.sample-caption {
  margin: 16px auto 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
  transform: rotate(-6deg); /* offset parent rotation so caption reads upright */
  max-width: 32ch;
}

@media (max-width: 1279px) {
  .sample-card { transform: rotate(3deg); max-width: 440px; }
  .sample-caption { transform: rotate(-3deg); }
}
@media (max-width: 767px) {
  .sample-card { transform: none; max-width: 100%; }
  .sample-caption { transform: none; }
}

/* ============================================================
   Blank postcard + textarea
   ============================================================ */

.postcard-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.blank-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 3 / 2;
  transform: rotate(-4deg);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 12px 28px rgba(58, 38, 18, 0.35));
}

.blank-card-large {
  max-width: 580px;
}

.blank-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  pointer-events: none;
}

.blank-stamp {
  position: absolute;
  top: 5%;
  right: 6%;
  width: 14%;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(58, 38, 18, 0.3));
  pointer-events: none;
}

.postcard-textarea {
  position: absolute;
  inset: 8% 8% 16% 6%;
  width: 86%;
  height: 76%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--hand);
  font-weight: 500;
  font-size: clamp(20px, 3.4vw, 30px);
  line-height: 1.32;
  color: var(--ink);
  padding: 4px;
  border-radius: 2px;
  caret-color: var(--coral-stamp);
}

.postcard-textarea::placeholder {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ink-mute);
  opacity: 0.8;
}

.postcard-textarea:focus-visible {
  outline: 2px solid var(--coral-stamp);
  outline-offset: 4px;
}

.char-counter {
  position: absolute;
  bottom: 4%;
  left: 6%;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  pointer-events: none;
}

.char-counter.over { color: var(--coral-stamp-deep); }

@media (max-width: 1279px) {
  .blank-card { transform: rotate(-2deg); }
}
@media (max-width: 767px) {
  .blank-card { transform: none; max-width: 100%; }
  .postcard-textarea { font-size: 22px; }
}

/* Mobile preview strip (sticky above keyboard) */
.mobile-preview {
  display: none;
}
@media (max-width: 767px) {
  .mobile-preview {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    line-height: 36px;
    background: var(--linen-deep);
    border-top: 1px solid var(--ink-mute);
    color: var(--ink);
    font-family: var(--hand);
    font-size: 18px;
    padding: 0 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 30;
  }
  .mobile-preview.visible { display: block; }
}

/* ============================================================
   Form cluster
   ============================================================ */

.form-cluster {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  align-items: stretch;
}

.email-field {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--linen-deep);
  border: 1px solid var(--ink-mute);
  border-radius: 6px;
  padding: 14px 16px;
  width: 100%;
  min-height: var(--tap);
}

.email-field::placeholder {
  color: var(--ink-mute);
}

.email-field:focus-visible {
  outline: 2px solid var(--coral-stamp);
  outline-offset: 2px;
  border-color: var(--ink);
}

.consent-plain {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}
.consent-plain strong { color: var(--ink); font-weight: 500; }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  cursor: pointer;
}
.consent input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 3px 0 0;
  width: 18px;
  height: 18px;
  accent-color: var(--coral-stamp);
}
.consent a { color: var(--ink); text-decoration: underline; }

.primary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  color: var(--linen);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 14px 28px;
  min-height: var(--tap);
  cursor: pointer;
  transition: transform 120ms ease, opacity 200ms ease, background-color 200ms ease;
  align-self: center;
}

.primary-pill:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #2a2520;
}
.primary-pill:active:not(:disabled) {
  transform: translateY(1px);
}
.primary-pill:focus-visible {
  outline: 2px solid var(--coral-stamp);
  outline-offset: 3px;
}

.primary-pill[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary-pill.sent {
  background: var(--postmark);
  border-color: var(--postmark);
}

.pill-arrow {
  display: inline-block;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.primary-pill:hover:not(:disabled) .pill-arrow {
  transform: translateX(4px);
}

.pill-disabled-hint {
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  margin: -8px 0 0;
}

.velvet-rope {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  text-decoration: none;
  padding: 6px 0;
  align-self: center;
}
.velvet-rope:hover, .velvet-rope:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}
.velvet-rope:focus-visible {
  outline: 2px solid var(--coral-stamp);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Social proof row */
.social-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}
.avatar-stack {
  display: inline-flex;
}
.avatar-stack .av {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--linen);
  background: var(--kraft);
  margin-left: -8px;
}
.avatar-stack .av:first-child { margin-left: 0; }
.av-1 { background: linear-gradient(135deg, #D4B289, #B89366); }
.av-2 { background: linear-gradient(135deg, #E8E0D1, #C9A77A); }
.av-3 { background: linear-gradient(135deg, #2F4A3A, #4a6b56); }
.av-4 { background: linear-gradient(135deg, #D45D4A, #A8412F); }
.av-5 { background: linear-gradient(135deg, #6B6056, #3D3530); }

.counter {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--postmark);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.reassurance {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
  margin: 0;
}

@media (max-width: 360px) {
  .avatar-stack .av:nth-child(4),
  .avatar-stack .av:nth-child(5) { display: none; }
}

@media (max-width: 767px) {
  .primary-pill { width: 100%; align-self: stretch; }
}

/* ============================================================
   Prose sections
   ============================================================ */

.prose,
.how,
.why-now,
.quotes,
.faq,
.final-cta {
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 32px;
}

.prose-headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 32px;
  text-wrap: balance;
}
.prose-headline em { font-style: italic; }

.prose p,
.why-now p {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.prose .anchor,
.how .anchor {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-mute);
  margin-top: 32px;
}
.prose .anchor a,
.how .anchor a {
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-mute);
}
.prose .anchor a:hover { color: var(--ink); }

@media (max-width: 767px) {
  .prose,
  .how,
  .why-now,
  .quotes,
  .faq,
  .final-cta {
    padding: 64px 20px;
  }
  .prose-headline { font-size: 28px; }
  .prose p,
  .why-now p { font-size: 16px; }
}

/* ============================================================
   How it works
   ============================================================ */

.how-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.how-card {
  background: rgba(201, 167, 122, 0.10);
  border: 1px solid rgba(168, 137, 94, 0.25);
  border-radius: 8px;
  padding: 24px;
  filter: drop-shadow(0 6px 14px rgba(58, 38, 18, 0.10));
}
.how-step {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 12px;
}
.how-card p {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

@media (max-width: 767px) {
  .how-row { grid-template-columns: 1fr; }
}

/* ============================================================
   Why now (pull quote)
   ============================================================ */

.pull-quote {
  background: rgba(201, 167, 122, 0.16);
  border: 1px solid rgba(168, 137, 94, 0.3);
  border-radius: 12px;
  padding: 48px;
  position: relative;
  filter: drop-shadow(0 8px 22px rgba(58, 38, 18, 0.12));
}
.pull-quote::after {
  content: '';
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 60px;
  background: url('/assets/stamp-coral.svg') no-repeat center / contain;
  opacity: 0.85;
}
.pull-quote p em {
  font-style: italic;
  color: var(--ink);
}
.pull-quote a {
  color: var(--coral-stamp-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media (max-width: 767px) {
  .pull-quote { padding: 32px 24px 32px; }
  .pull-quote::after { width: 36px; height: 45px; }
}

/* ============================================================
   Quotes row
   ============================================================ */

.quotes-kicker {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-mute);
  margin: -16px 0 32px;
}

.quotes-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: flex-start;
}
.quote-card {
  margin: 0;
  filter: drop-shadow(0 8px 18px rgba(58, 38, 18, 0.25));
}
.quote-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.quote-card[data-tilt="-3"] { transform: rotate(-3deg); }
.quote-card[data-tilt="2"] { transform: rotate(2deg); }
.quote-card[data-tilt="-2"] { transform: rotate(-2deg); }

@media (max-width: 767px) {
  .quotes-row { grid-template-columns: 1fr; gap: 32px; }
  .quote-card[data-tilt] { transform: none; }
}

/* ============================================================
   FAQ
   ============================================================ */

.faq-list {
  margin: 0;
  padding: 0;
}
.faq-list dt {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 20px;
  color: var(--ink);
  margin: 32px 0 12px;
}
.faq-list dt:first-of-type { margin-top: 16px; }
.faq-list dd {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.faq-list dd a {
  color: var(--ink);
  text-decoration: underline;
}

/* ============================================================
   Final CTA
   ============================================================ */

.final-cta { text-align: center; }
.final-lead {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.final-cta .postcard-form {
  margin-top: 48px;
}

/* ============================================================
   Success screen
   ============================================================ */

.success-screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 32px 96px;
  text-align: center;
}
.success-headline {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 32px;
}
.success-headline em { font-style: italic; color: var(--postmark); }

.success-card {
  margin: 0 auto 32px;
  max-width: 560px;
  filter: drop-shadow(0 12px 28px rgba(58, 38, 18, 0.35));
}

.export-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 6px;
  overflow: hidden;
}
.export-stage .export-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.export-text {
  position: absolute;
  inset: 8% 8% 16% 6%;
  font-family: var(--hand);
  font-weight: 500;
  font-size: clamp(20px, 3.4vw, 30px);
  line-height: 1.32;
  color: var(--ink);
  white-space: pre-wrap;
  text-align: left;
}
.export-stamp {
  position: absolute;
  top: 5%;
  right: 6%;
  width: 14%;
  height: auto;
}
.export-postmark {
  position: absolute;
  bottom: 8%;
  right: 8%;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--postmark);
  text-align: right;
  line-height: 1.4;
}

.success-confirm {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 auto 32px;
  max-width: 36em;
  text-wrap: balance;
}

.share-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}
@media (min-width: 480px) {
  .share-row { flex-direction: row; justify-content: center; }
}

.success-closer {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-mute);
  margin: 0;
}

/* ============================================================
   Crisis card
   ============================================================ */

.crisis-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 32px 96px;
  text-align: left;
  border: 1px solid var(--coral-stamp-deep);
  border-radius: 12px;
  background: rgba(212, 93, 74, 0.04);
  margin-top: 48px;
  margin-bottom: 64px;
}
.crisis-headline {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0 0 16px;
  color: var(--ink);
}
.crisis-body {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 16px;
}
.crisis-resources {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}
.crisis-resources li {
  font-family: var(--sans);
  font-size: 16px;
  margin: 0 0 12px;
  color: var(--ink);
}
.crisis-resources strong { font-weight: 500; }
.crisis-resources a { color: var(--coral-stamp-deep); }
.crisis-soft {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

/* ============================================================
   Stamp modal
   ============================================================ */

.stamp-modal {
  border: none;
  border-radius: 12px;
  background: var(--linen);
  padding: 32px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 64px rgba(26, 23, 20, 0.35);
}
.stamp-modal::backdrop {
  background: rgba(26, 23, 20, 0.55);
}
.modal-headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--ink);
}
.modal-headline em { font-style: italic; }
.modal-body {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.modal-status {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-mute);
  margin: 8px 0 16px;
  min-height: 1.2em;
}
.modal-status.error { color: var(--coral-stamp-deep); }
.modal-status.ok { color: var(--postmark); }
.modal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  max-width: 720px;
  margin: 64px auto 0;
  padding: 48px 32px 64px;
  border-top: 1px solid rgba(168, 137, 94, 0.3);
  text-align: center;
}
.footer-wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  color: var(--ink);
  margin: 0 0 16px;
}
.footer-tagline {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}
.footer-nav {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0 0 16px;
  line-height: 2;
}
.footer-nav a {
  color: var(--ink-mute);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.footer-nav a:hover { color: var(--ink); }
.footer-subprocessors,
.footer-founding {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0 0 8px;
}
.footer-closer {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-mute);
  margin: 24px 0 0;
}

/* ============================================================
   Motion: reduced-motion override (binding per 05-vibe-system)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .sample-card,
  .blank-card,
  .quote-card[data-tilt] {
    transform: none !important;
  }
  .sample-caption {
    transform: none !important;
  }
}
