/*
 * Stylesheet for the public user guide (resources/views/guide/show.blade.php).
 *
 * Hand-written rather than generated: this deployment compiles no front-end
 * bundle, so a Tailwind class here would be a class name that exists in no
 * stylesheet. It is also served to both `dir="rtl"` (Arabic, the default) and
 * `dir="ltr"` (French) from the same rules — every directional property below
 * is a *logical* one (`inline-start`, `inline-end`, `margin-inline`), never
 * `left`/`right`, which is what lets one file mirror itself.
 *
 * Colours follow the app: Amber primary, neutral zinc surfaces, and a dark
 * palette keyed off `prefers-color-scheme` so the page matches whatever the
 * reader's phone is already doing.
 */

:root {
    color-scheme: light dark;

    --primary: #b45309;
    --primary-strong: #92400e;
    --primary-soft: #fef3c7;
    --primary-line: #fcd34d;

    --bg: #fafaf9;
    --surface: #ffffff;
    --surface-alt: #f5f5f4;
    --text: #1c1917;
    --text-muted: #57534e;
    --line: #e7e5e4;

    --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 8px 24px rgba(28, 25, 23, .05);
    --radius: 14px;
    --wrap: 60rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #fbbf24;
        --primary-strong: #fcd34d;
        --primary-soft: #2b2113;
        --primary-line: #78350f;

        --bg: #18181b;
        --surface: #202023;
        --surface-alt: #27272a;
        --text: #f4f4f5;
        --text-muted: #a1a1aa;
        --line: #35353a;

        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    }
}

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

html {
    scroll-behavior: smooth;
    /* Anchored sections land clear of the top edge instead of flush against
       it, which is what makes a deep link from the app read as "here is the
       section" rather than "here is a wall of text". */
    scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Tajawal", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.85;
    text-align: start;
    -webkit-text-size-adjust: 100%;
}

.wrap {
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-strong);
}

.skip-link {
    position: absolute;
    inset-inline-start: -9999px;
}

.skip-link:focus {
    inset-inline-start: 1rem;
    top: 1rem;
    z-index: 10;
    background: var(--surface);
    padding: .5rem .9rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* ---------- hero ---------- */

.hero {
    background: linear-gradient(160deg, var(--primary-soft), var(--bg) 70%);
    border-block-end: 1px solid var(--line);
    padding-block: 2.5rem 2rem;
}

.hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.hero-text {
    flex: 1 1 20rem;
}

.brand {
    margin: 0 0 .35rem;
    font-weight: 700;
    letter-spacing: .18em;
    font-size: .75rem;
    color: var(--primary);
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.5rem);
    line-height: 1.3;
    font-weight: 700;
}

.tagline {
    margin: .6rem 0 0;
    color: var(--text-muted);
    max-width: 46rem;
}

.lang-switch {
    flex: 0 0 auto;
    display: inline-block;
    padding: .45rem 1.1rem;
    border: 1px solid var(--primary-line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.lang-switch:hover {
    background: var(--primary-soft);
}

/* ---------- table of contents ---------- */

.toc {
    padding-block: 2rem 0;
}

.toc-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .02em;
}

.toc-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: .75rem;
}

.toc-grid a {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    height: 100%;
    padding: .85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}

.toc-grid a:hover {
    border-color: var(--primary-line);
    transform: translateY(-1px);
}

.toc-icon {
    font-size: 1.15rem;
    line-height: 1.6;
}

.toc-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.toc-name {
    font-weight: 700;
    line-height: 1.5;
}

.toc-summary {
    font-size: .875rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ---------- sections ---------- */

.section {
    margin-block: 2.25rem;
    padding: 1.5rem 1.6rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* The accent sits on the inline-start edge, so it flips sides with the
       document direction on its own. */
    border-inline-start: 4px solid var(--primary-line);
}

.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 .35rem;
    font-size: 1.45rem;
    line-height: 1.4;
    font-weight: 700;
    /* Deep links land on the heading; without this, a browser that ignores
       scroll-padding still leaves it readable under a fixed edge. */
    scroll-margin-top: 1.5rem;
}

.section-icon {
    font-size: 1.4rem;
}

.block-heading {
    margin: 1.5rem 0 .4rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-strong);
}

.section p {
    margin: .7rem 0;
}

.bullets,
.steps {
    margin: .7rem 0;
    padding-inline-start: 1.35rem;
}

.bullets li,
.steps li {
    margin-block: .4rem;
}

.bullets {
    list-style: none;
    padding-inline-start: 0;
}

.bullets li {
    position: relative;
    padding-inline-start: 1.35rem;
}

.bullets li::before {
    content: "";
    position: absolute;
    inset-inline-start: .25rem;
    top: .85em;
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: var(--primary-line);
}

.steps {
    counter-reset: step;
    list-style: none;
    padding-inline-start: 0;
}

.steps li {
    position: relative;
    counter-increment: step;
    padding-inline-start: 2.4rem;
    min-height: 1.9rem;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    inset-inline-start: 0;
    top: .35em;
    width: 1.7rem;
    height: 1.7rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: .85rem;
    font-weight: 700;
    line-height: 1;
}

.note {
    margin: 1.1rem 0;
    padding: .85rem 1rem;
    background: var(--primary-soft);
    border-inline-start: 3px solid var(--primary);
    border-radius: 10px;
    font-size: .97rem;
}

/* ---------- tables ---------- */

.table-scroll {
    /* Wide content scrolls inside its own box; the page body never scrolls
       sideways, which on a phone is the difference between a readable rate
       card and a broken layout. */
    overflow-x: auto;
    margin: 1.1rem 0;
    border: 1px solid var(--line);
    border-radius: 10px;
}

table {
    width: 100%;
    min-width: 34rem;
    border-collapse: collapse;
    font-size: .93rem;
    line-height: 1.7;
}

th,
td {
    padding: .7rem .85rem;
    text-align: start;
    vertical-align: top;
    border-block-end: 1px solid var(--line);
}

thead th {
    background: var(--surface-alt);
    font-weight: 700;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-block-end: 0;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: .78rem;
    color: var(--text-muted);
    /* Latin placement identifiers inside an RTL table cell — pinned LTR so
       `app_open` never renders as `open_app`. */
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

/* ---------- faq ---------- */

.faq {
    margin: .8rem 0 0;
}

.faq dt {
    margin-top: 1.1rem;
    font-weight: 700;
}

.faq dd {
    margin: .2rem 0 0;
    padding-inline-start: 0;
    color: var(--text-muted);
}

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

.back-to-top {
    display: inline-block;
    margin-top: 1.2rem;
    font-size: .85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.back-to-top:hover {
    color: var(--primary);
}

.site-footer {
    padding-block: 2rem 3rem;
    color: var(--text-muted);
    font-size: .9rem;
    text-align: center;
}

@media (max-width: 40rem) {
    body {
        font-size: 1rem;
    }

    .section {
        padding: 1.15rem 1.15rem .9rem;
    }
}

@media print {
    .toc,
    .lang-switch,
    .back-to-top,
    .skip-link {
        display: none;
    }

    .section {
        box-shadow: none;
        break-inside: avoid;
    }
}
