/* Top Stitch — design tokens & component styles
   Mobile-first. Tweakable via CSS variables (palette, type, motif). */

:root {
  /* Palette — Soft Cream + Sage + Dusty Rose (default) */
  --bg: #F5EFE4;
  --bg-2: #EDE5D5;
  --surface: #FBF7EE;
  --ink: #2E2A24;
  --ink-2: #5C4A3A;
  --muted: #8B7E6E;
  --line: #D9CFBC;
  --sage: #8A9A7B;
  --sage-deep: #6F8062;
  --rose: #C9A4A0;
  --rose-deep: #B07E78;
  --accent: var(--sage-deep);
  --accent-on: #FBF7EE;

  /* Type */
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Nunito", system-ui, sans-serif;

  /* Motif intensity (0 subtle .. 2 bold) — controls dash usage */
  --motif: 1;

  --radius: 14px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(46,42,36,0.06);
  --shadow-md: 0 8px 24px rgba(46,42,36,0.10);
}

/* Palette variants applied via [data-palette] */
[data-palette="modern"] {
  --bg: #FBF7F0;
  --bg-2: #F2EBDD;
  --surface: #FFFFFF;
  --ink: #1F1D1A;
  --ink-2: #3A372F;
  --muted: #7A6F5F;
  --line: #E2D9C5;
  --sage: #6B7F5C;
  --sage-deep: #556849;
  --rose: #B8645E;
  --rose-deep: #9A4F49;
  --accent: var(--rose-deep);
  --accent-on: #FBF7F0;
}
[data-palette="warm-gold"] {
  --bg: #EFE8DC;
  --bg-2: #E5DCC8;
  --surface: #FAF4E6;
  --ink: #2A2520;
  --ink-2: #4A3F30;
  --muted: #8C7E68;
  --line: #D4C8AE;
  --sage: #A89968;
  --sage-deep: #877A50;
  --rose: #D4A5A0;
  --rose-deep: #B07E78;
  --accent: var(--sage-deep);
  --accent-on: #FAF4E6;
}
[data-palette="forest"] {
  --bg: #F2EDE3;
  --bg-2: #E6DFD0;
  --surface: #FBF7EC;
  --ink: #2A2620;
  --ink-2: #4A3F35;
  --muted: #82766A;
  --line: #D4C9B5;
  --sage: #7A8A6F;
  --sage-deep: #5E6F55;
  --rose: #A85C50;
  --rose-deep: #8A4A40;
  --accent: var(--rose-deep);
  --accent-on: #FBF7EC;
}

/* Type variants */
[data-type="playfair"] { --font-serif: "Playfair Display", Georgia, serif; --font-sans: "Inter", system-ui, sans-serif; }
[data-type="cormorant"] { --font-serif: "Cormorant Garamond", Georgia, serif; --font-sans: "Inter", system-ui, sans-serif; }
[data-type="fraunces"]  { --font-serif: "Fraunces", Georgia, serif; --font-sans: "Nunito", system-ui, sans-serif; }

/* Motif intensity */
[data-motif="subtle"] { --motif: 0; }
[data-motif="medium"] { --motif: 1; }
[data-motif="bold"]   { --motif: 2; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5.5vw, 3.5rem); line-height: 1.05; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.25rem); line-height: 1.15; }
h3 { font-size: 1.25rem; line-height: 1.25; }
p  { text-wrap: pretty; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

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

/* ---- Stitching dashed motif ------------------------------------- */
.stitch-divider {
  height: 1px;
  border: 0;
  background-image: linear-gradient(to right, var(--ink-2) 50%, transparent 50%);
  background-size: 10px 1px;
  background-repeat: repeat-x;
  opacity: 0.35;
  margin: 32px 0;
}

.stitch-frame {
  position: relative;
  border-radius: var(--radius);
}
.stitch-frame::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px dashed var(--accent);
  border-radius: calc(var(--radius) - 4px);
  opacity: calc(0.25 + 0.25 * var(--motif));
  pointer-events: none;
}

/* ---- Layout ----------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.section { padding: 56px 0; }
@media (min-width: 768px) { .section { padding: 88px 0; } }

/* ---- Top nav ---------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0;
}
.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1.5px dashed var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 0.9rem;
}
.nav-links { display: none; gap: 28px; }
@media (min-width: 900px) { .nav-links { display: flex; } }
.nav-link {
  font-size: 0.95rem;
  color: var(--ink-2);
  position: relative;
  padding: 6px 0;
}
.nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px;
  background-image: linear-gradient(to right, var(--accent) 50%, transparent 50%);
  background-size: 6px 1px;
}
.nav-cta { display: none; }
@media (min-width: 900px) { .nav-cta { display: inline-flex; } }

.hamburger {
  display: inline-flex; flex-direction: column; gap: 5px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
@media (min-width: 900px) { .hamburger { display: none; } }
.hamburger span { display: block; width: 18px; height: 1.5px; background: var(--ink); }

.mobile-menu {
  position: fixed; inset: 0;
  height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  z-index: 50;
  padding: 20px;
  display: flex; flex-direction: column;
  transform: translateY(-100%);
  transition: transform 0.32s ease;
}
@media (min-width: 900px) {
  .mobile-menu { display: none; }
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 24px; border-bottom: 1px dashed var(--line);
}
.mobile-menu-links {
  display: flex; flex-direction: column; gap: 4px;
  padding: 24px 0;
}
.mobile-menu-link {
  font-family: var(--font-serif);
  font-size: 1.6rem; padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mobile-menu-link.active { color: var(--accent); }

/* ---- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, black 12%); color: var(--accent-on); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink-2); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--accent); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ---- Cards ------------------------------------------------------ */
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.product-card .img-wrap {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-2);
}
.product-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover img { transform: scale(1.04); }
.product-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.product-card .name { font-family: var(--font-serif); font-size: 1.15rem; }
.product-card .desc { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.product-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 12px; }
.product-card .price { font-family: var(--font-serif); font-size: 1.15rem; color: var(--ink-2); }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ---- Chips ------------------------------------------------------ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---- Forms ------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 0.9rem; color: var(--ink-2); font-weight: 600; }
.input, .textarea, .select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.input:focus, .textarea:focus, .select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.textarea { resize: vertical; min-height: 110px; }
.error-text { color: #B0413E; font-size: 0.85rem; }
.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }

/* ---- Toasts ----------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 12px 20px; border-radius: 999px;
  font-size: 0.9rem;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.32s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- Hero ------------------------------------------------------- */
.hero {
  padding: 48px 0 40px;
  background:
    radial-gradient(1100px 500px at 80% -10%, color-mix(in oklab, var(--rose) 30%, transparent), transparent 60%),
    radial-gradient(900px 400px at 0% 110%, color-mix(in oklab, var(--sage) 24%, transparent), transparent 60%),
    var(--bg);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 56px; }
  .hero { padding: 80px 0 64px; }
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 700;
}
.eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background-image: linear-gradient(to right, var(--accent) 50%, transparent 50%);
  background-size: 6px 1px;
}
.hero h1 { margin-top: 18px; }
.hero p.lede { color: var(--ink-2); font-size: 1.1rem; margin: 18px 0 28px; max-width: 52ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  position: relative;
}
.hero-collage .ph {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
}
.hero-collage .ph img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/5; }
.hero-collage .ph:nth-child(1) { grid-row: span 2; aspect-ratio: 3/4; }
.hero-collage .ph:nth-child(1) img { aspect-ratio: 3/4; }
.hero-collage .ph:nth-child(2) { aspect-ratio: 1/1; }
.hero-collage .ph:nth-child(2) img { aspect-ratio: 1/1; }
.hero-collage .ph:nth-child(3) { aspect-ratio: 1/1; }
.hero-collage .ph:nth-child(3) img { aspect-ratio: 1/1; }

/* ---- Service tiles ---------------------------------------------- */
.tiles { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  color: var(--accent);
  border-radius: 12px;
}
.tile h3 { font-family: var(--font-serif); }
.tile p { color: var(--ink-2); }
.tile .more { margin-top: auto; padding-top: 8px; color: var(--accent); font-weight: 700; font-size: 0.9rem; }

/* ---- Reviews ---------------------------------------------------- */
.review-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .review-grid { grid-template-columns: 1fr 1fr; } }
.review {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--line);
  position: relative;
}
.review .stars { letter-spacing: 4px; color: var(--accent); margin-bottom: 12px; font-size: 1.1rem; }
.review blockquote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
}
.review .who { margin-top: 16px; font-size: 0.9rem; color: var(--muted); }
.review .who strong { color: var(--ink-2); font-weight: 700; }

/* ---- Footer ----------------------------------------------------- */
.footer {
  background: var(--ink);
  color: color-mix(in oklab, var(--bg) 88%, white);
  padding: 56px 0 24px;
  margin-top: 64px;
}
.footer .container { max-width: 1200px; }
.footer-grid {
  display: grid; grid-template-columns: 1fr; gap: 32px;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
}
.footer h4 {
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin-bottom: 14px;
  font-weight: 500;
}
.footer a { color: color-mix(in oklab, var(--bg) 80%, white); }
.footer a:hover { color: var(--rose); }
.footer-bottom {
  margin-top: 40px; padding-top: 20px;
  border-top: 1px dashed color-mix(in oklab, var(--bg) 30%, transparent);
  font-size: 0.85rem;
  color: color-mix(in oklab, var(--bg) 60%, white);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* ---- Mailing list ----------------------------------------------- */
.mailing {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.mailing .input { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.16); color: var(--bg); }
.mailing .input::placeholder { color: color-mix(in oklab, var(--bg) 60%, white); }

/* ---- Page header ----------------------------------------------- */
.page-header {
  padding: 56px 0 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.page-header .eyebrow { margin-bottom: 16px; }
.page-header p.sub { color: var(--ink-2); margin-top: 12px; max-width: 60ch; font-size: 1.05rem; }

/* ---- Modal ------------------------------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(46, 42, 36, 0.55);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: grid; place-items: center;
  padding: 16px;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .modal { grid-template-columns: 1fr 1fr; } }
.modal-img { aspect-ratio: 4/5; background: var(--bg-2); overflow: hidden; }
.modal-img img { width: 100%; height: 100%; object-fit: cover; }
.modal-body { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; width: 36px; height: 36px;
  display: grid; place-items: center; cursor: pointer;
  z-index: 2;
}

/* ---- Lessons / process ----------------------------------------- */
.process { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .process { grid-template-columns: repeat(4, 1fr); } }
.process .step {
  padding: 20px 0;
  border-top: 1px dashed var(--line);
}
.process .step .num {
  font-family: var(--font-serif);
  color: var(--accent);
  font-size: 1.6rem;
}
.process .step h4 { font-family: var(--font-serif); font-size: 1.15rem; margin: 6px 0 8px; }

/* ---- Two col layout helper ------------------------------------- */
.two-col {
  display: grid; grid-template-columns: 1fr; gap: 32px;
}
@media (min-width: 900px) { .two-col { grid-template-columns: 1.2fr 1fr; gap: 56px; } }

/* ---- Cart / enquiry rows --------------------------------------- */
.cart-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
  align-items: center;
}
@media (min-width: 768px) { .cart-row { grid-template-columns: 96px 1fr auto auto; } }
.cart-row .thumb {
  width: 80px; height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-2);
}
@media (min-width: 768px) { .cart-row .thumb { width: 96px; } }
.cart-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.qty {
  display: inline-flex; align-items: center; gap: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.qty button { width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; color: var(--ink-2); }
.qty .n { width: 28px; text-align: center; font-weight: 700; }

/* ---- Admin ------------------------------------------------------ */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: middle;
}
.admin-table th {
  background: var(--bg-2);
  font-family: var(--font-serif);
  font-weight: 500;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .row-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }

.admin-mobile { display: grid; gap: 12px; }
@media (min-width: 768px) { .admin-mobile { display: none; } }
.admin-table-wrap { display: none; }
@media (min-width: 768px) { .admin-table-wrap { display: block; } }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}
.admin-card .ac-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }

/* ---- Misc ------------------------------------------------------- */
.grid-products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 560px) { .grid-products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-products { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
@media (min-width: 1200px) { .grid-products { grid-template-columns: repeat(4, 1fr); } }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 0.92rem; }
.kv dd { margin: 0; color: var(--ink); font-size: 0.95rem; }

.scroll-shadow { scroll-behavior: smooth; }

/* Focus visible for a11y */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* skip link */
.skip-link {
  position: absolute; top: -40px; left: 8px;
  background: var(--ink); color: var(--bg);
  padding: 8px 12px; border-radius: 6px;
  z-index: 1000;
}
.skip-link:focus { top: 8px; }

/* Empty state */
.empty {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty h3 { font-family: var(--font-serif); color: var(--ink); margin-bottom: 8px; }

/* Star rating in product card area */
.stars-inline { color: var(--accent); letter-spacing: 2px; font-size: 0.9rem; }
