/* tokens */
:root {
  --porcelain: #f4f2ec;   /* app background */
  --paper: #faf3e6;       /* slide 1: matches the jar photo's backdrop */
  --mist: #e3ece7;        /* slide 2 */
  --glass: #e5edf0;       /* slide 3: cool, like clear glass */
  --warm: #f3e6d4;        /* slide 4 */
  --card: #fffdf8;

  --ink: #16201c;
  --ink-2: #4a5650;
  --ink-3: #7d8781;
  --emerald: #1f7a68;
  --amber: #e8912f;
  --moss: #7fae3c;
  --moss-bright: #b9db6e;
  --on-night: #e9f3ee;

  --display: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  --ui: 'Helvetica Neue', Helvetica, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;   /* as on dooa.jp */
  --ease: cubic-bezier(.2, .75, .15, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--porcelain); color: var(--ink); font-family: var(--ui);
  -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
em { font-style: italic; }
svg { display: block; }

h1, h2, h3, .sig, .fog-title, .mono {
  font-family: var(--display); font-weight: 500;
  letter-spacing: -.02em; text-wrap: balance;
}
h1 em, h2 em { color: var(--emerald); font-weight: 400; }
.eyebrow { font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* app shell */
.app {
  height: 100vh; height: 100svh; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 20px 6px 18px;
}
/* monogram seal */
.seal { position: relative; width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.seal svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.seal-t {
  position: relative; top: -1px; font-family: var(--display);
  font-size: 17px; font-weight: 600; letter-spacing: .01em; color: var(--ink); display: flex; align-items: baseline;
}
.seal-t i { font-style: italic; font-weight: 500; font-size: 15px; color: var(--emerald); margin: 0 1.5px; position: relative; top: -.5px; }

/* chapter marker */
.chapter { display: flex; align-items: baseline; gap: 9px; }
.ch-num { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 24px; line-height: 1; color: var(--emerald); font-feature-settings: "lnum", "tnum"; }
.ch-label { font-size: 11px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }
.ch-num, .ch-label { transition: opacity .22s ease, transform .3s var(--ease); }
.chapter.swap .ch-num, .chapter.swap .ch-label { opacity: 0; transform: translateY(-5px); }
.chapter.swap .ch-label { transition-delay: .03s; }

.deck {
  position: relative; display: flex; gap: 10px; padding: 2px 16px;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: 16px;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.deck::-webkit-scrollbar { display: none; }
.slide {
  position: relative; flex: 0 0 100%; overflow: hidden; overflow: clip; isolation: isolate;
  scroll-snap-align: center; scroll-snap-stop: always;
  border-radius: 30px; container-type: size;
  display: flex; flex-direction: column; padding: 20px 20px 20px;
}
.slide h2 { font-size: 35px; font-size: min(10.4cqw, 6.6cqh); line-height: 1.04; margin-top: 6px; }
.head { padding: 2px 2px 0; }

.bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px calc(env(safe-area-inset-bottom) + 14px);
}
.dots { display: flex; gap: 2px; margin-left: -8px; }
.dots button { width: 32px; height: 32px; display: grid; place-items: center; }
.dots svg { width: 11px; height: 11px; fill: var(--ink); opacity: .2; transition: opacity .35s, transform .35s var(--ease); }
.dots button[aria-selected="true"] svg { opacity: 1; transform: scale(1.18); }
.next {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--porcelain); transition: transform .2s;
}
.next:active { transform: scale(.93); }
.next svg, .pill-btn svg, .cta-arrow { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .45s var(--ease); }
.next.back svg { transform: rotate(180deg); }

/* cards that are not on screen stop their looping animations */
.slide:not(.on) *, .slide:not(.on) *::before, .slide:not(.on) *::after { animation-play-state: paused !important; }

/* entrance: elements fade up the first time their slide is shown */
[data-in] { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--d, 0) * 90ms + 80ms); }
.seen [data-in] { opacity: 1; transform: none; }

.glow { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; background: radial-gradient(closest-side, var(--c) 30%, transparent); }

/* 1 · hello */
.s-hello { background: var(--paper); }
.g1 { --c: rgba(232, 145, 47, .17); width: 72%; aspect-ratio: 1; right: -38%; top: -32%; }   /* kept clear of the jar */
.g2 { --c: rgba(31, 122, 104, .15); width: 105%; aspect-ratio: 1; left: -50%; bottom: -38%; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border-radius: 99px;
  background: rgba(255, 255, 255, .6); border: 1px solid rgba(22, 32, 28, .07);
  font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--moss); }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--moss); animation: pulse 2.6s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 70%, 100% { transform: scale(2.6); opacity: 0; } }

.hello-jar { flex: 1; min-height: 0; display: grid; place-items: center; margin: 4px 0 8px; }
.hello-jar img { height: 320px; height: min(48.5cqh, 99.7cqw); width: auto; animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.s-hello h1 { font-size: 42px; font-size: min(12.2cqw, 7.4cqh); line-height: 1; }
.s-hello p { margin-top: 10px; font-size: 15.5px; line-height: 1.45; color: var(--ink-2); max-width: 31ch; }
.pill-btn {
  margin-top: 16px; display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px 12px 18px; border-radius: 99px; background: var(--ink); color: var(--paper);
  font-size: 14.5px; font-weight: 500;
}
.pill-btn svg { width: 18px; height: 18px; animation: nudge 1.8s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@container (max-height: 470px) { .s-hello p { display: none; } }

/* 2 · care card (unfolds) */
.s-care { background: var(--mist); padding-bottom: 16px; }
.s-care .head { margin-bottom: 14px; }
/* A plain card: three rows of two tips, each row as tall as its content (no animation).
   Pictures and text step down on shorter screens, so nothing is ever cut off. */
.fold { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; container-type: size; }
.panel { display: grid; grid-template-columns: 1fr 1fr; align-items: start; padding: 12px 4px; background: var(--card); }
.p1 { border-radius: 20px 20px 0 0; padding-top: 16px; }
.p2, .p3 { border-top: 1px dashed rgba(22, 32, 28, .13); }
.p3 { border-radius: 0 0 20px 20px; padding-bottom: 16px; box-shadow: 0 22px 30px -26px rgba(22, 50, 40, .45); }

.item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 0 4px; }
.ill { width: 64px; height: 64px; flex: none; border-radius: 30%; background: #e3f0e9; display: grid; place-items: center; }
.item.no .ill { background: #f8e8db; }
.ill svg { width: 88%; height: 88%; }
.item h3 { font-size: 18px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.item p { font-size: 12.5px; line-height: 1.3; color: var(--ink-3); max-width: 18ch; }
/* Size steps, chosen by app.js: the largest one whose three rows fit the space on this phone. */
.fold.size-m .panel, .fold.size-s .panel { padding: 9px 4px; }
.fold.size-m .p1, .fold.size-s .p1 { padding-top: 12px; }
.fold.size-m .p3, .fold.size-s .p3 { padding-bottom: 12px; }
.fold.size-m .ill, .fold.size-s .ill { width: 54px; height: 54px; }
.fold.size-m .item, .fold.size-s .item { gap: 5px; }
.fold.size-m .item h3, .fold.size-s .item h3 { font-size: 16.5px; }
.fold.size-m .item p { font-size: 12px; }
.fold.size-s .item p, .fold.size-xs .item p { display: none; }
.fold.size-xs .panel { padding: 6px 4px; }
.fold.size-xs .p1 { padding-top: 9px; }
.fold.size-xs .p3 { padding-bottom: 9px; }
.fold.size-xs .ill { width: 46px; height: 46px; }
.fold.size-xs .item h3 { font-size: 15px; }

/* 3 · foggy glass */
.s-glass { background: var(--glass); }
.s-glass h2 { margin-top: 2px; }
.shot-wrap { flex: 1; min-height: 0; display: flex; padding: 16px 0 14px; }
.shot {
  position: relative; flex: 1; border-radius: 22px; overflow: hidden; background: var(--paper);
  box-shadow: 0 1px 0 rgba(22, 32, 28, .04), 0 18px 36px -28px rgba(30, 60, 70, .45);
}
.jarbox { position: absolute; inset: 9% 3% 4%; }
.jarbox img, .jarbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.when {
  position: absolute; top: 12px; left: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px 6px 8px; border-radius: 99px; background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(22, 32, 28, .06); font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.when svg { width: 15px; height: 15px; fill: none; stroke: var(--amber); stroke-width: 1.8; stroke-linecap: round; }
#whenText { transition: opacity .35s; }
#whenText.swap { opacity: 0; }
.s-glass .body { font-size: 15px; line-height: 1.45; color: var(--ink-2); max-width: 34ch; }
.rule { margin-top: 10px; font-family: var(--display); font-style: italic; font-weight: 500; font-size: 22px; color: var(--emerald); }
@container (max-height: 470px) { .s-glass .body { display: none; } }

/* 4 · a note from us */
.s-keep { background: var(--warm); padding-bottom: 16px; }
.g3 { --c: rgba(232, 145, 47, .2); width: 110%; aspect-ratio: 1; right: -55%; top: -34%; }
.note-wrap { flex: 1; min-height: 0; display: grid; align-items: center; padding: 34px 0 16px; }
.note {
  position: relative; text-align: center; background: var(--card); border-radius: 22px;
  padding: 50px 24px 26px;
  box-shadow: 0 1px 0 rgba(120, 90, 50, .06), 0 26px 44px -30px rgba(120, 80, 40, .55);
}
.wax {
  position: absolute; top: -28px; left: 50%; width: 58px; height: 58px; border-radius: 50%;
  transform: translateX(-50%) rotate(-7deg); display: grid; place-items: center;
  background: radial-gradient(circle at 34% 30%, #2f957d, #1f7a68 55%, #165d4d);
  box-shadow: 0 8px 16px -8px rgba(15, 60, 50, .7), inset 0 -2px 4px rgba(0, 0, 0, .15);
}
.wax::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px dotted rgba(243, 238, 223, .55); }
.wax svg { position: relative; width: 32px; height: 32px; }
.note-msg {
  font-family: var(--display); font-weight: 500;
  font-size: 23px; font-size: min(6.7cqw, 4.5cqh); line-height: 1.36; color: var(--ink); text-wrap: balance;
}
.note-name { margin-top: 20px; font-size: 15px; color: var(--ink-2); }
.blank {
  display: inline-block; min-width: 132px; padding: 1px 8px 2px; margin: 0 2px;
  border-bottom: 1.5px dashed rgba(31, 122, 104, .55); color: var(--ink-3); font-style: italic; font-size: 14px;
}
.note-name .nb { white-space: nowrap; }
.blank { white-space: normal; max-width: 88%; vertical-align: bottom; }
.blank.named { min-width: 0; padding: 0 1px 1px; margin: 0 0 0 3px; font-family: var(--display); font-weight: 600; font-size: 21px; color: var(--emerald); border-bottom: 1px solid rgba(31, 122, 104, .35); }
.note-sign { margin-top: 22px; font-family: var(--display); font-weight: 500; font-size: 18px; line-height: 1.2; color: var(--ink-2); }
.note-sign em { display: block; margin-top: 3px; font-size: 31px; color: var(--emerald); }

.keep-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 46px; border-radius: 14px;
  border: 1px solid rgba(22, 32, 28, .12); background: rgba(255, 253, 248, .55);
  font-size: 13.5px; font-weight: 500; color: var(--ink); transition: transform .2s, background .2s;
}
.chip-btn:active { transform: scale(.96); background: var(--card); }
.chip-btn svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.credit { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.credit svg { height: 7px; width: 45px; fill: var(--ink); opacity: .5; }
@container (min-height: 620px) {
  .note { padding: 62px 28px 36px; }
  .note-msg { line-height: 1.42; }
  .note-name { margin-top: 28px; }
  .note-sign { margin-top: 30px; }
}
@container (max-height: 500px) {
  .note { padding: 42px 18px 18px; }
  .note-name { margin-top: 12px; }
  .note-sign { margin-top: 12px; }
  .note-sign em { font-size: 25px; }
}

/* misted glass intro */
.fog { position: fixed; inset: 0; z-index: 50; touch-action: none; transition: opacity 1.3s var(--ease), transform 1.4s var(--ease); }
.fog canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fog.gone { opacity: 0; transform: scale(1.05); pointer-events: none; }
.fog-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; transition: opacity .6s; }
.fog.touched .fog-ui { opacity: 0; }
.fog-title { font-style: italic; font-size: 40px; color: rgba(22, 32, 28, .74); }
.fog-sub { margin-top: 6px; font-size: 14px; letter-spacing: .02em; color: rgba(22, 32, 28, .5); }
.finger { margin-top: 26px; width: 64px; height: 64px; animation: wipe 2.2s ease-in-out infinite; }
@keyframes wipe { 0%, 100% { transform: translateX(-22px); } 50% { transform: translateX(22px); } }
.fog-skip { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); font-size: 13px; letter-spacing: .08em; color: rgba(22, 32, 28, .5); padding: 12px 18px; }

/* name sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(12, 26, 21, .38); opacity: 0; transition: opacity .35s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; max-height: 92svh; overflow: auto;
  background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 22px calc(env(safe-area-inset-bottom) + 22px);
  transform: translateY(100%); transition: transform .5s var(--ease);
}
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.grabber { width: 40px; height: 4px; border-radius: 2px; background: rgba(22, 32, 28, .15); margin: 0 auto 18px; }
.sheet h3 { font-size: 31px; line-height: 1.05; }
.sheet h3 em { color: var(--emerald); }
.sheet-sub { margin: 8px 0 18px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.sheet form { display: grid; gap: 12px; }
.sheet .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sheet form .sheet-sub { margin-bottom: 6px; }
.sheet label { display: grid; gap: 6px; }
.sheet label span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.sheet input, .sheet textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--porcelain);
  border: 1px solid rgba(22, 32, 28, .1); border-radius: 14px; padding: 13px 15px; outline: none; resize: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.sheet input:focus, .sheet textarea:focus { border-color: var(--emerald); background: #fff; box-shadow: 0 0 0 4px rgba(31, 122, 104, .13); }
.sheet ::placeholder { color: #a3aaa5; }
.submit { margin-top: 6px; height: 54px; border-radius: 16px; background: var(--ink); color: var(--card); font-size: 16px; font-weight: 500; width: 100%; }
.submit.ghost { background: var(--porcelain); color: var(--ink); }
.done { text-align: center; padding: 8px 0 4px; }
.grow { width: 64px; height: 64px; margin: 0 auto 10px; transform-origin: 50% 85%; animation: grow .9s var(--ease) both; }
@keyframes grow { from { transform: scale(0); } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--porcelain); font-size: 13.5px; padding: 10px 16px; border-radius: 99px;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* larger screens: keep it a phone-sized object */
@media (min-width: 640px) {
  body { background: radial-gradient(60% 50% at 20% 10%, rgba(232,145,47,.14), transparent), radial-gradient(60% 60% at 85% 90%, rgba(31,122,104,.14), transparent), var(--porcelain); }
  .app { max-width: 460px; height: min(100svh, 900px); margin-top: max(0px, calc((100svh - 900px) / 2)); }
}

/* still mode + reduced motion */
.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }
.still [data-in] { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  [data-in] { opacity: 1; transform: none; }
}
