/* Cassie No. 36 — a native-botanical perfume lab.
   Paper is eucalyptus grey-green; ink is ironbark brown.
   The flask is the one loud thing; everything else stays quiet. */

:root {
  --paper: #DCE3D5;
  --paper-deep: #CBD5C2;
  --paper-rule: rgba(51, 38, 29, 0.18);
  --ink: #33261D;
  --ink-2: #5A4A3D;
  --wattle: #E3A812;
  --wattle-deep: #B8840A;
  --paw: #B8322A;
  --gum: #5E7A66;
  --flannel: #F7F5EE;

  --display: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;

  --gutter: 20px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --safe-top: max(env(safe-area-inset-top), 14px);
  --safe-bottom: max(env(safe-area-inset-bottom), 18px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background-color: var(--paper);
  /* fine paper fibre, then a soft light falling across the sheet */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .11 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 70% at 30% 0%, rgba(247, 245, 238, 0.55), rgba(247, 245, 238, 0) 70%);
  background-attachment: fixed;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body.is-lab { overscroll-behavior-y: none; }

p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
svg { display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

#sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2.5px solid var(--paw);
  outline-offset: 3px;
  border-radius: 6px;
}
[tabindex="-1"]:focus-visible { outline: none; }

/* ---------- Scenes ---------- */

.scene {
  min-height: 100dvh;
  padding: var(--safe-top) var(--gutter) var(--safe-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
}
.scene[hidden] { display: none; }
.scene.is-entering { animation: scene-in 0.5s var(--ease-out) both; }
.scene.is-leaving { animation: scene-out 0.26s ease-in both; }

@keyframes scene-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scene-out { from { opacity: 1; } to { opacity: 0; } }

.actions {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

/* ---------- Type ---------- */

.h-display {
  font-family: var(--display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.prose p + p { margin-top: 0.75em; }

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 0;
  min-height: 54px;
  padding: 0 34px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--flannel);
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s var(--ease-out), background-color 0.2s, opacity 0.2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  background: transparent;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1.5px var(--paper-rule);
  cursor: default;
  transform: none;
}
.btn--wide { width: 100%; max-width: 360px; }

.link {
  appearance: none;
  background: none;
  border: 0;
  min-height: 44px;
  padding: 0 6px;
  font-family: var(--body);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(51, 38, 29, 0.4);
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
}
.link:active { color: var(--paw); }

/* ---------- 1. Cover ---------- */

.scene--cover { justify-content: center; }

.cover {
  position: relative;
  width: min(100%, 400px, 52dvh);
  aspect-ratio: 1;
  margin-top: auto;
}
.cover__wreath { position: absolute; inset: 0; }
/* hold the "36" back until its typeface has loaded (app.js adds .fonts-ready, with a timeout) */
.fonts-ready .cover__title { opacity: 1; }
.cover__wreath svg { width: 100%; height: 100%; overflow: visible; }

.cover__title {
  opacity: 0;
  transition: opacity 0.5s ease-out;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 2%;
}
.cover__num {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(110px, 38cqw, 168px);
  font-size: min(41vw, 24dvh, 168px);
  line-height: 0.82;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96;
}
.cover__name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: min(10vw, 5.6dvh, 40px);
  line-height: 1;
  margin-top: 0.32em;
  letter-spacing: 0.01em;
}

.cover__line {
  margin-top: 26px;
  max-width: 19em;
  text-align: center;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: balance;
}
.scene--cover .actions { margin-bottom: auto; padding-top: 26px; }

/* ---------- 2. Intro ---------- */

.scene--intro { justify-content: center; }
.intro {
  width: 100%;
  max-width: 400px;
  margin-top: auto;
}
.intro__pyramid {
  width: 100%;
  max-width: 330px;
  margin: 0 auto 30px;
}
.intro .h-display { margin-bottom: 16px; }
.scene--intro .actions { margin-bottom: auto; padding-top: 30px; }

/* ---------- 3–5. Lab ---------- */

.scene--lab {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding-left: 16px;
  padding-right: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  justify-items: stretch;
  width: 100%;
}

.lab__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  transition: opacity 0.4s;
}
.lab__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  text-align: center;
}
.steps {
  display: flex;
  gap: 16px;
  font-size: 15px;
  color: var(--ink-2);
}
.steps li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.steps__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.25px rgba(51, 38, 29, 0.45);
  background: transparent;
  transition: background-color 0.4s, box-shadow 0.4s;
}
.steps li.is-current { color: var(--ink); font-weight: 600; }
.steps li.is-current .steps__dot { box-shadow: inset 0 0 0 1.5px var(--ink); }
.steps li.is-done .steps__dot { box-shadow: inset 0 0 0 1px rgba(51, 38, 29, 0.35); }

.scene--lab.is-reveal .lab__head { opacity: 0; pointer-events: none; }

.lab__stage {
  position: relative;
  min-height: 200px;
}
.flask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.flask:focus-visible { outline-offset: -4px; border-radius: 24px; }

.lab__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}
.panel { width: 100%; display: flex; flex-direction: column; align-items: center; }
.panel[hidden] { display: none; }

.lab__lede {
  font-size: 16px;
  color: var(--ink-2);
  text-align: center;
  margin-bottom: 12px;
  min-height: 1.5em;
  text-wrap: balance;
}

.choices {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.choice {
  appearance: none;
  position: relative;
  border: 0;
  border-radius: 14px;
  background: rgba(247, 245, 238, 0.55);
  box-shadow: inset 0 0 0 1px rgba(51, 38, 29, 0.12);
  min-height: 118px;
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s var(--ease-out);
  touch-action: manipulation;
}
.choice:active { transform: scale(0.97); }
.choice svg { width: 64px; height: 64px; flex: none; }
.choice__name {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 500;
  text-align: center;
  text-wrap: balance;
}
.choice[aria-checked="true"] {
  background: var(--flannel);
  box-shadow: inset 0 0 0 2px var(--ink);
}
.choice[aria-checked="true"]::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1.5px var(--flannel), 0 0 0 2.5px rgba(51, 38, 29, 0.5);
}
.choice:disabled { cursor: default; }

.detail {
  width: 100%;
  min-height: 132px;
  padding: 14px 4px 14px;
  text-align: center;
}
.detail__name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.15;
}
.detail__latin {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-2);
  margin-top: 2px;
}
.detail__scent {
  font-size: 16px;
  line-height: 1.45;
  margin-top: 6px;
  text-wrap: balance;
}
.detail__prompt {
  font-size: 16px;
  color: var(--ink-2);
  padding-top: 24px;
}
.detail.is-fresh > * { animation: detail-in 0.35s var(--ease-out) both; }
@keyframes detail-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel--swirl { padding: 4px 0 8px; min-height: 120px; justify-content: flex-start; }
.hint {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}
.hint__alt {
  margin-top: 8px;
  font-size: 16px;
  color: var(--ink-2);
  text-align: center;
}
.panel--swirl .link { margin-top: 6px; }

.panel--reveal { padding-bottom: 4px; }
.reveal__copy {
  text-align: center;
  max-width: 22em;
  margin-bottom: 20px;
}
.reveal__copy p { font-size: 18px; line-height: 1.5; text-wrap: balance; }
.reveal__copy p:first-child {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  margin-bottom: 6px;
}
.panel--reveal > * { opacity: 0; transform: translateY(8px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.panel--reveal.is-shown > * { opacity: 1; transform: none; }
.panel--reveal.is-shown > .btn { transition-delay: 0.5s; }

/* the label on the finished bottle */
.bottle-label {
  --ls: 280px;
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--flannel);
  color: var(--ink);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(51, 38, 29, 0.15), inset 0 0 0 calc(var(--ls) * 0.008) var(--flannel), inset 0 0 0 calc(var(--ls) * 0.0125) var(--ink);
  padding: calc(var(--ls) * 0.03);
  opacity: 0;
  transform: scale(0.94);
  transform-origin: 50% 50%;
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  pointer-events: none;
  visibility: hidden;
}
.bottle-label.is-on { opacity: 1; transform: none; visibility: visible; }
.bottle-label__name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: calc(var(--ls) * 0.088);
  line-height: 1;
}
.bottle-label__no {
  font-family: var(--display);
  font-weight: 500;
  font-size: calc(var(--ls) * 0.05);
  letter-spacing: 0.08em;
  margin-top: calc(var(--ls) * 0.012);
  padding-bottom: calc(var(--ls) * 0.024);
  border-bottom: 1px solid rgba(51, 38, 29, 0.45);
  min-width: 46%;
}
.bottle-label__notes {
  margin-top: calc(var(--ls) * 0.022);
  font-size: max(13px, calc(var(--ls) * 0.044));
  line-height: 1.32;
}
.bottle-label__notes li { white-space: nowrap; }

/* ---------- 6. Gift ---------- */

.scene--gift { justify-content: center; }
.gift {
  margin-top: auto;
  width: 100%;
  max-width: 400px;
  background: var(--flannel);
  border-radius: 6px;
  padding: 26px 22px 26px;
  position: relative;
  text-align: center;
  box-shadow: 0 1px 0 rgba(51, 38, 29, 0.1), 0 18px 40px -24px rgba(51, 38, 29, 0.45);
}
/* herbarium-sheet double rule */
.gift::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(51, 38, 29, 0.55);
  box-shadow: inset 0 0 0 3px var(--flannel), inset 0 0 0 3.6px rgba(51, 38, 29, 0.35);
  border-radius: 2px;
  pointer-events: none;
}
.gift__art { width: 168px; height: 128px; margin: 0 auto 10px; }
.gift__art svg { width: 100%; height: 100%; overflow: visible; }
.gift__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.05;
  text-wrap: balance;
}
.gift__with {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  margin-top: 8px;
  color: var(--ink-2);
}
.gift__body {
  margin: 18px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--paper-rule);
  max-width: 21em;
  text-align: left;
}
.gift__for {
  margin-top: 18px;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
}
.gift__when { margin-top: 4px; font-size: 16px; color: var(--ink-2); }
.scene--gift .actions { margin-bottom: auto; padding-top: 26px; }

/* ---------- 7. The day ---------- */

.scene--day { padding-bottom: calc(var(--safe-bottom) + 8px); }
.day__head { text-align: center; padding: 18px 0 22px; }
.day__sub {
  margin-top: 8px;
  font-size: 17px;
  color: var(--ink-2);
  text-wrap: balance;
}

.pyramid {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tier {
  --tint: #E8D9A8;
  --hue: #C99A2E;
  --inset: 0px;
  position: relative;
  background: var(--tint);
  text-align: center;
  padding: 20px calc(var(--pad, 24px)) 18px;
  clip-path: var(--clip, none);
}
.tier::before {
  /* a band of the ingredient's own colour along the top edge */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 5px;
  background: var(--hue);
}
.tier__flag {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 12px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: var(--ink);
  color: var(--flannel);
}
.tier.is-next .tier__flag { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.tier__note {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
}
.tier__time {
  font-family: var(--display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.1;
  margin-top: 2px;
}
.tier__what {
  font-size: 19px;
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.25;
  text-wrap: balance;
}
.tier__where { margin-top: 6px; font-size: 16px; line-height: 1.45; text-wrap: balance; }
.tier__detail { margin-top: 6px; font-size: 16px; line-height: 1.45; color: var(--ink-2); text-wrap: balance; }
.tier__ingredient {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 15px;
  color: var(--ink-2);
}
.tier__ingredient svg { width: 36px; height: 36px; flex: none; margin-left: -10px; }
.tier__ingredient span { text-wrap: balance; }
.tier__ingredient em { font-style: normal; color: var(--ink); font-weight: 500; }
.tier__dir {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: inset 0 0 0 1.5px rgba(51, 38, 29, 0.7);
  background: rgba(247, 245, 238, 0.5);
}
.tier__dir svg { width: 16px; height: 16px; }
.tier__dir:active { background: var(--flannel); }
.tier.is-now { outline: none; }
/* past stops: quieten the headline only, so the address stays easy to read */
.tier.is-past .tier__time,
.tier.is-past .tier__what { opacity: 0.6; }

.scene--day .actions { padding-top: 28px; }
.day__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding-top: 18px;
}

/* ---------- 8. The note ---------- */

.scene--note { justify-content: center; }
.note {
  width: 100%;
  max-width: 400px;
  padding: 8px 6px 0;
}
.note__art { width: 120px; height: 92px; margin: 0 auto 18px; }
.note__art svg { width: 100%; height: 100%; overflow: visible; }
.note__body p {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.55;
  font-variation-settings: "opsz" 14;
  text-wrap: pretty;
}
.note__body p + p { margin-top: 0.7em; }
.note__sign {
  margin-top: 22px;
  font-family: var(--display);
  font-style: italic;
  font-size: 28px;
}
.note__actions { padding-top: 34px; }
.note__links {
  padding-top: 16px;
  display: flex;
  gap: 4px 22px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Petal burst ---------- */

.burst {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  z-index: 10;
}

.noscript { padding: 40px 20px; text-align: center; }

/* ---------- Small and short screens ---------- */

@media (max-height: 700px) {
  .lab__title { font-size: 26px; }
  .choice { min-height: 104px; }
  .choice svg { width: 52px; height: 52px; }
  .detail { min-height: 120px; padding-top: 8px; }
  .cover__line { margin-top: 16px; }
}

@media (min-width: 600px) {
  .scene { padding-left: 32px; padding-right: 32px; }
}

/* Phone turned sideways: flask on the left, choices and copy on the right */
@media (orientation: landscape) and (max-height: 500px) {
  .scene--lab {
    max-width: 920px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 20px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .lab__head { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 18px; padding-top: 2px; }
  .lab__title { font-size: 22px; }
  .steps { font-size: 14px; gap: 12px; }
  .lab__stage { grid-column: 1; grid-row: 2; min-height: 0; }
  .lab__panel {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    overflow-y: auto;
    justify-content: safe center;
    padding-bottom: 8px;
  }
  .lab__lede { margin-bottom: 8px; }
  .choice { min-height: 84px; padding: 6px 4px 8px; }
  .choice svg { width: 44px; height: 44px; }
  .detail { min-height: 0; padding: 8px 4px; }
  .detail__prompt { padding-top: 8px; }
  .panel--swirl { min-height: 0; justify-content: center; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
