/* ZakatEase — screen styles. Logical properties keep RTL (Arabic) working without extra rules. */

:root {
    --accent: #0f5c4d;
    --accent-text: var(--accent);
    --header-bg: #0b3d34;
    --header-ink: #f8f1df;
    --gold: #b8862b;
    --gold-strong: #8a6116;
    --gold-soft: #f4e7c5;
    --bg: #f5f0e6;
    --surface: #fffdf8;
    --surface-2: #faf6ec;
    --ink: #1c2925;
    --muted: #5d6b66;
    --line: #e6ddca;
    --minus: #9a3b28;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(28, 41, 37, .06), 0 10px 30px rgba(28, 41, 37, .07);
    --font-latin: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, "Noto Sans", Arial, sans-serif;
    --font-sans: var(--font-latin);
    --font-display: "Palatino Linotype", Palatino, "Book Antiqua", "Iowan Old Style", Georgia, serif;
    color-scheme: light;
}

@supports (color: color-mix(in oklab, red, blue)) {
    :root { --header-bg: color-mix(in oklab, var(--accent) 72%, #03110e); }
}

:root:lang(bn) {
    --font-sans: "Noto Sans Bengali", "Hind Siliguri", "Nirmala UI", "Vrinda", var(--font-latin);
    --font-display: "Noto Serif Bengali", "Noto Sans Bengali", "Nirmala UI", var(--font-latin);
}

:root:lang(ar) {
    --font-sans: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", var(--font-latin);
    --font-display: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Segoe UI", Tahoma, serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent-text: #6fd0b5;
        --gold: #d6a84c;
        --gold-strong: #e6be6d;
        --gold-soft: #3a311e;
        --bg: #0d1513;
        --surface: #141f1c;
        --surface-2: #1a2723;
        --ink: #e7eee9;
        --muted: #9db0a8;
        --line: #283733;
        --minus: #f08f78;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
        color-scheme: dark;
    }
    @supports (color: color-mix(in oklab, red, blue)) {
        :root { --accent-text: color-mix(in oklab, var(--accent) 45%, #ffffff); }
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }

.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 24px;
}

.icon { width: 18px; height: 18px; fill: currentColor; flex: none; }

.skip-link {
    position: absolute;
    inset-inline-start: 16px;
    top: -60px;
    z-index: 50;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--gold);
    color: #1c1406;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */

.site-header {
    position: relative;
    overflow: hidden;
    background-color: var(--header-bg);
    background-image: url("../assets/pattern.svg");
    background-size: 84px 84px;
    color: var(--header-ink);
}

.site-header::after {
    content: "";
    position: absolute;
    inset-inline-end: -110px;
    top: 30px;
    width: 460px;
    height: 460px;
    background: url("../assets/star.svg") no-repeat center / contain;
    opacity: .14;
    pointer-events: none;
}

.site-header__bar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-block: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.brand__logo { width: 40px; height: 40px; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font: 700 1.18rem/1.2 var(--font-display); letter-spacing: .01em; }
.brand__date { font-size: .8rem; opacity: .75; }

.prefs { display: flex; gap: 12px; flex-wrap: wrap; }
.prefs__item { display: flex; flex-direction: column; gap: 4px; }
.prefs__label {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .7;
}

.hero {
    position: relative;
    z-index: 1;
    padding-block: 28px 112px;
}
.hero__title {
    max-width: 18ch;
    font: 700 clamp(2.1rem, 4.2vw, 3.3rem)/1.08 var(--font-display);
    letter-spacing: -.01em;
}
:root:lang(bn) .hero__title,
:root:lang(ar) .hero__title { line-height: 1.35; letter-spacing: 0; }
.hero__lead {
    max-width: 60ch;
    margin-top: 14px;
    font-size: 1.08rem;
    color: rgba(248, 241, 223, .82);
}
.hero__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
.hero__steps li {
    counter-increment: step;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 330px;
    padding: 9px 14px 9px 10px;
    border: 1px solid rgba(248, 241, 223, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    font-size: .9rem;
    line-height: 1.35;
}
.hero__steps li::before {
    content: counter(step);
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    color: #1c1406;
    font-weight: 700;
    font-size: .8rem;
}
.hero__private {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    font-size: .88rem;
    color: #e9cf8f;
}

/* ---------- layout ---------- */

.layout {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 26px;
    align-items: start;
    margin-top: -76px;
    padding-bottom: 48px;
}
.layout:focus { outline: none; }

.noscript {
    grid-column: 1 / -1;
    margin: 0;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--gold-soft);
}

/* ---------- form cards ---------- */

.form { min-width: 0; }

.card {
    min-width: 0;
    margin: 0 0 18px;
    padding: 22px 24px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card__title {
    float: left; /* makes the legend a normal block; width is 100% so RTL is unaffected */
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
    padding: 0;
    font: 700 1.16rem/1.3 var(--font-display);
}
.card__title + * { clear: both; }
.card__num {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold-strong);
    font: 700 .9rem/1 var(--font-latin);
}
.card--minus .card__num { background: rgba(154, 59, 40, .1); color: var(--minus); font-size: 1.2rem; }
.card__lead { margin: -6px 0 16px; color: var(--muted); font-size: .93rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--grow { flex: 1; }
.field label { font-size: .9rem; font-weight: 600; }

.money,
.input,
.select {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.money { display: flex; align-items: stretch; overflow: hidden; }
.money__cur {
    display: flex;
    align-items: center;
    padding-inline: 12px;
    border-inline-end: 1px solid var(--line);
    color: var(--muted);
    font: 600 .75rem/1 var(--font-latin);
    letter-spacing: .06em;
}
.money input,
.input {
    width: 100%;
    min-width: 0;
    padding: 11px 12px;
    font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
}
.money input {
    flex: 1;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
}
.money input:focus,
.input:focus,
.select:focus { outline: none; }
.money:focus-within,
.input:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 92, 77, .18);
}
.select { padding: 10px 12px; min-height: 46px; cursor: pointer; }
.select--dark {
    min-height: 40px;
    padding: 7px 10px;
    border-color: rgba(248, 241, 223, .24);
    background: rgba(255, 255, 255, .08);
    color: var(--header-ink);
    font-size: .92rem;
}
.select--dark option { background: #fffdf8; color: #1c2925; }
.select--dark:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 168, 76, .3); }

.hint { margin-top: 12px; color: var(--muted); font-size: .84rem; }

.metal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) minmax(120px, 150px);
    gap: 14px 16px;
}
.metal-row + .metal-row { margin-top: 16px; }

/* nisab choice */
.nisab {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}
.nisab__title { grid-column: 1 / -1; font-weight: 600; font-size: .9rem; }
.choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.choice input { margin: 4px 0 0; accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.choice__body { display: flex; flex-direction: column; gap: 2px; }
.choice__label { font-weight: 600; }
.choice__hint { color: var(--muted); font-size: .84rem; line-height: 1.4; }
.choice:has(input:checked) { border-color: var(--accent); background: rgba(15, 92, 77, .06); }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(15, 92, 77, .2); }

/* notes */
.notes {
    padding: 20px 24px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}
.notes__title { font: 700 1.05rem/1.3 var(--font-display); margin-bottom: 10px; }
.notes ul { padding-inline-start: 20px; display: grid; gap: 8px; color: var(--muted); font-size: .93rem; }
.notes li::marker { color: var(--gold); }

/* ---------- results ---------- */

.results {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 18px;
    min-width: 0;
}

.result-card,
.breakdown {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.result-card { border-top: 4px solid var(--gold); }

.result-card__title { font: 700 1.2rem/1.3 var(--font-display); margin-bottom: 14px; }
.due__label {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.due__amount {
    margin-top: 2px;
    color: var(--accent-text);
    font: 700 clamp(2.2rem, 3.4vw, 2.9rem)/1.12 var(--font-display);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.due__rate { color: var(--muted); font-size: .86rem; }

.status {
    margin-top: 16px;
    padding: 11px 14px;
    border-radius: 10px;
    border-inline-start: 3px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
}
.status--due { border-color: var(--accent); background: rgba(15, 92, 77, .08); color: var(--ink); }
.status--below { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }

.meter { margin-top: 14px; }
.meter__track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
    transition: width .35s ease;
}
.meter--reached .meter__fill { background: var(--accent); }
.meter__label { margin-top: 6px; color: var(--muted); font-size: .8rem; }

.totals { margin-top: 16px; }
.totals__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-block: 9px;
    border-bottom: 1px dashed var(--line);
    font-size: .94rem;
}
.totals__row dd { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.totals__row--strong { font-weight: 700; font-size: 1rem; }
.totals__row--muted { color: var(--muted); border-bottom: 0; }

.actions { display: grid; gap: 10px; margin-top: 18px; }
.actions__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: 600 .95rem/1.2 var(--font-sans);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, filter .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 3px solid rgba(214, 168, 76, .7); outline-offset: 2px; }
.btn--primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.1); }
.btn--gold { border-color: var(--gold); background: var(--gold); color: #1c1406; }
.btn--gold:hover { filter: brightness(1.06); border-color: var(--gold); }
.btn--ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn--small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn[hidden] { display: none; }

.toast {
    min-height: 1.2em;
    color: var(--accent-text);
    font-size: .86rem;
    text-align: center;
    opacity: 0;
    transition: opacity .2s;
}
.toast.is-visible { opacity: 1; }

.breakdown__title { font: 700 1.05rem/1.3 var(--font-display); }
.breakdown__group {
    margin: 14px 0 6px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.breakdown__list { padding: 0; list-style: none; }
.breakdown__list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-block: 7px;
    border-bottom: 1px solid var(--line);
    font-size: .9rem;
}
.breakdown__list li:last-child { border-bottom: 0; }
.breakdown__label small { display: block; color: var(--muted); font-size: .78rem; }
.breakdown__value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.breakdown__list--minus .breakdown__value { color: var(--minus); }
.breakdown__list .breakdown__empty { color: var(--muted); font-style: italic; }

.print-only { display: none; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); padding-block: 26px 40px; }
.site-footer__disclaimer { max-width: 80ch; color: var(--muted); font-size: .88rem; }
.site-footer__brand { margin-top: 10px; color: var(--muted); font-size: .8rem; opacity: .8; }

.mobile-bar { display: none; }

/* ---------- embedded in another site (?embed=1) ---------- */

.is-embed .brand,
.is-embed .hero__steps,
.is-embed .site-footer__brand,
.is-embed .mobile-bar { display: none; }
.is-embed .site-header__bar { justify-content: flex-end; }
.is-embed .hero { padding-block: 4px 100px; }
.is-embed .results { position: static; }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .results { position: static; }
    body:not(.is-embed) { padding-bottom: 84px; }
    .mobile-bar {
        position: fixed;
        inset-inline: 12px;
        bottom: 12px;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
        padding-inline-start: 16px;
        border-radius: 14px;
        background: var(--header-bg);
        color: var(--header-ink);
        box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    }
    .mobile-bar__label { display: block; font-size: .72rem; opacity: .75; }
    .mobile-bar__amount { font: 700 1.25rem/1.2 var(--font-display); }
    .mobile-bar .btn { border: 0; background: var(--gold); color: #1c1406; }
    .is-embed .mobile-bar { display: none; }
}

@media (max-width: 640px) {
    .container { padding-inline: 16px; }
    .site-header__bar { flex-direction: column; align-items: flex-start; gap: 14px; }
    .prefs { width: 100%; }
    .prefs__item { flex: 1; min-width: 140px; }
    .hero { padding-block: 12px 96px; }
    .hero__steps li { max-width: none; }
    .card, .result-card, .breakdown { padding: 18px 16px; }
    .metal-row { grid-template-columns: 1fr 1fr; }
    .metal-row .field--grow { grid-column: 1 / -1; }
    .nisab { grid-template-columns: 1fr; }
    .site-header::after { width: 300px; height: 300px; inset-inline-end: -120px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
