/* ==========================================================================
   Manual kit - the shared look of the illustrated app manuals
   --------------------------------------------------------------------------
   Rendered by includes/manual-kit.php. Every class is .mk-*, and every token
   is --mk-* and declared on .mk-page / .mk-zoom rather than on :root, so a
   product stylesheet that puts --primary or --bg-* on :root cannot leak in,
   and this file cannot leak out.

   Logical properties throughout (padding-inline, inset-inline-start,
   border-inline-start), so the Arabic page mirrors without a second sheet.

   Spacing scale: 4 8 12 16 24 32 48 64 (--mk-s1 .. --mk-s8).
   Breakpoints: 980 (hero stacks), 860 (sidebar becomes the chip strip),
   640 (phone: cards and tables stack).
   ========================================================================== */

.mk-page,
.mk-zoom {
    --mk-s1: 4px;
    --mk-s2: 8px;
    --mk-s3: 12px;
    --mk-s4: 16px;
    --mk-s5: 24px;
    --mk-s6: 32px;
    --mk-s7: 48px;
    --mk-s8: 64px;

    --mk-bg: #0b0f1a;
    --mk-surface: #131a2a;
    --mk-surface-2: #1a2236;
    --mk-glass: rgba(19, 26, 42, 0.82);
    --mk-border: rgba(255, 255, 255, 0.09);
    --mk-border-strong: rgba(255, 255, 255, 0.16);
    --mk-text: #eef1f7;
    /* Body copy and muted text both clear 4.5:1 on the page, the cards and the sidebar. */
    --mk-text-2: #c0c7d6;
    --mk-muted: #9ca5b8;

    /* The default accent pair; a manual picks its own with a .mk-page--<app> modifier. */
    --mk-accent: #a78bfa;
    --mk-accent-2: #38bdf8;
    --mk-accent-rgb: 167, 139, 250;
    --mk-accent-2-rgb: 56, 189, 248;
    --mk-on-accent: #0b0f1a;

    --mk-warn: #fbbf24;
    --mk-warn-rgb: 251, 191, 36;
    --mk-danger: #f87171;
    --mk-danger-rgb: 248, 113, 113;
    --mk-tip: #34d399;
    --mk-tip-rgb: 52, 211, 153;

    --mk-radius-s: 8px;
    --mk-radius: 12px;
    --mk-radius-l: 18px;
    --mk-radius-xl: 26px;

    --mk-nav-h: 72px;
    --mk-toc-w: 256px;
    --mk-measure: 1240px;
    --mk-prose: 76ch;

    --mk-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mk-font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    --mk-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

/* Anime Gallery: the product's pink and violet. */
.mk-page--anime,
.mk-page--anime ~ .mk-zoom {
    --mk-accent: #f472b6;
    --mk-accent-2: #a78bfa;
    --mk-accent-rgb: 244, 114, 182;
    --mk-accent-2-rgb: 167, 139, 250;
}

/* VPD Gallery: the product page's violet, with rose as the second colour. */
.mk-page--vpd,
.mk-page--vpd ~ .mk-zoom {
    --mk-accent: #c084fc;
    --mk-accent-2: #fb7185;
    --mk-accent-rgb: 192, 132, 252;
    --mk-accent-2-rgb: 251, 113, 133;
}

/* AI Prompt Assistant: the product page's purple and cyan. */
.mk-page--apa,
.mk-page--apa ~ .mk-zoom {
    --mk-accent: #a48bff;
    --mk-accent-2: #39d7f2;
    --mk-accent-rgb: 164, 139, 255;
    --mk-accent-2-rgb: 57, 215, 242;
}

/*
 * AI Prompt Assistant has no Arabic interface, so its Arabic manual names each control by its
 * English on-screen label. A label keeps its own direction inside Arabic text, so trailing
 * punctuation such as "Search prompts…" or "(set key)" stays where the app shows it.
 */
.mk-page--apa strong {
    unicode-bidi: plaintext;
}

.mk-page {
    background: var(--mk-bg);
    color: var(--mk-text);
    font-family: var(--mk-font);
    font-size: 1rem;
    line-height: 1.7;
}

html[dir="rtl"] .mk-page,
html[dir="rtl"] .mk-zoom {
    font-family: var(--mk-font-ar);
}

.mk-container {
    width: min(var(--mk-measure), calc(100% - 2 * var(--mk-s6)));
    margin-inline: auto;
}

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

.mk-hero {
    position: relative;
    overflow: hidden;
    padding-block: calc(var(--mk-nav-h) + var(--mk-s7)) var(--mk-s7);
    border-block-end: 1px solid var(--mk-border);
}

.mk-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(40rem 22rem at 12% -10%, rgba(var(--mk-accent-rgb), 0.22), transparent 70%),
        radial-gradient(34rem 20rem at 92% 10%, rgba(var(--mk-accent-2-rgb), 0.18), transparent 70%);
}

html[dir="rtl"] .mk-hero-bg {
    transform: scaleX(-1);
}

.mk-breadcrumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--mk-s2);
    margin-block-end: var(--mk-s5);
    padding: var(--mk-s2) var(--mk-s4);
    border: 1px solid var(--mk-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--mk-text-2);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}

.mk-breadcrumb:hover {
    color: var(--mk-text);
    border-color: rgba(var(--mk-accent-rgb), 0.6);
}

.mk-breadcrumb i {
    inline-size: 16px;
    block-size: 16px;
}

/* The arrow points back the way the reader came, which flips with the script. */
html[dir="rtl"] .mk-breadcrumb i {
    transform: scaleX(-1);
}

.mk-hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
    gap: var(--mk-s7);
    align-items: center;
}

.mk-kicker {
    display: inline-flex;
    align-items: center;
    gap: var(--mk-s2);
    margin-block-end: var(--mk-s4);
    padding: 6px var(--mk-s3);
    border: 1px solid rgba(var(--mk-accent-rgb), 0.4);
    border-radius: 999px;
    background: rgba(var(--mk-accent-rgb), 0.1);
    color: var(--mk-accent);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mk-kicker i {
    inline-size: 15px;
    block-size: 15px;
}

/* The icon script replaces each <i data-lucide> with an <svg> (24px unless told otherwise),
   so every icon size in this file is given for both. */
.mk-kicker svg { inline-size: 15px; block-size: 15px; }
.mk-breadcrumb svg { inline-size: 16px; block-size: 16px; }
.mk-btn svg { inline-size: 17px; block-size: 17px; }
.mk-meta svg { inline-size: 18px; block-size: 18px; margin-block-start: 2px; color: var(--mk-accent); flex: none; }
.mk-callout svg { inline-size: 20px; block-size: 20px; flex: none; margin-block-start: 3px; color: var(--mk-tone); }
html[dir="rtl"] .mk-breadcrumb svg { transform: scaleX(-1); }

html[dir="rtl"] .mk-kicker {
    letter-spacing: normal;
}

.mk-hero h1 {
    margin: 0 0 var(--mk-s4);
    font-size: clamp(2rem, 4.2vw, 3.1rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

html[dir="rtl"] .mk-hero h1 {
    letter-spacing: normal;
    line-height: 1.3;
}

.mk-hero-lead {
    margin: 0 0 var(--mk-s5);
    max-inline-size: 62ch;
    color: var(--mk-text-2);
    font-size: 1.08rem;
    line-height: 1.75;
}

.mk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mk-s3);
}

.mk-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--mk-s2);
    min-block-size: 44px;
    padding: var(--mk-s3) var(--mk-s5);
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.mk-btn i {
    inline-size: 17px;
    block-size: 17px;
}

.mk-btn-primary {
    background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-accent-2) 100%);
    color: var(--mk-on-accent);
}

.mk-btn-secondary {
    border: 1px solid var(--mk-border-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--mk-text);
}

.mk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.mk-btn:focus-visible,
.mk-breadcrumb:focus-visible,
.mk-toc a:focus-visible,
.mk-mobile-nav a:focus-visible,
.mk-content a:focus-visible {
    outline: 2px solid var(--mk-accent-2);
    outline-offset: 3px;
}

/* The "at a glance" panel beside the heading. */
.mk-meta {
    display: grid;
    gap: var(--mk-s3);
    margin: 0;
    padding: var(--mk-s5);
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius-l);
    background: var(--mk-glass);
    list-style: none;
}

.mk-meta li {
    display: flex;
    align-items: flex-start;
    gap: var(--mk-s3);
    color: var(--mk-text-2);
    font-size: 0.93rem;
    line-height: 1.5;
}

.mk-meta i {
    inline-size: 18px;
    block-size: 18px;
    margin-block-start: 2px;
    color: var(--mk-accent);
    flex: none;
}

/* ------------------------------------------------------- contents nav --- */

.mk-mobile-nav {
    display: none;
    position: sticky;
    inset-block-start: var(--mk-nav-h);
    z-index: 20;
    padding-block: var(--mk-s3);
    border-block-end: 1px solid var(--mk-border);
    background: rgba(11, 15, 26, 0.95);
    backdrop-filter: blur(12px);
}

.mk-mobile-nav .mk-container {
    display: flex;
    gap: var(--mk-s2);
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.mk-mobile-nav a {
    flex: none;
    padding: 6px var(--mk-s3);
    border: 1px solid var(--mk-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--mk-text-2);
    font-size: 0.84rem;
    text-decoration: none;
    white-space: nowrap;
}

.mk-mobile-nav a[aria-current="true"] {
    border-color: rgba(var(--mk-accent-rgb), 0.6);
    background: rgba(var(--mk-accent-rgb), 0.14);
    color: var(--mk-text);
}

.mk-layout {
    display: grid;
    grid-template-columns: var(--mk-toc-w) minmax(0, 1fr);
    gap: var(--mk-s7);
    align-items: start;
    padding-block: var(--mk-s7) var(--mk-s8);
}

.mk-toc {
    position: sticky;
    inset-block-start: calc(var(--mk-nav-h) + var(--mk-s5));
    max-block-size: calc(100vh - var(--mk-nav-h) - var(--mk-s7));
    overflow-y: auto;
    padding: var(--mk-s4);
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius-l);
    background: var(--mk-glass);
    backdrop-filter: blur(12px);
    scrollbar-width: thin;
}

.mk-toc h2 {
    margin: 0 0 var(--mk-s3);
    padding-inline: var(--mk-s2);
    color: var(--mk-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

html[dir="rtl"] .mk-toc h2 {
    letter-spacing: normal;
    font-size: 0.85rem;
}

.mk-toc nav {
    display: grid;
    gap: 2px;
    counter-reset: mk-toc;
}

.mk-toc a {
    display: flex;
    gap: var(--mk-s2);
    padding: 6px var(--mk-s2);
    border-radius: var(--mk-radius-s);
    color: var(--mk-text-2);
    font-size: 0.875rem;
    line-height: 1.4;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
    counter-increment: mk-toc;
}

.mk-toc a::before {
    content: counter(mk-toc, decimal-leading-zero);
    flex: none;
    min-inline-size: 1.6em;
    color: var(--mk-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    line-height: 1.75;
}

.mk-toc a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--mk-text);
}

/* The chapter being read, marked by the script. */
.mk-toc a[aria-current="true"] {
    background: rgba(var(--mk-accent-rgb), 0.13);
    color: var(--mk-text);
    box-shadow: inset 3px 0 0 var(--mk-accent);
}

html[dir="rtl"] .mk-toc a[aria-current="true"] {
    box-shadow: inset -3px 0 0 var(--mk-accent);
}

.mk-toc a[aria-current="true"]::before {
    color: var(--mk-accent);
}

/* ------------------------------------------------------------ article --- */

.mk-content {
    min-inline-size: 0;
    counter-reset: mk-sec;
}

.mk-section {
    padding-block: 0 var(--mk-s7);
    scroll-margin-block-start: calc(var(--mk-nav-h) + var(--mk-s5));
    counter-increment: mk-sec;
}

.mk-section + .mk-section {
    padding-block-start: var(--mk-s7);
    border-block-start: 1px solid var(--mk-border);
}

.mk-content h2 {
    display: flex;
    align-items: baseline;
    gap: var(--mk-s3);
    margin: 0 0 var(--mk-s4);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

html[dir="rtl"] .mk-content h2 {
    letter-spacing: normal;
    line-height: 1.4;
}

.mk-section > h2::before {
    content: counter(mk-sec, decimal-leading-zero);
    flex: none;
    padding: 2px var(--mk-s2);
    border-radius: var(--mk-radius-s);
    background: rgba(var(--mk-accent-rgb), 0.14);
    color: var(--mk-accent);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    transform: translateY(-3px);
}

/* Sub-sections are anchors too: an inventory item or a cross-reference lands on them. */
.mk-sub {
    scroll-margin-block-start: calc(var(--mk-nav-h) + var(--mk-s5));
}

.mk-content h3 {
    margin: var(--mk-s6) 0 var(--mk-s3);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}

.mk-content h4 {
    margin: var(--mk-s5) 0 var(--mk-s2);
    font-size: 1.02rem;
    font-weight: 650;
}

.mk-content p {
    margin: 0 0 var(--mk-s4);
    max-inline-size: var(--mk-prose);
    color: var(--mk-text-2);
}

.mk-lead {
    color: var(--mk-text) !important;
    font-size: 1.08rem;
}

.mk-content strong {
    color: var(--mk-text);
    font-weight: 650;
}

.mk-content ul,
.mk-content ol {
    margin: 0 0 var(--mk-s4);
    padding-inline-start: var(--mk-s5);
    max-inline-size: var(--mk-prose);
    color: var(--mk-text-2);
}

.mk-content li {
    margin-block-end: var(--mk-s2);
}

.mk-content li::marker {
    color: var(--mk-accent);
}

/* Links in running text keep an underline: colour alone is not a cue (WCAG 1.4.1). */
.mk-content a:not(.mk-btn) {
    color: var(--mk-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.mk-content a:not(.mk-btn):hover {
    text-decoration-thickness: 2px;
}

/* A path or a typed value: always left-to-right, even inside an Arabic sentence. */
.mk-code {
    display: inline-block;
    max-inline-size: 100%;
    padding: 1px 7px;
    border: 1px solid var(--mk-border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--mk-text);
    direction: ltr;
    unicode-bidi: isolate;
    font-family: var(--mk-mono);
    font-size: 0.86em;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.mk-keys {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    direction: ltr;
    unicode-bidi: isolate;
    color: var(--mk-muted);
    vertical-align: baseline;
}

.mk-page kbd {
    display: inline-block;
    min-inline-size: 1.7em;
    padding: 1px 7px;
    border: 1px solid var(--mk-border-strong);
    border-block-end-width: 2px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--mk-text);
    font-family: var(--mk-mono);
    font-size: 0.8em;
    line-height: 1.6;
    text-align: center;
    white-space: nowrap;
}

/* --------------------------------------------------------------- steps --- */

.mk-steps {
    list-style: none;
    padding: 0 !important;
    counter-reset: mk-step;
}

.mk-steps li {
    position: relative;
    margin: 0;
    padding-block: 2px var(--mk-s3);
    padding-inline-start: 44px;
    counter-increment: mk-step;
}

.mk-steps li::before {
    content: counter(mk-step);
    position: absolute;
    inset-block-start: 1px;
    inset-inline-start: 0;
    display: grid;
    place-items: center;
    inline-size: 28px;
    block-size: 28px;
    border: 1px solid rgba(var(--mk-accent-rgb), 0.5);
    border-radius: 50%;
    background: rgba(var(--mk-accent-rgb), 0.12);
    color: var(--mk-accent);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

/* The thread that joins one step to the next. */
.mk-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    inset-block: 32px 0;
    inset-inline-start: 14px;
    border-inline-start: 1px dashed rgba(var(--mk-accent-rgb), 0.35);
}

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

.mk-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--mk-s4);
    margin-block: var(--mk-s2) var(--mk-s5);
}

.mk-cards-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mk-card {
    padding: var(--mk-s5);
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius);
    background: var(--mk-surface);
}

.mk-card h3 {
    margin: 0 0 var(--mk-s2);
    font-size: 1rem;
}

.mk-card p {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.65;
}

/* ----------------------------------------------------------- callouts --- */

.mk-callout {
    --mk-tone: var(--mk-accent-2);
    --mk-tone-rgb: var(--mk-accent-2-rgb);
    display: flex;
    gap: var(--mk-s3);
    max-inline-size: calc(var(--mk-prose) + 60px);
    margin-block: var(--mk-s5);
    padding: var(--mk-s4) var(--mk-s5);
    border: 1px solid rgba(var(--mk-tone-rgb), 0.35);
    border-inline-start: 3px solid var(--mk-tone);
    border-radius: var(--mk-radius);
    background: rgba(var(--mk-tone-rgb), 0.08);
}

.mk-callout-tip {
    --mk-tone: var(--mk-tip);
    --mk-tone-rgb: var(--mk-tip-rgb);
}

.mk-callout-warning {
    --mk-tone: var(--mk-warn);
    --mk-tone-rgb: var(--mk-warn-rgb);
}

.mk-callout-danger {
    --mk-tone: var(--mk-danger);
    --mk-tone-rgb: var(--mk-danger-rgb);
}

.mk-callout i {
    inline-size: 20px;
    block-size: 20px;
    flex: none;
    margin-block-start: 3px;
    color: var(--mk-tone);
}

.mk-callout > div {
    color: var(--mk-text-2);
    font-size: 0.95rem;
    line-height: 1.7;
}

.mk-callout strong {
    color: var(--mk-text);
}

/* ------------------------------------------------------------ figures --- */

.mk-figure {
    margin: var(--mk-s5) 0 var(--mk-s6);
}

/* A picture is never shown wider than its own pixels (--mk-fig-w, set per figure),
   and never wider than the column. Upscaling a screenshot only adds blur. */
.mk-figure img {
    display: block;
    inline-size: min(var(--mk-fig-w, 100%), 100%);
    block-size: auto;
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius);
    background: #0d1118;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

/* A small crop (a button row, a menu) is centred rather than hugging the start edge. */
.mk-figure-small img {
    margin-inline: auto;
    border-radius: var(--mk-radius-s);
}

.mk-figure-small figcaption {
    text-align: center;
}

.mk-figure figcaption {
    margin-block-start: var(--mk-s3);
    max-inline-size: var(--mk-prose);
    color: var(--mk-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Two or three related crops side by side. */
.mk-figrow {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: var(--mk-s4) var(--mk-s6);
    margin-block: var(--mk-s5) var(--mk-s6);
}

/* The basis is the capture's own width, not its content: a lazy picture that has not
   loaded contributes no width, so an auto basis sized each figure by its caption and
   squeezed a 690px capture to ~110px. Figures that do not fit side by side wrap instead. */
.mk-figrow .mk-figure {
    flex: 0 1 var(--mk-fig-w, auto);
    min-inline-size: 0;
    max-inline-size: 100%;
    margin: 0;
}

.mk-figrow .mk-figure img {
    margin-inline: auto;
}

.mk-figrow .mk-figure figcaption {
    max-inline-size: max(var(--mk-fig-w, 100%), 220px);
    text-align: center;
}

/* Text beside a tall capture. The figure keeps its own width, up to half the column. */
.mk-split {
    display: flex;
    align-items: flex-start;
    gap: var(--mk-s6);
    margin-block: var(--mk-s5) var(--mk-s6);
}

.mk-split-text {
    flex: 1 1 320px;
    min-inline-size: 0;
}

.mk-split-text > :last-child {
    margin-block-end: 0;
}

.mk-split > .mk-figure {
    flex: 0 1 var(--mk-fig-w, 400px);
    min-inline-size: 0;
    max-inline-size: 50%;
    margin: 0;
}

.mk-split > .mk-figure img,
.mk-split > .mk-figure .mk-zoom-trigger {
    inline-size: 100%;
    max-inline-size: var(--mk-fig-w, 100%);
}

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

.mk-table-wrap {
    margin-block: var(--mk-s5);
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius);
    overflow: hidden;
}

.mk-table {
    inline-size: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.mk-table th,
.mk-table td {
    padding: var(--mk-s3) var(--mk-s4);
    border-block-start: 1px solid var(--mk-border);
    text-align: start;
    vertical-align: top;
    line-height: 1.6;
}

.mk-table thead th {
    border-block-start: 0;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mk-text);
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.mk-table tbody th {
    color: var(--mk-text);
    font-weight: 600;
}

.mk-table td {
    color: var(--mk-text-2);
}

.mk-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.018);
}

/* Settings tables: option | what it does | default | when to change it. */
.mk-table-options th[scope="row"] {
    inline-size: 20%;
}

.mk-table-options td:nth-child(3) {
    inline-size: 16%;
    color: var(--mk-text);
}

.mk-table-keys th[scope="row"] {
    inline-size: 34%;
    white-space: nowrap;
}

.mk-table-group th {
    background: rgba(var(--mk-accent-rgb), 0.1);
    color: var(--mk-accent) !important;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

html[dir="rtl"] .mk-table-group th,
html[dir="rtl"] .mk-table thead th {
    letter-spacing: normal;
}

/* -------------------------------------------------------------- FAQ --- */

.mk-faq {
    display: grid;
    gap: var(--mk-s3);
    margin-block: var(--mk-s4);
}

.mk-faq details {
    border: 1px solid var(--mk-border);
    border-radius: var(--mk-radius);
    background: var(--mk-surface);
}

.mk-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--mk-s3);
    padding: var(--mk-s4) var(--mk-s5);
    color: var(--mk-text);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.mk-faq summary::-webkit-details-marker {
    display: none;
}

.mk-faq summary::after {
    content: "+";
    flex: none;
    color: var(--mk-accent);
    font-size: 1.3rem;
    line-height: 1;
    transition: transform .2s ease;
}

.mk-faq details[open] summary::after {
    transform: rotate(45deg);
}

.mk-faq summary:focus-visible {
    outline: 2px solid var(--mk-accent-2);
    outline-offset: 2px;
    border-radius: var(--mk-radius);
}

.mk-faq details > div {
    padding: 0 var(--mk-s5) var(--mk-s4);
}

.mk-faq details > div p:last-child {
    margin-block-end: 0;
}

/* ------------------------------------------------------------ end CTA --- */

.mk-cta {
    margin-block-start: var(--mk-s3);
    padding: var(--mk-s7) var(--mk-s6);
    border: 1px solid rgba(var(--mk-accent-rgb), 0.3);
    border-radius: var(--mk-radius-xl);
    background:
        linear-gradient(135deg, rgba(var(--mk-accent-rgb), 0.12) 0%, rgba(var(--mk-accent-2-rgb), 0.07) 100%);
    text-align: center;
}

.mk-cta h2 {
    justify-content: center;
    margin-block-end: var(--mk-s3);
}

.mk-cta p {
    margin-inline: auto;
    max-inline-size: 56ch;
}

.mk-cta .mk-actions {
    justify-content: center;
    margin-block-start: var(--mk-s5);
}

/* -------------------------------------------------------- breakpoints --- */

@media (max-width: 980px) {
    .mk-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--mk-s5);
    }
}

@media (max-width: 860px) {
    .mk-container {
        width: calc(100% - 2 * var(--mk-s4));
    }

    .mk-mobile-nav {
        display: block;
    }

    .mk-layout {
        grid-template-columns: minmax(0, 1fr);
        padding-block: var(--mk-s6) var(--mk-s7);
    }

    .mk-toc {
        display: none;
    }

    .mk-hero {
        padding-block: calc(var(--mk-nav-h) + var(--mk-s6)) var(--mk-s6);
    }

    .mk-section,
    .mk-sub {
        scroll-margin-block-start: calc(var(--mk-nav-h) + 72px);
    }

    .mk-split {
        flex-direction: column;
        align-items: stretch;
    }

    .mk-split > .mk-figure {
        flex: none;
        max-inline-size: 100%;
    }

    .mk-split > .mk-figure img,
    .mk-split > .mk-figure .mk-zoom-trigger {
        margin-inline: auto;
    }
}

@media (max-width: 640px) {
    .mk-cards,
    .mk-cards-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .mk-actions .mk-btn {
        inline-size: 100%;
        justify-content: center;
    }

    .mk-cta {
        padding: var(--mk-s6) var(--mk-s4);
    }

    /* A stacked table: one card per row, each value labelled with its column. */
    .mk-table-stack thead {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .mk-table-stack,
    .mk-table-stack tbody,
    .mk-table-stack tr,
    .mk-table-stack th,
    .mk-table-stack td {
        display: block;
        inline-size: auto !important;
    }

    .mk-table-stack tr {
        padding: var(--mk-s3) var(--mk-s4);
        border-block-start: 1px solid var(--mk-border);
    }

    .mk-table-stack tr:first-child {
        border-block-start: 0;
    }

    .mk-table-stack th,
    .mk-table-stack td {
        padding: var(--mk-s1) 0;
        border: 0;
        white-space: normal !important;
    }

    .mk-table-stack th[scope="row"] {
        padding-block-end: var(--mk-s2);
        font-size: 1rem;
    }

    .mk-table-stack td::before {
        content: attr(data-label);
        display: block;
        color: var(--mk-muted);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    html[dir="rtl"] .mk-table-stack td::before {
        letter-spacing: normal;
        font-size: 0.8rem;
    }

    .mk-table-stack .mk-table-group th {
        padding: var(--mk-s1) 0;
        background: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mk-btn,
    .mk-breadcrumb,
    .mk-toc a,
    .mk-faq summary::after {
        transition: none;
    }

    .mk-btn:hover {
        transform: none;
    }
}

/* --------------------------------------------------- enlarged screenshots --- */

/* The button the script wraps a figure in. The picture is the control, so
   everything a <button> brings is stripped and only the pointer, the magnifier
   and the focus ring are added back. */
.mk-zoom-trigger {
    position: relative;
    display: block;
    inline-size: min(var(--mk-fig-w, 100%), 100%);
    padding: 0;
    border: 0;
    border-radius: var(--mk-radius);
    background: none;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
}

.mk-figure-small .mk-zoom-trigger,
.mk-figrow .mk-zoom-trigger {
    margin-inline: auto;
}

.mk-zoom-trigger img {
    inline-size: 100%;
}

.mk-zoom-trigger:focus-visible {
    outline: 2px solid var(--mk-accent-2);
    outline-offset: 3px;
}

.mk-zoom-trigger::after {
    content: "";
    position: absolute;
    inset-block-end: var(--mk-s3);
    inset-inline-end: var(--mk-s3);
    inline-size: 34px;
    block-size: 34px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9px;
    background: rgba(11, 15, 26, 0.84) no-repeat center / 17px 17px;
    /* Lucide "zoom-in", inlined so the badge costs no request. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eef1f7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E");
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}

/* With a pointer the badge waits for hover (the zoom-in cursor advertises the
   figure); a touch screen has no hover, so there it stays visible. */
@media (hover: hover) {
    .mk-zoom-trigger::after {
        opacity: 0;
    }
}

.mk-zoom-trigger:hover::after,
.mk-zoom-trigger:focus-visible::after {
    opacity: 1;
    transform: scale(1.06);
}

.mk-zoom-trigger:hover img {
    border-color: rgba(var(--mk-accent-rgb), 0.55);
}

.mk-zoom {
    inline-size: min(96vw, 1600px);
    max-inline-size: 96vw;
    max-block-size: 94vh;
    padding: 0;
    border: 1px solid var(--mk-border-strong);
    border-radius: var(--mk-radius-l);
    background: var(--mk-surface);
    color: var(--mk-text);
    overflow: hidden;
}

.mk-zoom::backdrop {
    background: rgba(4, 7, 14, 0.88);
}

.mk-zoom-bar {
    display: flex;
    justify-content: flex-end;
    gap: var(--mk-s2);
    padding: var(--mk-s2) var(--mk-s3);
    border-block-end: 1px solid var(--mk-border);
}

.mk-zoom-btn {
    min-block-size: 36px;
    padding: 6px var(--mk-s4);
    border: 1px solid var(--mk-border-strong);
    border-radius: var(--mk-radius-s);
    background: rgba(255, 255, 255, 0.05);
    color: var(--mk-text);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.mk-zoom-btn:hover {
    border-color: rgba(var(--mk-accent-rgb), 0.6);
}

.mk-zoom-btn:focus-visible,
.mk-zoom-body:focus-visible {
    outline: 2px solid var(--mk-accent-2);
    outline-offset: -2px;
}

.mk-zoom-body {
    /* The bar and the caption are the only other rows, so the picture gets the rest. */
    max-block-size: calc(94vh - 124px);
    overflow: auto;
    background: #0d1118;
    text-align: center;
}

.mk-zoom-body img {
    display: block;
    margin-inline: auto;
    max-inline-size: 100%;
    max-block-size: calc(94vh - 124px);
    inline-size: auto;
    block-size: auto;
}

/* Actual size: the picture keeps its own pixels and the box is panned instead. */
.mk-zoom.is-actual .mk-zoom-body img {
    max-inline-size: none;
    max-block-size: none;
}

.mk-zoom-cap {
    margin: 0;
    padding: var(--mk-s3) var(--mk-s4);
    border-block-start: 1px solid var(--mk-border);
    color: var(--mk-muted);
    font-size: 0.86rem;
    line-height: 1.55;
    text-align: start;
}

@media (prefers-reduced-motion: reduce) {
    .mk-zoom-trigger::after {
        transition: none;
    }
}
