/* Urdu Keyboard: Easy Typing — shared stylesheet
   Typography: Source Serif 4 (display), Inter (text), Noto Nastaliq Urdu (Urdu).
   Colour is defined once here and inverted for prefers-color-scheme: dark. */

:root {
    --paper: #FCFBF9;
    --paper-raised: #FFFFFF;
    --ink: #16181C;
    --ink-soft: #4A5058;
    --ink-faint: #767D87;
    --rule: #E4E1DB;
    --rule-strong: #D3CFC7;
    --accent: #1E5B47;
    --accent-soft: #EDF3F0;
    --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 8px 24px -16px rgba(20, 22, 26, 0.18);
    --measure: 68ch;
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #101214;
        --paper-raised: #16191C;
        --ink: #ECEDEF;
        --ink-soft: #A8AEB6;
        --ink-faint: #7E858D;
        --rule: #262A2E;
        --rule-strong: #333941;
        --accent: #7FC3A9;
        --accent-soft: #17211D;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -16px rgba(0, 0, 0, 0.8);
    }
}

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

body, h1, h2, h3, h4, p, ul, ol, li, figure, dl, dd { margin: 0; padding: 0; }

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

::selection { background: var(--accent); color: var(--paper); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- Layout ---------- */

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.wrap--reading { max-width: 780px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: var(--paper);
    padding: 10px 16px;
    z-index: 20;
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus { left: 0; }

/* ---------- Masthead ---------- */

.masthead {
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 10;
}

.masthead__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 68px;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.wordmark img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--rule);
}

.wordmark span { font-size: 15px; white-space: nowrap; }

.masthead__nav {
    display: flex;
    align-items: center;
    gap: 28px;
    font-size: 14px;
    color: var(--ink-soft);
}

.masthead__nav a {
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.masthead__nav a:hover {
    color: var(--ink);
    border-bottom-color: var(--rule-strong);
}

@media (max-width: 640px) {
    .masthead { position: static; }
    .masthead__inner { min-height: 60px; }
    .masthead__nav { gap: 18px; font-size: 13px; }
    .masthead__nav a[data-optional] { display: none; }
}

/* ---------- Type ---------- */

.display {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    direction: rtl;
    line-height: 2.1;
}

.lede {
    font-size: 17px;
    color: var(--ink-soft);
    max-width: var(--measure);
}

/* ---------- Buttons ---------- */

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
    background: var(--ink);
    color: var(--paper);
}

.btn--primary:hover { background: var(--accent); }

.btn--ghost {
    border-color: var(--rule-strong);
    color: var(--ink);
    background: var(--paper-raised);
}

.btn--ghost:hover { border-color: var(--ink); }

.btn--static {
    background: var(--accent-soft);
    border-color: var(--rule);
    color: var(--ink-soft);
    cursor: default;
}

.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Sections ---------- */

.section { padding: 72px 0; border-top: 1px solid var(--rule); }

.section--flush { border-top: 0; }

.section__head { max-width: var(--measure); margin-bottom: 40px; }

.section__head h2 { font-size: 30px; margin: 10px 0 12px; }

.section__head p { color: var(--ink-soft); }

/* ---------- Hero ---------- */

.hero { padding: 84px 0 72px; }

.hero__icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    border: 1px solid var(--rule);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.hero h1 {
    font-size: clamp(36px, 6vw, 56px);
    max-width: 16ch;
    margin-bottom: 18px;
}

.hero .urdu {
    font-size: clamp(19px, 3.4vw, 24px);
    color: var(--accent);
    margin-bottom: 22px;
    max-width: 24ch;
}

.hero .lede { margin-bottom: 32px; }

.hero__note {
    margin-top: 18px;
    font-size: 13px;
    color: var(--ink-faint);
}

/* ---------- Facts strip ---------- */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-raised);
    overflow: hidden;
}

.facts div {
    padding: 22px 24px;
    border-right: 1px solid var(--rule);
}

.facts div:last-child { border-right: 0; }

.facts dt {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.facts dd {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--ink-faint);
}

@media (max-width: 720px) {
    .facts div { border-right: 0; border-bottom: 1px solid var(--rule); }
    .facts div:last-child { border-bottom: 0; }
}

/* ---------- Feature grid ---------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
}

.tile {
    background: var(--paper-raised);
    padding: 32px 28px;
}

.tile__icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
    margin-bottom: 18px;
}

.tile h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.tile p { font-size: 15px; color: var(--ink-soft); }

.tile .urdu { font-size: 15px; color: var(--ink); }

/* ---------- Two-column ledger ---------- */

.ledger {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
}

.ledger__col {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-raised);
    padding: 28px;
}

.ledger__col h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
}

.ledger__col ul { list-style: none; }

.ledger__col li {
    display: flex;
    gap: 12px;
    font-size: 15px;
    color: var(--ink-soft);
    padding: 10px 0;
}

.ledger__col li svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 4px;
    color: var(--ink-faint);
}

/* ---------- Document (privacy) ---------- */

.doc { padding: 56px 0 40px; }

.doc__header { border-bottom: 1px solid var(--rule); padding-bottom: 28px; }

.doc__header h1 { font-size: clamp(32px, 5vw, 42px); margin: 10px 0 14px; }

.doc__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    font-size: 14px;
    color: var(--ink-faint);
    margin-top: 20px;
}

.doc__meta strong { color: var(--ink-soft); font-weight: 500; }

.summary {
    border-left: 2px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 22px 26px;
    margin: 36px 0 0;
}

.summary h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

.summary p { color: var(--ink-soft); font-size: 15px; }

.summary p + p { margin-top: 10px; }

.toc {
    margin: 36px 0 0;
    padding: 24px 0 0;
    border-top: 1px solid var(--rule);
    columns: 2;
    column-gap: 36px;
    list-style: none;
    font-size: 14px;
}

.toc li { margin-bottom: 8px; break-inside: avoid; }

.toc a { color: var(--ink-soft); text-decoration: none; }

.toc a:hover { color: var(--accent); }

@media (max-width: 560px) { .toc { columns: 1; } }

.doc section { padding-top: 44px; }

.doc section h2 {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 14px;
}

.doc section h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 24px 0 8px;
}

.doc p { color: var(--ink-soft); margin-bottom: 14px; }

.doc ul, .doc ol { color: var(--ink-soft); padding-left: 22px; margin-bottom: 16px; }

.doc li { margin-bottom: 10px; }

.doc li strong, .doc p strong { color: var(--ink); font-weight: 600; }

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

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: var(--accent-soft);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1px 5px;
}

.table-scroll { overflow-x: auto; margin-bottom: 16px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 520px;
}

th, td {
    text-align: left;
    vertical-align: top;
    padding: 12px 16px 12px 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-soft);
}

th {
    color: var(--ink);
    font-weight: 600;
    border-bottom-color: var(--rule-strong);
    white-space: nowrap;
}

td strong { color: var(--ink); font-weight: 500; }

/* ---------- Footer ---------- */

.colophon {
    border-top: 1px solid var(--rule);
    padding: 36px 0 48px;
    font-size: 14px;
    color: var(--ink-faint);
}

.colophon__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    justify-content: space-between;
    align-items: baseline;
}

.colophon a { color: var(--ink-soft); text-decoration: none; }

.colophon a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.colophon__links { display: flex; flex-wrap: wrap; gap: 24px; }

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