/* Charmed, by Juliette: storefront styles (direction A, "Marker").
   One marker-handwriting family, the logo's pink and sky blue as fills only,
   deep ink and berry for text and states. */

@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url("/assets/fonts/shantell-sans-latin-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #FFFFFF;
  --ink: #0F3D5C;
  --ink-soft: #3D6683;
  --sky: #7ECBF7;
  --bloom: #F4B3F0;
  --berry: #9B1B8E;
  --sky-wash: #EAF6FE;
  --bloom-wash: #FDEFFB;
  --hair: #CFE3F0;
  --danger: #B42318;

  --body: 1.125rem;      /* 18px */
  --small: 0.875rem;     /* 14px */
  --subhead: 1.5rem;     /* 24px */
  --title: clamp(2rem, 4vw + 1rem, 2.25rem);   /* 36px */
  --headline: clamp(2.25rem, 5vw + 1rem, 3rem); /* 48px */
  --gutter: 16px;
  --radius: 12px;
  --sticky-bar: 0px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-bottom: calc(var(--sticky-bar) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Shantell Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variation-settings: "INFM" 0, "BNCE" 0;
  font-size: var(--body);
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-variation-settings: "INFM" 100, "BNCE" 40;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--title); }
h2 { font-size: var(--subhead); }
h3 { font-size: 1.1875rem; }

p { margin: 0 0 1em; max-width: 65ch; }
/* Long words wrap instead of widening the page when text is enlarged. */
h1, h2, h3, p, legend, figcaption, .name, dd, dt { overflow-wrap: break-word; }
h1 { overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; }

a { color: var(--berry); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--berry);
  outline-offset: 3px;
  border-radius: 4px;
}

.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 {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  display: inline-flex; align-items: center; min-height: 44px;
  background: var(--ink); color: var(--paper); padding: 0 14px; border-radius: 8px;
}
.skip:focus { top: 12px; }

/* Only the test shop (config test_shop) shows this, on every page. */
.test-shop-banner {
  background: repeating-linear-gradient(-45deg, var(--ink) 0 14px, #164B6E 14px 28px);
  color: var(--paper); border-bottom: 4px solid var(--bloom);
  padding: 10px var(--gutter); text-align: center; font-size: 1rem; line-height: 1.4;
}
.test-shop-banner p { margin: 0 auto; max-width: none; }
.test-shop-banner strong { font-weight: 700; }
.test-shop-banner .card-number { white-space: nowrap; }
.gate-logo { width: 150px; margin: 0 0 20px; }

.wrap { width: min(100% - 2 * var(--gutter), 1180px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--hair); }
.site-header .bar { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.site-header .logo { display: block; padding: 6px 0; }
.site-header .logo img { width: 150px; }
.site-nav { flex: 1; min-width: 0; }
.site-nav ul { display: flex; gap: 6px 22px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { font-weight: 600; }
.site-nav a[aria-current="page"]:hover { text-decoration: none; }
.marker-underline { position: absolute; left: -4px; bottom: 4px; width: calc(100% + 8px); height: 10px; }
.marker-underline path { fill: none; stroke: var(--berry); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.bag-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px;
  color: var(--ink); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer;
}
.bag-link:hover .bag-word { text-decoration: underline; }
.bag-count {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 14px; background: var(--sky); color: var(--ink); font-weight: 600; font-size: 0.9375rem;
}

/* ---------- Home ---------- */
.hero { text-align: center; padding: 40px 0 16px; }
.hero h1 { margin: 0 auto 8px; width: min(100%, 520px); }
.hero h1 img { width: 100%; }
.hero p { margin: 0 auto; font-size: 1.25rem; }

.section { padding: 32px 0 64px; }
.section-title { margin-bottom: 18px; }

/* ---------- Design cards ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; }
.card a { display: block; color: var(--ink); text-decoration: none; }
.card .tile { aspect-ratio: 1; border-radius: 14px; background: var(--sky-wash); overflow: hidden; }
.card .tile img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { margin: 10px 0 0; }
.card a:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.card p { margin: 0; font-size: 1rem; }
.card .price { font-weight: 600; }
.badge { display: inline-block; margin-top: 4px; padding: 1px 10px; border-radius: 12px; background: var(--bloom); color: var(--ink); font-size: 0.9375rem; }
.muted { color: var(--ink-soft); }

.empty { padding: 32px 0; }

/* ---------- Prose pages ---------- */
.prose { padding: 40px 0 72px; max-width: 65ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--hair); padding: 28px 0 40px; font-size: 1rem; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; margin: 0; padding: 0; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 28px;
  border: 0; border-radius: 28px; background: var(--ink); color: var(--paper);
  font: inherit; font-weight: 600; font-size: 1.1875rem; text-decoration: none; cursor: pointer;
}
.button[aria-disabled="true"] { background: #DCE8F0; color: var(--ink); cursor: not-allowed; }
.button.secondary { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .site-header .bar { flex-wrap: wrap; gap: 0 12px; padding-top: 6px; }
  .site-header .logo { margin-right: auto; }
  .site-header .bar { min-height: 64px; }
  .site-nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); }
  /* One row on phones; it scrolls sideways rather than wrapping a lone link. */
  .site-nav ul { flex-wrap: nowrap; overflow-x: auto; gap: 16px; padding: 0 var(--gutter); scrollbar-width: none; }
  .site-nav a { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  /* ::backdrop neither matches * nor inherits from its element. */
  *, *::before, *::after, *::backdrop { animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}

/* ---------- Design page ---------- */
.product { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; padding: 40px 0 64px; }
.stage figure { margin: 0; }
.main-photo { aspect-ratio: 1; background: var(--sky-wash); border-radius: 18px; overflow: hidden; }
.main-photo img { width: 100%; height: 100%; object-fit: cover; }
.stage figcaption { margin-top: 10px; font-size: 0.9375rem; color: var(--ink-soft); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 14px 0 0; padding: 0; }
.thumb {
  display: block; padding: 0; border: 2px solid transparent; border-radius: 10px; background: var(--sky-wash);
  overflow: hidden; cursor: pointer; width: 72px; height: 72px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-pressed="true"], .thumb[aria-current="true"] { border-color: var(--ink); }

.product h1 { font-size: var(--headline); margin-top: 4px; }
.product .price { font-size: var(--subhead); color: var(--berry); font-weight: 600; margin: 0 0 16px; }
.product .desc { margin: 0 0 28px; }
.message { padding: 10px 14px; border-radius: 10px; background: var(--sky-wash); }
.message-alert { background: var(--bloom-wash); }
.sold-out { font-size: 1.25rem; font-weight: 600; }

.picker fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.picker legend {
  padding: 0; font-size: var(--subhead); font-weight: 600;
  font-variation-settings: "INFM" 100, "BNCE" 40;
}
.hint { margin: 2px 0 18px; color: var(--ink-soft); font-size: 1rem; }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px; }
.piece-option { position: relative; }
.piece-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.piece { position: relative; display: block; cursor: pointer; }
.piece .tile { display: block; aspect-ratio: 1; background: var(--sky-wash); border-radius: 12px; overflow: hidden; }
.piece .tile img { width: 100%; height: 100%; object-fit: cover; }
.piece .name { display: block; text-align: center; font-size: 0.9375rem; margin-top: 6px; }
.piece .in-bag { display: block; text-align: center; font-size: 0.875rem; color: var(--ink-soft); }
.piece-input:disabled + .piece { cursor: not-allowed; }
.piece-input:disabled + .piece .tile { opacity: 0.55; }

/* The one bold thing: a berry marker loop drawn around the chosen piece. */
.piece .loop {
  position: absolute; left: -9px; top: -9px; width: calc(100% + 18px); aspect-ratio: 1;
  height: auto; overflow: visible; pointer-events: none; opacity: 0;
}
.piece .loop path { fill: none; stroke: var(--berry); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.piece-input:checked + .piece .loop { opacity: 1; }
.piece-input:checked + .piece .loop path { animation: draw-loop 300ms ease-out forwards; }
.piece-input:checked + .piece .name { font-weight: 600; color: var(--berry); }
.piece-input:focus-visible + .piece .tile { outline: 3px solid var(--berry); outline-offset: 4px; }
@keyframes draw-loop { to { stroke-dashoffset: 0; } }

.add-bar { padding: 12px 0 0; background: var(--paper); }
.add-bar .note { min-height: 1.55em; margin: 0 0 12px; }
.add { width: 100%; }
.ship { font-size: 0.9375rem; color: var(--ink-soft); margin: 12px 0 0; }

/* ---------- Bag (page and drawer) ---------- */
.bag-page { padding: 40px 0 72px; max-width: 760px; }
.bag-lines { list-style: none; margin: 0 0 24px; padding: 0; }
.bag-line { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.bag-photo { width: 96px; height: 96px; border-radius: 10px; background: var(--sky-wash); overflow: hidden; }
.bag-photo img { width: 100%; height: 100%; object-fit: cover; }
.bag-text p { margin: 0; }
.bag-name a { color: var(--ink); font-weight: 600; text-decoration: none; text-underline-offset: 3px; }
.bag-name a:hover, .bag-name a:focus-visible { text-decoration: underline; }
.is-unbuyable .bag-photo { opacity: 0.55; }
.unavailable { color: var(--danger); font-size: 1rem; }
.link-button {
  font: inherit; font-size: 1rem; color: var(--berry); background: none; border: 0; padding: 0 4px;
  min-height: 44px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.totals { margin: 0 0 24px; max-width: 360px; margin-left: auto; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals dt { color: var(--ink-soft); }
.totals dd { margin: 0; font-weight: 600; }

.drawer {
  margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(440px, 100%); max-width: 100%;
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
}
.drawer::backdrop { background: rgb(15 61 92 / 0.35); }
.drawer-inner { padding: 24px var(--gutter) 32px; }
.drawer h2 { font-size: var(--subhead); }
.drawer-message:empty { display: none; }
.drawer-subtotal { font-weight: 600; text-align: right; }
.drawer-actions { display: grid; gap: 12px; }

/* On wider screens (desktop, iPad landscape) the drawer glides in from the
   right edge and back out on close. Phones keep the plain full-screen open.
   Browsers without @starting-style just show it, as before; reduced motion
   zeroes the durations below. */
@media (min-width: 861px) {
  .drawer, .drawer::backdrop {
    transition:
      transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 320ms ease,
      display 320ms allow-discrete,
      overlay 320ms allow-discrete;
  }
  .drawer { transform: translateX(100%); }
  .drawer[open] { transform: none; }
  .drawer::backdrop { opacity: 0; }
  .drawer[open]::backdrop { opacity: 1; }
  @starting-style {
    .drawer[open] { transform: translateX(100%); }
    .drawer[open]::backdrop { opacity: 0; }
  }
}

@media (max-width: 860px) {
  .product { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
  .pieces { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  /* Once a piece is chosen, the add button stays in reach on a phone. */
  .has-choice { --sticky-bar: 150px; }
  .has-choice .add-bar { position: sticky; bottom: 0; z-index: 5; padding: 12px var(--gutter) 14px; margin: 0 calc(-1 * var(--gutter)); border-top: 1px solid var(--hair); }
  .has-choice .add-bar .ship { display: none; }
  .bag-line { grid-template-columns: 72px 1fr; }
  .bag-line form { grid-column: 2; }
  .bag-photo { width: 72px; height: 72px; }
}
