/* ============================================================================
   DESIGN SYSTEM
   Everything about how this shop LOOKS is controlled from this one block.

   Claude: do NOT ship the defaults. Every shop must look like it was designed
   for that business. Pick or write a preset below, then tune it. Colour alone
   is not a design — change the type, the shapes, the density and the hero too,
   or every shop you build will look like the same shop.
   ========================================================================= */
:root {
  /* --- colour (QoodlesMart's own brand colours) --- */
  --ink: #181410;            /* headings + body text */
  --ink-soft: #776d60;       /* secondary text */
  --paper: #fffcf9;          /* page background */
  --panel: #fef2e8;          /* section bands, image wells */
  --line: #efe0ce;           /* hairlines */
  --accent: #ffab3a;         /* buttons, prices — the logo's orange */
  --accent-ink: #181410;     /* dark text on the accent (passes contrast) */
  --accent-green: #39b549;   /* in stock, free delivery, good news */
  --accent-red: #f15a28;     /* sale, sold out, needs attention */

  /* --- hero (a fixed brand-black band, in both light and dark mode) --- */
  --hero-bg: #141210;
  --hero-ink: #fbf5ee;
  --hero-ink-soft: #c9bcaa;

  /* --- type --- */
  --font-display: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --h1-size: clamp(2rem, 6vw, 3.4rem);
  --h1-weight: 700;
  --h1-spacing: -0.02em;
  --h1-case: none;
  --h1-leading: 1.12;
  --body-size: 16px;

  /* --- shape --- */
  --radius: 16px;
  --radius-btn: 999px;
  --border-width: 1px;
  --shadow: 0 10px 30px rgba(24, 20, 16, .06);

  /* --- rhythm --- */
  --section-pad: 64px;
  --grid-min: 240px;         /* smaller = more products per row */
  --shot-ratio: 4/5;         /* product image shape: 1/1, 4/5, 3/4 */

  color-scheme: light;
}

/* ---- dark mode ------------------------------------------------------------
   Follows the visitor's system setting by default. The toggle in the header
   (#themeToggle) overrides it by setting data-theme on <html>, remembered
   per visitor. Same brand colours, just re-balanced for a dark page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f5ede1;
    --ink-soft: #b9ab97;
    --paper: #15110d;
    --panel: #211a13;
    --line: #37291c;
    --accent: #ffab3a;
    --accent-ink: #181410;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f5ede1;
  --ink-soft: #b9ab97;
  --paper: #15110d;
  --panel: #211a13;
  --line: #37291c;
  --accent: #ffab3a;
  --accent-ink: #181410;
  color-scheme: dark;
}

/* ============================================================================
   PRESETS — copy ONE into :root above and adjust. These are starting points
   for common niches, not rules. Research the business's industry first.
   ----------------------------------------------------------------------------
   FOOD / BAKERY — warm, appetising, food does the talking
     --ink:#2b211c; --paper:#fffdf9; --panel:#f7efe5; --line:#ead9c6;
     --accent:#c2410c; --font-display:"Georgia",serif; --radius:18px;
     --shot-ratio:1/1; --shadow:0 10px 30px rgba(0,0,0,.06);

   FASHION — editorial, lots of air, big imagery, restrained colour
     --ink:#141414; --paper:#ffffff; --panel:#f4f3f1; --line:#e4e2de;
     --accent:#141414; --h1-case:uppercase; --h1-spacing:-0.03em;
     --radius:0; --radius-btn:0; --shot-ratio:3/4; --grid-min:260px;

   BEAUTY / SKINCARE — soft, clean, clinical-but-kind
     --ink:#2a2a33; --paper:#fdfcfb; --panel:#f3f0ee; --line:#e8e3df;
     --accent:#8a7a6d; --radius:20px; --shot-ratio:4/5;
     --shadow:0 8px 24px rgba(0,0,0,.05);

   STREETWEAR / YOUTH — loud, high contrast, tight type
     --ink:#0d0d0d; --paper:#ffffff; --panel:#111111; --line:#1f1f1f;
     --accent:#e8ff3a; --accent-ink:#0d0d0d; --h1-case:uppercase;
     --h1-weight:900; --h1-spacing:-0.04em; --radius:6px; --radius-btn:6px;

   HOME / CRAFT — natural, earthy, handmade
     --ink:#33302b; --paper:#faf8f4; --panel:#efe9df; --line:#ded5c7;
     --accent:#6b7f5e; --radius:12px; --shot-ratio:4/5;
   ========================================================================= */

/* ============================================================================
   LAYOUT VARIANTS — put one on <body> to change the SHAPE of the page, not
   just its colours. Combine with a preset for a look that is properly distinct.

     <body class="hero-split">    image beside the headline (good for fashion)
     <body class="hero-center">   centred headline, generous space (good for food)
     <body class="cards-plain">   no card borders, image-led grid
     <body class="cards-framed">  bordered cards with a tinted well
   ========================================================================= */

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, a, [role="button"], label { cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; max-width: 100%; }

h1, h2, h3 { font-family: var(--font-display); font-weight: var(--h1-weight); line-height: var(--h1-leading);
             letter-spacing: var(--h1-spacing); text-transform: var(--h1-case); margin: 0; }
h1 { font-size: var(--h1-size); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: 1.05rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
section { padding: var(--section-pad) 0; }
.band { background: var(--panel); }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--accent); color: var(--accent-ink);
  border: var(--border-width) solid var(--accent); border-radius: var(--radius-btn);
  padding: .85rem 1.6rem; font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(.92); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); filter: none; }
.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.btn-sm svg { width: 15px; height: 15px; }
.cart-btn svg { width: 17px; height: 17px; }

/* ---- header -------------------------------------------------------------- */
header.site {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--accent), var(--accent-red), var(--accent-green)) 1;
}
.nav-link {
  font-size: .9rem; font-weight: 600; color: var(--ink-soft); text-decoration: none;
}
.nav-link:hover { color: var(--accent); }
@media (max-width: 760px) { .nav-link { display: none; } }

/* A small two-colour accent before every section heading — ties every page
   back to the same brand mark without repeating the full three-colour bar. */
h2::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-red));
  margin-right: 10px; vertical-align: middle;
}
header.site .bar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 10px; flex-wrap: wrap; padding-block: 8px;
}
header.site nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  text-decoration: none; flex: 0 0 auto; line-height: 0;
}
/* height-constrained and width:auto so the logo always keeps its shape —
   max-width:none stops the page's default "img{max-width:100%}" rule from
   squeezing it when the header gets tight on a phone. */
.logo img { height: 36px; width: auto; max-width: none; }
@media (max-width: 480px) {
  .logo img { height: 26px; }
}

/* The logo in light mode, re-coloured for a dark page in dark mode. */
.logo-dark-img { display: none; }
:root[data-theme="dark"] .logo-light-img { display: none; }
:root[data-theme="dark"] .logo-dark-img { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light-img { display: none; }
  :root:not([data-theme="light"]) .logo-dark-img { display: inline-block; }
}

.footer-logo { display: inline-flex; margin-bottom: 12px; line-height: 0; }
.footer-logo img { height: 40px; width: auto; max-width: none; }
.cart-btn { position: relative; }

/* ---- theme toggle ---------------------------------------------------------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; flex: 0 0 auto;
  border: var(--border-width) solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink);
}
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
}
.cart-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px;
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  font-size: .72rem; font-weight: 700; display: grid; place-items: center; padding: 0 5px;
}

/* ---- hero ------------------------------------------------------------------
   A fixed brand-black band — stays black in both light and dark mode, so the
   logo's orange and the rest of the page always open on the same strong note. */
.hero {
  padding: 72px 0 56px;
  background: var(--hero-bg);
  color: var(--hero-ink);
}
.hero p.lede { font-size: 1.1rem; color: var(--hero-ink-soft); max-width: 46ch; margin: 1rem 0 1.8rem; }
.hero .muted { color: var(--hero-ink-soft); }
.brand-bar {
  width: 64px; height: 4px; border-radius: 999px; margin-top: 28px;
  background: linear-gradient(90deg, var(--accent) 0 33%, var(--accent-red) 33% 66%, var(--accent-green) 66% 100%);
}
body.hero-center .brand-bar { margin-left: auto; margin-right: auto; }

/* ---- product grid -------------------------------------------------------- */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr)); }
.card { border: var(--border-width) solid var(--line); border-radius: var(--radius); overflow: hidden;
        background: var(--paper); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card .shot { aspect-ratio: var(--shot-ratio); background: var(--panel); position: relative; display: block; }
.card .shot img { width: 100%; height: 100%; object-fit: contain; }

/* A card with more than one photo becomes a swipeable strip — no library,
   just native scroll-snap, so it works with a finger on a phone and a mouse
   drag on a desktop trackpad alike. */
.card .shot-track {
  display: flex; width: 100%; height: 100%; overflow-x: auto;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.card .shot-track::-webkit-scrollbar { display: none; }
.card .shot-track img {
  flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain;
  scroll-snap-align: start; background: var(--panel);
}
.card .shot-dots {
  position: absolute; left: 0; right: 0; bottom: 8px; z-index: 2;
  display: flex; justify-content: center; gap: 5px; pointer-events: none;
}
.card .shot-dots span {
  width: 6px; height: 6px; border-radius: 999px; background: rgba(0,0,0,.18);
  box-shadow: 0 0 0 1px rgba(255,255,255,.6);
}
.card .shot-dots span.is-on { background: var(--accent); box-shadow: none; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .row { gap: 20px; margin-top: 2px; }
.card .row .btn { margin-left: auto; }
.card .price { font-weight: 700; color: var(--accent); }
.card .desc {
  font-size: .87rem; color: var(--ink-soft); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sold-out { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-red); }
#freeDelivery { color: var(--accent-green); font-weight: 600; }

/* ---- delivery disclosure --------------------------------------------------- */
.delivery-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; list-style: none; font-weight: 600;
  padding: 14px 18px; border: var(--border-width) solid var(--line); border-radius: var(--radius);
  background: var(--paper);
}
.delivery-details summary::-webkit-details-marker { display: none; }
.delivery-details summary svg { width: 18px; height: 18px; flex: 0 0 auto; transition: transform .2s ease; }
.delivery-details[open] summary svg { transform: rotate(180deg); }
.delivery-details[open] summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }

/* A card's photo and name open the full details — the short description on
   the card is a taster, never the whole thing, so a feature-heavy product
   (like a smart watch) still gets read in full before someone buys it. */
.card .shot, .card h3 a { cursor: pointer; }
.card h3 a { color: inherit; text-decoration: none; }
.card .view-more {
  display: inline-block; font-size: .8rem; font-weight: 600; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 2px;
}
.card .view-more:hover { color: var(--ink); }

/* ---- the product's own page ------------------------------------------------
   Photos on one side, the name/price/buy/description on the other, so both
   are visible together — this is a whole page, not a quick taster. */
.product-layout { display: grid; gap: 36px; align-items: start; }
@media (min-width: 860px) {
  .product-layout { grid-template-columns: 1.05fr .95fr; }
  .product-layout-media { position: sticky; top: 90px; }
}
.product-modal-shot {
  width: 100%; aspect-ratio: var(--shot-ratio); border-radius: var(--radius);
  overflow: hidden; background: var(--panel); margin-bottom: 14px;
}
.product-modal-shot img { width: 100%; height: 100%; object-fit: contain; }
.product-modal-desc { white-space: pre-line; color: var(--ink-soft); margin: 10px 0 18px; }
.pm-thumbs { display: flex; gap: 8px; margin-bottom: 4px; }
.pm-thumb {
  width: 52px; height: 52px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; background: var(--panel); flex: 0 0 auto;
}
.pm-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pm-thumb.is-on { border-color: var(--accent); }
.in-stock {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-green);
}

/* ---- cart drawer --------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--paper); z-index: 50; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.14);
}
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer .items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer footer { border-top: 1px solid var(--line); padding: 18px 20px; display: grid; gap: 10px; }
.line { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line img { width: 62px; height: 62px; object-fit: cover; border-radius: 10px; background: var(--panel); }
.qty { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.qty button { border: 0; background: none; font-size: 1.1rem; line-height: 1; padding: 2px 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.total { font-weight: 700; font-size: 1.15rem; }

/* ---- forms / modal ------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.sheet { background: var(--paper); border-radius: var(--radius); width: min(520px, 100%); padding: 22px; max-height: 92vh; overflow-y: auto; }
label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: .72rem .85rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.err { color: #b3261e; font-size: .85rem; margin-top: 8px; }
.ok { color: #1b5e20; font-size: .9rem; }

/* ---- footer -------------------------------------------------------------- */
footer.site { border-top: 1px solid var(--line); padding: 40px 0; font-size: .9rem; color: var(--ink-soft); }
footer.site a { text-decoration: none; }

/* ---- tables (admin) ------------------------------------------------------ */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.tag { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--panel); }
.tag.paid { background: #e6f4ea; color: #1b5e20; }
.tag.pending { background: #fdf0e3; color: #8a4b12; }

.hidden { display: none !important; }
@media (max-width: 640px) { section { padding: 40px 0; } .hero { padding: 48px 0 36px; } }


/* ============================================================================
   LAYOUT VARIANTS
   Put one (or more) on <body>. These change the page's shape, which is what
   stops two shops built from this template looking like the same shop.
   ========================================================================= */

/* Centred hero — generous, appetising. Good for food and craft. */
body.hero-center .hero { text-align: center; padding-top: 88px; }
body.hero-center .hero p.lede { margin-left: auto; margin-right: auto; }

/* Split hero — headline beside a picture. Good for fashion and beauty.
   Add <img class="hero-shot" src="..."> inside .hero > .wrap to use it. */
/* Only becomes two columns when a hero image is actually present, otherwise the
   headline, lede and button would each become their own grid cell. */
body.hero-split .hero .wrap:has(.hero-shot) {
  display: grid; gap: 32px 40px; align-items: center;
  grid-template-areas: "shot" "h" "lede" "cta";
}
body.hero-split .hero .wrap:has(.hero-shot) > h1 { grid-area: h; }
body.hero-split .hero .wrap:has(.hero-shot) > p.lede { grid-area: lede; }
body.hero-split .hero .wrap:has(.hero-shot) > .btn { grid-area: cta; justify-self: start; }
body.hero-split .hero .wrap:has(.hero-shot) > .hero-shot { grid-area: shot; }
@media (min-width: 860px) {
  body.hero-split .hero .wrap:has(.hero-shot) {
    grid-template-columns: 1.05fr .95fr;
    grid-template-areas: "h shot" "lede shot" "cta shot";
    align-content: center;
  }
}
.hero-shot {
  width: 100%; border-radius: var(--radius); object-fit: cover;
  aspect-ratio: 4/5; background: var(--panel);
}

/* Plain cards — no border or background, the photograph does the work. */
body.cards-plain .card { border: 0; box-shadow: none; background: transparent; border-radius: 0; }
body.cards-plain .card .shot { border-radius: var(--radius); }
body.cards-plain .card .body { padding: 12px 2px 0; }

/* Framed cards — tinted image well inside a bordered card. */
body.cards-framed .card { background: var(--paper); }
body.cards-framed .card .shot { margin: 10px 10px 0; border-radius: calc(var(--radius) - 6px); overflow: hidden; }
body.cards-framed .card .body { padding: 12px 16px 16px; }

/* Dark shops: when --paper is dark, inputs and the drawer must follow. */
body.dark .drawer, body.dark .sheet { background: var(--paper); color: var(--ink); }
body.dark input, body.dark select, body.dark textarea {
  background: var(--panel); color: var(--ink); border-color: var(--line);
}
