/*
ART DIRECTION: "sofa-side cheer". A soft mint room, a cream paper card and a
cuppa on the side table. Friendly and a little cheeky, never clinical.

CONCEPT: a real greeting card that opens like paper, with three tap-to-play
bits (a cuppa, a ginger biscuit and a hot water bottle that warms up).

PALETTE
--mint        #CFEDE1  page background (the room)
--mint-deep   #A6DCC8  saucer, bottle body, soft tints
--cream       #FFF7EA  front of the card and extras panels
--paper       #FFFDF8  inside of the card
--teal        #0E4A4A  ink: headings and body text (about 8:1 on mint)
--teal-soft   #356B69  secondary text (about 5.7:1 on cream)
--tangerine   #F26A1B  decoration: bottle, meter, confetti
--action      #C2410C  buttons with white text (about 5.2:1)
--action-dark #9F3409  button hover

TYPE: Fredoka (rounded display) for headings and buttons; Nunito for text.
Sizes use clamp() so they scale from 360px wide up.

MOTIF: a mint stitched border on the card, hand-drawn stars, little sprinkles
and steam wisps.
*/

:root {
  --mint: #CFEDE1;
  --mint-deep: #A6DCC8;
  --cream: #FFF7EA;
  --paper: #FFFDF8;
  --teal: #0E4A4A;
  --teal-soft: #356B69;
  --tangerine: #F26A1B;
  --action: #C2410C;
  --action-dark: #9F3409;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --text: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 24px;
  --shadow: 0 2px 0 rgba(14, 74, 74, 0.06), 0 24px 48px -16px rgba(14, 74, 74, 0.38);
  --soft-shadow: 0 10px 24px -14px rgba(14, 74, 74, 0.45);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--mint);
  background-image: radial-gradient(rgba(14, 74, 74, 0.09) 1.2px, transparent 1.6px);
  background-size: 20px 20px;
  color: var(--teal);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  color: var(--teal);
}

p {
  margin: 0;
}

svg {
  display: block;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10;
  background: var(--teal);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 8px;
}

.skip-link:focus {
  left: 12px;
}

:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px) 16px 56px;
  overflow-x: hidden;
  overflow-x: clip;
}

.eyebrow {
  text-align: center;
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-soft);
  margin: 0 0 18px;
}

/* ---------- The card ---------- */

.card-wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

@media (prefers-reduced-motion: no-preference) {
  .card-wrap {
    animation: rise-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  display: grid;
  perspective: 1400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card > * {
  grid-area: 1 / 1;
}

.card-inside {
  background: var(--paper);
  border-radius: var(--radius);
  padding: clamp(28px, 7vw, 40px) clamp(22px, 6vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-inside h2 {
  font-size: clamp(1.75rem, 6vw, 2.2rem);
  margin-bottom: 0.6em;
}

.card-inside h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 6px;
  margin-top: 10px;
  border-radius: 6px;
  background: var(--tangerine);
}

.card-inside p {
  font-size: 1.125rem;
  margin: 0 0 1em;
}

.card-inside .sign {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 0.6em;
}

.sign-name {
  color: var(--action);
}

.card-inside .btn {
  align-self: flex-start;
  margin-top: 12px;
}

.card-front {
  position: relative;
  background: var(--cream);
  border-radius: var(--radius);
  padding: 28px 22px 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 8px var(--mint);
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.9s cubic-bezier(0.6, 0.05, 0.3, 1), opacity 0.9s ease, visibility 0s linear 0s;
  z-index: 2;
}

.card-front.is-open {
  transform: rotateY(-100deg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.9s cubic-bezier(0.6, 0.05, 0.3, 1), opacity 0.9s ease, visibility 0s linear 0.9s;
}

.front-title {
  font-size: clamp(2rem, 1.2rem + 3vw, 2.5rem);
  margin: 0 0 14px;
  pointer-events: none;
}

.front-art {
  width: min(100%, 250px);
  height: auto;
  margin: 0 auto;
  pointer-events: none;
}

.front-art .wisp {
  fill: none;
  stroke: var(--teal-soft);
  stroke-width: 3.5;
  stroke-linecap: round;
  opacity: 0.6;
}

@media (prefers-reduced-motion: no-preference) {
  .front-art .wisp {
    animation: wisp 3s ease-in-out infinite;
  }

  .front-art .wisp.w2 {
    animation-delay: -1.5s;
  }
}

@keyframes wisp {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* The whole front is one big button, so tapping anywhere opens the card */
.front-cta {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 22px;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.front-cta:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: -12px;
}

.front-cta .pill {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  background: var(--action);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.125rem;
  padding: 10px 26px;
  border-radius: 999px;
  box-shadow: 0 8px 18px -8px rgba(159, 52, 9, 0.7);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.front-cta:hover .pill {
  background: var(--action-dark);
  transform: translateY(-2px);
}

.front-cta:active .pill {
  transform: translateY(1px) scale(0.98);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--action);
  color: #fff;
  margin-top: 4px;
}

.btn-primary:hover {
  background: var(--action-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}

.btn-ghost:hover {
  background: var(--teal);
  color: var(--cream);
}

.btn[hidden] {
  display: none;
}

/* ---------- Extras ---------- */

.extras {
  margin-top: clamp(48px, 8vw, 72px);
}

.section-title {
  text-align: center;
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.4rem);
  margin-bottom: 24px;
}

.extras-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 980px;
  margin: 0 auto;
}

@media (min-width: 860px) {
  .extras-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.extra {
  --panel: var(--cream);
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px 20px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  box-shadow: var(--soft-shadow);
}

.extra h3 {
  font-size: 1.5rem;
}

.cuppa {
  --panel: var(--cream);
}

.biscuit {
  --panel: #FCE7CF;
}

.bottle {
  --panel: #EAF7F1;
}

.note {
  min-height: 3em;
  font-weight: 700;
  color: var(--teal);
  font-size: 1rem;
  max-width: 30ch;
}

/* Sugar choice: pill radios */
.sugar {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.sugar legend {
  font-weight: 800;
  font-size: 0.9375rem;
  padding: 0;
  margin-bottom: 8px;
  color: var(--teal);
}

.choices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choice span {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--teal-soft);
  background: var(--paper);
  color: var(--teal);
  font-weight: 800;
  line-height: 22px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.choice:hover span {
  border-color: var(--teal);
}

.choice input:checked + span {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--cream);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

/* Tappable illustrations */
.tap {
  position: relative;
  display: block;
  margin: 0;
  padding: 6px;
  border: 0;
  background: none;
  border-radius: 20px;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.tap svg {
  width: 100%;
  height: auto;
  transition: transform 0.25s ease;
}

.tap:hover svg {
  transform: translateY(-3px) rotate(-2deg);
}

.tap:active svg {
  transform: scale(0.97);
}

.tap:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 4px;
}

.tap:disabled {
  cursor: default;
}

.tap:disabled:hover svg {
  transform: none;
}

/* Cuppa */
.mug-btn {
  width: min(100%, 180px);
}

.liquid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  transition: transform 1s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.mug-btn[aria-pressed="true"] .liquid {
  transform: scaleY(1);
}

.steam path {
  fill: none;
  stroke: var(--teal-soft);
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0;
}

.mug-btn[aria-pressed="true"] .steam path {
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .mug-btn[aria-pressed="true"] .steam path {
    animation: steam 2.6s ease-in-out infinite;
  }

  .mug-btn[aria-pressed="true"] .steam path:nth-child(2) {
    animation-delay: 0.5s;
  }

  .mug-btn[aria-pressed="true"] .steam path:nth-child(3) {
    animation-delay: 1s;
  }
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  35% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Biscuit */
.biscuit-stage {
  position: relative;
  width: min(100%, 190px);
}

.biscuit-btn {
  width: 100%;
}

.bite {
  fill: var(--panel);
}

.crumbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50% 40% 50% 45%;
  background: #B8702F;
  transform: translate(var(--x), var(--y));
}

@media (prefers-reduced-motion: no-preference) {
  .crumb {
    animation: crumb 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }
}

@keyframes crumb {
  from {
    transform: translate(0, 0) scale(0.3);
    opacity: 1;
  }
  to {
    transform: translate(var(--x), var(--y)) scale(1);
    opacity: 0.95;
  }
}

/* Hot water bottle and meter */
.bottle-btn {
  width: min(100%, 220px);
  --p: 0;
}

.bottle-warm {
  opacity: var(--p, 0);
  transition: opacity 0.4s ease;
}

.meter {
  position: relative;
  width: 100%;
  max-width: 240px;
  height: 18px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--teal);
  overflow: hidden;
  --p: 0;
}

.meter-fill {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, #FFC857, var(--tangerine));
  transition: width 0.4s ease;
}

/* Confetti burst */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti span {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--c);
  animation: fall var(--d) ease-in var(--delay) forwards;
}

@keyframes fall {
  to {
    transform: translate(var(--sx), 360px) rotate(540deg);
    opacity: 0;
  }
}

/* Scroll-in for the extras */
.js .rise {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .rise.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Footer ---------- */

.foot {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--teal-soft);
  padding: 0 16px 40px;
}

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

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

  .confetti {
    display: none;
  }

  .mug-btn[aria-pressed="true"] .steam path {
    opacity: 0.85;
  }
}
