/* Maybach — silver / chrome quiet-luxury design system.
   Black + brushed-silver accent + off-white. Hairline rules, generous negative
   space, a metallic sheen. Manrope for everything. Shared by cabinet + install;
   landing.css / admin.css / miniapp.css extend these tokens. */

:root {
  /* surfaces */
  --bg: #0a0a0b;
  --bg-2: #0e0e11;
  --surface: rgba(22, 23, 26, 0.72);

  /* silver / chrome / platinum accent */
  --silver: #c8ccd2;
  --silver-bright: #eef1f4;
  --silver-deep: #8a8f97;

  /* text */
  --text: #f2f3f5;
  --text-2: #a8acb3;
  /* --text-3 lifted #6a6e76 → #767a82: 3.87:1 → 4.60:1 so muted small text clears
     WCAG AA (4.5:1) on --bg. Minimal bump — still the quietest text tier. */
  --text-3: #767a82;

  /* hairlines & fills */
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(200, 206, 214, 0.16);
  --fill: rgba(200, 206, 214, 0.05);

  /* the one state color — muted green, active subscription only */
  --active: #5ec97a;

  /* chrome sheen gradient, reused for wordmark + hairlines */
  --chrome: linear-gradient(180deg, #eef1f4 0%, #c8ccd2 32%, #8a8f97 58%, #c8ccd2 80%, #eef1f4 100%);

  --font-display: "Tenor Sans", "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Tenor Sans", "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --slow: 1.1s;
  --wrap: 68rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: #0a0a0b; color-scheme: dark; }

body {
  margin: 0;
  /* Split longhand so a single-token parse failure can never drop the dark bg
     (Safari was dropping the combined `background: … fixed, var()` shorthand,
     leaving a white page). background-color is the bulletproof floor. */
  background-color: #0a0a0b;
  background-image: radial-gradient(120% 90% at 50% -10%, #14161b 0%, #0a0a0b 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(200, 206, 214, 0.22); color: #fff; }

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

.container {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.14;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--text);
}
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 200; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
h3 { font-size: 1.15rem; font-weight: 400; }
p  { margin: 0 0 1rem; color: var(--text-2); }
strong { color: var(--text); font-weight: 500; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 11, 0.62);
  backdrop-filter: saturate(120%) blur(14px);
  -webkit-backdrop-filter: saturate(120%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.header-inner {
  display: flex;
  align-items: center;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}
.mark {
  width: 30px;
  height: 30px;
  display: block;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  padding-left: 0.06em; /* optical: last-letter tracking */
  color: var(--text);
}

/* ---------- Crest emblem (shield + double-M, chrome shine) ---------- */
.crest-stage {
  position: relative;
  width: clamp(140px, 30vw, 230px);
  aspect-ratio: 200 / 200;
  margin: 0 auto;
}
.crest {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 6px 30px rgba(200, 206, 214, 0.10));
}
/* a slow chrome shine sweeping across the crest */
.crest-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg,
      transparent 38%,
      rgba(255, 255, 255, 0.28) 48%,
      rgba(255, 255, 255, 0.42) 50%,
      rgba(255, 255, 255, 0.28) 52%,
      transparent 62%);
  -webkit-mask: var(--crest-mask, none);
  mask: var(--crest-mask, none);
  mix-blend-mode: screen;
  background-size: 260% 100%;
  background-position: 180% 50%;
  opacity: 0;
  animation: crest-shine 7s var(--ease) 1.2s infinite;
}
@keyframes crest-shine {
  0%   { opacity: 0; background-position: 180% 50%; }
  12%  { opacity: 0.7; }
  30%  { opacity: 0; background-position: -80% 50%; }
  100% { opacity: 0; background-position: -80% 50%; }
}

/* ---------- Hero (cabinet / install) ---------- */
.hero {
  text-align: center;
  padding: 5rem 0 3.5rem;
}
.hero .crest-stage { margin-bottom: 2.5rem; }
.hero h1 { margin-bottom: 0.9rem; }
.hero .quote,
.hero .lead {
  max-width: 34rem;
  margin: 0 auto;
  color: var(--text-2);
}
.hero .lead { margin-top: 0.75rem; font-size: 0.95rem; color: var(--text-3); }
.hero.hero-compact { padding: 1.45rem 0 1.15rem; }
.hero-compact .crest-stage { width: 72px; margin-bottom: 0.55rem; }
.hero-compact h1 { font-size: clamp(1.85rem, 3.6vw, 2.4rem); margin-bottom: 0.4rem; }
.hero-compact .quote { max-width: 40rem; font-size: 0.88rem; }
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--silver-deep);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card h2 {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.25rem;
}
.card h3 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 1.4rem 0 0.6rem;
}
.card p { color: var(--text-2); font-size: 0.95rem; }
.card p:last-child { margin-bottom: 0; }

/* ---------- Cabinet grid ---------- */
.cabinet {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  padding-bottom: 5rem;
}
.status-card, .key-card { grid-column: span 1; }
.qr-card, .renew-card { grid-column: span 1; }
.balance-card, .install-card, .tariff-card, .cabinet-notice { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .cabinet { grid-template-columns: 1fr; }
  .status-card, .key-card, .qr-card, .renew-card { grid-column: 1 / -1; }
}

/* renewal result + tariff summary */
.cabinet-notice {
  padding: 1.05rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--silver);
  background: rgba(200, 206, 214, 0.055);
  border-radius: 4px;
}
.cabinet-notice strong { display: block; margin-bottom: 0.15rem; }
.cabinet-notice p { margin: 0; font-size: 0.9rem; }
.cabinet-notice.notice-success { border-left-color: var(--active); }
.cabinet-notice.notice-warning { border-left-color: #c9a96a; }
.cabinet-notice.notice-error { border-left-color: #b87373; }

.tariff-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 -0.25rem 1.25rem;
  background: var(--line-2);
}
.summary-item {
  min-width: 0;
  padding: 0.9rem 1rem;
  background: #111216;
}
.summary-item span,
.renew-breakdown dt {
  display: block;
  color: var(--text-3);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.summary-item strong {
  display: block;
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}
.autorenew-state.is-on { color: var(--active); }
.next-charge { margin: 0 0 1.25rem; color: var(--text-2); }
.tariff-card .btn { margin-top: 0.15rem; }

@media (max-width: 720px) {
  .tariff-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .tariff-summary { grid-template-columns: 1fr; }
}

/* balance + top-up */
.balance-amount { font-size: 1.9rem; letter-spacing: 0.02em; margin: 0.25rem 0 1rem; }
.topup-label { color: var(--muted); margin-bottom: 0.6rem; }
.topup-presets { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.9rem; }
.topup-presets button {
  padding: 0.55rem 1.1rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line, rgba(255,255,255,0.18));
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.topup-presets button:hover { border-color: var(--text); background: rgba(255,255,255,0.04); }
.topup-custom { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.topup-custom input {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 0.6rem 0.9rem;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--line, rgba(255,255,255,0.18));
  border-radius: 10px;
  font: inherit;
}
.topup-hint { color: var(--muted); font-size: 0.9rem; margin-top: 0.8rem; }

/* status */
.status-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.status-label .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.status-active .dot {
  background: var(--active);
  box-shadow: 0 0 0 4px rgba(94, 201, 122, 0.14);
}
.status-active .status-label strong { color: var(--active); font-weight: 500; }
.expires, .days-left { font-size: 0.9rem; color: var(--text-2); margin-bottom: 0.35rem; }

/* key */
.key-hint { font-size: 0.85rem; color: var(--text-3); }
.masked-key { margin: 1rem 0 0; }
.masked-key code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--silver);
  background: var(--fill);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 0.85rem 1rem;
  word-break: break-all;
}

/* QR — black-on-white PNG needs a clean light card */
.qr-wrap { display: flex; justify-content: center; }
.qr-frame {
  background: #ffffff;
  border-radius: 4px;
  padding: 1rem;
  line-height: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.qr-img { width: 190px; height: 190px; display: block; image-rendering: pixelated; }
.qr-scan { display: none; }

/* renew */
.support-link { margin-top: 1rem; font-size: 0.85rem; color: var(--text-3); }
.support-link a { color: var(--silver); border-bottom: 1px solid var(--line); }
.support-link a:hover { color: var(--silver-bright); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.85rem 1.7rem;
  border-radius: 3px;
  border: 1px solid var(--silver-deep);
  color: var(--text);
  transition: background 0.5s var(--ease), color 0.5s var(--ease),
              border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
  cursor: pointer;
}
.btn-primary {
  background: var(--chrome);
  color: #0a0a0b;
  border-color: transparent;
}
.btn-primary:hover {
  box-shadow: 0 0 0 1px var(--silver), 0 10px 30px rgba(200, 206, 214, 0.16);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--silver); color: var(--silver-bright); }
.renew-card .btn { margin-top: 0.5rem; }

/* ---------- Renewal confirmation ---------- */
.renew-confirm {
  width: min(100%, 44rem);
  margin: 0 auto;
  padding-bottom: 5rem;
}
.confirmation-card { padding: clamp(1.4rem, 5vw, 2.4rem); }
.renew-breakdown { margin: 0 0 1.5rem; }
.renew-breakdown > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}
.renew-breakdown dt,
.renew-breakdown dd { margin: 0; }
.renew-breakdown dd { color: var(--text); text-align: right; }
.renew-breakdown .balance-after dd { color: var(--active); }
.confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.confirmation-actions .btn { flex: 1 1 15rem; }
.funds-warning {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 169, 106, 0.38);
  border-radius: 4px;
  background: rgba(201, 169, 106, 0.06);
}
.funds-warning strong { color: #dfc58c; }
.funds-warning p { margin: 0.3rem 0 0; font-size: 0.9rem; }
.confirmation-help {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
}
.confirmation-help a { color: var(--silver); border-bottom: 1px solid var(--line); }

@media (max-width: 520px) {
  .hero:not(.hero-compact) { padding: 2.5rem 0 2rem; }
  .hero:not(.hero-compact) .crest-stage { width: 104px; margin-bottom: 1.25rem; }
  .hero:not(.hero-compact) h1 {
    font-size: clamp(2rem, 9vw, 2.2rem);
    margin-bottom: 0.65rem;
  }
  .hero:not(.hero-compact) .quote { font-size: 0.95rem; line-height: 1.6; }
  .card { padding: 1.5rem; }
  .btn {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    text-transform: none;
    white-space: nowrap;
  }
  .hero.hero-compact { padding-top: 1.3rem; }
  .hero-compact .crest-stage { width: 68px; }
  .renew-breakdown > div { align-items: flex-start; }
  .confirmation-actions { flex-direction: column; }
  .confirmation-actions .btn { width: 100%; flex-basis: auto; }
}

/* ---------- Install lists ---------- */
.platform-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 0.5rem;
}
@media (max-width: 720px) { .platform-tabs { grid-template-columns: 1fr; } }
.platform ol, .card ol {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 0.9rem;
}
.card ol { counter-reset: step; list-style: none; padding-left: 0; }
.card ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.2rem;
  margin-bottom: 0.7rem;
}
.card ol > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--silver-deep);
  letter-spacing: 0.05em;
}
.card ol ul { margin: 0.4rem 0; padding-left: 1.1rem; list-style: none; }
.card ol ul li { position: relative; padding-left: 0.9rem; margin-bottom: 0.3rem; }
.card ol ul li::before { content: "—"; position: absolute; left: 0; color: var(--text-3); }
.install-more-link { margin-top: 1.5rem; font-size: 0.85rem; }
.install-more-link a { color: var(--silver); border-bottom: 1px solid var(--line); }
.install-more-link a:hover { color: var(--silver-bright); }

/* ---------- Install page ---------- */
.install-page {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 5rem;
}
.platform-card h3 { color: var(--text-2); }
.help-card { text-align: left; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-2);
  padding: 3rem 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.site-footer small { color: var(--text-3); font-size: 0.8rem; }
.site-footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-footer-links a { color: var(--text-2); font-size: 0.8rem; }
.site-footer-links a:hover { color: var(--silver-bright); }

/* ---------- Public legal pages ---------- */
.legal-hero { padding-bottom: 2rem; }
.legal-updated { color: var(--text-3); font-size: 0.78rem; letter-spacing: 0.04em; }
.legal-page { max-width: 760px; margin: 0 auto 5rem; }
.legal-page section { padding: 1.5rem 0; border-top: 1px solid var(--line-2); }
.legal-page h2 { margin: 0 0 0.7rem; font-size: 1.1rem; }
.legal-page p, .legal-page li { color: var(--text-2); line-height: 1.75; }
.legal-page ul { margin: 0; padding-left: 1.2rem; }
.legal-page a {
  color: var(--silver-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Payment return ---------- */
.payment-return {
  min-height: calc(100svh - 206px);
  display: grid;
  place-items: center;
  padding: clamp(3.5rem, 9vw, 7.5rem) 0;
}
.payment-return__frame {
  position: relative;
  width: min(100%, 34rem);
  padding: clamp(2rem, 6vw, 3.5rem);
  overflow: hidden;
  text-align: center;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.035), transparent 42%),
    rgba(14, 14, 17, 0.78);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}
.payment-return__frame::before {
  content: "";
  position: absolute;
  inset: 0 12% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(238,241,244,.72), transparent);
}
.payment-return__eyebrow {
  margin: 0 0 2rem;
  color: var(--text-3);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.payment-return__signal {
  position: relative;
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 1.9rem;
  place-items: center;
}
.payment-return__signal svg {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  overflow: visible;
  fill: none;
  stroke: var(--silver-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.payment-return__orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(200, 206, 214, 0.2);
  border-radius: 50%;
}
.payment-return__orbit::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  border-top-color: rgba(238, 241, 244, 0.82);
  border-radius: inherit;
}
.payment-return__check,
.payment-return__cross,
.payment-return__wait { display: none; }
.payment-return--processing .payment-return__wait,
.payment-return--success .payment-return__check,
.payment-return--failed .payment-return__cross { display: block; }
.payment-return--processing .payment-return__orbit::after {
  animation: payment-orbit 1.8s linear infinite;
}
.payment-return--success .payment-return__orbit::after { border-color: rgba(94, 201, 122, 0.68); }
.payment-return--failed .payment-return__orbit::after { border-color: rgba(200, 206, 214, 0.3); }
.payment-return__copy h1 {
  font-size: clamp(1.85rem, 6vw, 2.65rem);
  background: var(--chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.payment-return__amount {
  margin: 0.7rem 0 0;
  color: var(--silver-bright);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}
.payment-return__message {
  max-width: 27rem;
  margin: 1rem auto 0;
  color: var(--text-2);
  font-size: 0.98rem;
  line-height: 1.65;
}
.payment-return__note {
  max-width: 26rem;
  min-height: 2.8em;
  margin: 0.8rem auto 0;
  color: var(--text-3);
  font-size: 0.8rem;
  line-height: 1.55;
}
.payment-return__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin-top: 2rem;
}
.payment-return__actions .btn { width: 100%; }
.payment-return__trust {
  margin: 1.4rem 0 0;
  color: var(--text-3);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
@keyframes payment-orbit { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .payment-return { min-height: calc(100svh - 178px); padding: 1.25rem 0 3rem; }
  .payment-return__frame { padding: 2rem 1.25rem; border-right: 0; border-left: 0; }
  .payment-return__eyebrow { margin-bottom: 1.5rem; }
}

/* ---------- Load reveal ---------- */
.reveal-up {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal-up var(--slow) var(--ease) forwards;
}
.reveal-d1 { animation-delay: 0.16s; }
.reveal-d2 { animation-delay: 0.32s; }
@keyframes reveal-up {
  to { opacity: 1; transform: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .crest-stage::after { animation: none; opacity: 0; }
  .payment-return__orbit::after { animation: none; }
  .reveal-up { opacity: 1; transform: none; animation: none; }
  body { background: var(--bg); }
  * { scroll-behavior: auto !important; }
}
