/* ==========================================================================
   MainMenu landing page

   The page is built around one artefact: the receipt. Paper is the resting
   surface, ink is the counter, and the only warm colour in the system is the
   amber the app already reserves for money leaving the till — so the schedule
   chips and the instalment line on the receipt are the warm points on an
   otherwise cool page.

   Everything is written with logical properties: the same stylesheet serves
   `dir="rtl"` (Farsi, the default) and `dir="ltr"` (English).
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette */
  --ink: #0b1220;
  --ink-raised: #14203a;
  --ink-line: #22304e;
  --paper: #faf8f3;
  --paper-deep: #f2efe7;
  --card: #ffffff;
  --rule: #e2ddd1;
  --text: #101827;
  --text-muted: #56607a;
  --text-on-ink: #e8edf7;
  --text-on-ink-muted: #97a4bd;
  --blue: #1d4ed8;
  --blue-deep: #1b3fae;
  --blue-soft: #e6ecfd;
  --stamp: #a24a06;
  --stamp-bg: #fbeedd;
  --green: #15653f;
  --green-bg: #dcf3e6;

  /* Type */
  --font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-tab: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', monospace;

  /* Rhythm — marketing page, so the scale is roomier than the app's */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(16 24 39 / 6%), 0 1px 3px rgb(16 24 39 / 4%);
  --shadow-md: 0 8px 24px rgb(16 24 39 / 8%), 0 2px 6px rgb(16 24 39 / 5%);
  --shadow-paper: 0 18px 44px rgb(11 18 32 / 16%), 0 2px 6px rgb(11 18 32 / 8%);

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --wrap: 74rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

/* Moved out of view with a transform, not a negative offset: in RTL a negative
   inline-start resolves to `right`, which pushes the page into a horizontal scroll. */
.skip {
  position: absolute;
  inset-inline-start: var(--space-3);
  top: 0;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transform: translateY(-150%);
}
.skip:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}
.band--ink :focus-visible,
.closing :focus-visible {
  outline-color: #fff;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

/* ── Type ─────────────────────────────────────────────────────────────────── */

.display {
  margin: 0 0 var(--space-3);
  font-size: clamp(2.1rem, 5.2vw, 3.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-wrap: balance;
}
:root[data-lang='fa'] .display {
  line-height: 1.45;
  letter-spacing: 0;
}

.h2 {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
:root[data-lang='fa'] .h2 {
  line-height: 1.55;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp);
}
:root[data-lang='fa'] .eyebrow {
  letter-spacing: 0.04em;
}
.eyebrow--onink {
  color: #f0b070;
}

.lede {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  color: var(--text-muted);
}
.lede--onink {
  color: var(--text-on-ink-muted);
}

.num,
.receipt,
.inst,
.kpi__value,
.ledger dd {
  font-variant-numeric: tabular-nums;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(250 248 243 / 88%);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid transparent;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.topbar.is-stuck {
  border-block-end-color: var(--rule);
  box-shadow: var(--shadow-sm);
}
.topbar__inner {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 4rem;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mark__word {
  font-size: 1.05rem;
}
/* The mark is a torn receipt stub: a filled block with a serrated bottom edge. */
.mark__glyph {
  inline-size: 1.05rem;
  block-size: 1.35rem;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
  clip-path: polygon(
    0 0,
    100% 0,
    100% 78%,
    83% 100%,
    66% 78%,
    50% 100%,
    33% 78%,
    17% 100%,
    0 78%
  );
}

.topnav {
  display: flex;
  gap: var(--space-4);
  font-size: 0.92rem;
}
.topnav a {
  text-decoration: none;
  color: var(--text-muted);
  padding-block: 0.35rem;
  border-block-end: 2px solid transparent;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.topnav a:hover {
  color: var(--text);
  border-block-end-color: var(--blue);
}

.langswitch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding-inline: 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill, 999px);
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.langswitch:hover {
  border-color: var(--blue);
  color: var(--text);
}
.langswitch__on {
  font-weight: 700;
  color: var(--text);
}
.langswitch__off {
  opacity: 0.55;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding-inline: 1.35rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease),
    transform 180ms var(--ease), box-shadow 180ms var(--ease);
}
.btn--sm {
  min-height: 2.5rem;
  padding-inline: 1rem;
  font-size: 0.9rem;
}
.btn--lg {
  min-height: 3.25rem;
  padding-inline: 1.9rem;
  font-size: 1.05rem;
}
.btn--solid {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--solid:hover {
  background: var(--blue-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn--ghost {
  border: 1px solid var(--rule);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.closing .btn--ghost {
  border-color: rgb(255 255 255 / 30%);
  color: var(--text-on-ink);
}
.closing .btn--ghost:hover {
  border-color: #fff;
  color: #fff;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  padding-block: clamp(var(--space-5), 7vw, var(--space-7)) var(--space-6);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: clamp(var(--space-5), 6vw, var(--space-6));
  align-items: center;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block: var(--space-4) var(--space-5);
}

.factstrip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin: 0;
  padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--rule);
}
.fact dt {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.fact dd {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ── The receipt (signature) ──────────────────────────────────────────────── */

.hero__receipt {
  display: flex;
  justify-content: center;
}
.receipt {
  --tooth: 14px;
  inline-size: min(100%, 21rem);
  color: #1a2334;
  font-size: 0.86rem;
  line-height: 1.85;
  filter: drop-shadow(0 18px 34px rgb(11 18 32 / 18%));
  transform: rotate(-1.1deg);
}
.receipt__body {
  background: var(--card);
  padding: var(--space-4) var(--space-4) var(--space-3);
}
.receipt__tear {
  block-size: 9px;
  background-image: linear-gradient(45deg, transparent 50%, var(--card) 50%),
    linear-gradient(-45deg, transparent 50%, var(--card) 50%);
  background-size: var(--tooth) 100%;
  background-repeat: repeat-x;
}
.receipt__tear--bottom {
  transform: scaleY(-1);
}

.receipt__line {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.receipt__store {
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.receipt__kind {
  justify-content: center;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.receipt__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.receipt__rule {
  margin-block: 0.5rem;
  border: 0;
  border-block-start: 1px dashed #c9c4b6;
}
.receipt__item .q {
  margin-inline-start: auto;
  padding-inline-end: 0.9rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.receipt__item .v,
.receipt__sum .v,
.receipt__split .v {
  font-variant-numeric: tabular-nums;
}
.receipt__sum {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.receipt__total {
  margin-block-start: 0.15rem;
  padding-block: 0.35rem;
  border-block: 2px solid #1a2334;
  font-weight: 700;
  font-size: 1rem;
}
.receipt__split {
  font-size: 0.82rem;
}
.receipt__split--credit {
  color: var(--stamp);
  font-weight: 500;
}
/* Irregular bar widths so it reads as a scan, not a texture. */
.receipt__barcode {
  block-size: 2.6rem;
  margin-block: var(--space-3) 0.4rem;
  background-image: repeating-linear-gradient(
      90deg,
      #1a2334 0 2px,
      transparent 2px 5px
    ),
    repeating-linear-gradient(90deg, #1a2334 0 1px, transparent 1px 4px);
  background-size: 100% 100%, 100% 100%;
  opacity: 0.9;
}
.receipt__foot {
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.receipt.is-printing .receipt__line,
.receipt.is-printing .receipt__rule,
.receipt.is-printing .receipt__barcode {
  animation: print 300ms var(--ease) both;
  animation-delay: var(--print-delay, 0ms);
}
.receipt.is-printed .receipt__line,
.receipt.is-printed .receipt__rule,
.receipt.is-printed .receipt__barcode {
  animation: none;
  opacity: 1;
  clip-path: none;
}
@keyframes print {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

/* ── Bands ────────────────────────────────────────────────────────────────── */

.band {
  padding-block: clamp(var(--space-6), 9vw, var(--space-7));
}
.band--paperdeep {
  background: var(--paper-deep);
}
.band--ink {
  background: var(--ink);
  color: var(--text-on-ink);
}
/* Perforation between two paper bands, the way a roll is scored. */
.band + .band:not(.band--ink) {
  border-block-start: 2px dashed var(--rule);
}

.sechead {
  max-width: 52rem;
  margin-block-end: var(--space-5);
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-3);
}
.cardgrid--2 {
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}
.card {
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  /* Set explicitly: white cards also sit inside the ink bands, where the
     inherited colour would be the light-on-dark one. */
  color: var(--text);
}
.card--onink {
  background: var(--ink-raised);
  border-color: var(--ink-line);
  box-shadow: none;
  color: var(--text-on-ink);
}
.card__title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.card__text {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}
.card--onink .card__text {
  color: var(--text-on-ink-muted);
}

/* ── Instalment schedule — the one sequence on the page ───────────────────── */

.schedule {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
}
.inst {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-block-start: 1px solid var(--rule);
}
.inst:first-child {
  border-block-start: 0;
}
.inst--due {
  background: var(--stamp-bg);
}
.inst__no {
  display: grid;
  place-items: center;
  inline-size: 1.9rem;
  block-size: 1.9rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.inst--due .inst__no {
  background: var(--stamp);
}
.inst__date {
  color: var(--text-muted);
  font-size: 0.94rem;
}
.inst__amt {
  font-weight: 700;
}

.chip {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: #eef0f4;
  color: var(--text-muted);
  white-space: nowrap;
}
.chip--paid {
  background: var(--green-bg);
  color: var(--green);
}
.chip--due {
  background: var(--stamp);
  color: #fff;
}

.notegrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
}
.note {
  margin: 0;
  padding-inline-start: var(--space-3);
  border-inline-start: 2px solid var(--blue);
  font-size: 0.94rem;
  color: var(--text-muted);
}
.note strong {
  color: var(--text);
}

/* ── Dashboard strip ──────────────────────────────────────────────────────── */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-3);
}
.kpi {
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}
.kpi__label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.kpi__value {
  margin: 0.1rem 0 0.2rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
}
.kpi__delta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.kpi__delta--up {
  color: var(--green);
}
.kpi__delta--warn {
  color: var(--stamp);
}
.kpi--chart {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.spark {
  inline-size: 100%;
  block-size: 4rem;
  margin-block-start: var(--space-2);
}
.spark__line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.spark__area {
  fill: var(--blue-soft);
  stroke: none;
}
.spark__dot {
  fill: var(--blue);
}

/* ── Ledger (the numbers that are actually verifiable) ────────────────────── */

.ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0;
  margin: var(--space-5) 0 0;
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ledger__row {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 1px solid var(--ink-line);
}
.ledger__row:first-child {
  border-inline-start: 0;
}
.ledger dt {
  font-size: 0.82rem;
  color: var(--text-on-ink-muted);
}
.ledger dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.ledger dd:not(.num) {
  font-size: 1.05rem;
}

/* ── Plans ────────────────────────────────────────────────────────────────── */

.plangrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3);
}
.plan {
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}
.plan--featured {
  border-color: var(--ink);
  box-shadow: var(--shadow-md);
}
.plan__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.plan__for {
  margin: 0.2rem 0 var(--space-3);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.plan__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.94rem;
}
.plan__list li {
  padding-block: 0.35rem;
  padding-inline-start: 1.25rem;
  border-block-start: 1px solid var(--rule);
  position: relative;
}
.plan__list li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 1.05rem;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 2px;
  background: var(--blue);
}
.plans__note {
  margin: var(--space-4) 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Close + footer ───────────────────────────────────────────────────────── */

.closing {
  background: var(--ink);
  color: var(--text-on-ink);
  padding-block: clamp(var(--space-6), 9vw, var(--space-7));
}
.closing__inner {
  text-align: center;
}
.closing__lede {
  margin-inline: auto;
  color: var(--text-on-ink-muted);
}
.closing__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-block-start: var(--space-4);
}

.foot {
  padding-block: var(--space-4);
  background: var(--ink);
  color: var(--text-on-ink-muted);
  border-block-start: 1px solid var(--ink-line);
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  font-size: 0.88rem;
}
.foot__line {
  margin: 0;
}
.mark--foot .mark__word {
  color: var(--text-on-ink);
}

/* ── Reveals ──────────────────────────────────────────────────────────────── */

.will-reveal {
  opacity: 0;
  transform: translateY(10px);
}
.will-reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 320ms var(--ease) var(--reveal-delay, 0ms),
    transform 320ms var(--ease) var(--reveal-delay, 0ms);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 62rem) {
  .topnav {
    display: none;
  }
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero__receipt {
    order: -1;
  }
  .receipt {
    transform: none;
  }
}

@media (max-width: 34rem) {
  .inst {
    grid-template-columns: 2.4rem 1fr auto;
    row-gap: var(--space-1);
  }
  .inst .chip {
    grid-column: 2 / -1;
    justify-self: start;
  }
  .factstrip {
    gap: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn:hover {
    transform: none;
  }
}
