/* ============================================================
   Mikki's Wax Bar — Design System tokens
   Phase 3 deliverable. Imported by Phase 4 specs & Phase 6 build.
   Single source of truth — no hex values appear in component code.
   ============================================================ */

/* ---------- Font loading ----------
   Fraunces  — display + editorial (variable; opsz 9–144, weight 300–700)
   Switzer   — body sans (Fontshare; Suisse Int'l adjacent)
   JetBrains Mono — labels, codes, prices
*/

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..700,30..100;1,9..144,300..700,30..100&family=JetBrains+Mono:wght@400;500&display=swap");
@import url("https://api.fontshare.com/v2/css?f%5B%5D=switzer@300,400,500,600,700&display=swap");

/* ============================================================
   Architecture
   ============================================================
   Every visual property in the build resolves to one of:
   --ink           text + structural ink
   --ink-soft      secondary ink
   --paper         page background
   --paper-soft    cards, callouts
   --accent        single-use accent (italics, focus, links)
   --muted         captions, metadata
   --line          hairlines, table borders
   --alert         form error only
   --serif, --sans, --mono
   --s-1 … --s-11
   --ease-*  --dur-*
   ============================================================ */

:root {
  /* type families ---------------------------------------------------- */
  --serif: "Fraunces", ui-serif, Georgia, serif;
  --sans:  "Switzer", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* spacing scale (4px base) ---------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 120px;
  --s-11: 160px;

  /* type scale (clamp for fluid display sizes) ----------------------- */
  --t-display-xl: clamp(56px, 8vw, 120px);
  --t-display-l:  clamp(40px, 5.4vw, 72px);
  --t-display-m:  clamp(32px, 4vw, 48px);
  --t-heading:    28px;
  --t-subhead:    22px;
  --t-lede:       20px;
  --t-body-l:     18px;
  --t-body-m:     16px;
  --t-body-s:     14px;
  --t-caption:    13px;
  --t-label:      11px;
  --t-microlabel: 10px;

  /* line-heights ---------------------------------------------------- */
  --lh-display-xl: 1.00;
  --lh-display-l:  1.05;
  --lh-display-m:  1.10;
  --lh-heading:    1.20;
  --lh-subhead:    1.30;
  --lh-lede:       1.50;
  --lh-body:       1.55;

  /* max-widths ------------------------------------------------------ */
  --w-display: 32ch;
  --w-lede:    36ch;
  --w-body:    64ch;
  --w-content: 1280px;

  /* motion ---------------------------------------------------------- */
  --ease-out-precise: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:      cubic-bezier(0.65, 0, 0.35, 1);
  --ease-precise:     cubic-bezier(0.4, 0, 0.2, 1);
  --dur-micro:  150ms;
  --dur-short:  250ms;
  --dur-medium: 400ms;
  --dur-long:   600ms;
}

/* ============================================================
   Palette A — Aldgate dusk    (recommended)
   navy ink · warm cream · dusty rose accent
   ============================================================ */
:root,
.palette-a {
  --ink:        #14202E;
  --ink-soft:   #1F2E40;
  --paper:      #F4EFE6;
  --paper-soft: #EAE3D3;
  --accent:     #9C5644;
  --muted:      #5B6779;
  --line:       rgba(20, 32, 46, 0.16);
  --line-soft:  rgba(20, 32, 46, 0.08);
  --alert:      #8B4843;

  /* on-dark variants (when --ink is the background) */
  --on-ink:        #F4EFE6;
  --on-ink-muted:  rgba(244, 239, 230, 0.7);
  --on-ink-line:   rgba(244, 239, 230, 0.18);
}

/* ============================================================
   Palette B — Eastcheap morning
   deeper navy · cooler ivory · sage accent
   ============================================================ */
.palette-b {
  --ink:        #0F1B2C;
  --ink-soft:   #1B2A3F;
  --paper:      #F0EBE0;
  --paper-soft: #E4DCC9;
  --accent:     #7B8A6F;
  --muted:      #586473;
  --line:       rgba(15, 27, 44, 0.16);
  --line-soft:  rgba(15, 27, 44, 0.08);
  --alert:      #8B4843;

  --on-ink:        #F0EBE0;
  --on-ink-muted:  rgba(240, 235, 224, 0.7);
  --on-ink-line:   rgba(240, 235, 224, 0.18);
}

/* ============================================================
   Palette C — Minories gold
   midnight ink · ivory · burnished gold accent
   ============================================================ */
.palette-c {
  --ink:        #11151F;
  --ink-soft:   #1C2330;
  --paper:      #F2EDDF;
  --paper-soft: #E6DFCC;
  --accent:     #A67C42;
  --muted:      #5A6271;
  --line:       rgba(17, 21, 31, 0.16);
  --line-soft:  rgba(17, 21, 31, 0.08);
  --alert:      #8B4843;

  --on-ink:        #F2EDDF;
  --on-ink-muted:  rgba(242, 237, 223, 0.7);
  --on-ink-line:   rgba(242, 237, 223, 0.18);
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-short:  0ms;
    --dur-medium: 0ms;
    --dur-long:   0ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Base reset + typography defaults
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--t-body-m);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display + headings: Fraunces, with opsz set per size. */
.display-xl, .display-l, .display-m, h1, h2, h3, h4 { font-family: var(--serif); }

.display-xl {
  font-size: var(--t-display-xl);
  line-height: var(--lh-display-xl);
  font-weight: 320;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 96, "SOFT" 30;
  max-width: var(--w-display);
  text-wrap: balance;
}
.display-l, h1 {
  font-size: var(--t-display-l);
  line-height: var(--lh-display-l);
  font-weight: 340;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 60;
  max-width: var(--w-display);
  text-wrap: balance;
}
.display-m, h2 {
  font-size: var(--t-display-m);
  line-height: var(--lh-display-m);
  font-weight: 380;
  letter-spacing: -0.012em;
  font-variation-settings: "opsz" 44;
  text-wrap: balance;
}
h3 {
  font-size: var(--t-heading);
  line-height: var(--lh-heading);
  font-weight: 420;
  letter-spacing: -0.008em;
  font-variation-settings: "opsz" 32;
}
h4 {
  font-size: var(--t-subhead);
  line-height: var(--lh-subhead);
  font-weight: 420;
  font-variation-settings: "opsz" 28;
}

.lede {
  font-family: var(--serif);
  font-size: var(--t-lede);
  line-height: var(--lh-lede);
  font-weight: 360;
  max-width: var(--w-lede);
  font-variation-settings: "opsz" 32;
}

p { margin: 0 0 var(--s-4); max-width: var(--w-body); }
p:last-child { margin-bottom: 0; }

em { font-style: italic; color: var(--ink-soft); }

/* Mono labels ----------------------------------------------------- */
.label {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
}
.microlabel {
  font-family: var(--mono);
  font-size: var(--t-microlabel);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
}

/* Links in body --------------------------------------------------- */
a {
  color: var(--ink);
  text-decoration: underline 1px var(--line);
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-short) var(--ease-precise);
}
a:hover { text-decoration-color: var(--accent); }
a:visited { color: var(--ink); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-6);
  font-family: var(--sans);
  font-size: var(--t-body-s);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  border-radius: 0;
  transition:
    background-color var(--dur-short) var(--ease-precise),
    color var(--dur-short) var(--ease-precise),
    border-color var(--dur-short) var(--ease-precise);
}
.btn--primary {
  background: #14202E;
  background: var(--ink);
  color: #F4EFE6 !important;
}
.btn--primary:hover { background: #1F2E40; background: var(--ink-soft); }
.btn--primary,
.btn--primary * { color: #F4EFE6 !important; }
.btn--primary .arrow { display: inline-block; margin-left: var(--s-1); transition: transform var(--dur-short) var(--ease-precise); }
.btn--primary:hover .arrow { transform: translateX(3px); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn--secondary:hover {
  background: var(--ink);
  color: var(--on-ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  padding: var(--s-2) 0;
  text-decoration: underline 1px var(--line);
  text-underline-offset: 5px;
}
.btn--ghost:hover { text-decoration-color: var(--accent); }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   Form inputs
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.input, .textarea, .select {
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--ink);
  padding: var(--s-4) var(--s-4);
  font-family: var(--sans);
  font-size: var(--t-body-m);
  color: var(--ink);
  border-radius: 0;
  transition: border-color var(--dur-short) var(--ease-precise);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.7; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-bottom-color: var(--accent);
  border-bottom-width: 2px;
  padding-bottom: calc(var(--s-4) - 1px);
}
.textarea { min-height: 120px; resize: vertical; }
.field.error .input,
.field.error .textarea {
  border-bottom-color: var(--alert);
  border-bottom-width: 2px;
  padding-bottom: calc(var(--s-4) - 1px);
}
.field .error-msg {
  font-family: var(--sans);
  font-size: var(--t-caption);
  color: var(--alert);
}

/* ============================================================
   Component primitives
   ============================================================ */

/* P1 — Named-credited reviewer block */
.reviewer {
  display: flex; flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
}
.reviewer .source { /* uses .microlabel as a class */ }
.reviewer blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-l);
  line-height: var(--lh-lede);
  font-weight: 340;
  font-variation-settings: "opsz" 28;
  color: var(--ink);
  margin: 0;
  max-width: var(--w-lede);
}
.reviewer .attr {
  font-family: var(--sans);
  font-size: var(--t-body-s);
  color: var(--muted);
}
.reviewer--pulled blockquote {
  font-size: var(--t-display-m);
  line-height: 1.2;
  max-width: var(--w-display);
}

/* P2 — Real-photo gallery card */
.result-card {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--paper-soft);
  overflow: hidden;
}
.result-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-card .meta {
  position: absolute;
  bottom: var(--s-3); left: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: rgba(20, 32, 46, 0.78);
  color: var(--on-ink);
  font-family: var(--mono);
  font-size: var(--t-microlabel);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.result-card + .caption {
  margin-top: var(--s-3);
  font-family: var(--sans);
  font-size: var(--t-caption);
  color: var(--muted);
}

/* P3 — Patch-test offer chip */
.chip {
  display: inline-flex; align-items: center;
  height: 32px;
  padding: 0 var(--s-4);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: var(--t-microlabel);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.chip--accent {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

/* P4 — Sticky mobile CTA bar */
.sticky-cta {
  display: none;
}
@media (max-width: 768px) {
  .sticky-cta {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 56px;
    padding: 0 var(--s-5);
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    z-index: 50;
    transform: translateY(100%);
    transition: transform var(--dur-short) var(--ease-out-precise);
  }
  .sticky-cta.is-visible { transform: translateY(0); }
  .sticky-cta .label-link {
    color: var(--on-ink);
    text-decoration: none;
    font-family: var(--sans);
    font-size: var(--t-body-s);
    font-weight: 500;
  }
}

/* P5 — Branded Phorest-shell modal frame */
.modal-shell {
  position: fixed; inset: 0;
  background: rgba(20, 32, 46, 0.4);
  display: grid; place-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-medium) var(--ease-in-out);
}
.modal-shell.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal-shell .panel {
  width: 100%; max-width: 720px;
  max-height: 90vh;
  background: var(--paper);
  display: flex; flex-direction: column;
  transform: translateY(24px);
  transition: transform var(--dur-medium) var(--ease-in-out);
}
.modal-shell.is-open .panel { transform: translateY(0); }
.modal-shell .header {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  padding: 0 var(--s-5);
  border-bottom: 1px solid var(--line);
}
.modal-shell .header .logo {
  font-family: var(--serif);
  font-size: var(--t-subhead);
  font-weight: 380;
  font-variation-settings: "opsz" 28;
}
.modal-shell .body {
  flex: 1; overflow: auto;
  padding: var(--s-6) var(--s-7);
}
.modal-shell .footer {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: var(--t-caption);
  color: var(--muted);
  text-align: center;
}
@media (max-width: 768px) {
  .modal-shell .panel { max-height: 100vh; height: 100vh; max-width: 100vw; }
  .modal-shell .body { padding: var(--s-5); }
}

/* P6 — Fitzpatrick-scale strip */
.fitzpatrick {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-1);
}
.fitz-cell {
  aspect-ratio: 1;
  position: relative;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: var(--s-3);
}
.fitz-cell .roman {
  font-family: var(--mono);
  font-size: var(--t-microlabel);
  letter-spacing: 0.14em;
  font-weight: 500;
  color: var(--on-ink);
  mix-blend-mode: difference;
}
/* Skin-tone reference values from the standard Fitzpatrick scale. */
.fitz-1 { background: #F5D6BB; }
.fitz-2 { background: #E5BC95; }
.fitz-3 { background: #C99877; }
.fitz-4 { background: #A26F4D; }
.fitz-5 { background: #6E4626; }
.fitz-6 { background: #3B2516; }
.fitzpatrick + .caption {
  margin-top: var(--s-4);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-l);
  font-variation-settings: "opsz" 28;
  font-weight: 340;
  color: var(--ink-soft);
}

/* P7 — FAQ accordion */
.faq { border-top: 1px solid var(--line); }
.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--serif);
  font-size: var(--t-subhead);
  font-weight: 420;
  font-variation-settings: "opsz" 28;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  display: block;
  width: 12px; height: 12px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: rotate(45deg);
  margin-left: var(--s-4);
  transition: transform var(--dur-short) var(--ease-precise);
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(-135deg); }
.faq-item .answer {
  padding: 0 0 var(--s-5);
  font-family: var(--sans);
  font-size: var(--t-body-m);
  line-height: var(--lh-body);
  color: var(--ink-soft);
  max-width: var(--w-body);
}

/* P8 — Named-portrait module */
.portrait {
  display: grid; gap: var(--s-4);
  max-width: 320px;
}
.portrait .photo {
  aspect-ratio: 1;
  background: var(--paper-soft);
  overflow: hidden;
}
.portrait .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait .name {
  font-family: var(--serif);
  font-size: var(--t-display-m);
  font-weight: 380;
  font-variation-settings: "opsz" 44;
  line-height: 1.05;
  margin: 0;
}
.portrait .credentials { /* .microlabel applied */ }
.portrait .quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-l);
  line-height: 1.45;
  font-weight: 340;
  font-variation-settings: "opsz" 28;
  color: var(--ink-soft);
  margin: 0;
}

/* ============================================================
   Layout helpers
   ============================================================ */
.container {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
@media (max-width: 768px) { .container { padding: 0 var(--s-5); } }

.section { padding: var(--s-9) 0; }
@media (max-width: 768px) { .section { padding: var(--s-8) 0; } }

/* skip-to-content link */
.skip-link {
  position: absolute;
  top: -40px; left: 0;
  background: var(--ink);
  color: var(--on-ink);
  padding: var(--s-3) var(--s-5);
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  z-index: 100;
}
.skip-link:focus { top: 0; }
