/*
 * Curlit website styles.
 * Tokens mirror the app's theme (src/theme/colors.ts, tokens.ts, typography.ts) so the brand
 * matches. If a token changes in the app, change it here too.
 */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces_600SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces_500Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/Figtree_400Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/Figtree_500Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/Figtree_600SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

/* ---------- Tokens (from the app theme) ---------- */
:root {
  color-scheme: light dark;

  /* colors: light */
  --background: #f7f2ec;
  --surface: #fffcf8;
  --surface-sunken: #efe7dd;
  --border: #e2d6c8;
  --border-strong: #8c7b6c;
  --text: #2b211b;
  --text-muted: #65564a;
  --text-subtle: #75665a;
  --accent: #b4492a;
  --accent-pressed: #963a20;
  --accent-soft: #f6e1d6;
  --accent-text: #a13f22;
  --on-accent: #ffffff;
  --success: #3f6e4e;
  --danger: #a42a2a;

  /* spacing (4pt base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 48px;
  --space-huge: 64px;

  /* radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* layout */
  --gutter: 20px;
  --min-touch: 44px;
  --button-height: 56px;
  --field-height: 52px;
  --content-width: 1080px;
  --text-width: 680px;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(74, 52, 38, 0.06), 0 1px 1px rgba(74, 52, 38, 0.04);
  --shadow-md: 0 4px 12px rgba(74, 52, 38, 0.08), 0 1px 3px rgba(74, 52, 38, 0.05);

  /* motion */
  --duration-fast: 160ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* type */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #1a1512;
    --surface: #241e1a;
    --surface-sunken: #14100d;
    --border: #3a302a;
    --border-strong: #7a6a5d;
    --text: #f4ebe2;
    --text-muted: #c4b3a4;
    --text-subtle: #a39282;
    --accent: #ee8e66;
    --accent-pressed: #d97a53;
    --accent-soft: #3d271d;
    --accent-text: #f2a07d;
    --on-accent: #1f130d;
    --success: #8cc09a;
    --danger: #f08a80;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  }
}

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem; /* 17px: app body */
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Author display rules (e.g. display: grid) would otherwise override the hidden attribute. */
[hidden] {
  display: none !important;
}

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

a {
  color: var(--accent-text);
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs, 4px);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
}
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2.125rem, 1.4rem + 3.4vw, 3.75rem); /* 34px app display -> 60px */
  line-height: 1.1;
}
h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); /* 28px app title1 -> 40px */
  line-height: 1.15;
}
h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.125rem; /* 18px app title3 */
  line-height: 1.33;
}
p {
  margin: 0;
}

.overline {
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.33;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.muted {
  color: var(--text-muted);
}
.lead {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  color: var(--text-muted);
  max-width: 36em;
}
.small {
  font-size: 0.9375rem; /* 15px app callout */
  line-height: 1.4;
}

.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;
}

.skip-link {
  position: absolute;
  left: var(--space-lg);
  top: -100px;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.skip-link:focus {
  top: var(--space-lg);
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.prose {
  max-width: var(--text-width);
}

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--min-touch);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
}
.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-touch);
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover {
  color: var(--text);
  background: var(--surface-sunken);
}
.nav a[aria-current='page'] {
  color: var(--text);
}
.nav .nav-cta {
  color: var(--accent-text);
  font-weight: 600;
}
@media (max-width: 520px) {
  .nav .nav-secondary {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--button-height);
  padding: 0 var(--space-xxl);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}
.button:hover {
  background: var(--accent-pressed);
  text-decoration: none;
}
.button:active {
  transform: scale(0.97);
}
.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- Sections ---------- */
section {
  padding: var(--space-huge) 0;
}
.section-head {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-xxl);
  max-width: var(--text-width);
}

/* Hero */
.hero {
  padding-top: var(--space-xxxl);
}
.hero .container {
  display: grid;
  gap: var(--space-xxl);
  align-items: center;
}
.hero-copy {
  display: grid;
  gap: var(--space-xl);
  justify-items: start;
}
.hero-art {
  justify-self: center;
  width: min(320px, 70vw);
}
.hero-note {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}
@media (min-width: 860px) {
  .hero {
    padding-top: var(--space-huge);
  }
  .hero .container {
    grid-template-columns: 1.3fr 1fr;
  }
  .hero-art {
    width: 100%;
    max-width: 380px;
  }
}

/* Trade-off strip */
.tradeoff {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tradeoff-grid {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tradeoff-grid li {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--background);
  border: 1px solid var(--border);
}
@media (min-width: 720px) {
  .tradeoff-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Steps */
.steps {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.step {
  display: grid;
  gap: var(--space-sm);
  align-content: start;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.step-number {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
}
@media (min-width: 640px) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1000px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Screenshots */
.screens {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
/* Phones: a swipeable row on small screens, three columns on wide ones. */
.screens-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(240px, 64vw);
  gap: var(--space-xl);
  margin: 0 calc(-1 * var(--gutter));
  padding: var(--space-xs) var(--gutter) var(--space-lg);
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  overscroll-behavior-x: contain;
}
.screens-grid li {
  scroll-snap-align: start;
}
.screens-grid figure {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  text-align: center;
}
.swipe-hint {
  margin-top: var(--space-sm);
  text-align: center;
}
.phone {
  aspect-ratio: 1206 / 2622;
  width: 100%;
  object-fit: cover;
  border-radius: 36px;
  border: 8px solid var(--text);
  background: var(--surface-sunken);
  box-shadow: var(--shadow-md);
}
@media (min-width: 820px) {
  .screens-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    margin: 0;
    padding: 0;
    overflow: visible;
    justify-items: center;
  }
  .screens-grid figure {
    width: min(260px, 100%);
  }
  .swipe-hint {
    display: none;
  }
}

/* Privacy strip */
.privacy-strip .container {
  display: grid;
  gap: var(--space-lg);
  max-width: var(--text-width);
  text-align: center;
  justify-items: center;
}
.privacy-icon {
  width: 48px;
  height: 48px;
  color: var(--accent-text);
}

/* ---------- Beta form ---------- */
.beta {
  background: var(--accent-soft);
}
.beta .container {
  display: grid;
  gap: var(--space-xxl);
}
@media (min-width: 900px) {
  .beta .container {
    grid-template-columns: 1fr 1.1fr;
    align-items: start;
  }
}
.beta-copy {
  display: grid;
  gap: var(--space-lg);
}
.beta-copy ul {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: var(--space-sm);
  color: var(--text-muted);
}
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
@media (min-width: 520px) {
  .card {
    padding: var(--space-xxl);
  }
}

.form {
  display: grid;
  gap: var(--space-xl);
}
.field {
  display: grid;
  gap: var(--space-sm);
}
.label {
  font-weight: 600;
  font-size: 1rem;
}
.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.input {
  width: 100%;
  min-height: var(--field-height);
  padding: 0 var(--space-lg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
legend {
  padding: 0;
  margin-bottom: var(--space-sm);
}
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
}
.choice {
  position: relative;
}
.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--field-height);
  padding: 0 var(--space-lg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-weight: 500;
}
.choice span::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
}
.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.choice input:checked + span::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 45%, transparent 50%);
}
.choice input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.error {
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 500;
}
.error:empty {
  display: none;
}
.form-status {
  display: grid;
  gap: var(--space-md);
}
.form-status:focus {
  outline: none;
}
.honeypot {
  display: none;
}

/* ---------- Content pages (privacy, terms, support) ---------- */
.page {
  padding: var(--space-xxxl) 0 var(--space-huge);
}
.page .container > * + * {
  margin-top: var(--space-lg);
}
.page h1 {
  font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem);
  margin-bottom: var(--space-sm);
}
.page h2 {
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); /* 22px app title2 */
  font-weight: 500;
  margin-top: var(--space-xxl);
}
.page ul {
  padding-left: 1.2em;
  display: grid;
  gap: var(--space-sm);
}
.page li::marker {
  color: var(--accent-text);
}

.contact-card {
  display: grid;
  gap: var(--space-md);
  justify-items: start;
}

.faq {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 60px;
  padding: var(--space-md) var(--space-xl);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  flex: none;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent-text);
  line-height: 1;
}
.faq details[open] summary::after {
  content: '\2212';
}
.faq details > div {
  padding: 0 var(--space-xl) var(--space-xl);
  color: var(--text-muted);
  display: grid;
  gap: var(--space-md);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-xxxl) 0;
  color: var(--text-muted);
}
.site-footer .container {
  display: grid;
  gap: var(--space-xl);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-touch);
  padding: 0 var(--space-sm);
  margin-left: calc(-1 * var(--space-sm));
  margin-right: var(--space-sm);
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--text);
}
@media (min-width: 720px) {
  .site-footer .container {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.page h3 {
  margin-top: var(--space-xl);
}
.page .contact-card {
  margin-top: var(--space-xl);
}
.page .contact-card h2 {
  margin-top: 0;
}
