/* =====================================================================
   Passion for Dance by Ryno and Elena — stylesheet
   Palette & "known kiro bugs" rules from research/design-language.md §2.
   Two text-on-dark roles kept separate from card-surface fills.
   ===================================================================== */

/* ---------- Tokens: light (default) ---------- */
:root {
  --ground: #ECE0D0;       /* warm ivory ground (>=1.3:1 vs white cards) */
  --surface: #FFFFFF;
  --ink: #2B1020;
  --muted: #5C4552;        /* >=4.5:1 on ground */
  --brand: #A81F48;        /* CTA fill, white text >=4.5:1 */
  --brand-text: #A81F48;   /* small accent text on light */
  --gold: #E0A93B;         /* highlight fill — dark ink text on it */
  --gold-text: #7A5300;    /* gold as small text / stars on light, >=4.5:1 */
  --on-brand: #FFFFFF;     /* text on brand / dark bands — FIXED both themes */
  --ivory: #F6EDE4;        /* text on always-dark bands — FIXED both themes */
  --band: #2B1020;         /* always-dark header/hero/footer/CTA/Dance Card */

  /* Secondary tokens for dark bands (ivory family, fixed both themes) */
  --band-muted: #D8C4CF;   /* muted text on dark band, >=4.5:1 on --band */
  --band-line: rgba(246,237,228,0.22);
  --band-chip-bg: rgba(246,237,228,0.10);

  --line: #E7D9CB;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(43,16,32,0.08);
  --maxw: 1080px;

  --font-head: "Playfair Display", Georgia, serif;
  --font-body: "Nunito Sans", system-ui, sans-serif;
}

/* ---------- Tokens: dark ---------- */
[data-theme="dark"] {
  --ground: #160A12;
  --surface: #38232F;      /* card fill (>=1.3:1 vs dark ground) */
  --ink: #F6EDE4;
  --muted: #C9B5C0;        /* >=4.5:1 on dark ground */
  --brand: #9A1B41;        /* darkened so white >=4.5:1 on fill (bug 7) */
  --brand-text: #F28DA9;   /* accent text on dark */
  --gold: #E0A93B;         /* fill stays gold — dark ink text on it */
  --gold-text: #E0A93B;    /* gold text/stars on dark */
  --on-brand: #FFFFFF;
  --ivory: #F6EDE4;
  --band: #0F060C;

  --band-muted: #D8C4CF;
  --band-line: rgba(246,237,228,0.22);
  --band-chip-bg: rgba(246,237,228,0.10);

  --line: #523A49;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--ground);
  color: var(--ink);
  line-height: 1.6;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;           /* bug 3: no horizontal overflow */
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; color: var(--ink); font-weight: 700; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand-text); }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; display: block; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;        /* bug 4: never padding shorthand on .container */
}
.section { padding-block: clamp(3rem, 7vw, 5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 700; color: var(--brand-text); margin: 0 0 .5rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  padding: .72rem 1.3rem; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .15s ease, color .15s ease, border-color .15s ease;
  line-height: 1.1;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: #8d1a3d; color: var(--on-brand); }
.btn--ghost { background: transparent; color: var(--brand-text); border-color: var(--brand); }
.btn--ghost:hover { background: var(--brand); color: var(--on-brand); }
.btn--gold { background: var(--gold); color: #2B1020; border-color: var(--gold); } /* bug 8: dark ink on gold */
.btn--gold:hover { background: #cf9a2f; color: #2B1020; border-color: #cf9a2f; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 600;
  padding: .3rem .75rem; border-radius: 999px;
  background: rgba(168,31,72,0.08); color: var(--brand-text);
  border: 1px solid rgba(168,31,72,0.25);
}
.chip--info { background: rgba(224,169,59,0.14); color: var(--gold-text); border-color: rgba(224,169,59,0.5); }

/* ---------- Header ---------- */
.site-header {
  background: var(--band); color: var(--ivory);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--band-line);
}
.site-header .container {
  display: flex; align-items: center; gap: 1rem;
  padding-block: .8rem;
  flex-wrap: wrap;
}
.brand {
  display: flex; flex-direction: column; text-decoration: none;
  color: var(--ivory); font-family: var(--font-head); font-weight: 700;
  line-height: 1.05; margin-right: auto;
  min-width: 0;                /* bug 3: allow wrap */
}
.brand__name { font-size: 1.15rem; }
.brand__sub { font-family: var(--font-body); font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--band-muted); }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; align-items: center; }
.site-nav a { color: var(--ivory); text-decoration: none; font-weight: 600; font-size: .98rem; padding: .3rem 0; }
.site-nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.site-nav a[aria-current="page"] { color: var(--gold); }
.header__cta { display: inline-flex; }

/* Theme toggle */
.theme-toggle {
  background: var(--band-chip-bg); color: var(--ivory);
  border: 1px solid var(--band-line); border-radius: 999px;
  width: 42px; height: 42px; display: inline-grid; place-items: center;
  cursor: pointer; flex: none;
}
.theme-toggle:hover { background: rgba(246,237,228,0.18); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =====================================================================
   DARK BAND TEXT RULES (bug 1 + bug 6)
   Applies to .hero, .band, .site-header, .site-footer, and .dance-card__out
   Explicit light-on-dark for every text role; button exceptions incl :hover.
   ===================================================================== */
.hero, .band, .site-header, .site-footer, .dance-card__out { background: var(--band); color: var(--ivory); }

.hero h1, .hero h2, .hero h3, .hero h4,
.band h1, .band h2, .band h3, .band h4,
.site-header h1, .site-header h2, .site-header h3, .site-header h4,
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4,
.dance-card__out h1, .dance-card__out h2, .dance-card__out h3, .dance-card__out h4 { color: var(--ivory); }

.hero p, .hero li, .hero .lead,
.band p, .band li, .band .lead,
.site-header p, .site-header li,
.site-footer p, .site-footer li,
.dance-card__out p, .dance-card__out li { color: var(--ivory); }

.hero .muted, .band .muted, .site-footer .muted, .dance-card__out .muted,
.hero .lead, .band .lead { color: var(--band-muted); }

/* links on dark bands */
.hero a, .band a, .site-header a, .site-footer a, .dance-card__out a { color: var(--gold); }
.hero a:hover, .band a:hover, .site-header a:hover, .site-footer a:hover, .dance-card__out a:hover { color: #f2c877; }

/* bug 6: button-class exceptions so link rules never recolour buttons, incl :hover */
.hero a.btn--primary, .band a.btn--primary, .site-header a.btn--primary, .site-footer a.btn--primary, .dance-card__out a.btn--primary,
.hero a.btn--primary:hover, .band a.btn--primary:hover, .site-header a.btn--primary:hover, .site-footer a.btn--primary:hover, .dance-card__out a.btn--primary:hover {
  color: var(--on-brand);
}
.hero a.btn--ghost, .band a.btn--ghost, .site-header a.btn--ghost, .site-footer a.btn--ghost, .dance-card__out a.btn--ghost {
  color: var(--ivory); border-color: var(--ivory);
}
.hero a.btn--ghost:hover, .band a.btn--ghost:hover, .site-header a.btn--ghost:hover, .site-footer a.btn--ghost:hover, .dance-card__out a.btn--ghost:hover {
  color: #2B1020; background: var(--ivory); border-color: var(--ivory);
}
.hero button.btn--ghost, .band button.btn--ghost, .dance-card__out button.btn--ghost { color: var(--ivory); border-color: var(--ivory); }
.hero button.btn--ghost:hover, .band button.btn--ghost:hover, .dance-card__out button.btn--ghost:hover { color: #2B1020; background: var(--ivory); border-color: var(--ivory); }
.hero a.btn--gold, .band a.btn--gold, .site-header a.btn--gold, .site-footer a.btn--gold, .dance-card__out a.btn--gold,
.hero a.btn--gold:hover, .band a.btn--gold:hover, .site-header a.btn--gold:hover, .site-footer a.btn--gold:hover, .dance-card__out a.btn--gold:hover {
  color: #2B1020;   /* bug 8: dark ink on gold, keep on hover */
}

/* chips on dark bands */
.hero .chip, .band .chip, .site-footer .chip, .dance-card__out .chip {
  background: var(--band-chip-bg); color: var(--ivory); border-color: var(--band-line);
}
.hero .chip--info, .band .chip--info, .site-footer .chip--info, .dance-card__out .chip--info {
  background: rgba(224,169,59,0.18); color: #f2c877; border-color: rgba(224,169,59,0.55);
}

/* nap list on dark bands — both dt AND dd (bug 1) */
.hero dl.nap dt, .band dl.nap dt, .site-footer dl.nap dt, .dance-card__out dl.nap dt { color: var(--band-muted); }
.hero dl.nap dd, .band dl.nap dd, .site-footer dl.nap dd, .dance-card__out dl.nap dd { color: var(--ivory); }

/* proof/stat text on dark bands (bug 1) */
.hero .proof__big, .band .proof__big, .site-footer .proof__big, .dance-card__out .proof__big { color: var(--gold); }
.hero .proof__label, .band .proof__label, .site-footer .proof__label, .dance-card__out .proof__label { color: var(--band-muted); }

/* notes on dark bands */
.hero .img-note, .band .img-note, .site-footer .img-note, .dance-card__out .img-note { color: var(--band-muted); }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(22,10,18,0.78), rgba(22,10,18,0.9)),
    url("../img/ballroom-floor-wide.jpg") center/cover no-repeat;
}
.hero .container { padding-block: clamp(3.5rem, 9vw, 6.5rem); }
.hero__inner { max-width: 44ch; }
.hero .btn-row { margin-top: 1.5rem; }

/* ---------- Image note / demo note ---------- */
.img-note { font-size: .82rem; color: var(--muted); font-style: italic; margin-top: .4rem; }
.demo-note {
  background: var(--band); color: var(--ivory);     /* solid dark bg (bug 1) */
  border-radius: var(--radius-sm); padding: .9rem 1.1rem;
  font-size: .9rem; border: 1px solid var(--band-line);
}
.demo-note strong { color: var(--gold); }
.demo-note a { color: var(--gold); }

/* site-wide demo banner */
.demo-banner {
  background: var(--band); color: var(--ivory);
  text-align: center; font-size: .85rem; padding: .5rem 1rem;
  border-bottom: 1px solid var(--band-line);
}
.demo-banner strong { color: var(--gold); }

/* ---------- Proof strip ---------- */
.proof { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: center; }
.proof__item { min-width: 0; }      /* bug 3 */
.proof__big { font-family: var(--font-head); font-weight: 700; font-size: 1.9rem; color: var(--brand-text); display: block; }
.proof__label { font-size: .9rem; color: var(--muted); }
.proof__stars { color: var(--gold-text); }  /* bug 9: stars on light >=4.5:1 */

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid > * { min-width: 0; }         /* bug 3: grid children */

.card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow);
}
.card h3 { color: var(--ink); margin-bottom: .4rem; }
.card .muted { color: var(--muted); }
.card__icon { font-size: 1.6rem; margin-bottom: .4rem; }
.feature-banner { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.feature-banner img { width: 100%; object-fit: cover; }

/* ---------- Find-us / NAP ---------- */
dl.nap { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
dl.nap dt { font-weight: 700; color: var(--muted); }
dl.nap dd { margin: 0; color: var(--ink); }

/* ---------- Dance Card feature ---------- */
.dc { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: start; }
.dc__form { min-width: 0; }
.dc fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 0 0 1.25rem; }
.dc legend { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; padding: 0 .4rem; }
.dc .hint { font-size: .9rem; color: var(--muted); margin: -.3rem 0 .8rem; }

/* radio tiles (no nested buttons — labels wrapping inputs) */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.tiles > * { min-width: 0; }
.tile {
  display: flex; align-items: center; gap: .6rem;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: .7rem .85rem; cursor: pointer; background: var(--surface); color: var(--ink);
  font-weight: 600;
}
.tile input { accent-color: var(--brand); flex: none; }
.tile:hover { border-color: var(--brand); }
.tile:has(input:checked) { border-color: var(--brand); background: rgba(168,31,72,0.07); }
.tile:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

/* goal chips (multi-select via checkboxes in labels) */
.goals { display: flex; flex-wrap: wrap; gap: .55rem; }
.goal-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 2px solid var(--line); border-radius: 999px;
  padding: .45rem .9rem; cursor: pointer; background: var(--surface); color: var(--ink); font-weight: 600;
}
.goal-chip input { accent-color: var(--brand); }
.goal-chip:has(input:checked) { border-color: var(--brand); background: rgba(168,31,72,0.07); color: var(--brand-text); }
.goal-chip:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; }
.field input[type="date"], .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem;
}
.field textarea { resize: vertical; min-height: 4.5rem; }
.field .count { font-size: .82rem; color: var(--muted); }
.flex-check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; margin-top: .5rem; }

/* The always-dark output panel */
.dance-card__out {
  background: var(--band); color: var(--ivory);
  border-radius: var(--radius); padding: 1.5rem; position: sticky; top: 88px;
  border: 1px solid var(--band-line);
}
.dance-card__out .dc-summary { font-size: 1.1rem; font-weight: 700; color: var(--ivory); }
.dance-card__out .dc-block { margin-top: 1.1rem; }
.dance-card__out .dc-block h4 { color: var(--gold); font-family: var(--font-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .35rem; }
.dance-card__out ul { margin: 0; padding-left: 1.1rem; }
.dance-card__out .dc-message {
  background: rgba(246,237,228,0.08); border: 1px solid var(--band-line);
  border-radius: var(--radius-sm); padding: .9rem; color: var(--ivory);
  white-space: pre-wrap; font-size: .95rem;
}
.dance-card__out .btn-row { margin-top: 1rem; }
.copy-ok { font-size: .85rem; color: var(--gold); margin-top: .5rem; min-height: 1.2em; }

/* ---------- Footer ---------- */
.site-footer { padding-block: 2.5rem; margin-top: 2rem; border-top: 1px solid var(--band-line); }
.site-footer .footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2rem; }
.site-footer .footer-grid > * { min-width: 0; }
.site-footer h4 { font-family: var(--font-body); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; color: var(--band-muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .4rem; }
.footer-bottom { border-top: 1px solid var(--band-line); margin-top: 2rem; padding-top: 1.2rem; font-size: .85rem; color: var(--band-muted); }

/* ---------- Visually hidden ---------- */
.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: -9999px; top: 0; background: var(--gold); color: #2B1020;
  padding: .6rem 1rem; z-index: 100; font-weight: 700; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* =====================================================================
   RESPONSIVE (bug 3)
   ===================================================================== */
@media (max-width: 920px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .dc { grid-template-columns: 1fr; }
  .dance-card__out { position: static; }
  .site-footer .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  /* nav on its own row under 700px */
  .site-header .container { flex-wrap: wrap; }
  .brand { margin-right: auto; }
  .site-nav { order: 3; flex-basis: 100%; width: 100%; justify-content: flex-start; gap: .2rem 1rem; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .proof { grid-template-columns: 1fr; gap: 1.5rem; }
  .site-footer .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 480px) {
  /* hide header CTA under 480px */
  .header__cta { display: none; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  body { font-size: 1rem; }
  .brand__name { font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
