/* =========================================================
   Khata — design tokens
   Light theme. Ledger/khata-book aesthetic. A real mode toggle
   (Standard / Islamic) re-themes accent color + reveals Zakat UI,
   not just a label swap.
========================================================= */

:root{
  --bg:          #F6F5F1;
  --surface:     #FFFFFF;
  --surface-2:   #EEEDE6;
  --border:      #E2E0D5;
  --ink:         #1B2A22;
  --muted:       #5C6359;
  --muted-2:     #8B9184;

  /* Standard mode accent (default) */
  --accent:      #1E6FBF;
  --accent-bg:   #E8F0FA;

  --good:        #1F7A5C;
  --good-bg:     #E6F2EC;
  --warn:        #C4552E;
  --warn-bg:     #F7E8E1;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --maxw: 1120px;

  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
}

/* Islamic mode re-themes the accent + surfaces a gold thread — applied via body.mode-islamic */
body.mode-islamic{
  --accent:    #1F7A5C;
  --accent-bg: #E6F2EC;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img{ max-width:100%; display:block; }
a{ color: inherit; }
h1,h2,h3,h4{ font-family: var(--font-display); line-height:1.2; margin:0 0 0.5em 0; letter-spacing:-0.01em; }
h1{ font-size: clamp(2.1rem, 4vw, 3.3rem); font-weight:700; }
h2{ font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight:700; }
h3{ font-size: 1.1rem; font-weight:700; }
p{ margin:0 0 1em 0; }
.muted{ color: var(--muted); }
.wrap{ max-width: var(--maxw); margin:0 auto; padding:0 24px; }

/* Thin geometric accent rule — a restrained nod, not a pattern overload */
.geo-rule{
  height:6px; width:100%;
  background: repeating-linear-gradient(135deg, var(--accent) 0 10px, transparent 10px 20px);
  opacity:0.55; border-radius:999px; margin: 18px 0 0;
  transition: background .3s ease;
}

/* ---------- Nav ---------- */
.site-nav{ position:sticky; top:0; z-index:50; background: rgba(246,245,241,0.9); backdrop-filter: blur(8px); border-bottom:1px solid var(--border); }
.site-nav .wrap{ display:flex; align-items:center; justify-content:space-between; height:68px; }
.brand{ display:flex; align-items:center; gap:9px; font-family: var(--font-display); font-weight:700; font-size:1.2rem; text-decoration:none; color: var(--ink); }
.brand .mark{ width:26px; height:26px; border-radius:7px; background: var(--accent); display:flex; align-items:center; justify-content:center; color:#fff; font-size:0.85rem; font-weight:700; transition: background .3s ease; }
.nav-links{ display:flex; gap:26px; align-items:center; list-style:none; margin:0; padding:0; }
.nav-links a{ text-decoration:none; color: var(--muted); font-weight:600; font-size:0.94rem; }
.nav-links a:hover{ color: var(--ink); }
.nav-cta{ background: var(--ink); color:#fff !important; padding:9px 18px; border-radius: var(--radius-sm); font-weight:700 !important; }
.nav-toggle{ display:none; }
@media (max-width:760px){
  .nav-links{ position:absolute; top:68px; left:0; right:0; background: var(--surface); border-bottom:1px solid var(--border); flex-direction:column; align-items:flex-start; padding:16px 24px; gap:16px; display:none; }
  .nav-links.open{ display:flex; }
  .nav-toggle{ display:block; background:none; border:1px solid var(--border); border-radius: var(--radius-sm); padding:8px 10px; font-size:1.1rem; cursor:pointer; }
}

/* ---------- Buttons ---------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:13px 24px; border-radius: var(--radius-sm); font-weight:700; font-size:0.96rem; text-decoration:none; cursor:pointer; border:1px solid transparent; transition: background .15s ease, transform .12s ease, box-shadow .15s ease; }
.btn:active{ transform: translateY(1px); }
.btn-primary{ background: var(--accent); color:#fff; }
.btn-primary:hover{ box-shadow: 0 8px 20px -6px var(--accent); }
.btn-ghost{ background:transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover{ border-color: var(--ink); }
.btn-block{ width:100%; }

/* ---------- Mode toggle (the signature interaction) ---------- */
.mode-switch{ display:inline-flex; background: var(--surface-2); border:1px solid var(--border); border-radius:999px; padding:4px; gap:2px; }
.mode-switch button{
  border:none; background:none; padding:9px 18px; border-radius:999px; font-weight:700; font-size:0.86rem;
  cursor:pointer; color: var(--muted); transition: background .2s ease, color .2s ease;
}
.mode-switch button.active{ background: var(--ink); color:#fff; }

/* ---------- Hero ---------- */
.hero{ padding:64px 0 50px; }
.hero-grid{ display:grid; grid-template-columns:1.05fr 0.95fr; gap:50px; align-items:center; }
@media (max-width:900px){ .hero-grid{ grid-template-columns:1fr; } }
.eyebrow{ display:inline-flex; align-items:center; gap:8px; font-size:0.78rem; font-weight:700; letter-spacing:0.04em; text-transform:uppercase; color: var(--accent); background: var(--accent-bg); padding:6px 12px; border-radius:999px; margin-bottom:18px; transition: color .3s ease, background .3s ease; }
.hero p.lead{ font-size:1.14rem; color: var(--muted); max-width:46ch; }
.hero-actions{ display:flex; gap:14px; margin-top:26px; flex-wrap:wrap; align-items:center; }

/* Ledger card — signature visual */
.ledger-card{ background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding:24px; box-shadow: 0 24px 60px -30px rgba(27,42,34,0.28); }
.ledger-head{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:16px; }
.ledger-head .month{ font-weight:700; }
.ledger-head .total{ font-family: var(--font-display); font-weight:700; font-size:1.3rem; color: var(--accent); transition: color .3s ease; }
.ledger-rows{ display:flex; flex-direction:column; gap:12px; }
.ledger-row{ display:grid; grid-template-columns: 1fr auto; gap:8px; padding-bottom:10px; border-bottom:1px dashed var(--border); }
.ledger-row .cat{ font-weight:600; font-size:0.92rem; }
.ledger-row .bar{ grid-column:1 / -1; height:8px; background: var(--surface-2); border-radius:999px; overflow:hidden; margin-top:4px; }
.ledger-row .bar span{ display:block; height:100%; background: var(--accent); border-radius:999px; transition: width .8s ease, background .3s ease; }
.ledger-row .amt{ font-weight:700; font-size:0.88rem; }
.zakat-line{ display:none; margin-top:14px; padding-top:14px; border-top:1px solid var(--border); font-size:0.88rem; color: var(--good); font-weight:700; align-items:center; gap:8px; }
body.mode-islamic .zakat-line{ display:flex; }

/* ---------- Sections ---------- */
section{ padding:60px 0; }
.section-head{ max-width:640px; margin-bottom:36px; }
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:22px; }
.grid-2{ display:grid; grid-template-columns:repeat(2,1fr); gap:22px; }
@media (max-width:860px){ .grid-3{ grid-template-columns:1fr; } .grid-2{ grid-template-columns:1fr; } }
.card{ background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding:26px; }
.card .icon{ width:40px; height:40px; border-radius:10px; background: var(--accent-bg); color: var(--accent); display:flex; align-items:center; justify-content:center; font-weight:700; margin-bottom:16px; transition: background .3s ease, color .3s ease; }

.steps{ display:flex; flex-direction:column; }
.step{ display:grid; grid-template-columns:56px 1fr; gap:20px; padding:22px 0; border-top:1px solid var(--border); }
.step:last-child{ border-bottom:1px solid var(--border); }
.step .num{ font-family: var(--font-display); font-size:1.4rem; font-weight:700; color: var(--muted-2); }

/* ---------- Comparison infographic (Standard vs Islamic) ---------- */
.compare-table{ display:grid; grid-template-columns: 1.2fr 1fr 1fr; border:1px solid var(--border); border-radius: var(--radius-lg); overflow:hidden; }
.compare-table > div{ padding:16px 18px; border-bottom:1px solid var(--border); font-size:0.92rem; }
.compare-table > div:nth-child(3n+1){ background: var(--surface-2); font-weight:700; }
.compare-table .head{ font-family: var(--font-display); font-weight:700; background: var(--ink) !important; color:#fff !important; }
@media (max-width:640px){ .compare-table{ grid-template-columns:1fr; } .compare-table > div:nth-child(3n+1){ background: var(--surface); } }

/* ---------- Bar chart (infographic, animated) ---------- */
.bar-chart{ display:flex; flex-direction:column; gap:14px; }
.bar-row{ display:grid; grid-template-columns:140px 1fr 60px; align-items:center; gap:14px; }
.bar-row .name{ font-weight:600; font-size:0.9rem; }
.bar-row .track{ height:10px; background: var(--surface-2); border-radius:999px; overflow:hidden; }
.bar-row .fill{ height:100%; border-radius:999px; background: var(--accent); width:0; transition: width 1s ease, background .3s ease; }
.bar-row .pct{ font-weight:700; font-size:0.85rem; text-align:right; }

/* ---------- Reviews ---------- */
.review-empty{ border:1px dashed var(--border); border-radius: var(--radius-lg); padding:32px; text-align:center; color: var(--muted); }

/* ---------- Auth pages ---------- */
.auth-shell{ background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding:32px; max-width:440px; margin:0 auto; }
.field{ margin-bottom:20px; }
.field label{ display:block; font-weight:700; font-size:0.9rem; margin-bottom:8px; }
.field input, .field select{ width:100%; padding:12px 14px; border-radius: var(--radius-sm); border:1px solid var(--border); background: var(--bg); font-family: var(--font-body); font-size:0.95rem; color: var(--ink); }
.form-alert{ border:1px solid var(--warn); background: var(--warn-bg); color: var(--warn); padding:12px 14px; border-radius: var(--radius-sm); font-size:0.86rem; }

/* ---------- Dashboard ---------- */
.dash-grid{ display:grid; grid-template-columns: 1fr 1.4fr; gap:24px; align-items:start; }
@media (max-width:960px){ .dash-grid{ grid-template-columns:1fr; } }
.dash-card{ background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding:24px; margin-bottom:22px; }
.txn-row{ display:grid; grid-template-columns: 1fr auto auto; gap:12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--border); font-size:0.9rem; }
.txn-row .cat{ font-weight:600; }
.txn-row .amt.income{ color: var(--good); font-weight:700; }
.txn-row .amt.expense{ color: var(--warn); font-weight:700; }
.pill-select{ display:flex; gap:8px; flex-wrap:wrap; }
.pill-select button{ border:1px solid var(--border); background: var(--bg); border-radius:999px; padding:8px 14px; font-size:0.85rem; cursor:pointer; font-weight:600; }
.pill-select button.active{ background: var(--ink); color:#fff; border-color: var(--ink); }
.zakat-result{ background: var(--good-bg); border:1px solid var(--good); border-radius: var(--radius-md); padding:18px; margin-top:16px; }
.zakat-result .amt{ font-family: var(--font-display); font-size:1.6rem; font-weight:700; color: var(--good); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference){
  .card, .step{ transition: transform .18s ease; }
  .card:hover{ transform: translateY(-3px); }
  .reveal{ opacity:0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
  .reveal.is-visible{ opacity:1; transform: translateY(0); }
}

/* ---------- Blog ---------- */
.post-card{ display:block; text-decoration:none; color:inherit; background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding:24px; margin-bottom:16px; }
.post-card .tag{ font-size:0.72rem; font-weight:700; text-transform:uppercase; color: var(--accent); margin-bottom:8px; display:block; }
.post-body{ max-width:68ch; margin:0 auto; }
.post-body h2{ margin-top:1.4em; }
.post-body ul{ padding-left:1.2em; }
.post-body li{ margin-bottom:0.5em; }

/* ---------- Footer ---------- */
footer{ border-top:1px solid var(--border); padding:40px 0; margin-top:20px; }
.footer-grid{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:20px; align-items:center; }
.footer-links{ display:flex; gap:20px; list-style:none; margin:0; padding:0; }
.footer-links a{ text-decoration:none; color: var(--muted); font-size:0.88rem; }
.footer-links a:hover{ color: var(--ink); }
