/* ==========================================================================
   Attic & Ember — design tokens
   Palette pulled from the actual objects: kraft paper, pumpkin flesh,
   printer's ink, harvest gold, faded porch-light sage.
   ========================================================================== */

:root {
  --paper:      #EDE3D0;
  --paper-deep: #E3D5B8;
  --ink:        #201C18;
  --night:      #14100D;   /* page ground: deep night-brown, darker than ink */
  --night-soft: #1D1712;   /* slightly lifted dark for panels */
  --pumpkin:    #C9622D;
  --pumpkin-deep: #A94E22;
  --gold:       #B98A2E;
  --gold-bright: #D9A84E;  /* readable gold for headings/links on night */
  --sage:       #5C6B4F;
  --sage-light: #93A184;   /* moonlit sage for text on dark */
  --rust:       #7A3B2E;

  --display: "Rye", serif;
  --body: "Lora", Georgia, serif;
  --mono: "Special Elite", "Courier New", monospace;

  --rule: 2px solid var(--ink);
  --radius: 3px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ---- drifting embers canvas (created by assets/js/atmosphere.js) ----
   Fixed behind all content, never intercepts clicks. The JS never builds
   this element under prefers-reduced-motion, so there's nothing to hide,
   but we belt-and-suspenders it here too. */
.atmosphere-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
/* Keep all real content above the embers. The embers only show through
   transparent areas (hero, section padding, page margins) — never over
   the opaque header, cards, or footer, so text stays fully readable. */
.site-header,
main,
.site-footer,
body > .scallop {
  position: relative;
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .atmosphere-canvas { display: none; }
}

body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  /* moonlight from the upper right, a faint warm hearth-glow low left */
  background-image:
    radial-gradient(ellipse 70% 45% at 78% -8%, rgba(185,138,46,0.10) 0, transparent 60%),
    radial-gradient(ellipse 55% 40% at 12% 108%, rgba(201,98,45,0.07) 0, transparent 60%);
  background-attachment: fixed;
}

/* ---- drifting fog — one fixed layer of soft moonlit blooms, slowly
   wandering. Oversized so its edges never show while it moves. ---- */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 42% 30% at 68% 24%, rgba(237,227,208,0.05) 0, transparent 70%),
    radial-gradient(ellipse 36% 26% at 24% 70%, rgba(185,138,46,0.05) 0, transparent 70%);
  animation: fog-drift 90s ease-in-out infinite alternate;
}
@keyframes fog-drift {
  from { transform: translate3d(-2%, -1%, 0); }
  to   { transform: translate3d(2.5%, 1.5%, 0); }
}

a { color: var(--gold-bright); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

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

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- scalloped divider, drawn as a repeating SVG, not an image asset ---- */
.scallop {
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='18'%3E%3Cpath d='M0 0 C6 18 12 18 18 0 C24 18 30 18 36 0 Z' fill='%23201C18'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 36px 18px;
}
.scallop.flip { transform: rotate(180deg); }
.scallop.orange {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='18'%3E%3Cpath d='M0 0 C6 18 12 18 18 0 C24 18 30 18 36 0 Z' fill='%23C9622D'/%3E%3C/svg%3E");
}

/* ---- header ---- */
.site-header {
  background: var(--ink);
  color: var(--paper);
  padding: 18px 0 14px;
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.brand {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.5px;
  color: var(--paper);
  text-decoration: none;
}
.brand span { color: var(--pumpkin); }
.tagline {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--paper-deep);
  opacity: 0.85;
  margin-left: 14px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 14px;
}
.header-right a { color: var(--paper); text-decoration: none; border-bottom: 1px dashed var(--gold); }

/* Snipcart cart trigger, styled like a rubber ink stamp */
.cart-stamp {
  font-family: var(--mono);
  background: transparent;
  border: 2px solid var(--pumpkin);
  color: var(--pumpkin);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transform: rotate(-2deg);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.cart-stamp:hover { transform: rotate(0deg); background: var(--pumpkin); color: var(--paper); }

/* Fire-crackle sound toggle (built by assets/js/ambience.js) */
.sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--paper);
  background: transparent;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sound-toggle:hover { background: var(--gold); color: var(--ink); }
.sound-toggle .slash { opacity: 0; }              /* shown only when muted */
.sound-toggle.muted { color: var(--paper-deep); border-color: var(--sage); opacity: 0.8; }
.sound-toggle.muted .waves { opacity: 0; }
.sound-toggle.muted .slash { opacity: 1; }
/* subtle invitation to click, until the crackle first starts */
.sound-toggle.awaiting { animation: sound-invite 2.4s ease-in-out infinite; }
@keyframes sound-invite {
  50% { border-color: var(--pumpkin); box-shadow: 0 0 10px rgba(201,98,45,0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .sound-toggle.awaiting { animation: none; }
}

/* ---- hero ---- */
.hero {
  padding: 64px 0 48px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.05;
  margin: 0 0 20px;
  color: var(--gold-bright);
  text-shadow: 0 0 32px rgba(185,138,46,0.25);
}
.hero p { font-size: 19px; max-width: 46ch; margin: 0 0 28px; }
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 15px;
  background: var(--pumpkin);
  color: var(--paper);
  padding: 13px 26px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid #060504;
  box-shadow: 4px 4px 0 #060504;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #060504; }
.btn.ghost { background: transparent; color: var(--paper); }

.hero-art { position: relative; }
.hero-art svg { width: 100%; height: auto; }

/* Anchor point for the cat's perch: on the moon's lower horn as it
   sweeps right. Percentages map to the svg viewBox: (300, 227) of
   400x340. */
.moon-seat {
  position: absolute;
  left: 75%;
  top: 66.8%;
  width: 0;
  height: 0;
}

/* ---- section eyebrow ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sage-light);
  margin: 0 0 6px;
}
.section-title {
  font-family: var(--display);
  font-size: 32px;
  margin: 0 0 32px;
  color: var(--paper);
}

/* ---- product grid ---- */
.shop { padding: 56px 0 72px; }
.shop-all-cta { text-align: center; margin-top: 40px; }

/* ---- shop filter + sort controls ---- */
.shop-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 32px;
  padding-bottom: 20px;
  border-bottom: 2px dashed rgba(185,138,46,0.3);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-chip {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--paper);
  background: transparent;
  border: 2px solid var(--sage);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.filter-chip:hover { transform: translateY(-1px); border-color: var(--gold); }
/* active chip fills with that category's badge color (matches the stamps) */
.filter-chip.is-active { border-color: transparent; box-shadow: 2px 2px 0 rgba(0,0,0,0.25); }
.filter-chip.is-active[data-filter="all"] { background: var(--gold); color: var(--ink); }
.filter-chip.is-active[data-filter="vintage"] { background: var(--rust); }
.filter-chip.is-active[data-filter="reproduction"] { background: var(--sage); }
.filter-chip.is-active[data-filter="handmade"] { background: var(--pumpkin-deep); }

.sort-control { display: flex; align-items: center; gap: 8px; }
.sort-control label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sage-light);
}
.sort-select {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--paper);
  background-color: var(--night-soft);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 7px 34px 7px 12px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23D9A84E' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.sort-select option { background: var(--night-soft); color: var(--paper); }
.shop-empty {
  text-align: center;
  font-family: var(--mono);
  color: var(--sage-light);
  padding: 48px 0;
}
@media (max-width: 560px) {
  .shop-controls { flex-direction: column; align-items: stretch; }
  .sort-control { justify-content: space-between; }
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .hero { grid-template-columns: 1fr; padding-top: 40px; } }

.card {
  background: var(--paper-deep);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  /* lit paper object on a dark shelf: deep drop + faint warm halo */
  box-shadow:
    0 10px 30px rgba(0,0,0,0.55),
    0 0 0 1px rgba(185,138,46,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 40px rgba(0,0,0,0.6),
    0 0 28px rgba(201,98,45,0.18);
}
.card-photo {
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(45deg, rgba(32,28,24,0.06) 0 2px, transparent 2px 14px),
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  opacity: 0.55;
  font-family: var(--mono);
  font-size: 13px;
  border-bottom: 2px solid var(--ink);
}
.badge {
  position: absolute;
  top: 10px;
  left: -6px;
  background: var(--sage);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  transform: rotate(-6deg);
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
/* category badge colors, driven by source_type (see _includes/source-badge.html).
   Same stamp — only the background changes, all from the palette. */
.badge--vintage  { background: var(--rust); }          /* genuine vintage */
.badge--repro    { background: var(--sage); }          /* vendor reproduction */
.badge--handmade { background: var(--pumpkin-deep); }  /* made by us */
/* product-page placement: same stamp, sitting inline above the title */
.badge--inline {
  position: static;
  display: inline-block;
  margin-bottom: 12px;
}
.card-body { padding: 16px 18px 20px; }
.card-body h3 {
  font-family: var(--display);
  font-size: 21px;
  margin: 0 0 4px;
  color: var(--rust);
}
.card-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--sage);
  margin: 0 0 10px;
}
.card-desc { font-size: 15px; margin: 0 0 14px; color: var(--ink); opacity: 0.85; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.price {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink);
}
.add-btn {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.add-btn:hover { background: var(--pumpkin-deep); }
.add-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- product page ---- */
.product-page { padding: 48px 0 72px; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
@media (max-width: 760px) { .product-page { grid-template-columns: 1fr; } }
.product-photo {
  aspect-ratio: 1 / 1;
  background:
    repeating-linear-gradient(45deg, rgba(32,28,24,0.06) 0 2px, transparent 2px 14px),
    var(--paper-deep);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  color: var(--ink);
  opacity: 0.55;
  overflow: hidden;
}
.product-photo.has-photo { opacity: 1; }
/* a real photo fills the square frame; the placeholder text still centers */
.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}
/* thumbnail strip under the main product photo */
.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.thumb {
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: 0;
}
.thumb:hover { border-color: var(--sage-light); }
.thumb.is-active { border-color: var(--gold); }
/* video in the main stage */
.product-video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #000;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  display: block;
}
/* these boxes set display, so the [hidden] attribute needs help to win */
.product-video[hidden] { display: none; }
.product-photo[hidden] { display: none; }
/* video thumbnails: first frame + a play badge */
.thumb { position: relative; }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb--video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.28);
}
.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-size: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  pointer-events: none;
}
.product-info h1 {
  font-family: var(--display);
  font-size: 40px;
  color: var(--gold-bright);
  margin: 0 0 8px;
}
.product-price { font-family: var(--mono); font-size: 24px; margin: 0 0 18px; }
.product-desc { font-size: 16px; margin: 0 0 24px; }
.condition-note {
  background: rgba(147,161,132,0.10);
  border-left: 3px solid var(--sage-light);
  padding: 12px 16px;
  font-size: 14px;
  margin: 0 0 24px;
}

/* ---- footer ---- */
.site-footer {
  background: var(--ink);
  color: var(--paper-deep);
  padding: 40px 0 32px;
  font-size: 14px;
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.site-footer h4 {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  color: var(--pumpkin);
  margin: 0 0 10px;
}
.site-footer a { color: var(--paper-deep); }
.fine-print { opacity: 0.6; font-family: var(--mono); font-size: 12px; }

/* ---- the shop cat (built by assets/js/cat.js) ---- */
.page-cat {
  position: fixed;
  bottom: 4px;
  left: 0;
  z-index: 40;
  width: 64px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.page-cat .cat-svg {
  display: block;
  overflow: visible;
  /* soft moonlit rim around the whole silhouette — replaces per-shape
     outlines, so no internal "wireframe" lines */
  filter: drop-shadow(0 0 1.5px rgba(147,161,132,0.45));
}
.page-cat .cat-rig { transform-origin: 50% 100%; }

/* one cat, two poses: side view on the ground, upright in the moon */
.page-cat .pose-sit { display: none; }
.page-cat.seated .pose-sit { display: block; }
.page-cat.seated .pose-walk { display: none; }
.page-cat.seated {
  /* JS parks the cat in .moon-seat; bottom-center lands on the anchor */
  transform: translate(-50%, -100%);
}

/* anticipation: gather down for a beat before springing */
.page-cat.crouch .cat-rig { animation: cat-crouch 0.18s ease-out forwards; }
@keyframes cat-crouch { to { transform: scale(1.07, 0.8); } }

/* mid-leap: lean into the arc, tail streams, legs tucked */
.page-cat.leaping .cat-rig { transform: rotate(9deg) scale(1.02, 0.97); }
.page-cat.leaping .cat-tail { animation: none; transform: rotate(22deg); }
.page-cat.leaping .leg { transform: translateY(-3px); }

/* idle: slow tail sway + occasional blink */
.cat-tail {
  transform-origin: 13px 45px;
  animation: cat-tail-sway 3.6s ease-in-out infinite;
}
@keyframes cat-tail-sway { 50% { transform: rotate(12deg); } }
/* blink by squashing the whole eye group — reads as eyelids closing */
.cat-eye {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: cat-blink 6s infinite;
}
@keyframes cat-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94.5%, 96.5%  { transform: scaleY(0.08); }
}

/* walking: gentle bob, quicker tail, shuffling legs */
.page-cat.walking .cat-rig { animation: cat-bob 0.45s ease-in-out infinite; }
@keyframes cat-bob { 50% { transform: translateY(-1.5px); } }
.page-cat.walking .cat-tail { animation-duration: 1.6s; }
.page-cat.walking .leg-a { animation: cat-step 0.45s ease-in-out infinite; }
.page-cat.walking .leg-b { animation: cat-step 0.45s ease-in-out infinite; animation-delay: 0.22s; }
@keyframes cat-step { 50% { transform: translateY(-2.5px); } }

/* petting reactions */
.page-cat.hop .cat-rig { animation: cat-hop 0.5s ease; }
@keyframes cat-hop {
  30% { transform: translateY(-14px); }
  60% { transform: translateY(0); }
  80% { transform: translateY(-4px); }
}
.page-cat.poof .cat-rig { animation: cat-poof 0.55s ease; }
@keyframes cat-poof {
  20% { transform: scale(1.15, 0.8); }
  50% { transform: scale(0.9, 1.2) translateY(-7px); }
  80% { transform: scale(1.05, 0.95); }
}

/* touchdown: hit squashed, rebound past neutral, settle */
.page-cat.landing .cat-rig { animation: cat-land 0.28s ease-out; }
@keyframes cat-land {
  0%   { transform: scale(1.28, 0.7); }
  55%  { transform: scale(0.93, 1.07); }
  100% { transform: none; }
}

/* the long luxurious stretch: chest down, rear up, held, released */
.page-cat.stretching .cat-rig { animation: cat-stretch 1.5s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes cat-stretch {
  0%   { transform: none; }
  30%  { transform: skewX(-9deg) scaleX(1.26) scaleY(0.84) translateY(2px); }
  62%  { transform: skewX(-9deg) scaleX(1.26) scaleY(0.84) translateY(2px); }
  100% { transform: none; }
}

/* speech bubble */
.cat-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0);
  transform-origin: bottom center;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}
.cat-bubble.show {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  body::before { animation: none; }
  .page-cat, .page-cat * { animation: none !important; }
}
