/* The plan card with the discount sticker that peels off: the Studio plan of a writing app, printed on thick warm paper
   (grain, a lit top edge, two stacked edges underneath for its thickness) on a white page. A soft band of light slides
   across the paper. The Save sticker is glossy vermilion vinyl: its face is clipped where the corner lifts, the fold is
   its pale backing, and its shadow stays on the card so you see it leave the surface. */
:root {
  --page: #ffffff;          /* the page */
  --paper: #fbf7ef;         /* the card's paper */
  --paper-edge: #e8dfcf;    /* the thickness of the paper */
  --ink: #1c1a17;           /* the words */
  --muted: #8b8478;         /* the small words */
  --rule: rgba(28, 26, 23, 0.1); /* thin lines */
  --accent: #e8492a;        /* the sticker and the hand-drawn strike */
  --accent-deep: #c2361b;   /* the sticker's darker side */
  --backing: #f4ede2;       /* the back of the sticker */
}

* {
  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;
  margin: 0;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 22px 16px 16px;
  overflow: hidden;
}

/* the card: thick paper */
.plan {
  position: relative;
  width: min(84vw, 316px);
  padding: clamp(14px, 4.2vh, 26px) clamp(16px, 5.4vw, 24px) clamp(14px, 3.8vh, 22px);
  border-radius: 18px;
  background:
    radial-gradient(120% 70% at 18% 0%, #fffdf8 0%, transparent 60%),
    var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(60, 44, 20, 0.07),
    0 1px 0 var(--paper-edge),
    0 2px 0 #e1d6c3,
    0 3px 1px rgba(60, 44, 20, 0.08),
    0 12px 22px -10px rgba(60, 44, 20, 0.18),
    0 34px 60px -26px rgba(60, 44, 20, 0.24);
  opacity: 0;
}

.plan__grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.28 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the light that slides across the paper (--lx from 0 to 1, moved by script.js) */
.plan__sheen {
  --lx: 0.2;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: soft-light;
}

.plan__sheen::before {
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: calc(var(--lx) * 140% - 70%);
  width: 70%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.0) 18%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0) 82%, transparent 100%);
  filter: blur(6px);
}

/* the sticker, half over the card's top edge */
.tag {
  position: absolute;
  top: -13px;
  right: clamp(14px, 5vw, 22px);
  z-index: 4;
  width: 100px;
  height: 30px;
}

.tag__shadow {
  position: absolute;
  inset: 1px 2px 0;
  border-radius: 8px;
  background: rgba(60, 30, 10, 0.32);
  filter: blur(1.5px);
  transform: translateY(1px);
}

.tag__lift {
  position: absolute;
  inset: 0;
  --s: 0px;
}

.tag__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-right: 6px;
  border-radius: 8px;
  background: linear-gradient(170deg, #f25d3c 0%, var(--accent) 45%, var(--accent-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(90, 20, 5, 0.25);
  clip-path: polygon(0 0, calc(100% - var(--s)) 0, 100% var(--s), 100% 100%, 0 100%);
  overflow: hidden;
}

/* the gloss of the vinyl, sliding with the same light */
.tag__face::after {
  content: '';
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: calc(var(--glx, 0.2) * 160% - 60%);
  width: 46%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42) 50%, transparent);
  transform: skewX(-18deg);
}

.tag__words {
  position: relative;
  z-index: 1;
  color: #fff8f2;
  font-size: 12.5px;
  font-weight: 640;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(120, 25, 5, 0.35);
}

/* the backing showing where the corner has lifted */
.tag__fold {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--s);
  height: var(--s);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  background: linear-gradient(225deg, #fffaf2 10%, var(--backing) 55%, #ddd2c0 100%);
  filter: drop-shadow(-1px 1px 1px rgba(60, 30, 10, 0.3));
}

.plan__head {
  position: relative;
}

.plan__brand {
  margin: 0;
  font-size: 11px;
  font-weight: 560;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.plan__name {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 660;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.plan__line {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* the period switch: a sunk track with a raised paper thumb */
.switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: clamp(10px, 2.8vh, 18px);
  padding: 3px;
  border-radius: 999px;
  background: rgba(60, 44, 20, 0.07);
  box-shadow: inset 0 1px 2px rgba(60, 44, 20, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

.switch__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: 50px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #fbf8f2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 1) inset, 0 0 0 1px rgba(60, 44, 20, 0.08), 0 2px 5px -1px rgba(60, 44, 20, 0.2);
}

.switch__opt {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  padding: 7px 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease;
}

.switch__opt[aria-checked='true'] {
  color: var(--ink);
}

.switch__opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* the price */
.price {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: clamp(10px, 3vh, 18px);
}

.price__big {
  display: inline-flex;
  align-items: flex-start;
  font-size: clamp(40px, min(13vw, 11vh), 50px);
  line-height: 1;
  font-weight: 660;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.035em;
}

.price__cur {
  font-size: 0.48em;
  margin: 0.12em 0.04em 0 0;
  font-weight: 560;
}

.price__digits {
  display: inline-flex;
}

/* one column per digit, a strip of 0 to 9 and a blank */
.price__col {
  position: relative;
  display: inline-block;
  height: 1em;
  width: 0.58em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}

.price__strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.price__strip span {
  height: 1em;
  line-height: 1;
}

.price__side {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 4px;
}

.price__old {
  position: relative;
  align-self: flex-start;
  font-size: 16px;
  font-weight: 560;
  color: var(--muted);
  opacity: 0;
  font-variant-numeric: tabular-nums;
}

.price__strike {
  position: absolute;
  left: -5px;
  right: -5px;
  top: -1px;
  width: calc(100% + 10px);
  height: 20px;
  overflow: visible;
}

.price__strike path {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.price__strike-a {
  stroke-width: 2.1;
}

.price__strike-b {
  stroke-width: 1.7;
}

.price__per {
  font-size: 12px;
  color: var(--muted);
}

.bill {
  position: relative;
  height: 16px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink);
}

.bill span {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
}

.bill__b {
  opacity: 0;
}

.feats {
  list-style: none;
  margin: clamp(10px, 2.8vh, 18px) 0 0;
  padding: clamp(8px, 2.4vh, 14px) 0 0;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: clamp(4px, 1.2vh, 8px);
  font-size: 12.5px;
}

.feats li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feats svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.feats path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the button: ink on paper, it gives under the finger */
.cta {
  appearance: none;
  border: 0;
  padding: 0;
  margin-top: clamp(12px, 3.2vh, 20px);
  width: 100%;
  background: none;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  position: relative;
  z-index: 2;
}

.cta__face {
  display: block;
  padding: 12px 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2723, var(--ink));
  color: #fbf7ef;
  font-size: 13.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 0 rgba(0, 0, 0, 0.2), 0 6px 14px -6px rgba(28, 26, 23, 0.5);
  transition: font-variation-settings 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), box-shadow 0.25s ease;
}

@media (hover: hover) {
  .cta:hover .cta__face {
    font-variation-settings: 'wdth' 112;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 0 rgba(0, 0, 0, 0.2), 0 10px 20px -8px rgba(28, 26, 23, 0.55);
  }

  .switch__opt:hover {
    color: var(--ink);
  }
}

.cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .cta__face {
    transition: none;
  }
}
