/*
Theme Name: Twirlables
Theme URI: https://nanastoyworkshop.com/
Author: Nana's Workshop
Description: Custom Twirlables theme converted from the Claude/Netlify static site, with WooCommerce support and the interactive 3D builder.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: twirlables
*/
:root {
  --paper: #faf3e7;
  --paper-deep: #f2e8d5;
  --ink: #3b2f2a;
  --ink-soft: #6b5d54;
  --red: #c12e1f; /* Bambu PLA Red, matches the pieces */
  --mustard: #e3a63b;
  --sage: #7c9a6d;
  --sky: #6fa8c9;
  --plum: #b45a9d;
  --radius: 22px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

/* subtle paper grain */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 50;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.23 0 0 0 0 0.18 0 0 0 0 0.16 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 700; }
.hand { font-family: 'Caveat', cursive; }

/* ===== stage ===== */
#stage {
  position: fixed; inset: 0;
  z-index: 0;
}
#scene { width: 100%; height: 100%; display: block; }

/* ===== nav ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 48px);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', serif; font-weight: 800;
  font-size: 1.25rem; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 28px; height: 28px;
  background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%20100%20100'%3E%3Cpath%20fill%3D'%23c12e1f'%20fill-rule%3D'evenodd'%20d%3D'M50.00%202.00%20A13.5%2013.5%200%200%201%2066.42%204.89%20A13.5%2013.5%200%200%201%2080.85%2013.23%20A13.5%2013.5%200%200%201%2091.57%2026.00%20A13.5%2013.5%200%200%201%2097.27%2041.66%20A13.5%2013.5%200%200%201%2097.27%2058.34%20A13.5%2013.5%200%200%201%2091.57%2074.00%20A13.5%2013.5%200%200%201%2080.85%2086.77%20A13.5%2013.5%200%200%201%2066.42%2095.11%20A13.5%2013.5%200%200%201%2050.00%2098.00%20A13.5%2013.5%200%200%201%2033.58%2095.11%20A13.5%2013.5%200%200%201%2019.15%2086.77%20A13.5%2013.5%200%200%201%208.43%2074.00%20A13.5%2013.5%200%200%201%202.73%2058.34%20A13.5%2013.5%200%200%201%202.73%2041.66%20A13.5%2013.5%200%200%201%208.43%2026.00%20A13.5%2013.5%200%200%201%2019.15%2013.23%20A13.5%2013.5%200%200%201%2033.58%204.89%20A13.5%2013.5%200%200%201%2050.00%202.00%20Z%20M59%2050%20A9%209%200%201%200%2041%2050%20A9%209%200%201%200%2059%2050%20Z%20M66.73%2047.64A16.5%204.6%20277%201%200%2070.75%2014.88A16.5%204.6%20277%201%200%2066.73%2047.64Z%20M47.64%2033.27A16.5%204.6%20187%201%200%2014.88%2029.25A16.5%204.6%20187%201%200%2047.64%2033.27Z%20M33.27%2052.36A16.5%204.6%2097%201%200%2029.25%2085.12A16.5%204.6%2097%201%200%2033.27%2052.36Z%20M52.36%2066.73A16.5%204.6%207%201%200%2085.12%2070.75A16.5%204.6%207%201%200%2052.36%2066.73Z'%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;
  filter: drop-shadow(0 1.5px 0 rgba(59,47,42,.25));
  animation: spin-slow 14s linear infinite;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.nav nav { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 30px); }
.nav nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem;
}
.nav nav a:not(.nav-cta):hover { text-decoration: underline wavy var(--red) 2px; text-underline-offset: 5px; }
.nav-basket { display: flex; align-items: center; gap: 6px; }
.nav-basket svg { display: block; }
.nav-basket:hover { color: var(--red) !important; }
.nav-cta {
  background: var(--red);
  color: #ffffff !important;
  text-align: center;
  padding: 10px 20px;
  border-radius: 999px;
  transform: rotate(-1.5deg);
  transition: transform .2s, background-color .2s;
  box-shadow: 0 4px 10px rgba(193, 46, 31, 0.25);
}

.nav-cta:hover {
  background: #a82418;   /* slightly darker red */
  color: #ffffff !important;
  transform: rotate(1.5deg) scale(1.04);
}

/* ===== scroll track ===== */
#scrolly {
  position: relative; z-index: 10;
  height: 520vh;
  pointer-events: none;
}
#scrolly a, #scrolly button { pointer-events: auto; }

.hero {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(24px, 6vw, 90px);
  max-width: 780px;
}
.kicker {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  color: var(--red);
  transform: rotate(-2deg);
  margin-bottom: 8px;
}
.hero h1 {
  font-size: clamp(3rem, 8.5vw, 7rem);
  line-height: .98;
  letter-spacing: -.01em;
}
.hero h1 em {
  font-style: italic; color: var(--red);
  font-variation-settings: 'SOFT' 100;
}
.lede {
  margin-top: 24px;
  max-width: 420px;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.6;
  color: var(--ink-soft);
  font-weight: 600;
}
.scroll-hint {
  margin-top: 40px;
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-soft);
  animation: bob 2.4s ease-in-out infinite;
}
.scroll-hint .hand { font-size: 1.3rem; }
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(8px);} }

/* captions during the drop */
.drop-captions { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.caption {
  position: absolute; top: 0; height: 100vh; right: clamp(20px, 7vw, 110px);
  display: flex; flex-direction: column; justify-content: center;
  text-align: right;
  opacity: 0; transform: translateY(30px);
  transition: opacity .5s ease, transform .5s ease;
}
.caption.on { opacity: 1; transform: translateY(0); }
.caption h2 { font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1.05; }
.cap-note { font-size: clamp(1.2rem, 2vw, 1.5rem); color: var(--red); transform: rotate(1.5deg); margin-bottom: 6px; }
@media (max-width: 720px) {
  .caption { right: 20px; left: 20px; text-align: center; align-items: center; }
}

/* ===== content over stage ===== */
.paper { position: relative; z-index: 20; background: var(--paper); }
.wave { display: block; width: 100%; height: 60px; margin-top: -59px; position: relative; z-index: 21; }
.wave-footer { margin-top: 0; background: var(--paper); }

section { padding: clamp(60px, 9vw, 120px) clamp(24px, 6vw, 90px); }
.section-note { font-size: clamp(1.3rem, 2.2vw, 1.7rem); color: var(--red); transform: rotate(-1.5deg); text-align: center; }
.section-title {
  text-align: center;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  margin: 8px auto 0;
  max-width: 800px;
  line-height: 1.1;
}

/* how it works */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(20px, 3vw, 40px);
  max-width: 1050px; margin: clamp(40px, 6vw, 70px) auto 0;
}
.step {
  background: #fff;
  border: 2px dashed rgba(59,47,42,.25);
  border-radius: var(--radius);
  padding: 34px 28px 30px;
  text-align: center;
  transition: transform .25s ease;
}
.tilt-l { transform: rotate(-1.4deg); }
.tilt-r { transform: rotate(1.4deg); }
.step:hover, .card:hover { transform: rotate(0) translateY(-6px); }
.step-num {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--mustard);
  color: var(--ink);
  font-family: 'Fraunces', serif; font-weight: 800; font-size: 1.5rem;
  display: grid; place-items: center;
  box-shadow: inset 0 -4px 0 rgba(59,47,42,.18);
}
.step:nth-child(2) .step-num { background: var(--sky); }
.step:nth-child(3) .step-num { background: var(--sage); }
.step h3 { font-size: 1.3rem; margin-bottom: 10px; }
.step p { color: var(--ink-soft); line-height: 1.55; font-size: .95rem; }

/* shop */
.shop { background: var(--paper-deep); border-radius: 60px 60px 0 0; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(16px, 2vw, 24px);
  max-width: 1120px; margin: clamp(32px, 5vw, 56px) auto 0;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  box-shadow: 0 8px 22px rgba(59,47,42,.09);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-6px); }
/* shared square image well so every card matches */
.card .toy, .card .mini3d {
  aspect-ratio: 1 / 1; height: auto;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(59,47,42,.03), rgba(59,47,42,.06));
  overflow: hidden;
}
.card-media { position: relative; display: block; border-radius: 14px; }
.card-photo {
  width: 100%; aspect-ratio: 4 / 5;
  object-fit: cover; object-position: center;
  border-radius: 14px; display: block;
}
.mini-badge + .xmas-tag { top: 48px; left: auto; right: 10px; }
.xmas-tag {
  position: absolute; top: 10px; left: 10px;
  background: #3f8e43; color: #fff;
  font-size: .95rem; line-height: 1;
  padding: 5px 11px 4px; border-radius: 999px;
  transform: rotate(-2deg);
  pointer-events: none;
}
.dims {
  font-size: .78rem; color: var(--ink-soft);
  text-align: center; margin-top: 2px;
}
.builder-buy .dims { font-size: .85rem; }
.card h3 { font-size: 1.2rem; margin: 12px 0 0; text-align: center; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 12px;
}
.card-foot .btn { padding: 10px 16px; font-size: .85rem; white-space: nowrap; }
.price s { opacity: .5; font-size: .68em; font-weight: 700; margin-right: 5px; }
.save-note { font-size: 1.2rem; color: var(--red); transform: rotate(-2deg); }

/* mix & match promo card */
.mix-card {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 18px;
  background: #fff;
  border: 2px dashed var(--red);
  border-radius: var(--radius);
  padding: 26px 30px;
  text-decoration: none; color: var(--ink);
  transition: transform .25s ease;
}
.mix-card:hover { transform: translateY(-4px) rotate(-.4deg); }
.mix-card h3 { font-size: 1.6rem; margin: 2px 0 6px; }
.mix-card p { color: var(--ink-soft); font-size: .95rem; max-width: 46ch; }
.mix-note { font-size: 1.25rem; color: var(--red); transform: rotate(-1.5deg); }
.mix-dots { display: flex; gap: 6px; margin-top: 10px; }
.mix-dots i {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.mixhome { padding-top: 0; }
.mixhome .mix-card { max-width: 1000px; margin: 0 auto; }

/* coming-soon placeholders */
.card-soon { opacity: .72; }
.card-soon .toy { filter: grayscale(.4); }
.soon-tag {
  font-family: 'Caveat', cursive; font-size: 1.15rem;
  color: var(--ink-soft); transform: rotate(-2deg); white-space: nowrap;
}
.price { font-family: 'Fraunces', serif; font-weight: 800; font-size: 1.3rem; }
.btn {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .9rem;
  text-align: center;
  background: var(--red); color: #fff;
  border: none; border-radius: 999px;
  padding: 11px 20px; cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
  transition: transform .15s;
}
a.btn { text-decoration: none; display: inline-block; }
.btn:hover { transform: scale(1.05) rotate(-1deg); }
.btn:active { transform: scale(.97); }

/* CSS toy illustrations: stacked discs on a pole */
.toy {
  position: relative;
  height: 230px;
  display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-start;
  gap: 4px;
  padding-bottom: 12px;
}
.toy::before { /* pole */
  content: '';
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 10px; height: calc(100% - 20px);
  background: linear-gradient(90deg, #caa06c, #e5c795 45%, #caa06c);
  border-radius: 6px 6px 0 0;
}
/* compact placeholders */
.toy-soon { height: 150px; }
.toy-soon span { height: 20px; }
.toy::after { /* base */
  content: '';
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 110px; height: 14px;
  background: linear-gradient(90deg, #b98f5d, #dcbd8a 45%, #b98f5d);
  border-radius: 7px;
}
.toy span {
  position: relative; z-index: 1;
  width: var(--w, 84px); height: 22px;
  min-width: 40px;
  background: var(--c);
  border-radius: 11px;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.15), 0 2px 3px rgba(59,47,42,.15);
  animation: settle .5s ease backwards;
}
.toy-tree span { width: var(--w); }
.toy span:nth-child(1) { animation-delay: .05s; }
.toy span:nth-child(2) { animation-delay: .15s; }
.toy span:nth-child(3) { animation-delay: .25s; }
.toy span:nth-child(4) { animation-delay: .35s; }
.toy span:nth-child(5) { animation-delay: .45s; }
@keyframes settle {
  from { transform: translateY(-60px) rotate(8deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.toy-eye {
  position: absolute; z-index: 2;
  top: 26px; left: calc(50% + 14px);
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--ink);
}

/* story */
.story-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.story .section-title { margin-bottom: 26px; }
.story-title { max-width: 20ch; text-wrap: balance; }
.story p:not(.hand) { color: var(--ink-soft); line-height: 1.75; margin-bottom: 18px; font-size: 1.05rem; }
.signoff { font-size: 2rem; color: var(--red); transform: rotate(-3deg); }

/* footer */
footer { position: relative; z-index: 20; background: var(--ink); color: var(--paper); }
.foot-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 30px clamp(24px, 6vw, 90px) 50px;
  display: flex; flex-wrap: wrap; gap: 30px; align-items: center; justify-content: space-between;
}
.foot-brand { color: var(--paper); font-size: 1.2rem; }
.foot-tag { color: var(--mustard); font-size: 1.3rem; transform: rotate(-2deg); }
.foot-links { display: flex; gap: 22px; }
.foot-links a { color: var(--paper); text-decoration: none; font-weight: 700; font-size: .92rem; opacity: .85; }
.foot-links a:hover { opacity: 1; text-decoration: underline wavy var(--mustard) 2px; text-underline-offset: 5px; }
.foot-copy { width: 100%; text-align: center; font-size: .82rem; opacity: .55; }

/* mini 3D viewer on the shop card */
.mini3d {
  position: relative; height: 230px;
  cursor: grab; border-radius: 14px;
  background: linear-gradient(180deg, rgba(59,47,42,.03), rgba(59,47,42,.07));
}
.mini3d:active { cursor: grabbing; }
.mini3d canvas { width: 100%; height: 100%; display: block; border-radius: 14px; }
.mini-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--ink); color: var(--paper);
  font-size: 1.05rem; line-height: 1;
  padding: 5px 12px 4px; border-radius: 999px;
  transform: rotate(2deg);
  pointer-events: none;
}
.build-link {
  display: block; margin-top: 10px; text-align: right;
  font-size: 1.15rem; color: var(--red); text-decoration: none;
  transform: rotate(-1deg);
}
.build-link:hover { text-decoration: underline wavy var(--red) 2px; text-underline-offset: 4px; }

/* standalone pages (no 3D stage) */
.subpage .shop {
  padding-top: clamp(120px, 16vw, 170px);
  border-radius: 0;
  min-height: calc(100vh - 60px);
}

/* ===== interactive builder ===== */
.builder-page { overflow: hidden; }
.builder { position: fixed; inset: 0; }
.builder #scene { width: 100%; height: 100%; display: block; touch-action: none; }
.builder-head {
  position: absolute; top: 90px; left: clamp(20px, 5vw, 70px);
  pointer-events: none;
}
.builder-head h1 { font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; }
.builder-head .section-note { text-align: left; }
.builder-tip { margin-top: 14px; font-size: 1.25rem; color: var(--ink-soft); }
.builder-buy {
  position: absolute; top: 100px; right: clamp(20px, 5vw, 70px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 2px dashed rgba(59,47,42,.35);
  box-shadow: none;
}
.tray {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; flex-wrap: nowrap; justify-content: center;
  max-width: min(96vw, 940px);
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(6px);
  border: 2px dashed rgba(59,47,42,.25);
  border-radius: 999px;
  padding: 10px 18px;
}
/* grouped tray (mix & match) */
.tray.grouped {
  flex-direction: column; align-items: stretch;
  gap: 2px; border-radius: 26px;
  padding: 10px 16px;
  max-width: min(97vw, 880px);
}
.tray-group { display: flex; align-items: center; gap: 6px; }
.tray-label {
  flex: 0 0 96px; text-align: right; padding-right: 6px;
  font-size: 1.05rem; color: var(--ink-soft);
}
.tray.grouped .chip-name { display: none; }
.tray.grouped .chip-num { width: 42px; height: 42px; font-size: .9rem; }
.chip {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  padding: 4px 2px;
  transition: transform .15s;
}
.chip:hover:not(:disabled) { transform: translateY(-4px) rotate(-2deg); }
.chip-num {
  width: 66px; height: 66px;
  background: center / contain no-repeat;
  color: #fff; font-size: 1.05rem;
  display: grid; place-items: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.65), 0 0 5px rgba(0,0,0,.45);
  filter: drop-shadow(0 2px 2px rgba(59,47,42,.25));
}
.chip-name { display: none; }
.chip.used { opacity: .3; cursor: default; }
.chip.used .chip-num { filter: grayscale(.6); }
.done-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-4deg);
  background: var(--mustard); color: var(--ink);
  border-radius: var(--radius);
  padding: 18px 34px; text-align: center;
  box-shadow: 0 12px 30px rgba(59,47,42,.25);
  animation: pop .45s cubic-bezier(.2,1.6,.4,1);
  pointer-events: none;
}
.done-badge .hand { font-size: 1.6rem; color: var(--red); }
.done-badge p:last-child { font-family: 'Fraunces', serif; font-weight: 800; font-size: 1.3rem; }
@keyframes pop { from { transform: translate(-50%,-50%) rotate(-4deg) scale(.4); opacity: 0; } }
@media (max-width: 720px) {
  .builder-head { top: 78px; right: clamp(20px, 5vw, 70px); }
  .builder-head h1 { font-size: 1.9rem; }
  .builder-tip { display: none; }
  /* bottom control bar: price + actions above, pieces strip below */
  .builder-buy {
    position: fixed; inset: auto 0 96px 0; top: auto;
    flex-direction: row; align-items: center; justify-content: center;
    gap: 14px; padding: 0 16px;
  }
  .builder-buy .price { font-size: 1.4rem; }
  .builder-buy .btn { padding: 12px 18px; }
  .tray {
    left: 0; right: 0; bottom: 0; transform: none;
    max-width: none; width: 100%;
    border-radius: 20px 20px 0 0;
    border-width: 2px 0 0;
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    gap: 14px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
  .chip { flex: 0 0 auto; }
  .chip-name { display: none; }
  .chip-num { width: 44px; height: 44px; }
  .tray.grouped { border-radius: 20px 20px 0 0; }
  .tray-group { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tray-label { flex: 0 0 78px; font-size: .95rem; }
  .tray.grouped .chip-num { width: 34px; height: 34px; }
  .mix .builder-head { max-width: 48vw; }
  .mix .builder-head h1 { font-size: 1.5rem; }
  .mix .builder-buy {
    top: 84px; bottom: auto; left: auto; right: 12px;
    width: min(48vw, 195px);
    flex-direction: column; align-items: flex-end; gap: 8px;
  }
  .mix .builder-buy .dims,
  .mix .builder-buy .save-note { text-align: right; }
  .mix .builder-buy .btn {
    width: auto; align-self: flex-end;
    max-width: 140px; padding: 10px 14px; font-size: .82rem;
  }
  .foot-links { width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
  .foot-inner { text-align: center; justify-content: center; }
}

/* tablet range */
@media (min-width: 721px) and (max-width: 1100px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .step:nth-child(3) {
    grid-column: 1 / -1;
    width: calc(50% - clamp(10px, 1.5vw, 20px));
    margin-inline: auto;
  }
  .chip-name { display: none !important; }
  .tray { max-width: 98vw; flex-wrap: nowrap; }
  .tray.grouped { max-width: none; flex-wrap: wrap; padding: 10px 30px; }
  .tray-group { flex-wrap: nowrap; }
  .tray.grouped .chip { padding: 4px 1px; }
  .tray-label { flex: 0 0 76px; }
}

/* reduced motion: skip the scroll theater */
@media (prefers-reduced-motion: reduce) {
  #scrolly { height: 100vh; }
  .caption { display: none; }
  .brand-mark, .scroll-hint { animation: none; }
  html { scroll-behavior: auto; }
}

/* ===== WordPress and WooCommerce integration ===== */
body.admin-bar .nav { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar .nav { top: 46px; }
}

.wp-page,
.woocommerce-page main.wp-page {
  min-height: 100vh;
  padding: clamp(120px, 15vw, 165px) clamp(24px, 6vw, 90px) clamp(70px, 9vw, 120px);
  background: var(--paper);
}
.wp-content {
  max-width: 1100px;
  margin: 0 auto;
  line-height: 1.7;
}
.wp-content > * + * { margin-top: 1.1em; }
.wp-content h1,
.wp-content h2,
.wp-content h3 { line-height: 1.15; }
.wp-content a { color: var(--red); }
.wp-content img { max-width: 100%; height: auto; }

/* WooCommerce: preserve the custom look while leaving checkout/cart functional. */
.woocommerce .woocommerce-breadcrumb { color: var(--ink-soft); margin-bottom: 24px; }
.woocommerce div.product { max-width: 1100px; margin: 0 auto; }
.woocommerce div.product .product_title { font-size: clamp(2rem, 4.5vw, 3.4rem); }
.woocommerce div.product p.price,
.woocommerce div.product span.price { color: var(--red); font-family: 'Fraunces', serif; font-weight: 800; }
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 13px 24px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover {
  background: var(--ink);
  color: var(--paper);
}
.woocommerce table.shop_table,
.woocommerce form.checkout_coupon,
.woocommerce form.login,
.woocommerce form.register {
  border-radius: var(--radius);
  background: #fff;
}
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce select {
  border: 1px solid rgba(59,47,42,.25);
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
}
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border-radius: 14px;
  background: #fff;
}

/* Prevent WordPress's default block spacing from changing the bespoke templates. */
.twirlables-template main,
.twirlables-template section { max-width: none; }

/* Screen-reader text. */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* Basket/cart and checkout product images */
.woocommerce-cart .product-thumbnail img,
.woocommerce-checkout .product-thumbnail img,
.woocommerce-checkout-review-order img,
.woocommerce-checkout .wc-block-components-order-summary-item__image img,
.woocommerce-cart .wc-block-cart-item__image img {
    width: 80px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

/* Mobile navigation */
@media (max-width: 600px) {

    /* Hide How It Works, Our Story, and Assembly Instructions */
    .nav nav a:nth-child(1),
    .nav nav a:nth-child(2),
    .nav nav a:nth-child(3) {
        display: none !important;
    }

    .nav {
        padding: 14px 12px;
    }

    .nav nav {
        gap: 10px;
    }
}

/* Completion message: show briefly, then fade away */
.done-badge {
  animation:
    pop .45s cubic-bezier(.2, 1.6, .4, 1),
    fade-done .6s ease 2.4s forwards;
}

@keyframes fade-done {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* Keep the message near the top on phones */
@media (max-width: 720px) {
  .done-badge {
    top: 115px;
    left: 50%;
    transform: translateX(-50%) rotate(-4deg);
    padding: 12px 22px;
    width: max-content;
    max-width: calc(100vw - 32px);
  }

  .done-badge .hand {
    font-size: 1.25rem;
  }

  .done-badge p:last-child {
    font-size: 1rem;
  }
}
/* ===== Custom empty-cart hero ===== */

/* Hide WooCommerce's default sad-face heading */
.woocommerce-cart .wc-block-cart__empty-cart__title-with-icon {
  display: none !important;
}

.empty-cart-hero {
  max-width: 760px;
  margin: 0 auto 55px;
  padding: 30px 24px 38px;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  border: 2px dashed rgba(59, 47, 42, 0.18);
  border-radius: 30px;
}

.empty-cart-hero[hidden] {
  display: none !important;
}

.empty-cart-hero h1 {
  max-width: 620px;
  margin: 6px auto 12px;
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  color: var(--ink);
}

.empty-cart-note {
  margin-top: 12px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  color: var(--red);
  transform: rotate(-1.5deg);
}

.empty-cart-copy {
  max-width: 520px;
  margin: 0 auto 22px;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

.empty-cart-shop-button {
  background: var(--red) !important;
  color: #ffffff !important;
  padding: 13px 26px !important;
  font-size: 1rem;
}

/* Rotating Twirlapillar stage */
.empty-cart-toy-stage {
  width: 210px;
  height: 230px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  perspective: 700px;
}

.empty-cart-twirlapillar {
  position: relative;
  width: 180px;
  height: 220px;
  transform-style: preserve-3d;
  animation: empty-cart-toy-spin 14s linear infinite;
}

.empty-cart-pole {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 13px;
  height: 185px;
  transform: translateX(-50%);
  border-radius: 7px;
  background: linear-gradient(
    90deg,
    #d8d8d8,
    #ffffff 42%,
    #bdbdbd
  );
  box-shadow: 2px 3px 7px rgba(59, 47, 42, 0.2);
}

.empty-cart-piece {
  position: absolute;
  left: 50%;
  height: 24px;
  transform: translateX(-50%) rotateX(62deg);
  border-radius: 50%;
  box-shadow:
    inset 0 -7px 0 rgba(0, 0, 0, 0.16),
    0 5px 6px rgba(59, 47, 42, 0.15);
}

.piece-red {
  bottom: 31px;
  width: 136px;
  background: #c12e1f;
}

.piece-orange {
  bottom: 54px;
  width: 127px;
  background: #ff9016;
}

.piece-yellow {
  bottom: 77px;
  width: 118px;
  background: #fec600;
}

.piece-green {
  bottom: 100px;
  width: 109px;
  background: #00ae42;
}

.piece-blue {
  bottom: 123px;
  width: 100px;
  background: #0a2989;
}

.piece-indigo {
  bottom: 146px;
  width: 91px;
  background: #482960;
}

.piece-purple-top {
  bottom: 169px;
  width: 82px;
  background: #5e43b7;
}

.empty-cart-base {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 150px;
  height: 20px;
  transform: translateX(-50%) rotateX(62deg);
  border-radius: 50%;
  background: linear-gradient(
    90deg,
    #b98f5d,
    #e2c593 48%,
    #a87d4b
  );
  box-shadow: 0 5px 8px rgba(59, 47, 42, 0.18);
}

@keyframes empty-cart-toy-spin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .empty-cart-twirlapillar {
    animation: none;
  }
}

@media (max-width: 600px) {
  .empty-cart-hero {
    margin-bottom: 38px;
    padding: 22px 16px 30px;
    border-radius: 24px;
  }

  .empty-cart-toy-stage {
    width: 175px;
    height: 195px;
    transform: scale(0.84);
    margin-top: -12px;
    margin-bottom: -13px;
  }

  .empty-cart-hero h1 {
    font-size: 2rem;
  }
}
