/* Tomo — shared base: reset, buttons, pass mock, strip motion, toast, sheet, confetti. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
blockquote,
dl,
dd,
ol,
ul,
figure {
  margin: 0;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2.5px solid currentColor;
  outline-offset: 3px;
  border-radius: 6px;
}

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

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--xl {
  width: 34px;
  height: 34px;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font-weight: 650;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 160ms ease, box-shadow 160ms ease;
}

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

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--btn-bg, #1b1a17);
  color: var(--btn-fg, #faf7f1);
  box-shadow: 0 10px 24px -14px var(--btn-shadow, rgba(0, 0, 0, 0.5));
}

.btn--ghost {
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 1.5px var(--line-strong, rgba(0, 0, 0, 0.2));
}

/* Apple Wallet badge — official artwork, never altered; only sized. */
.wallet-badge {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: manipulation;
}

.wallet-badge:active {
  transform: scale(0.97);
}

.wallet-badge__img {
  height: 50px;
  width: auto;
}

.wallet-badge--small .wallet-badge__img {
  height: 40px;
}

/* ------------------------------------------------------------------ pass mock (Apple Wallet storeCard) */

.pass {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--pass-bg);
  color: var(--pass-value);
  border-radius: 16px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  text-align: left;
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.16),
    0 18px 40px -18px var(--shadow-color, rgba(0, 0, 0, 0.45)),
    0 40px 80px -40px var(--shadow-color, rgba(0, 0, 0, 0.45));
  transform: translateZ(0);
}

/* Wallet keeps a fixed card height; below the fields stays empty (no barcode). */
.pass--full {
  aspect-ratio: 1 / 0.9;
}

.pass__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4cqw;
  height: 19cqw;
  padding: 0 4.4cqw;
}

.pass__logo-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
}

.pass__logo {
  max-height: 13.6cqw;
  max-width: 48cqw;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.pass__logotext {
  font-size: 5.4cqw;
  font-weight: 600;
  color: var(--pass-value);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pass__field {
  display: flex;
  flex-direction: column;
  gap: 0.6cqw;
  min-width: 0;
}

.pass__heads {
  display: flex;
  gap: 4.4cqw;
  flex: none;
}

.pass__field--header[hidden] {
  display: none;
}

.pass__field--header {
  align-items: flex-end;
  text-align: right;
  flex: none;
}

.pass__label {
  font-size: 3.05cqw;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: var(--pass-label);
}

.pass__field--header .pass__label {
  color: var(--pass-head-label, var(--pass-label));
}

.pass__field--header .pass__value {
  color: var(--pass-head-value, var(--pass-value));
}

.pass__value {
  font-size: calc(4.6cqw * var(--fit, 1));
  line-height: 1.2;
  color: var(--pass-value);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pass__value--header {
  font-size: 6.3cqw;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pass__strip {
  line-height: 0;
}

.pass__strip .strip {
  width: 100%;
  height: auto;
  aspect-ratio: 375 / 144;
}

.pass__fields {
  display: flex;
  justify-content: space-between;
  gap: 5cqw;
  padding: 3.6cqw 4.4cqw 4cqw;
}

.pass__fields .pass__field:first-child {
  flex: 0 1 auto;
}

.pass__field--end {
  text-align: right;
  align-items: flex-end;
  flex: 0 1 auto;
}

.pass__foot {
  flex: 1;
}

/* ------------------------------------------------------------------ iOS 27 poster card (full-art) */

.pass--poster {
  aspect-ratio: 358 / 448;
  border-radius: 6cqw;
}

.poster__art {
  position: absolute;
  inset: 0;
  line-height: 0;
}

.poster__art .strip {
  width: 100%;
  height: 100%;
}

.poster__top {
  position: relative;
  z-index: 1;
  height: 22cqw;
  /* like Wallet's poster card: primaryLogo 30 pt high from about x 16, y 14 pt (358 pt wide card) */
  padding: 3.9cqw 4.5cqw 0;
  align-items: flex-start;
}

.pass--poster .pass__logo-wrap {
  height: 8.4cqw;
}

.pass__logo-wrap.is-in-art {
  visibility: hidden;
}

.pass--poster .pass__logo {
  max-height: 8.4cqw;
  max-width: 35.2cqw;
}

.poster__material {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  /* as compact as Apple's poster cards: fields take the bottom quarter, the artwork keeps the rest */
  gap: 1.6cqw;
  padding: 3cqw 8cqw 6cqw;
  /* Wallet's material strip: the artwork shows through, blurred and tinted with the card color */
  background: linear-gradient(to bottom, color-mix(in srgb, var(--pass-bg) 55%, transparent), color-mix(in srgb, var(--pass-bg) 92%, transparent));
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

.poster__row {
  display: flex;
  justify-content: space-between;
  gap: 5cqw;
}

.pass--poster .pass__label {
  font-size: 3.3cqw;
}

.pass--poster .poster__row .pass__value {
  font-size: 5.6cqw;
}

.pass--poster .poster__foot .pass__value {
  font-size: 4.2cqw;
  white-space: normal;
}

/* Wallet's big bold title: the first primary field without label (variant C, 12.11.2026) */
.pass--poster .poster__row .pass__field--title {
  align-self: flex-end;
}

.pass--poster .poster__row .pass__field--title .pass__value {
  font-size: 8cqw;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.poster__row {
  align-items: flex-end;
}

.pass.is-bumped {
  animation: pass-bump 900ms cubic-bezier(0.2, 0.8, 0.2, 1) 240ms;
}

@keyframes pass-bump {
  0%,
  100% {
    transform: translateZ(0) scale(1);
  }
  38% {
    transform: translateZ(0) scale(0.985) translateY(2px);
  }
  62% {
    transform: translateZ(0) scale(1.006);
  }
}

/* ------------------------------------------------------------------ strip motion (§6.3: 1.35 → 1 spring + fade) */

.strip__stamp,
.strip__burst {
  transform-box: fill-box;
  transform-origin: center;
}

.strip__stamp.is-landing {
  animation: stamp-land 760ms cubic-bezier(0.22, 1, 0.36, 1) 320ms both;
}

@keyframes stamp-land {
  0% {
    opacity: 0;
    transform: scale(1.35) rotate(-10deg);
  }
  45% {
    opacity: 1;
    transform: scale(0.93) rotate(2deg);
  }
  70% {
    transform: scale(1.035) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.strip__burst {
  opacity: 0;
  animation: stamp-burst 720ms cubic-bezier(0.2, 0.7, 0.3, 1) 620ms;
}

@keyframes stamp-burst {
  0% {
    opacity: 0.6;
    transform: scale(0.95);
  }
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

.strip__stamp.is-popping {
  animation: stamp-pop 620ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay, 0ms) both;
}

@keyframes stamp-pop {
  0% {
    opacity: 0.3;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.strip__glow {
  animation: glow-pulse 2.4s ease-in-out infinite;
}

@keyframes glow-pulse {
  50% {
    opacity: 0.7;
  }
}

/* ------------------------------------------------------------------ toast */

.toasts {
  position: fixed;
  grid-template-areas: "t";
  z-index: 60;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  grid-area: t;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(24, 22, 20, 0.88);
  color: #fbf8f2;
  font: 600 15px/1.3 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
  transition: opacity 260ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

.toast.is-out {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

.toast__dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--stamp, #6e8b3d);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.toast--win .toast__dot {
  background: var(--win, #d9482b);
}

/* ------------------------------------------------------------------ sheet */

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: none;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text, #1b1a17);
  overflow: visible;
}

.sheet::backdrop {
  background: rgba(10, 8, 6, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 220ms ease both;
}

.sheet__panel {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--surface, #faf7f1);
  font-family: var(--font-cafe, system-ui);
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.5);
  animation: sheet-up 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sheet.is-closing .sheet__panel {
  animation: sheet-down 220ms ease-in both;
}

.sheet.is-closing::backdrop {
  animation: fade-out 220ms ease both;
}

.sheet__grabber {
  justify-self: center;
  width: 38px;
  height: 5px;
  margin-bottom: 8px;
  border-radius: 3px;
  background: var(--line-strong, rgba(0, 0, 0, 0.2));
}

.sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--line, rgba(0, 0, 0, 0.08));
  cursor: pointer;
}

.sheet__close .icon {
  width: 18px;
  height: 18px;
}

.sheet__title {
  font-size: 24px;
  line-height: 1.15;
  color: var(--heading, inherit);
  padding-right: 40px;
}

.sheet__lead {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}

.sheet__text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-soft, inherit);
}

.sheet__actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 560px) {
  .sheet {
    margin: auto;
  }
  .sheet__panel {
    border-radius: 28px;
    padding-bottom: 24px;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-down {
  to {
    transform: translateY(100%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ confetti */

.confetti {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ------------------------------------------------------------------ by tomo */

.by-tomo {
  display: inline-block;
  width: 72px;
  height: 17px;
  background-color: currentColor;
  -webkit-mask: url("/brand/tomo/by-tomo.svg") center / contain no-repeat;
  mask: url("/brand/tomo/by-tomo.svg") center / contain no-repeat;
}

/* ------------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .strip__stamp.is-landing {
    animation: stamp-fade 400ms ease 200ms both !important;
  }
  .strip__burst {
    display: none;
  }
}

@keyframes stamp-fade {
  from {
    opacity: 0;
  }
}
