/* memecurator — structural CSS (theme-agnostic)
 * No :root vars here. Theme tokens live in theme-*.css.
 * 4px base unit per Wherewithal design standards.
 */

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

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit; color: inherit; background: none; border: none;
  cursor: pointer; padding: 0;
}

/* ── Layout primitives ───────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow { max-width: 720px; }

.stack > * + * { margin-top: var(--stack, 16px); }
.stack--lg { --stack: 32px; }
.stack--xl { --stack: 64px; }

.row { display: flex; gap: 16px; align-items: center; }
.row--between { justify-content: space-between; }

/* ── Section rhythm ──────────────────────────────────────── */

section {
  padding: 96px 0;
  border-top: 1px solid var(--rule);
}

section:first-of-type { border-top: 0; }

@media (max-width: 768px) {
  section { padding: 64px 0; }
}

/* ── Typography ──────────────────────────────────────────── */

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }

h1 {
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 500;
}

h2 {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
}

p { margin: 0; max-width: 60ch; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin: 0;
}

.lead {
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 56ch;
}

.mono { font-family: var(--font-mono); }

/* ── Hairlines (the Calm divider system) ─────────────────── */

.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  min-height: 44px; /* WCAG / HIG touch target */
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn--primary:hover { background: var(--accent-dead); border-color: var(--accent-dead); }

.btn--ghost { border-color: transparent; }
.btn--ghost:hover { background: transparent; color: var(--accent-dead); }

/* ── Half-life pill (Calm: best-before metaphor) ─────────── */

.pill {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  min-width: 140px;
}

.pill__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
}

.pill__bar {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.pill__bar-fill {
  position: absolute;
  inset: 0;
  background: var(--state-color, var(--ink-muted));
  transform-origin: left;
  transform: scaleX(var(--fill, 0.5));
}

.pill[data-state="fresh"]   { --state-color: var(--accent-fresh); }
.pill[data-state="peaking"] { --state-color: var(--accent-fresh); }
.pill[data-state="aging"]   { --state-color: var(--accent-aging); }
.pill[data-state="stale"]   { --state-color: var(--accent-dead); }
.pill[data-state="cringe"]  { --state-color: var(--accent-dead); }
.pill[data-state="unscored"] { --state-color: var(--ink-muted); }

.pill[data-state="stale"] .pill__label,
.pill[data-state="cringe"] .pill__label { color: var(--accent-dead); }

/* Compact pill variant for library cards */
.pill--compact {
  min-width: 0;
  padding: 4px 8px;
}
.pill--compact .pill__label { font-size: 10px; letter-spacing: 0.06em; }
.pill--compact .pill__bar { height: 2px; }

/* Full-width detail pill */
.pill--detail { min-width: 100%; padding: 12px 16px; }
.pill--detail .pill__label { font-size: 13px; }
.pill--detail .pill__bar { height: 4px; }

/* ── Library card ────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--paper);
}

.card__media {
  aspect-ratio: 1 / 1;
  background: var(--surface-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  text-align: center;
  padding: 16px;
  overflow: hidden;
}

.card__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 60%;
}

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ── Grid ────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: 24px;
}

.grid--library {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .grid--library { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .grid--library { grid-template-columns: repeat(4, 1fr); }
}

/* ── Pack contact sheet (the differentiating gesture) ────── */

.contact-sheet {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 32px;
  background: var(--paper);
}

.contact-sheet__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contact-sheet__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .contact-sheet__grid { grid-template-columns: repeat(5, 1fr); } }

.contact-sheet__cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  position: relative;
}

.contact-sheet__cell--pick::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-dead);
}

.contact-sheet__footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
}

/* ── Decode mock ─────────────────────────────────────────── */

.decode {
  display: grid;
  gap: 24px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px;
}

@media (min-width: 720px) {
  .decode { grid-template-columns: 1fr 1.2fr; }
}

.decode__verdict-prefix {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

/* ── Animations (respect reduced motion) ─────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-reveal] {
  opacity: 0;
  animation: fadeUp 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ── Header ──────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.brand {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dead);
  display: inline-block;
}

.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  padding: 8px 12px;
}

.site-nav a:hover { color: var(--ink); }

@media (max-width: 540px) {
  .site-nav a:not(.btn) { display: none; }
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  padding-top: 88px;
  padding-bottom: 96px;
  border-top: 0;
}

.hero__lockup {
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero__title {
  font-size: clamp(40px, 8vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 500;
}

.hero__title em {
  font-style: italic;
  color: var(--accent-dead);
  font-weight: 400;
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.site-footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ── Waitlist form ───────────────────────────────────────── */

.waitlist {
  display: flex;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px;
  max-width: 480px;
  background: var(--paper);
  transition: border-color 200ms ease;
}

.waitlist:focus-within { border-color: var(--ink); }

.waitlist input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 12px;
  font: inherit;
  color: var(--ink);
  min-height: 44px;
}

.waitlist input::placeholder { color: var(--ink-muted); }
.waitlist input:focus { outline: none; }

.waitlist__status {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-top: 12px;
  min-height: 16px;
}

.waitlist__status[data-ok="true"] { color: var(--accent-fresh); }
