/* ---------------------------------------------------------------------------
   Minglea — website stylesheet.

   Colours, radii, spacing and the card shadow are transcribed from the app's
   design tokens (lib/core/theme/tokens.dart, itself copied from
   01-design.json → tokens), so the site and the product read as one brand.
   There is no build step that shares them: when a token changes in Dart,
   change it here too.
   --------------------------------------------------------------------------- */

/* ---- fonts ------------------------------------------------------------- */
/* Inter by Rasmus Andersson, SIL Open Font License 1.1 — the same files the
   app bundles in assets/fonts/. Self-hosted so the site renders identically
   offline and from file://. */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-400.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-500.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-600.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-700.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

/* ---- tokens ------------------------------------------------------------ */
:root {
  /* Straight from `class T`. */
  --primary: #c92f4f;
  --secondary: #087f78;
  --accent: #f2b705;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16181d;
  --text-secondary: #626772;
  --border: #d9dce2;
  --success: #1e7a46;
  --warning: #9a5b00;
  --danger: #b42318;

  /* T.primarySoft / secondarySoft / accentSoft. */
  --primary-soft: rgba(201, 47, 79, 0.08);
  --secondary-soft: rgba(8, 127, 120, 0.08);
  --accent-soft: rgba(242, 183, 5, 0.14);

  /* T.shadow: offset (0, 2), blur 12, text at 8 %. */
  --shadow: 0 2px 12px rgba(22, 24, 29, 0.08);
  --shadow-raised: 0 8px 28px rgba(22, 24, 29, 0.12);

  /* T.rSmall / rMedium / rLarge. */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* T.xs … T.xl. */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --maxw: 1120px;
  --gutter: 24px;
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  /* Anchor targets must clear the sticky header. */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
  /* Avoid a lone word on the last line where supported. */
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 5.2vw, 3.5rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.7rem, 3.3vw, 2.35rem);
  font-weight: 700;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

/* Keyboard users must always see where they are. */
:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--text);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-lg) 0;
}

.skip-link:focus {
  left: 0;
}

/* Line-icon set used across the site (24 × 24, stroke = currentColor). */
.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---- layout ------------------------------------------------------------ */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(56px, 9vw, 104px);
}

.section--tint {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section__head {
  max-width: 660px;
  margin-bottom: 44px;
}

.section__head p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin: 14px 0 0;
}

/* Heading with an app illustration beside it. */
.section__head--art {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 660px) auto;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xl);
}

.section__art {
  width: 132px;
  height: 132px;
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ---- header ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
}

.nav {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--text);
  text-decoration: none;
}

.nav .btn {
  color: var(--surface);
}

.nav-toggle {
  display: none;
  margin-inline-start: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

/* ---- buttons ----------------------------------------------------------- */
/* Same shape as the app's ElevatedButton / OutlinedButton: T.brLarge. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--primary);
  color: var(--surface);
  box-shadow: var(--shadow);
}

/* Primary darkened ~10 % for the pressed/hover state. */
.btn--primary:hover {
  background: #b52845;
}

.btn--ghost {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn--secondary {
  background: var(--secondary);
  color: var(--surface);
}

.btn--sm {
  min-height: 40px;
  padding: 0 18px;
  font-size: 0.92rem;
}

/* Store buttons before the listings exist: visibly inert, not dead links. */
.btn.is-disabled {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
  box-shadow: none;
  cursor: default;
}

.btn.is-disabled:hover {
  transform: none;
}

.btn__sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---- hero -------------------------------------------------------------- */
.hero {
  padding-block: clamp(44px, 7vw, 88px) clamp(56px, 9vw, 96px);
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero__lede {
  font-size: 1.18rem;
  color: var(--text-secondary);
  max-width: 31em;
  margin-block: 22px 32px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.hero__note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.hero__visual {
  position: relative;
}

/* Soft brand disc behind the phone. */
.hero__visual::before {
  content: '';
  position: absolute;
  inset: 8% -6% auto auto;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-soft) 0%, rgba(8, 127, 120, 0.06) 55%, transparent 70%);
  z-index: 0;
}

/* ---- phone frame ------------------------------------------------------- */
/* The device shell is CSS; the screen is a 780 × 1690 capture of the app's
   high-fidelity design (same 19.5:9 ratio as current iPhones). */
.phone {
  --phone-w: 300px;
  position: relative;
  z-index: 1;
  width: var(--phone-w);
  max-width: 100%;
  margin-inline: auto;
  padding: 10px;
  border-radius: 46px;
  background: var(--text);
  box-shadow: 0 28px 64px rgba(22, 24, 29, 0.22), 0 4px 14px rgba(22, 24, 29, 0.12);
}

.phone::after {
  /* Dynamic Island. */
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  height: 22px;
  border-radius: 999px;
  background: var(--text);
}

.phone__screen {
  aspect-ratio: 780 / 1690;
  border-radius: 36px;
  overflow: hidden;
  background: var(--surface);
}

.phone__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- screens: phone beside the tab list -------------------------------- */
.tour {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.tour figure {
  margin: 0;
}

.tour figcaption {
  margin-top: 18px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.tabs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.tabs-list li {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.tabs-list strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.tabs-list span {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ---- feature cards ----------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 8px;
}

.card p {
  color: var(--text-secondary);
  font-size: 0.97rem;
  margin-bottom: 0;
}

/* Same treatment as the app's SettingRow icon: tinted tile, coloured glyph. */
.card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: var(--primary);
  background: var(--primary-soft);
}

.tabs-list .card__icon {
  margin-bottom: 0;
}

.card__icon--secondary {
  color: var(--secondary);
  background: var(--secondary-soft);
}

.card__icon--accent {
  color: var(--warning);
  background: var(--accent-soft);
}

/* ---- stats ------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-top: 36px;
  padding: 34px;
  border-radius: var(--radius-lg);
  background: var(--secondary);
  color: var(--surface);
  box-shadow: var(--shadow-raised);
}

.stat strong {
  display: block;
  font-size: 2.1rem;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat span {
  font-size: 0.93rem;
  color: rgba(255, 255, 255, 0.82);
}

/* ---- CTA band ---------------------------------------------------------- */
.cta {
  text-align: center;
  padding: clamp(44px, 7vw, 76px) 32px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.cta p {
  color: var(--text-secondary);
  max-width: 34em;
  margin: 14px auto 28px;
}

.cta__actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta__actions .btn.is-disabled {
  flex-direction: column;
  gap: 0;
  min-width: 210px;
  padding-block: 8px;
}

/* ---- FAQ / disclosure -------------------------------------------------- */
.faq {
  display: grid;
  gap: 12px;
  max-width: 860px;
}

details.qa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

details.qa summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

details.qa summary::-webkit-details-marker {
  display: none;
}

details.qa summary::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--primary);
  line-height: 1;
  flex: none;
}

details.qa[open] summary::after {
  content: '\2013';
}

details.qa p {
  color: var(--text-secondary);
  font-size: 0.97rem;
  margin: 12px 0 0;
}

/* ---- legal / long-form pages ------------------------------------------- */
.page-head {
  background: var(--surface);
  padding-block: clamp(44px, 7vw, 72px) 32px;
  border-bottom: 1px solid var(--border);
}

.page-head h1 {
  font-size: clamp(2rem, 4.4vw, 2.9rem);
}

.page-head p {
  color: var(--text-secondary);
  margin: 14px 0 0;
  max-width: 62ch;
}

.updated {
  font-size: 0.9rem;
}

.prose {
  max-width: 76ch;
  padding-block: clamp(40px, 6vw, 64px);
}

.prose--flush {
  padding-block: 0;
}

.prose h2 {
  font-size: 1.55rem;
  margin-top: 2.2em;
  margin-bottom: 0.55em;
}

/* Nothing gets top spacing when it opens its container. */
.prose > :first-child,
.doc > :first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 1.08rem;
  margin-top: 1.8em;
  margin-bottom: 0.4em;
}

.prose ul,
.prose ol {
  padding-inline-start: 1.3em;
  margin-block: 0 1em;
}

.prose li {
  margin-bottom: 0.5em;
}

.prose li::marker {
  color: var(--primary);
}

/* A whole legal document inside a page (e.g. Coin & Virtual Gift Rules). */
.doc {
  border-top: 1px solid var(--border);
  margin-top: 3em;
  padding-top: 2.4em;
}

.doc:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.doc__version {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
  background: var(--secondary-soft);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 0.9em;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--secondary);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-block: 24px 32px;
  box-shadow: var(--shadow);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout--warning {
  border-inline-start-color: var(--danger);
}

/* Table of contents on legal pages. */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 36px;
  box-shadow: var(--shadow);
}

.toc strong {
  display: block;
  margin-bottom: 10px;
}

.toc ol {
  margin: 0;
  padding-inline-start: 1.2em;
  columns: 2;
  column-gap: 32px;
}

.toc li {
  margin-bottom: 4px;
  break-inside: avoid;
}

/* Publisher / controller details. */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0 0 1em;
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
  color: var(--text-secondary);
}

/* ---- contact grid (support page) --------------------------------------- */
/* Two columns on desktop (min() keeps one column on narrow phones). */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 20px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow);
}

.contact-card h3 {
  margin-bottom: 6px;
}

.contact-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.contact-card p:last-child {
  margin-bottom: 0;
}

.contact-card a {
  font-weight: 600;
  word-break: break-word;
}

.path {
  font-weight: 600;
  color: var(--text);
}

/* Numbered steps, used for "before you write" and account deletion. */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0 0 1.2em;
  display: grid;
  gap: 14px;
}

.prose .steps {
  padding-inline-start: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 46px;
  margin: 0;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}

/* ---- footer ------------------------------------------------------------ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 52px 36px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 36px;
  margin-bottom: 36px;
}

.site-footer p {
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.site-footer h4 {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.site-footer ul a {
  color: var(--text);
  font-size: 0.95rem;
}

.site-footer__bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

/* Out-ranks `.site-footer ul { display: grid }` so the chips stay inline. */
.site-footer .langs {
  display: flex;
}

.langs li {
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg);
}

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .hero__grid,
  .tour {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    order: -1;
  }

  .phone {
    --phone-w: 270px;
  }

  .section__head--art {
    grid-template-columns: 1fr;
  }

  .section__art {
    display: none;
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .nav-toggle {
    display: block;
  }

  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 8px var(--gutter) 20px;
  }

  .nav[data-open='true'] {
    display: flex;
  }

  .nav a {
    padding-block: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
  }

  .nav .btn {
    margin-top: 14px;
    border-bottom: 0;
  }

  .toc ol {
    columns: 1;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts dd {
    margin-bottom: 10px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* ---- print (legal pages get printed and filed) ------------------------- */
@media print {
  .site-header,
  .site-footer,
  .cta,
  .toc,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    font-size: 12pt;
  }

  .page-head {
    border: 0;
  }
}
