/* ShipTag blog theme. Arabic, right to left, one typeface (IBM Plex Sans Arabic).
   ShipTag colors and shapes, laid out as an editorial blog (not a copy of shiptag.com). */

/* ---------- Tokens ---------- */
:root {
    --paper: #f8f6f1;
    --paper-2: #f1ece3;
    --surface: #ffffff;
    --ink: #101012;
    --ink-2: #2b2b30;
    --ink-3: #4a4a52;
    --muted: #71717a;
    --line: #e7e2d9;
    --line-strong: #d9d2c5;
    --accent: #ed5137;
    --accent-2: #ff852f;
    --accent-ink: #c23d24;
    --accent-soft: #fdeee9;
    --grad: linear-gradient(180deg, #ff852f 0%, #ed5137 100%);
    --dark: #101012;

    --font: var(--gh-font-body, "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif);
    --font-heading: var(--gh-font-heading, var(--font));
    --container: 1200px;
    --gutter: clamp(16px, 4vw, 32px);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 16, 18, 0.05);
    --shadow: 0 1px 2px rgba(16, 16, 18, 0.04), 0 14px 32px -18px rgba(16, 16, 18, 0.22);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* One typeface everywhere, including form controls and code. */
body,
button,
input,
select,
textarea,
code,
kbd,
pre,
samp {
    font-family: var(--font);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
}

/* Links and spans inside headings keep the heading weight (an old site-wide code injection sets 400 on every a/span). */
:is(h1, h2, h3, h4, h5, h6) :is(a, span, strong, b) {
    font-weight: inherit;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

img {
    height: auto;
    display: block;
}

picture {
    display: block;
}

.card-media picture,
.lead-media picture {
    height: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
ul,
ol {
    margin: 0;
}

button {
    color: inherit;
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid rgba(237, 81, 55, 0.45);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection {
    background: rgba(255, 133, 47, 0.28);
}

.icon {
    flex: none;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
}

.container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.skip-link {
    position: absolute;
    inset-inline-start: 16px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font-weight: 600;
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    min-height: 38px;
    padding: 0 16px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 6px 18px -8px rgba(237, 81, 55, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 10px 24px -8px rgba(237, 81, 55, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

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

.btn-accent-outline {
    border-color: rgba(237, 81, 55, 0.45);
    color: var(--accent-ink);
}

.btn-accent-outline:hover {
    border-color: transparent;
    background: var(--grad);
    color: #fff;
}

/* Tag + date line used on every post listing */
.post-meta {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.post-tag {
    color: var(--accent-ink);
    font-weight: 600;
}

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

.post-tag + time::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-inline-end: 10px;
    border-radius: 50%;
    background: var(--line-strong);
    vertical-align: middle;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

a.chip:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
}

/* ---------- Header: masthead + topics ---------- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.masthead {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 72px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

.brand-logo {
    width: 96px;
    height: auto;
}

.brand-label {
    padding-inline-start: 12px;
    border-inline-start: 1.5px solid var(--line-strong);
    color: var(--ink);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.masthead-nav {
    margin-inline-start: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.masthead-nav .nav a {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--ink-3);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.masthead-nav .nav a:hover {
    color: var(--accent-ink);
}

.masthead-nav .nav .is-current a {
    color: var(--ink);
}

.masthead-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

.masthead-nav + .masthead-actions {
    margin-inline-start: 8px;
    padding-inline-start: 18px;
    border-inline-start: 1px solid var(--line);
}

.masthead > .brand + .masthead-actions {
    margin-inline-start: auto;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink-3);
    font-size: 15px;
    transition: border-color 0.2s, color 0.2s;
}

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

.search-btn .icon {
    width: 18px;
    height: 18px;
}

.topics-bar {
    border-top: 1px solid var(--line);
}

/* The topics scroll sideways in one line (swipe on phones), fading at the end to show there is more. */
.topics ul {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(270deg, #000 90%, transparent);
    mask-image: linear-gradient(270deg, #000 90%, transparent);
}

.topics ul::-webkit-scrollbar {
    display: none;
}

.topics li {
    flex: none;
}

.topics a {
    display: block;
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--ink-3);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.topics a:hover {
    background: var(--paper);
    color: var(--ink);
}

.topics a.is-current {
    background: var(--ink);
    color: #fff;
}

@media (max-width: 1023px) {
    .masthead-nav {
        display: none;
    }

    .masthead > .brand + .masthead-nav + .masthead-actions {
        margin-inline-start: auto;
        padding-inline-start: 0;
        border-inline-start: 0;
    }
}

@media (max-width: 560px) {
    .masthead {
        gap: 12px;
        height: 62px;
    }

    .brand {
        gap: 10px;
    }

    .brand-logo {
        width: 82px;
    }

    .brand-label {
        padding-inline-start: 10px;
        font-size: 17px;
    }

    .masthead-actions {
        gap: 6px;
    }

    .search-btn {
        width: 38px;
        padding: 0;
        justify-content: center;
    }

    .search-btn span {
        display: none;
    }

    .masthead-actions .btn-sm {
        padding: 0 14px;
        font-size: 14px;
    }

    .topics a {
        padding: 5px 12px;
        font-size: 14px;
    }
}

/* Reading progress (posts) */
.progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 60;
    height: 3px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: right;
    pointer-events: none;
}

/* ---------- Home intro ---------- */
.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    gap: 24px 48px;
    align-items: end;
    padding-top: clamp(32px, 5vw, 56px);
    padding-bottom: clamp(24px, 3vw, 36px);
}

.intro-title {
    font-size: clamp(28px, 3.6vw, 42px);
    font-weight: 700;
    line-height: 1.35;
    text-wrap: balance;
}

.intro-title::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-top: 16px;
    border-radius: 4px;
    background: var(--grad);
}

.intro-sub {
    max-width: 38em;
    margin-top: 14px;
    color: var(--ink-3);
    font-size: 18px;
    line-height: 1.85;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    padding: 0 18px 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--muted);
    font-size: 16px;
    text-align: start;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-field:hover {
    border-color: var(--ink);
    box-shadow: var(--shadow);
}

.search-field .icon {
    color: var(--accent);
}

.search-field span {
    flex: 1;
}

.search-field kbd {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 860px) {
    .intro {
        grid-template-columns: minmax(0, 1fr);
    }

    .search-field kbd {
        display: none;
    }
}

/* ---------- Sections ---------- */
.section-top {
    padding-bottom: clamp(20px, 3vw, 32px);
}

.section {
    padding-block: clamp(28px, 4vw, 48px);
}

.section-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.section-head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.section-title {
    font-size: clamp(21px, 2.2vw, 25px);
    font-weight: 700;
    line-height: 1.4;
}

/* ---------- Lead story + latest list ---------- */
.lead-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 40px);
    align-items: start;
}

.lead {
    position: relative;
}

.lead-media {
    aspect-ratio: 20 / 11;
    border-radius: var(--radius-xl);
    background: var(--paper-2);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.lead-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.lead:hover .lead-media img {
    transform: scale(1.025);
}

.lead-body {
    display: grid;
    gap: 10px;
    padding-top: 20px;
}

.lead-title {
    font-size: clamp(23px, 2.6vw, 32px);
    font-weight: 700;
    line-height: 1.45;
    text-wrap: balance;
    transition: color 0.2s;
}

.lead:hover .lead-title {
    color: var(--accent-ink);
}

.lead-excerpt {
    color: var(--ink-3);
    font-size: 17px;
    line-height: 1.85;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-ink);
    font-size: 15px;
    font-weight: 600;
}

.read-more .icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s var(--ease);
}

.lead:hover .read-more .icon {
    transform: translateX(-4px);
}

.lead-side {
    padding: 22px 24px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
}

.side-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
    font-weight: 700;
}

.side-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.side-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: side;
}

.side-item {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 16px 0 16px 0;
    padding-inline-start: 44px;
    border-bottom: 1px solid var(--line);
    counter-increment: side;
}

.side-item:last-child {
    border-bottom: 0;
}

.side-item::before {
    content: counter(side);
    position: absolute;
    inset-inline-start: 0;
    top: 16px;
    color: var(--line-strong);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
}

.side-item-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.65;
    transition: color 0.2s;
}

.side-item:hover .side-item-title {
    color: var(--accent-ink);
}

@media (max-width: 960px) {
    .lead-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Post cards ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 28px;
}

@media (max-width: 1023px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 20px;
    }
}

@media (max-width: 639px) {
    .grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.card-media {
    aspect-ratio: 20 / 11;
    border-radius: var(--radius-lg);
    background: var(--paper-2);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease);
}

.card:hover .card-media {
    box-shadow: var(--shadow);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.card:hover .card-media img {
    transform: scale(1.03);
}

.card-placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    background: linear-gradient(135deg, var(--paper-2), var(--accent-soft));
}

.card-placeholder img {
    width: 96px;
    height: auto;
    opacity: 0.6;
}

.card-body {
    display: grid;
    gap: 8px;
    padding-top: 16px;
}

.card-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.6;
    transition: color 0.2s;
}

.card:hover .card-title {
    color: var(--accent-ink);
}

.card-excerpt {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.85;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The whole card is clickable through its title link. */
.card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.card-link:focus-visible {
    outline: 0;
}

.card:has(.card-link:focus-visible),
.lead:has(.card-link:focus-visible),
.side-item:has(.card-link:focus-visible),
.topic:has(.card-link:focus-visible) {
    outline: 3px solid rgba(237, 81, 55, 0.5);
    outline-offset: 4px;
    border-radius: var(--radius-lg);
}

/* ---------- Topics ---------- */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topic {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 132px;
    padding: 20px 20px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.topic:hover {
    border-color: rgba(237, 81, 55, 0.45);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.topic-name {
    font-size: 18px;
    font-weight: 700;
}

.topic-desc {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-count {
    margin-top: auto;
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 600;
}

.topic-arrow {
    position: absolute;
    inset-inline-end: 18px;
    bottom: 16px;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.topic-arrow .icon {
    width: 16px;
    height: 16px;
}

.topic:hover .topic-arrow {
    background: var(--accent);
    color: #fff;
    transform: translateX(-3px);
}

@media (max-width: 1023px) {
    .topic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .topic-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .topic {
        min-height: 0;
    }
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.pagination-info {
    color: var(--muted);
    font-size: 15px;
}

.pagination-spacer {
    width: 120px;
}

@media (max-width: 520px) {
    .pagination .btn {
        padding: 0 16px;
    }

    .pagination-spacer {
        width: 60px;
    }
}

/* ---------- Page header (tag, author, archive) ---------- */
.page-hero {
    padding-top: clamp(28px, 5vw, 56px);
    padding-bottom: 8px;
}

.page-kicker {
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 600;
}

.page-title {
    font-size: clamp(28px, 3.8vw, 42px);
    font-weight: 700;
    line-height: 1.35;
}

.page-sub {
    max-width: 42em;
    margin-top: 10px;
    color: var(--ink-3);
    font-size: 18px;
}

.page-count {
    margin-top: 10px;
    color: var(--muted);
    font-size: 15px;
}

.author-hero {
    display: flex;
    align-items: center;
    gap: 24px;
}

.author-hero-avatar {
    width: 96px;
    height: 96px;
    border-radius: 28px;
    background: var(--surface);
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 14px;
}

.breadcrumb li + li::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-inline-end: 6px;
    border-top: 1.5px solid currentColor;
    border-left: 1.5px solid currentColor;
    transform: rotate(-45deg) translateY(-2px);
    opacity: 0.6;
}

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

/* ---------- Article ---------- */
.article-header {
    max-width: calc(860px + var(--gutter) * 2);
    padding-top: clamp(28px, 5vw, 56px);
    text-align: center;
}

.article-header .breadcrumb ol {
    justify-content: center;
}

.article-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.45;
    text-wrap: balance;
}

.article-dek {
    max-width: 40em;
    margin: 16px auto 0;
    color: var(--ink-3);
    font-size: clamp(17px, 1.6vw, 19px);
    line-height: 1.85;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 22px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 15px;
}

.author-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 600;
}

.author-chip img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface);
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.meta-item .icon {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.meta-item[hidden] {
    display: none;
}

.article-image {
    max-width: calc(1080px + var(--gutter) * 2);
    margin-top: clamp(24px, 4vw, 36px);
}

.article-image img {
    width: 100%;
    border-radius: var(--radius-xl);
    background: var(--paper-2);
    box-shadow: var(--shadow);
}

.article-image figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: clamp(32px, 5vw, 64px);
    align-items: start;
    max-width: calc(1080px + var(--gutter) * 2);
    padding-top: clamp(28px, 4vw, 48px);
}

.article-main {
    min-width: 0;
}

/* The sidebar column is as tall as the article; only the table of contents follows the reader, and only when it fits the screen. */
.article-aside {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: stretch;
}

.toc-side.is-sticky {
    position: sticky;
    top: 24px;
}

@media (max-width: 1023px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr);
        max-width: calc(740px + var(--gutter) * 2);
    }

    .article-aside {
        display: none;
    }
}

/* Table of contents */
.toc[hidden] {
    display: none !important;
}

.toc-side {
    padding-inline-start: 2px;
}

.toc-title,
.toc-inline summary {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.toc-title .icon,
.toc-inline summary .icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.toc-list {
    display: grid;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.toc-list a {
    display: block;
    padding: 5px 14px;
    border-inline-start: 2px solid var(--line);
    color: var(--ink-3);
    font-size: 14px;
    line-height: 1.6;
    transition: color 0.2s, border-color 0.2s;
}

.toc-list a:hover {
    color: var(--ink);
    border-color: var(--line-strong);
}

.toc-list a.is-active {
    color: var(--accent-ink);
    border-color: var(--accent);
    font-weight: 600;
}

.toc-inline {
    margin-bottom: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.toc-inline summary {
    min-height: 54px;
    padding: 0 18px;
    cursor: pointer;
    list-style: none;
}

.toc-inline summary::-webkit-details-marker {
    display: none;
}

.toc-inline summary span {
    flex: 1;
}

.toc-inline summary .icon:last-child {
    color: var(--muted);
    transition: transform 0.2s var(--ease);
}

.toc-inline[open] summary .icon:last-child {
    transform: rotate(180deg);
}

.toc-inline nav {
    padding: 0 18px 16px;
}

.toc-inline .toc-list {
    margin-top: 0;
}

@media (min-width: 1024px) {
    .toc-inline {
        display: none;
    }
}

.aside-cta {
    padding: 18px;
    border: 1px solid rgba(237, 81, 55, 0.25);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--accent-soft), var(--surface));
}

.aside-cta-title {
    font-size: 16px;
    font-weight: 700;
}

.aside-cta-text {
    margin: 4px 0 14px;
    color: var(--ink-3);
    font-size: 14px;
    line-height: 1.75;
}

/* ---------- Article content ---------- */
.gh-content {
    color: var(--ink-2);
    font-size: 18px;
    line-height: 2;
    overflow-wrap: break-word;
}

.gh-content > * + * {
    margin-top: 1.15em;
}

.gh-content > :first-child {
    margin-top: 0;
}

.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4 {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: 0;
    scroll-margin-top: 24px;
}

.gh-content h1,
.gh-content h2 {
    position: relative;
    margin-top: 2em;
    padding-inline-start: 18px;
    font-size: clamp(23px, 2.4vw, 28px);
    line-height: 1.55;
}

.gh-content h1::before,
.gh-content h2::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.3em;
    bottom: 0.3em;
    width: 5px;
    border-radius: 5px;
    background: var(--grad);
}

.gh-content h3 {
    margin-top: 1.7em;
    font-size: clamp(20px, 2vw, 22px);
    line-height: 1.6;
}

.gh-content h4 {
    margin-top: 1.5em;
    font-size: 19px;
    line-height: 1.6;
}

.gh-content h2 + *,
.gh-content h3 + *,
.gh-content h4 + * {
    margin-top: 0.6em;
}

.gh-content strong,
.gh-content b {
    color: var(--ink);
    font-weight: 700;
}

.gh-content a:not([class*="kg-"]) {
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(194, 61, 36, 0.35);
    text-underline-offset: 5px;
    transition: text-decoration-color 0.2s, color 0.2s;
}

.gh-content a:not([class*="kg-"]):hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

.gh-content ul,
.gh-content ol {
    padding-inline-start: 1.4em;
}

.gh-content li + li {
    margin-top: 0.45em;
}

.gh-content li::marker {
    color: var(--accent);
    font-weight: 700;
}

.gh-content li > ul,
.gh-content li > ol {
    margin-top: 0.45em;
}

.gh-content blockquote:not([class*="kg-"]) {
    padding: 18px 22px;
    border-inline-start: 4px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.95;
    box-shadow: var(--shadow-sm);
}

.gh-content blockquote.kg-blockquote-alt {
    padding: 8px 20px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.8;
    text-align: center;
}

.gh-content hr {
    height: 1px;
    margin-block: 2.4em;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent);
}

.gh-content hr + h2,
.gh-content hr + h3 {
    margin-top: 0;
}

.gh-content figure img,
.gh-content .kg-image {
    margin-inline: auto;
    border-radius: var(--radius);
}

.gh-content figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
    text-align: center;
}

.gh-content code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--paper-2);
    color: var(--ink);
    font-size: 0.9em;
}

.gh-content pre {
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--dark);
    color: #f4f4f5;
    font-size: 15px;
    line-height: 1.8;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
}

.gh-content pre code {
    padding: 0;
    background: none;
    color: inherit;
}

.gh-content iframe {
    width: 100%;
    border: 0;
    border-radius: var(--radius);
}

/* Tables: wrapped by main.js so wide tables scroll inside the column. Inline styles from the editor are overridden for one look. */
.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
}

.gh-content table {
    width: 100% !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    background: var(--surface) !important;
    font-family: var(--font) !important;
    font-size: 15px !important;
    line-height: 1.75;
    direction: rtl !important;
}

.gh-content table * {
    font-family: var(--font) !important;
}

.gh-content th,
.gh-content td {
    padding: 12px 16px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
    text-align: right !important;
    vertical-align: top;
}

.gh-content th {
    background: var(--paper-2) !important;
    color: var(--ink) !important;
    font-weight: 700 !important;
}

.gh-content td {
    background: transparent !important;
    color: var(--ink-2) !important;
}

.gh-content tbody tr:nth-child(even) td {
    background: #fcfbf8 !important;
}

.gh-content tbody tr:last-child td {
    border-bottom: 0 !important;
}

.gh-content td:first-child {
    color: var(--ink) !important;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .gh-content th,
    .gh-content td {
        padding: 10px 12px !important;
    }
}

/* Phones: every row is a card. The first cell is the card title, the others show their column name. */
@media (max-width: 639px) {
    .table-wrap.is-stacked {
        border: 0;
        background: none;
        box-shadow: none;
        overflow: visible;
    }

    .is-stacked table,
    .is-stacked tbody,
    .is-stacked tr,
    .is-stacked td {
        display: block;
        width: 100% !important;
    }

    .is-stacked thead,
    .is-stacked tr.is-head {
        display: none;
    }

    .is-stacked tr {
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
    }

    .is-stacked td,
    .is-stacked tbody tr:nth-child(even) td {
        display: grid;
        grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
        gap: 12px;
        padding: 10px 14px !important;
        border-bottom: 1px solid var(--line) !important;
        background: var(--surface) !important;
    }

    .is-stacked td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 13px;
        font-weight: 600;
    }

    .is-stacked td:first-child,
    .is-stacked tbody tr:nth-child(even) td:first-child {
        display: block;
        background: var(--paper-2) !important;
        color: var(--ink) !important;
        font-weight: 700;
    }

    .is-stacked td:first-child::before,
    .is-stacked td:not([data-label])::before {
        display: none;
    }

    .is-stacked td:not([data-label]) {
        display: block;
    }

    .is-stacked tr td:last-child {
        border-bottom: 0 !important;
    }
}

/* Ghost cards */
.gh-content .kg-width-wide,
.gh-content .kg-width-full {
    width: 100%;
}

@media (min-width: 1240px) {
    .gh-content .kg-width-wide,
    .gh-content .kg-width-full {
        width: auto;
        margin-inline: -40px;
    }
}

.gh-content .kg-width-full img {
    border-radius: var(--radius-lg);
}

.gh-content .kg-header-card.kg-v2 {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--dark) !important;
}

.gh-content .kg-header-card.kg-v2::before {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: 420px;
    height: 420px;
    background: radial-gradient(closest-side, rgba(255, 133, 47, 0.3), transparent);
    pointer-events: none;
}

.gh-content .kg-header-card.kg-v2 .kg-header-card-content {
    position: relative;
}

.gh-content .kg-header-card .kg-header-card-heading {
    padding: 0;
    color: #fff !important;
    font-weight: 700;
}

.gh-content .kg-header-card .kg-header-card-heading::before {
    display: none;
}

.gh-content .kg-header-card .kg-header-card-subheading {
    color: #c8c8cc !important;
}

.gh-content .kg-header-card .kg-header-card-button {
    border-radius: 999px !important;
    background: var(--grad) !important;
    color: #fff !important;
    font-family: var(--font);
    font-weight: 600;
    box-shadow: 0 8px 22px -10px rgba(237, 81, 55, 0.85);
}

.gh-content .kg-cta-card {
    border-radius: var(--radius-lg);
}

.gh-content .kg-cta-button,
.gh-content .kg-btn {
    border-radius: 999px !important;
    font-family: var(--font);
    font-weight: 600;
}

.gh-content .kg-callout-card {
    border-radius: var(--radius);
}

.gh-content .kg-bookmark-card a.kg-bookmark-container {
    border-radius: var(--radius);
    background: var(--surface);
    direction: rtl;
}

.gh-content .kg-bookmark-thumbnail img {
    border-radius: 0;
}

.gh-content .kg-file-card-container,
.gh-content .kg-toggle-card {
    border-radius: var(--radius);
    background: var(--surface);
}

/* ---------- Article footer ---------- */
.article-footer {
    display: grid;
    gap: 24px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.share-label {
    margin-inline-end: 6px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
}

.share-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.share-btn:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.share-wa:hover {
    border-color: #25d366;
    background: #25d366;
}

.share-btn span {
    display: inline-grid;
}

.share-copy .copy-done,
.share-copy.is-copied .copy-idle {
    display: none;
}

.share-copy.is-copied .copy-done {
    display: inline-grid;
    color: #16a34a;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.author-box {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.author-avatar {
    flex: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--paper);
}

.author-kicker {
    color: var(--muted);
    font-size: 13px;
}

.author-name {
    font-size: 18px;
    font-weight: 700;
}

.author-name:hover {
    color: var(--accent-ink);
}

.author-bio {
    margin-top: 4px;
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1.8;
}

.related {
    margin-top: clamp(16px, 3vw, 32px);
}

.page-body {
    max-width: calc(760px + var(--gutter) * 2);
    padding-block: clamp(28px, 4vw, 48px);
}

/* ---------- Call to action (end of pages) ---------- */
.cta {
    margin-block: clamp(24px, 4vw, 48px);
}

.cta-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 28px;
    padding: clamp(22px, 3vw, 32px);
    border: 1px solid rgba(237, 81, 55, 0.22);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(255, 133, 47, 0.12), transparent 55%),
        var(--surface);
}

.cta-mark {
    flex: none;
    width: 52px;
    height: auto;
}

.cta-copy {
    flex: 1 1 320px;
}

.cta-title {
    font-size: clamp(20px, 2.2vw, 24px);
    font-weight: 700;
    line-height: 1.5;
}

.cta-text {
    margin-top: 4px;
    color: var(--ink-3);
    font-size: 16px;
    line-height: 1.8;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 560px) {
    .cta-mark {
        width: 40px;
    }

    .cta-actions {
        width: 100%;
    }

    .cta-actions .btn {
        flex: 1 1 100%;
    }
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: clamp(16px, 3vw, 32px);
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
    gap: 32px;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin-inline: auto;
    padding: clamp(32px, 5vw, 52px) var(--gutter);
}

.footer-brand {
    display: grid;
    align-content: start;
    justify-items: start;
    gap: 14px;
}

.footer-brand .brand-logo {
    width: 104px;
}

.footer-about {
    max-width: 30em;
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1.85;
}

.footer-title {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.footer-col ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-col .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.footer-col a {
    color: var(--ink-3);
    font-size: 15px;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--accent-ink);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    width: calc(100% - var(--gutter) * 2);
    max-width: var(--container);
    margin-inline: auto;
    padding: 18px 0 28px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}

.footer-bottom a:hover {
    color: var(--ink);
}

@media (max-width: 860px) {
    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* ---------- Error page ---------- */
.error-hero {
    padding-block: clamp(48px, 8vw, 96px) 16px;
    text-align: center;
}

.error-code {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: clamp(72px, 12vw, 128px);
    font-weight: 700;
    line-height: 1.1;
}

.error-hero .page-sub {
    margin-inline: auto;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

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

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
