/* RangkaiJanji — application components.
   Every colour, size and radius comes from DESIGN.md via tokens.css. No raw hex here:
   if a value is missing, add a token rather than a literal. */

:root {
  --rj-serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --rj-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rj-max: 1200px;
  --rj-read: 680px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-neutral);
  color: var(--color-primary);
  font-family: var(--rj-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-tertiary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--color-tertiary);
  outline-offset: 2px;
}

.wrap { width: 100%; max-width: var(--rj-max); margin-inline: auto; padding-inline: 20px; }
.read { max-width: var(--rj-read); }

/* ---------- type ---------- */
.eyebrow {
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--color-tertiary); margin: 0 0 12px;
}
h1, h2, h3 { font-family: var(--rj-serif); font-weight: 400; margin: 0; }
h1 { font-size: clamp(2.25rem, 7vw, 4.5rem); line-height: 1.08; letter-spacing: -0.028em; }
h2 { font-size: clamp(1.75rem, 4.5vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; }
h3 { font-size: clamp(1.25rem, 2.6vw, 2rem); line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
.lead { font-size: clamp(1rem, 2.2vw, 1.125rem); line-height: 1.65; color: var(--color-secondary); }
.muted { color: var(--color-secondary); }
.small { font-size: 0.875rem; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--color-neutral) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}
.site-head.is-scrolled { border-bottom-color: var(--color-border); }
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px;
}
.brand { display: inline-flex; align-items: center; gap: 10px;
  color: var(--color-primary); min-height: 44px; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand-name { font-family: var(--rj-serif); font-size: 1.25rem; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--color-primary);
  font-size: 0.9375rem; min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--color-muted); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--color-tertiary); font-weight: 500; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer;
  color: var(--color-primary); min-height: 44px; min-width: 44px;
  align-items: center; justify-content: center;
}
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; inset: 100% 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    padding: 8px 20px 16px; display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 8px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--rj-sans); font-size: 0.9375rem; font-weight: 500; cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: var(--color-neutral); }
.btn-primary:hover { background: var(--color-accent); color: var(--color-primary); }
.btn-secondary {
  background: var(--color-surface); color: var(--color-primary);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-tertiary); background: var(--color-muted); }
.btn-sm { padding: 10px 16px; font-size: 0.875rem; }
.nav a.btn-primary { color: var(--color-neutral); }
.nav a.btn-primary:hover { color: var(--color-primary); }

/* ---------- hero ---------- */
.hero { padding: clamp(48px, 9vw, 128px) 0 clamp(40px, 7vw, 96px); }
.hero-grid { display: grid; gap: clamp(32px, 5vw, 64px); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } }
.hero h1 { margin: 0 0 20px; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin-top: 30px; }
.hero-note { margin-top: 28px; font-size: 0.875rem; color: var(--color-secondary); }

/* ---------- invitation preview card ---------- */
.preview {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); overflow: hidden; max-width: 420px;
  box-shadow: 0 1px 2px rgb(43 33 24 / 0.04);
}
.preview-stage {
  aspect-ratio: 4 / 5; position: relative; display: grid; place-items: center;
  padding: 32px 28px; text-align: center;
}
/* one family inside the card, matching the headline: mixing a geometric sans into a
   serif composition was the thing that read as unintentional */
.preview-stage .couple {
  font-family: var(--rj-serif); font-size: clamp(1.5rem, 4.4vw, 2rem);
  line-height: 1.15; margin: 0;
}
.preview-stage .amp { color: var(--preview-gold, var(--color-accent)); font-style: italic; }
.preview-stage .date {
  font-family: var(--rj-serif); font-size: 0.9375rem; letter-spacing: 0.12em;
  text-transform: uppercase; margin: 14px 0 0;
}
.preview-stage .eyebrow { font-family: var(--rj-sans); }
.preview-arc {
  position: absolute; inset: 26px 24px 18px 24px;
  border-radius: 999px 999px 0 0;
  border: 1px solid var(--preview-gold, var(--color-accent));
  border-bottom: 0; opacity: 0.45;
}
.preview-meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 14px 24px; border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
}
.preview-meta .tag { color: var(--color-secondary); }

/* ---------- sections ---------- */
.section { padding: clamp(48px, 8vw, 128px) 0; }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head h2 { margin-bottom: 14px; }

/* ---------- catalog ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px;
  padding-bottom: 20px; border-bottom: 1px solid var(--color-border);
}
.chip {
  padding: 8px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface); color: var(--color-secondary); font-size: 0.8125rem;
  cursor: pointer; min-height: 36px;
}
.chip[aria-pressed="true"] {
  background: var(--color-primary); color: var(--color-neutral);
  border-color: var(--color-primary);
}
.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgb(43 33 24 / 0.04);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgb(43 33 24 / 0.08); }
.tile-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tile h3 { margin: 0; font-size: 1.375rem; }
.tile-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-top: 6px;
}
.badge {
  display: inline-block; padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--color-muted); color: var(--color-secondary);
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.02em; white-space: nowrap;
}
.badge-tier { background: var(--color-primary); color: var(--color-neutral); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.08); }

/* ---------- pricing ---------- */
.price-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .price-grid { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.price-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); padding: 32px; display: flex; flex-direction: column;
  gap: 16px; height: 100%;
}
.price-card.is-featured {
  background: var(--color-primary); color: var(--color-neutral);
  border-color: var(--color-primary);
}
.price-card.is-featured .muted, .price-card.is-featured .price-tier { color: #CBBFAC; }
.price-card.is-featured .badge { background: var(--color-accent); color: var(--color-primary); }
.price-name { font-family: var(--rj-serif); font-size: 1.5rem; }
.price-value { font-family: var(--rj-serif); font-size: 2.5rem; letter-spacing: -0.02em; }
.price-tier { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }
.price-features { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.9375rem; }
.price-features li { padding-left: 22px; position: relative; margin-bottom: 8px; }
.price-features li::before {
  content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 1px;
  background: var(--color-tertiary);
}
.price-card.is-featured .price-features li::before { background: var(--color-accent); }
.same-note {
  margin-top: 28px; padding: 18px 20px; border-left: 2px solid var(--color-tertiary);
  background: var(--color-surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- steps ---------- */
.steps { display: grid; gap: 28px; counter-reset: step; }
@media (min-width: 700px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { position: relative; padding-top: 8px; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  display: block; font-family: var(--rj-serif); font-size: 1.75rem;
  color: var(--color-tertiary); margin-bottom: 10px;
}
.step h3 { font-size: 1.0625rem; margin-bottom: 6px; }

/* ---------- regions ---------- */
.regions { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .regions { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .regions { grid-template-columns: repeat(3, 1fr); } }
.region { border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 20px; background: var(--color-surface); }
.region h3 { font-size: 1.125rem; margin-bottom: 10px; }
.region .cultures { font-size: 0.875rem; color: var(--color-secondary); line-height: 1.75; }

/* ---------- faq ---------- */
.faq { border-top: 1px solid var(--color-border); }
.faq details { border-bottom: 1px solid var(--color-border); }
.faq summary {
  cursor: pointer; padding: 20px 0; font-family: var(--rj-serif); font-size: 1.125rem;
  list-style: none; display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--color-tertiary); font-family: var(--rj-sans); }
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding: 0 0 20px; color: var(--color-secondary); max-width: var(--rj-read); }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--color-border); padding: 48px 0 64px; margin-top: 32px;
  font-size: 0.875rem; color: var(--color-secondary);
}
.foot-grid { display: grid; gap: 28px; }
@media (min-width: 700px) { .foot-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-foot a { color: var(--color-secondary); }
.site-foot h4 { font-family: var(--rj-sans); font-size: 0.75rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--color-primary); margin: 0 0 12px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 8px; }
.foot-note { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--color-border);
  font-size: 0.8125rem; }

/* ---------- utilities ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--color-primary);
  color: var(--color-neutral); padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.stack > * + * { margin-top: 12px; }

/* ------------------------------------------------------------------ account area */
.narrow { max-width: 46ch; }
.stack { display: grid; gap: 16px; margin: 24px 0; }
.field { display: grid; gap: 6px; }
.field > span { font-size: .9rem; color: var(--color-primary); }
.field input { min-height: 48px; padding: 12px 14px; font: inherit;
  border: 1px solid var(--color-line); border-radius: var(--radius-sm, 4px);
  background: #fff; color: var(--color-primary); }
.field input:focus-visible { outline: 2px solid var(--color-tertiary); outline-offset: 2px; }
.form-error { padding: 12px 14px; border-left: 3px solid #a12b2b; background: #fbf0f0;
  color: #6d1a1a; border-radius: 2px; }
.acct-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start;
  justify-content: space-between; margin-bottom: 24px; }
.inv-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.inv-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  align-items: center; padding: 18px; border: 1px solid var(--color-line);
  border-radius: var(--radius-md, 6px); background: #fff; }
.inv-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inv-row-actions .btn { min-height: 44px; display: inline-flex; align-items: center; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem;
  border: 1px solid currentColor; }
.pill-published, .pill-approved { color: #2c5f3f; }
.pill-draft, .pill-pending, .pill-review { color: #7a5a12; }
.pill-unpublished, .pill-rejected { color: #8a3a3a; }
.small { font-size: .85em; }
.empty { padding: 48px 24px; text-align: center; border: 1px dashed var(--color-line);
  border-radius: var(--radius-md, 6px); }
.notice { padding: 16px 18px; border-left: 3px solid var(--color-tertiary);
  background: #fdf9f0; margin: 16px 0; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.acct-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.panel { padding: 20px; border: 1px solid var(--color-line);
  border-radius: var(--radius-md, 6px); background: #fff; }
.plain-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.gb-mod { list-style: none; padding: 0; display: grid; gap: 16px; }
.gb-mod li { padding-bottom: 14px; border-bottom: 1px solid var(--color-line); }
.inline-form { display: inline-block; margin-right: 8px; }
.inline-form .btn, .btn-sm { min-height: 44px; }
.share-line { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.share-line .btn { min-height: 44px; }

/* --- theme catalog card: the thumbnail is a real render, never an illustration --- */
.theme-card { overflow: hidden; }
.theme-thumb { position: relative; aspect-ratio: 4 / 5; overflow: hidden; }
.theme-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center;
  display: block; }
.theme-thumb--empty { display: grid; place-items: center; height: 100%;
  background: repeating-linear-gradient(135deg, rgb(43 33 24 / 0.05) 0 10px,
  transparent 10px 20px); }
.theme-thumb--empty span { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--color-text-muted); border: 1px dashed var(--color-border);
  padding: 8px 12px; border-radius: var(--radius-sm); background: rgb(255 255 255 / .6); }
.theme-meta { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 560px) {
  .theme-thumb { aspect-ratio: 3 / 4; }
}

/* --- catalog filter rows: one label column, one control column, aligned on every row.
   Without this the groups floated into a ragged, uneven grid. --- */
.filters { display: flex; flex-direction: column; gap: 14px; }
.filter-row { display: grid; grid-template-columns: 116px 1fr; gap: 12px;
  align-items: start; }
.filter-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--color-text-muted); padding-top: 9px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) {
  /* stacked: label directly above its controls, no phantom grid gap */
  .filter-row { grid-template-columns: 1fr; gap: 4px; }
  .filter-label { padding-top: 0; line-height: 1.2; }
}

/* live theme preview: the real invitation in a phone frame, never a drawing of one */
.preview-live { position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--color-border); background: #fff;
  box-shadow: 0 18px 48px rgb(43 33 24 / .14); max-width: 390px; margin-inline: auto; }
.preview-live iframe { display: block; width: 100%; height: 780px; border: 0; }
.preview-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  justify-content: center; margin-top: 14px; }

/* --- admin: dense table, readable on a phone by scrolling rather than reflowing --- */
.admin-table-wrap { overflow-x: auto; margin-top: 22px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--color-border); vertical-align: top; }
.admin-table th { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-text-muted); font-weight: 600; }
.admin-thumb { display: block; border: 1px solid var(--color-border); border-radius: 4px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { padding: 6px 8px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); font: inherit; font-size: .82rem; }
.badge-warn { background: #8a2f22; color: #fff; }

/* A theme in the owner QA view that the owner has not approved yet. It must read as
   provisional: same tile, visibly not for sale. */
.badge-draft {
  border: 1px dashed currentColor;
  opacity: .75;
}
