:root {
  --page: #f8f8f7;
  --paper: #fbf8f1;
  --ink: #1b1a18;
  --gray: #5c5c59;
  --soft: #7a7a76;
  --pencil: #b7b7b3;
  --line: #dcdcd7;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tight: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --hand: 'Nothing You Could Do', 'Segoe Print', cursive;
  --g: clamp(20px, 6.4vw, 96px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, canvas { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

.display {
  font-family: var(--serif);
  font-weight: 500;
  font-optical-sizing: auto;
  letter-spacing: -0.012em;
  line-height: 1.04;
  text-wrap: balance;
}
.muted { color: var(--gray); }
.hand { font-family: var(--hand); font-weight: 400; color: var(--soft); letter-spacing: 0.01em; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(36px, 6vw, 88px); overflow: clip; position: relative; }
.hero > .display, .hero > .lede, .hero > .hero-cta { margin-inline: var(--g); }
.hero h1 { font-size: clamp(40px, 5.8vw, 88px); max-width: 12.4em; }
.lede {
  margin-top: clamp(18px, 2vw, 32px);
  max-width: 29em;
  font-size: clamp(17px, 1.85vw, 27px);
  line-height: 1.42;
  color: var(--gray);
  text-wrap: pretty;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  font-weight: 500;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.stage { position: relative; height: 170vw; margin-top: 6px; }
.sheet-card { position: absolute; display: block; }
.sheet-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-inset { left: 3vw; top: 24vw; width: 66vw; height: 52.4vw; z-index: 2; }
.card-big { left: 22vw; top: 62vw; width: 90vw; height: 92vw; z-index: 1; }
.scribble { position: absolute; left: -2vw; top: 128vw; width: 42vw; height: 26vw; z-index: 3; pointer-events: none; }
.note-day {
  position: absolute;
  left: 46vw;
  top: 1vw;
  z-index: 3;
  font-size: 16.5px;
  line-height: 1.12;
  color: var(--pencil);
  white-space: nowrap;
}
.note-day span, .note-tray span { display: block; }
.wordmark {
  position: absolute;
  left: var(--g);
  top: 156vw;
  font: 800 13vw/0.9 var(--tight);
  letter-spacing: -0.05em;
  color: var(--ink);
  z-index: 3;
}

[data-reveal] span { clip-path: inset(-20% 100% -20% 0); transition: clip-path 1.1s var(--ease); }
[data-reveal].in span { clip-path: inset(-20% -10% -20% 0); }
[data-reveal].in span:nth-child(2) { transition-delay: .35s; }
[data-reveal].in span:nth-child(3) { transition-delay: .7s; }
[data-reveal].in span:nth-child(4) { transition-delay: 1.05s; }
[data-reveal].in span:nth-child(5) { transition-delay: 1.4s; }

@media (min-width: 900px) {
  .stage { height: 80vw; margin-top: clamp(32px, 4vw, 64px); }
  .card-inset { left: 31.8vw; top: 0; width: 41.6vw; height: 33vw; }
  .card-big { left: 40.5vw; top: 13vw; width: 62vw; height: 64vw; }
  .note-day { left: 76vw; top: 0.4vw; font-size: clamp(18px, 2.25vw, 34px); line-height: 1.06; }
  .scribble { left: 22vw; top: 56vw; width: 25vw; height: 13vw; }
  .wordmark { top: 70vw; font-size: 5.9vw; }
}

/* ---------- Sections ---------- */
.catalog, .howto, .story { padding: clamp(80px, 11vw, 176px) var(--g) 0; }
.section-head { max-width: 40em; }
.section-head h2, .story-text h2 { font-size: clamp(34px, 4.3vw, 64px); }
.section-head p { margin-top: 14px; font-size: clamp(16px, 1.35vw, 20px); max-width: 32em; text-wrap: pretty; }

/* ---------- Catalog ---------- */
.tabs {
  display: flex;
  gap: 4px 22px;
  margin: 26px calc(var(--g) * -1) 34px;
  padding: 0 var(--g);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none;
  min-height: 44px;
  padding: 8px 0 12px;
  border: 0;
  background: none no-repeat 0 100% / 100% 10px;
  color: var(--soft);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.tabs button[aria-pressed="true"] {
  color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1 6 C 20 3, 40 8, 60 5 S 90 3, 99 6 M4 8 C 30 6, 60 9, 96 7' fill='none' stroke='%23a3a39e' stroke-width='1.4' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 16px; align-items: start; }
.item {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.item[data-m="1"] { margin-top: 40px; }
.item[hidden] { display: none; }
.card-item {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  transition: transform .5s var(--ease);
}
.item:hover .card-item { transform: translateY(-4px) rotate(-.6deg); }
.item-price { margin-top: 10px; font-size: 21px; line-height: 1.1; color: var(--soft); transform: rotate(-2.5deg); transform-origin: 0 50%; }
.item-name { margin-top: 4px; font: 500 19px/1.15 var(--serif); letter-spacing: -0.005em; text-wrap: balance; }
.item-meta { margin-top: 4px; font-size: 13px; line-height: 1.35; }
.tag {
  display: inline-block;
  padding: 5px 9px 4px;
  border-radius: 3px 10px 4px 9px;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(27, 26, 24, .08);
  font: 600 11.5px/1.2 var(--sans);
  letter-spacing: .01em;
  color: var(--ink);
}
.item > .tag { position: absolute; top: 12px; left: 10px; z-index: 1; }
.tag-nuevo { background: #e2f8d6; }
.tag-ultimas { background: #fde3cf; }
.tag-agotado { background: var(--ink); color: var(--paper); box-shadow: none; }
.item.is-out .card-item canvas { filter: grayscale(.9) contrast(.9); opacity: .55; }
.item.is-out .item-price { text-decoration: line-through; }

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 64px clamp(24px, 3vw, 52px); }
  .item[data-m] { margin-top: 0; }
  .item[data-c="1"] { margin-top: 72px; }
  .item[data-c="2"] { margin-top: 22px; }
  .item[data-c="3"] { margin-top: 104px; }
  .item-name { font-size: 23px; }
  .item-price { font-size: 25px; }
  .item-meta { font-size: 14px; }
  .tabs { margin-inline: 0; padding: 0; gap: 6px 30px; flex-wrap: wrap; }
  .tabs button { font-size: 16px; }
}

/* ---------- How to order ---------- */
.steps { display: grid; gap: 34px; margin-top: 44px; counter-reset: s; }
.step-n { display: block; font-size: 58px; line-height: 1; color: var(--pencil); margin-bottom: 4px; }
.steps h3 { font: 500 25px/1.15 var(--serif); }
.steps p { margin-top: 8px; color: var(--gray); max-width: 26em; text-wrap: pretty; }
.facts { display: grid; gap: 22px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.facts dt { font-weight: 600; font-size: 14px; }
.facts dd { margin-top: 4px; color: var(--gray); font-size: 15px; max-width: 30em; }
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 48px; margin-top: 64px; }
  .step-n { font-size: 84px; }
  .steps h3 { font-size: 30px; }
  .facts { grid-template-columns: repeat(3, 1fr); gap: 48px; margin-top: 80px; }
}

/* ---------- Story ---------- */
.story { display: grid; gap: 40px; }
.story-art { position: relative; }
.card-story { position: relative; width: 86%; aspect-ratio: 10 / 11; }
.note-tray { margin: 16px 0 0 4%; font-size: 19px; line-height: 1.15; color: var(--soft); transform: rotate(-2.5deg); transform-origin: 0 50%; }
.story-text .lede { font-size: clamp(18px, 1.7vw, 24px); color: var(--gray); }
.where { margin-top: 32px; display: grid; gap: 14px; }
.where li { display: grid; grid-template-columns: 92px 1fr; align-items: baseline; gap: 10px; font-size: 16px; }
.where .hand { font-size: 20px; color: var(--soft); }
.where a { text-underline-offset: 4px; }
@media (min-width: 900px) {
  .story { grid-template-columns: 5fr 6fr; gap: 6vw; align-items: center; }
  .card-story { width: 78%; }
  .note-tray { font-size: 24px; }
  .where li { grid-template-columns: 120px 1fr; font-size: 17px; }
  .where .hand { font-size: 24px; }
}

/* ---------- Footer ---------- */
.foot { position: relative; padding: clamp(96px, 12vw, 180px) var(--g) calc(110px + env(safe-area-inset-bottom)); overflow: clip; }
.scribble-foot { position: absolute; left: auto; right: 4vw; top: clamp(30px, 5vw, 80px); width: clamp(150px, 26vw, 380px); height: clamp(90px, 13vw, 200px); }
.wordmark-foot { position: static; font-size: clamp(76px, 19vw, 300px); line-height: .86; letter-spacing: -0.055em; }
.foot-row { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 28px; font-size: 14px; color: var(--gray); }
.foot-row a { text-underline-offset: 4px; }

/* ---------- Fixed: Maito tag and bag ---------- */
.maito-tag {
  position: fixed;
  left: 14px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 40;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(251, 248, 241, .94);
  box-shadow: 0 0 0 1px rgba(27, 26, 24, .08);
  font: 500 11px/1.2 var(--sans);
  color: var(--gray);
  text-decoration: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.maito-tag:hover { color: var(--ink); }
.bag-btn {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 41;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(27, 26, 24, .55);
}
.bag-count {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}
.bag-btn.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.08) rotate(-2deg); } }
@media (min-width: 900px) {
  .maito-tag { left: 24px; bottom: 26px; font-size: 12px; }
  .bag-btn { right: 24px; bottom: 22px; }
}

/* ---------- Panels ---------- */
.panel { position: fixed; inset: 0; z-index: 60; }
.panel[hidden] { display: none; }
.panel-scrim { position: absolute; inset: 0; background: rgba(27, 26, 24, .32); opacity: 0; transition: opacity .35s; }
.panel-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--page);
  border-radius: 20px 20px 0 0;
  padding: 10px var(--g) calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .5s var(--ease);
}
.panel.is-open .panel-scrim { opacity: 1; }
.panel.is-open .panel-body { transform: none; }
.panel-close {
  display: block;
  margin-left: auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.card-product { position: relative; width: min(100%, 32dvh); aspect-ratio: 4 / 5; margin: 0 auto; }
.p-note { margin-top: 10px; font-size: 21px; transform: rotate(-2deg); transform-origin: 0 50%; }
.p-state:empty { display: none; }
.p-state { margin-top: 8px; }
.p-name { margin-top: 6px; font-size: clamp(30px, 3vw, 40px); }
.p-price { margin-top: 6px; font-size: 20px; font-weight: 500; }
.variants { border: 0; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.variants[hidden] { display: none; }
.variants legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--gray); }
.variant {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
}
.variant input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.variant:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper); }
.variant:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.v-price { font-weight: 600; }
.p-desc { margin-top: 16px; font-size: 15px; text-wrap: pretty; }
.btn-ink {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  margin-top: 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 -14px 0 0 var(--page);
}
.btn-ink:disabled { background: #c9c9c4; color: #fff; cursor: not-allowed; }
.p-added { min-height: 26px; margin-top: 8px; font-size: 20px; text-align: center; }
@media (min-width: 900px) {
  .panel-body {
    left: auto; top: 0;
    width: min(540px, 44vw);
    max-height: none;
    border-radius: 0;
    padding: 18px 44px 32px;
    transform: translateX(100%);
  }
  .card-product { width: min(78%, 40vh); margin: 0; }
}

/* ---------- Bag ---------- */
.bag-title { font-size: 36px; }
.bag-empty { margin-top: 10px; }
.bag-list { margin-top: 18px; }
.bag-line {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "text total" "qty qty";
  gap: 6px 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.bag-line-text { grid-area: text; }
.bag-line-name { font: 500 19px/1.2 var(--serif); }
.bag-line-variant { font-size: 13.5px; margin-top: 2px; }
.bag-line-total { grid-area: total; font-weight: 600; }
.qty { grid-area: qty; display: inline-flex; align-items: center; gap: 4px; }
.qty button {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.qty output { min-width: 32px; text-align: center; font-weight: 600; }
.bag-foot { border-top: 1px solid var(--line); padding-top: 18px; }
.bag-foot[hidden] { display: none; }
.bag-note-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.bag-note-label .muted { font-weight: 400; }
.bag-foot textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font: 400 16px/1.4 var(--sans);
  color: var(--ink);
  resize: vertical;
}
.bag-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; font: 500 26px/1.1 var(--serif); }
.bag-fine { margin-top: 10px; font-size: 13px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] span { clip-path: none !important; transition: none; }
  .panel-body, .panel-scrim, .card-item { transition: none; }
  .bag-btn.bump { animation: none; }
}
