/* 1TAKE Studios: base.css
   Modern reset, type scale, global layout primitives and the v3 "Shopee at 11.11"
   motifs (segmented progress, preview ribbon, count-up/pulse/shake motion).
   Colors only via var(--...) from tokens.css. Never hardcode a color here. */

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

* { margin: 0; }

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

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-3);
  line-height: var(--lh-body);
  margin: 0;
  /* Safety net only: layouts must not rely on this to avoid horizontal scroll. */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

button { cursor: pointer; }

table { border-collapse: collapse; border-spacing: 0; }

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

svg { display: block; }

/* ---------- Type scale ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--lh-tight);
  text-wrap: balance;
  color: var(--ink);
}

h1 { font-size: clamp(28px, 7vw, var(--fs-8)); }
h2 { font-size: var(--fs-7); }
h3 { font-size: var(--fs-6); }
h4 { font-size: var(--fs-5); font-weight: 700; }
h5 { font-size: var(--fs-4); font-weight: 700; }
h6 { font-size: var(--fs-3); font-weight: 700; }

p { max-width: var(--measure); }

.prose {
  max-width: var(--measure);
  line-height: var(--lh-body);
}

.prose > * + * { margin-top: var(--s-4); }

/* ---------- Focus ---------- */
:focus { outline: none; }

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

/* ---------- Utility text classes ---------- */
.num { font-variant-numeric: tabular-nums; }

.mono { font-family: var(--font-mono); }

.label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-2);
  line-height: var(--lh-snug);
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

/* ---------- 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;
  }
}

/* ---------- Layout primitives ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--s-4));
}

.row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--gap, var(--s-3));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap, var(--s-2));
}

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--s-4);
  padding-block: var(--s-6);
}

/* ---------- .perf-rule: retired motif, kept as a plain 1px rule ----------
   The film-perforation pattern is gone; the class stays so nothing that
   still renders it (folds, sections) breaks. */
.perf-rule {
  width: 100%;
  height: 1px;
  background: var(--rule);
  border: 0;
}

/* ---------- .slate: corner brackets and the clapper stripe are retired ----------
   .slate keeps position:relative so .preview-ribbon can still anchor to a
   corner. .slate-corner elements are left in older markup harmlessly hidden. */
.slate {
  position: relative;
}

.slate-corner {
  display: none;
}

/* ---------- .preview-ribbon: red corner tag replacing the slate motif ---------- */
.preview-ribbon {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  /* Yellow badge with ink text: the 12px white-on-red version failed AA. */
  background: var(--badge);
  color: var(--badge-ink);
  font-size: var(--fs-1);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: 3px var(--s-2);
  border-radius: var(--r-tag);
}

/* ---------- Segmented pill progress (replaces exposure ticks) ----------
   Six rounded segments; filled segments are solid accent, the current
   segment gets a soft pulsing halo. Fully static under reduced motion via
   the global animation-duration override above. */
.ticks {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tick {
  position: relative;
  width: 20px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--rule);
  flex-shrink: 0;
  transition: background-color var(--t-hover) var(--ease);
}

.tick-done {
  background: var(--accent);
}

.tick-current {
  background: var(--accent);
}

.tick-current::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: var(--accent-soft);
  animation: vph-tick-pulse 1.6s ease-in-out infinite;
}

@keyframes vph-tick-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.35); }
}

.ticks-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-1);
  color: var(--ink-2);
  letter-spacing: normal;
  text-transform: none;
}

/* ---------- Motion utilities ---------- */

/* Numbers that count up on scroll-in (JS drives the digits; toggles .is-in
   for the reveal). */
.count-up {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

.count-up.is-in {
  opacity: 1;
  transform: none;
}

/* Badge pulse (Flash badges, urgency chips). */
@keyframes vph-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.pulse {
  animation: vph-pulse 1.6s ease-in-out infinite;
}

/* Buy button shake, once, after idle. JS adds the class; it can remove it
   after the animation ends (~500ms) to allow re-triggering later. */
@keyframes vph-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.shake-once {
  animation: vph-shake 500ms ease-in-out;
}
