/* The festival of lights card with the oil lamps that light up one after another: the seasonal card of a made-up tea
   and spice shop, Kesar & Clay, on a warm near black page. Five clay oil lamps with brass rims, a gift code that
   completes itself one letter per lamp, and the warm light of the flames on everything. */
:root {
  --page: #0c0807;               /* the page */
  --card: #140e0b;               /* the body of the card */
  --edge: rgba(255, 214, 160, 0.09); /* its edge at rest */
  --ink: #f6e8d4;                /* the text */
  --muted: #a08a74;              /* the small words */
  --faint: #4b3a2e;              /* empty slots, rules */
  --accent: #f2b45a;             /* the flame light: count, code, button */
  --brass: #d7a75c;              /* the brass of the rims and the code frame */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 40px) clamp(10px, 3vw, 40px);
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 62%, rgba(255, 140, 50, calc(0.05 + var(--lit, 0) * 0.1)), transparent 70%),
    var(--page);
}

/* ---------------------------------------------------------------- the card */
.card {
  --pad: clamp(14px, min(3.6vw, 3.4vh), 30px);
  position: relative;
  width: min(580px, 94vw);
  padding: var(--pad);
  border-radius: clamp(16px, 2.6vh, 24px);
  background:
    linear-gradient(180deg, rgba(255, 220, 170, 0.035), transparent 40%),
    var(--card);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 180, 0.12),
    0 0 0 1px var(--edge),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 18px 40px -12px rgba(0, 0, 0, 0.7),
    0 40px 90px -30px rgba(255, 120, 40, calc(var(--lit, 0) * 0.35));
  overflow: hidden;
  isolation: isolate;
}

.card__warm {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(90% 70% at 50% 72%, rgba(255, 150, 60, 0.2), transparent 70%);
  opacity: var(--lit, 0);
}

.card__grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(12px, 1.9vh, 14px);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.count {
  font-size: clamp(11px, 1.7vh, 12.5px);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, 0.1);
  background: rgba(255, 220, 170, 0.03);
}

.count__num {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}

.card__text {
  margin-top: clamp(10px, 2.6vh, 24px);
}

.eyebrow {
  margin: 0;
  font-size: clamp(10px, 1.6vh, 12px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

.title {
  margin: clamp(4px, 0.9vh, 8px) 0 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 380;
  font-variation-settings: 'opsz' 72, 'SOFT' 60;
  font-size: clamp(20px, min(5.4vw, 4.9vh), 36px);
  line-height: 1.08;
  letter-spacing: -0.012em;
}

.title em {
  font-style: italic;
  color: #f7cf93;
}

/* ---------------------------------------------------------------- the lamps */
.row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: clamp(6px, 1.6vh, 16px) calc(var(--pad) * -0.4) 0;
  height: clamp(84px, min(24vw, 21vh), 160px);
}

.row::after {
  /* the ledge the lamps stand on */
  content: '';
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 11%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 210, 150, 0.22) 15%, rgba(255, 210, 150, 0.22) 85%, transparent);
}

.lamp {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lamp svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lamp svg {
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  .lamp:hover svg {
    transform: translateY(-2px);
  }
}

.lamp:active svg {
  transform: translateY(1px) scale(0.985);
  transition-duration: 0.12s;
}

.lamp:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 12px;
}

.lamp__halo {
  mix-blend-mode: screen;
}

.lamp__pool {
  mix-blend-mode: screen;
}

.lamp__smoke {
  fill: none;
  stroke: rgba(240, 225, 205, 0.45);
  stroke-width: 1.2;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- the gift */
.gift {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: clamp(8px, 2vh, 18px);
  padding-top: clamp(8px, 2vh, 18px);
  border-top: 1px solid rgba(255, 220, 170, 0.08);
}

.gift__left,
.gift__right {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.gift__right {
  align-items: flex-end;
  text-align: right;
}

.gift__label,
.gift__note {
  font-size: clamp(10.5px, 1.65vh, 12px);
  color: var(--muted);
}

.gift__note {
  opacity: 0;
}

.code {
  position: relative;
  display: inline-flex;
  gap: 3px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(255, 220, 170, 0.035);
  box-shadow: inset 0 0 0 1px rgba(215, 167, 92, 0.28);
  overflow: hidden;
}

.code__slot {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(18px, min(4.2vw, 3.6vh), 26px);
  height: clamp(24px, min(5.4vw, 4.6vh), 32px);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.code__slot::after {
  /* the empty mark of a letter not opened yet */
  content: '';
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 24%;
  height: 1px;
  background: var(--faint);
  transition: opacity 0.3s;
}

.code__slot.is-open::after {
  opacity: 0;
}

.code__ch {
  display: inline-block;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(14px, min(3.4vw, 2.9vh), 20px);
  font-weight: 560;
  color: #ffd99a;
  opacity: 0;
}

.code__sheen {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 236, 196, 0.45), transparent);
  transform: translateX(-140%) skewX(-12deg);
  pointer-events: none;
}

.copy {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.copy:disabled {
  cursor: default;
}

.copy__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: clamp(7px, 1.4vh, 9px) clamp(12px, 1.9vh, 15px);
  border-radius: 999px;
  font-size: clamp(11.5px, 1.75vh, 13px);
  font-weight: 600;
  color: #2a1505;
  background: linear-gradient(180deg, #ffd58d, #e9a24a);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(120, 60, 10, 0.35),
    0 6px 18px -6px rgba(255, 150, 50, 0.6);
  opacity: 0.18;
  filter: saturate(0.2);
}

.copy__check {
  width: 0;
  height: 14px;
  overflow: visible;
  fill: none;
  stroke: #2a1505;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .copy:not(:disabled):hover .copy__face {
    background: linear-gradient(180deg, #ffe0a6, #f0ad55);
  }
}

/* ---------------------------------------------------------------- the drawn pointer */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  width: 20px;
  height: 20px;
  fill: #fff;
  stroke: #1a1008;
  stroke-width: 1.1;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

@media (max-width: 420px) {
  .gift {
    gap: 10px;
  }
  .gift__more {
    display: none;
  }
}
