/* ============================================================
   Money Saver — app site (landing + legal pages)
   Matches the iOS app: Playpen Sans Arabic typeface, the cream
   "editorial" light palette, Inkwell Blue accent. Light only.
   ============================================================ */

/* ---- Brand typeface: Playpen Sans Arabic (same files the app ships) ---- */
@font-face { font-family: "Playpen Sans Arabic"; src: url("fonts/PlaypenSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Playpen Sans Arabic"; src: url("fonts/PlaypenSansArabic-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Playpen Sans Arabic"; src: url("fonts/PlaypenSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Playpen Sans Arabic"; src: url("fonts/PlaypenSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Playpen Sans Arabic"; src: url("fonts/PlaypenSansArabic-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
    color-scheme: light;

    --bg: #FAF9F5;
    --elevated: #FFFFFF;
    --muted-surface: #F2EEE6;
    --sunken: #ECE6D8;
    --fg: #1F1E1B;
    --muted: #6B655B;
    --faint: #A8A095;
    --border: #E8E3D8;
    --border-strong: #C9C1B0;
    --accent: #3A4A6B;        /* Inkwell Blue */
    --accent-bg: #DCE0E8;
    --on-accent: #FAF9F5;
    --income: #4A6B3F;        --income-bg: #E4EBDE;
    --expense: #A23F2E;       --expense-bg: #F3E2DE;
    --amber: #B8884A;         --amber-bg: #F0E7D6;

    --max: 1040px;
    --reading: 720px;
    --radius: 20px;
    --radius-sm: 14px;
    --shadow: 0 1px 2px rgba(31,30,27,.05), 0 8px 28px rgba(31,30,27,.06);
    --shadow-lg: 0 2px 6px rgba(31,30,27,.06), 0 30px 70px rgba(31,30,27,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: "Playpen Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background-image:
        radial-gradient(1200px 600px at 75% -10%, rgba(58,74,107,.07), transparent 60%),
        radial-gradient(900px 500px at 0% 5%, rgba(184,136,74,.06), transparent 55%);
    background-repeat: no-repeat;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); }

/* ---------- Sticky top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250,249,245,.8);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; max-width: var(--max); margin: 0 auto; padding: 13px 24px; }
.topbar .app-icon { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow); }
.topbar .app-name { font-weight: 700; font-size: 16px; }
.topbar nav { margin-left: auto; display: flex; gap: 20px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.topbar nav a:hover { color: var(--accent); }
@media (max-width: 560px) { .topbar nav { gap: 14px; } .topbar nav a.hide-sm { display: none; } }

/* ---------- Eyebrow / section heads ---------- */
.eyebrow {
    display: inline-block;
    font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-bg);
    padding: 6px 12px; border-radius: 999px;
}
.section-title { font-size: clamp(28px, 4.6vw, 40px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 16px; }
.section-sub { color: var(--muted); font-size: 17px; margin-top: 12px; max-width: 56ch; }
.center { text-align: center; }
.center .section-sub { margin-left: auto; margin-right: auto; }

/* ---------- Hero (two-column: copy + framed iPhone) ---------- */
.hero { padding: 56px 0 28px; }
/* `minmax(0, …)` (not bare `1fr`) lets the tracks shrink below their
   content's intrinsic size — without it the device column inherits the
   raw 1284px screenshot width and blows the whole grid past the viewport,
   which stops the headline from wrapping on phones. Paired with
   `min-width: 0` on the items, this keeps the hero inside the screen at
   every width. */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero-copy, .device-stage { min-width: 0; }
.hero-copy h1 { font-size: clamp(32px, 8vw, 62px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 18px; overflow-wrap: break-word; }
.hero-copy h1 .grad { background: linear-gradient(120deg, var(--accent), #5c74a8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy .sub { font-size: 19px; color: var(--muted); margin-top: 18px; max-width: 46ch; }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 14px; border-radius: 999px;
    background: var(--elevated); border: 1px solid var(--border);
    font-size: 13px; font-weight: 500; color: var(--fg); box-shadow: var(--shadow);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge {
    display: inline-block; margin-top: 26px; padding: 12px 22px;
    background: var(--accent); color: var(--on-accent);
    border-radius: 999px; font-size: 15px; font-weight: 700; box-shadow: var(--shadow);
}

/* ---------- CSS iPhone frame (real raw screenshot inside) ---------- */
.device-stage { display: flex; justify-content: center; }
.device {
    width: min(300px, 76vw);
    flex: 0 0 auto;
    background: #1F1E1B;            /* charcoal bezel — makes the cream screen pop */
    border-radius: 46px;
    padding: 11px;
    box-shadow: var(--shadow-lg);
    transition: transform .4s ease;
}
.device:hover { transform: translateY(-5px); }
.device-screen {
    border-radius: 36px;
    overflow: hidden;
    background: var(--bg);
    display: block;
    line-height: 0;            /* kill the inline-image baseline gap */
}
.device-screen img { width: 100%; height: auto; display: block; }

@media (max-width: 860px) {
    .hero { padding: 40px 0 24px; }
    .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; text-align: center; }
    .hero-copy .sub { margin-left: auto; margin-right: auto; }
    .pill-row { justify-content: center; }
    .device-stage { order: 2; }
}

/* ============================================================
   Screenshot gallery — real App Store frames, horizontal scroll
   ============================================================ */
.gallery { padding: 28px 0 64px; }
.gallery-track {
    display: flex; gap: 22px;
    /* `width: max-content; max-width: 100%; margin-inline: auto` is the
       robust "centered when it fits, scroll when it doesn't" pattern:
       - cards narrower than the viewport  → track shrinks to content and
         the auto margins centre it.
       - cards wider than the viewport     → track is capped at 100%, so it
         never widens the page, and `overflow-x: auto` scrolls it instead.
       (The earlier `justify-content: safe center` let the cards escape the
       page on browsers that don't support the `safe` keyword.) */
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 24px;
    padding: 10px 24px 30px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.shot {
    flex: 0 0 auto;
    width: 272px;
    scroll-snap-align: center;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--elevated);
    transition: transform .25s ease;
}
.shot:hover { transform: translateY(-6px); }
.shot img { width: 100%; height: auto; display: block; }
.scroll-hint { text-align: center; color: var(--faint); font-size: 13px; margin-top: 4px; }
.scroll-hint span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 560px) {
    .shot { width: 78vw; max-width: 320px; }
}

/* ============================================================
   Feature groups
   ============================================================ */
section { padding: 56px 0; border-top: 1px solid var(--border); }

.feat-group { margin-top: 36px; }
.feat-group:first-of-type { margin-top: 28px; }
.feat-group-label {
    font-size: 13px; font-weight: 700; letter-spacing: .04em;
    color: var(--accent); margin-bottom: 16px; text-align: left;
    display: flex; align-items: center; gap: 10px;
}
.feat-group-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; text-align: left; }
.feature {
    padding: 22px; background: var(--elevated);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .15s ease, border-color .15s ease;
}
.feature:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.feature .ico { width: 46px; height: 46px; border-radius: 13px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; }
.feature .ico svg { width: 24px; height: 24px; display: block; }
.feature .t { font-weight: 700; margin-top: 14px; font-size: 16px; }
.feature .d { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.5; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }

/* ---------- Privacy callout ---------- */
.callout {
    background: linear-gradient(135deg, var(--accent), #2c3a57);
    color: #fff; border-radius: var(--radius); padding: 44px;
    text-align: center; box-shadow: var(--shadow-lg);
}
.callout .ti { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.callout .de { color: rgba(255,255,255,.85); margin-top: 14px; max-width: 56ch; margin-inline: auto; font-size: 17px; }
.callout .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.callout .row .chip { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; }

/* ---------- Mobile polish ---------- */
@media (max-width: 560px) {
    section { padding: 44px 0; }
    .callout { padding: 30px 22px; }
    .feat-group { margin-top: 28px; }
    .wrap { padding: 0 18px; }
}

/* ---------- Footer ---------- */
footer { padding: 48px 0 64px; border-top: 1px solid var(--border); text-align: center; color: var(--faint); font-size: 13px; }
footer .flinks { display: flex; gap: 20px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
footer .flinks a { color: var(--muted); text-decoration: none; font-weight: 500; }
footer .flinks a:hover { color: var(--accent); }
footer .sign { margin-bottom: 6px; }

/* ============================================================
   Legal pages (privacy / terms)
   ============================================================ */
.legal { padding: 48px 24px 24px; max-width: calc(var(--reading) + 48px); margin: 0 auto; }
.legal h1 { font-size: clamp(30px, 6vw, 42px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.legal .updated { color: var(--faint); font-size: 14px; margin-top: 12px; }
.legal .lead { color: var(--muted); font-size: 17px; margin-top: 20px; }

.legal-body { padding: 0 24px 56px; max-width: calc(var(--reading) + 48px); margin: 0 auto; }
.legal-body h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 40px 0 12px; padding-top: 8px; }
.legal-body h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.legal-body p { color: var(--muted); margin-bottom: 12px; }
.legal-body ul { color: var(--muted); margin: 0 0 14px 0; padding-left: 22px; }
.legal-body li { margin-bottom: 7px; }
.legal-body strong { color: var(--fg); font-weight: 600; }
.legal-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-body .tldr { background: var(--accent-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin: 24px 0; }
.legal-body .tldr p { margin: 0; color: var(--fg); }
.toc { background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin: 28px 0 8px; box-shadow: var(--shadow); }
.toc .t { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc ol { padding-left: 20px; color: var(--muted); }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ============================================================
   App Store download — header button, hero/CTA badge
   ============================================================ */
.nav-dl {
    background: var(--accent); color: var(--on-accent) !important;
    padding: 8px 16px; border-radius: 999px;
    font-weight: 700 !important; box-shadow: var(--shadow);
    transition: transform .2s ease, opacity .2s ease;
}
.nav-dl:hover { transform: translateY(-1px); opacity: .94; color: var(--on-accent) !important; }

.cta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 28px; }
.cta-row.center-row { justify-content: center; margin-top: 24px; }
.cta-note { color: var(--muted); font-size: 14px; font-weight: 500; }

.appstore-badge {
    display: inline-flex; align-items: center; gap: 11px;
    background: #000; color: #fff; text-decoration: none;
    padding: 11px 20px; border-radius: 14px;
    box-shadow: var(--shadow); transition: transform .2s ease, opacity .2s ease;
}
.appstore-badge:hover { transform: translateY(-2px); opacity: .92; }
.appstore-badge .apple-logo { width: 26px; height: 26px; color: #fff; flex: 0 0 auto; }
.appstore-badge .ab-text { display: flex; flex-direction: column; line-height: 1.04; text-align: left; }
.appstore-badge .ab-text small { font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.appstore-badge .ab-text strong { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
/* Keep the badge white + un-underlined even inside .article-body, where
   `.article-body a` (specificity 0,1,1) would otherwise tint it accent-blue.
   `:link`/`:visited` raise these to specificity 0,2,0 so they win. */
.appstore-badge:link, .appstore-badge:visited, .appstore-badge:hover { color: #fff; text-decoration: none; }
.appstore-badge .ab-text small, .appstore-badge .ab-text strong { color: #fff; text-decoration: none; }

@media (max-width: 860px) { .cta-row { justify-content: center; } }
@media (max-width: 420px) { .topbar nav a.hide-sm { display: none; } }

/* ============================================================
   Final download CTA section
   ============================================================ */
.dl-cta {
    background: linear-gradient(180deg, var(--muted-surface), var(--bg));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   FAQ (accessible <details> accordion)
   ============================================================ */
.faq { max-width: var(--reading); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
    background: var(--elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    overflow: hidden;
}
.faq-item summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px; font-size: 17px; font-weight: 600; color: var(--fg);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: ""; flex: 0 0 auto;
    width: 11px; height: 11px;
    border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
    transform: rotate(45deg); transition: transform .2s ease; margin-top: -4px;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: 2px; }
.faq-item[open] summary { color: var(--accent); }
.faq-a { padding: 0 20px 20px; color: var(--muted); font-size: 16px; line-height: 1.6; }

/* ============================================================
   Blog — index grid + article pages
   ============================================================ */
.breadcrumb { max-width: var(--reading); margin: 0 auto; padding: 28px 24px 0; font-size: 13px; color: var(--faint); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

.blog-hero { padding: 44px 24px 8px; max-width: var(--max); margin: 0 auto; }
.blog-hero .eyebrow { margin-bottom: 16px; }
.blog-hero h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 800; letter-spacing: -.02em; line-height: 1.08; }
.blog-hero .lead { color: var(--muted); font-size: 18px; margin-top: 14px; max-width: 60ch; }

.post-grid { max-width: var(--max); margin: 0 auto; padding: 28px 24px 64px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
@media (max-width: 760px) { .post-grid { grid-template-columns: minmax(0,1fr); } }
.post-card { display: flex; flex-direction: column; background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.post-card .tag { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-bg); padding: 5px 11px; border-radius: 999px; }
.post-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; margin: 15px 0 9px; }
.post-card p { color: var(--muted); font-size: 15px; line-height: 1.55; flex: 1; }
.post-card .more { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: 14px; }

/* Article page */
.article { max-width: var(--reading); margin: 0 auto; padding: 22px 24px 8px; }
.article h1 { font-size: clamp(28px, 5.4vw, 42px); font-weight: 800; letter-spacing: -.02em; line-height: 1.14; }
.post-meta { color: var(--faint); font-size: 14px; margin-top: 16px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.post-meta .mdot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

.article-body { max-width: var(--reading); margin: 0 auto; padding: 10px 24px 36px; }
.article-body > p:first-of-type { font-size: 19px; color: var(--fg); }
.article-body p { color: var(--muted); font-size: 17px; line-height: 1.7; margin-bottom: 16px; }
.article-body h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin: 38px 0 12px; }
.article-body h3 { font-size: 18px; font-weight: 700; margin: 24px 0 8px; color: var(--fg); }
.article-body ul, .article-body ol { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 0 0 16px 0; padding-left: 24px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: var(--fg); font-weight: 600; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-body blockquote { border-left: 3px solid var(--accent); background: var(--muted-surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 22px 0; padding: 14px 20px; color: var(--fg); }
.article-body blockquote p { margin: 0; color: var(--fg); }

.article-cta { background: var(--muted-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 26px; margin: 38px 0; text-align: center; }
.article-cta h3 { font-size: 21px; font-weight: 800; margin-bottom: 8px; }
.article-cta p { color: var(--muted); margin-bottom: 18px; }
.article-cta .appstore-badge { margin: 0 auto; }

.related { max-width: var(--reading); margin: 0 auto; padding: 0 24px 56px; }
.related .t { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.related a { display: block; color: var(--fg); text-decoration: none; padding: 13px 0; border-top: 1px solid var(--border); font-weight: 600; }
.related a:last-child { border-bottom: 1px solid var(--border); }
.related a:hover { color: var(--accent); }
