/* =====================================================================
   A Letter to Someone I No Longer Know or Have Not Met Yet — Gracie Dolan
   Minimal, mostly-white, gallery-like book site.
   The cover's paint-swatch colours appear only in small, deliberate places.
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Accent palette pulled from the cover (use sparingly, never as big blocks) */
  --magenta: #D81B7A;
  --teal:    #009CA6;
  --amber:   #F2A900;
  --coral:   #FF5C39;
  --lime:    #8BC53F;
  --sky:     #5BC2E7;
  --plum:    #8E5A9F;
  --navy:    #1F3A93;

  /* Primary interactive accent + a deeper shade for hover/active */
  --accent: var(--magenta);
  --accent-press: #b3155f;

  /* Neutrals */
  --bg: #ffffff;
  --panel: #faf9f7;          /* subtle warm off-white for the form card */
  --ink: #191919;            /* headings / strong text */
  --body: #2c2c2c;           /* paragraph text (~13:1 on white) */
  --muted: #5c5c5c;          /* helper text (~7:1 on white, passes AA) */
  --line: #e7e5e1;           /* hairline borders */
  --field-border: #cfcdc8;

  /* Type */
  --serif: "Fraunces", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing + layout */
  --container: 72rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section-gap: clamp(4.5rem, 11vw, 9rem);
  --radius: 14px;

  --focus: 0 0 0 3px rgba(216, 27, 122, 0.28);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
}

p { margin: 0 0 1.1em; }

a { color: inherit; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sprite { position: absolute; }

/* Skip link (keyboard accessibility) */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.18s ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.95rem 1.6rem;
  transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px -10px rgba(216, 27, 122, 0.65);
}
.btn--primary:hover { background: var(--accent-press); transform: translateY(-2px); }
.btn--primary:active { transform: translateY(0); }

.btn--small {
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
  background: var(--accent);
  color: #fff;
}
.btn--small:hover { background: var(--accent-press); }

button.btn { font: inherit; font-weight: 500; }

/* Visible focus for everything interactive */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.radio input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible { outline-offset: 3px; }

/* ---------- Brushstroke divider ---------- */
.brush {
  width: 92px;
  height: auto;
  fill: currentColor;
  display: block;
}
.brush--teal { color: var(--teal); }
.brush--coral { color: var(--coral); }
.brush--lime { color: var(--lime); }
.brush--amber { color: var(--amber); }

/* ---------- Swatch dots motif ---------- */
.swatches {
  list-style: none;
  display: flex;
  gap: 0.55rem;
  padding: 0;
  margin: 2rem 0 0;
}
.swatches li {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
}
.swatches--center { justify-content: center; margin: 0 auto 1.75rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.18rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.9rem);
}
.site-nav > a:not(.btn) {
  text-decoration: none;
  color: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.site-nav > a:not(.btn):hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding-top: clamp(3rem, 8vw, 6.5rem);
  padding-bottom: var(--section-gap);
}
.hero__text { min-width: 0; }
.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--teal);
  margin: 0 0 1.2rem;
}
#hero-title {
  font-size: clamp(1.95rem, 1.1rem + 4.5vw, 4.4rem);
  font-weight: 500;
  margin: 0 0 1.1rem;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.8vw, 1.6rem);
  color: var(--body);
  margin: 0 0 2rem;
  max-width: 36ch;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.hero__media { display: flex; justify-content: center; }
.cover {
  width: min(100%, 26rem);
  border-radius: 4px;
  border: 1px solid var(--line);
  box-shadow:
    0 36px 60px -28px rgba(20, 18, 30, 0.42),
    0 14px 26px -18px rgba(20, 18, 30, 0.30);
  transform: rotate(-1.6deg);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.hero__media:hover .cover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow:
    0 44px 70px -28px rgba(20, 18, 30, 0.46),
    0 16px 30px -18px rgba(20, 18, 30, 0.32);
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-gap); }
.section + .section { padding-top: 0; }
[id] { scroll-margin-top: 5.5rem; }

.section__head { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section__head .brush { margin-bottom: 1.1rem; }
.section h2 {
  font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.6rem);
  margin: 0;
}

/* Comfortable reading measure */
.prose { max-width: 60ch; }
.prose p { color: var(--body); }
.prose cite {
  font-style: italic;
  font-family: var(--serif);
}

/* The "Time is inevitable…" statement line */
.statement {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2.05rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  max-width: 24ch;
  margin: clamp(2.25rem, 5vw, 3.25rem) 0 0;
  position: relative;
  padding-left: 1.25rem;
  text-wrap: balance;
}
.statement::before {
  content: "";
  position: absolute;
  left: 0; top: 0.15em; bottom: 0.15em;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(var(--amber), var(--coral));
}

.section__cta { margin-top: clamp(2.25rem, 5vw, 3rem); }

/* ---------- Share / form ---------- */
.form-wrap {
  margin-top: clamp(2rem, 5vw, 3rem);
  max-width: 42rem;
}
.letter-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.field { margin-bottom: 1.5rem; border: 0; padding: 0; min-width: 0; }
.field:last-of-type { margin-bottom: 0; }
.field--narrow { max-width: 12rem; }

label,
.field legend {
  display: block;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.96rem;
  margin-bottom: 0.5rem;
  padding: 0;
}
.field legend { margin-bottom: 0.7rem; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: 0.06em;
}
.tag--opt { color: var(--muted); background: #efede9; }
.tag--req { color: #fff; background: var(--teal); }

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input::placeholder,
textarea::placeholder { color: #9a988f; }

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

textarea {
  resize: vertical;
  min-height: 11rem;
  line-height: 1.65;
}

/* Radios — native inputs tinted with the accent for free accessibility */
.radios { display: grid; gap: 0.55rem; }
.radio {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 400;
  color: var(--body);
  margin: 0;
  cursor: pointer;
  line-height: 1.4;
}
.radio input {
  margin: 0;
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  flex: none;
  cursor: pointer;
}
.radio span { padding-top: 0.02rem; }

.help {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}
.field-error {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-press);
}
input:invalid,
textarea:invalid { /* only styled once JS adds .show-error via aria, see below */ }
.field.has-error input,
.field.has-error textarea {
  border-color: var(--accent-press);
  box-shadow: 0 0 0 3px rgba(179, 21, 95, 0.18);
}

.form-actions { margin-top: 1.75rem; }
.form-actions .btn { width: 100%; }

.form-status {
  margin: 1.1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
}
.form-status[data-kind="error"] {
  background: #fdecef;
  color: var(--accent-press);
  border: 1px solid #f6c9d5;
}
.form-status[data-kind="setup"] {
  background: #fff7e6;
  color: #8a5a00;
  border: 1px solid #f3dca6;
}

/* Success panel */
.form-success {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  text-align: center;
}
.form-success .brush { margin: 0 auto 1.1rem; }
.form-success h3 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  margin: 0 0 0.6rem;
}
.form-success p { color: var(--body); max-width: 42ch; margin-inline: auto; }

.link-btn {
  background: none;
  border: 0;
  margin-top: 1rem;
  padding: 0.2rem 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  border-bottom: 2px solid var(--accent);
}
.link-btn:hover { color: var(--accent-press); border-bottom-color: var(--accent-press); }

.privacy-note {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 42rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 7vw, 4.5rem);
  text-align: center;
}
.footer-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--body);
  margin: 0 0 0.75rem;
}
.copyright {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Scroll-reveal (only active when JS is present) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: left;
    padding-top: clamp(2rem, 7vw, 3.5rem);
  }
  .hero__media { order: 2; margin-top: 2.5rem; }
  .cover { width: min(78%, 20rem); transform: rotate(-1.4deg); }
  .swatches { margin-top: 1.75rem; }
}

@media (max-width: 560px) {
  /* Keep the header to the wordmark + buy button on small screens */
  .site-nav > a:not(.btn) { display: none; }
  .hero__actions .btn,
  .form-actions .btn { width: 100%; }
  .hero__actions { width: 100%; }
}

@media (min-width: 561px) {
  .hero__actions .btn { width: auto; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .cover { transform: none; }
  .hero__media:hover .cover { transform: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
