/* =========================================================
   KODE MAGAZINE — Monochrome Stylesheet
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Custom Properties ── */
:root {
    --bg: #ffffff;
    --bg-card: #f9f9f9;
    --bg-subtle: #f2f2f2;
    --bg-nav: rgba(255, 255, 255, 0.92);
    --t1: #0a0a0a;
    --t2: #3a3a3a;
    --t3: #888888;
    --border: #d4d4d4;
    --border-h: #0a0a0a;
    --accent: #0a0a0a;

    --font-sans: 'Outfit', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --r-card: 0px;
    --r-sm: 0px;

    /* Syntax Highlighting Tokens (Light Mode) */
    --token-keyword: #a626a4;
    --token-string: #50a14f;
    --token-comment: #a0a1a7;
    --token-function: #4078f2;
    --token-number: #986801;
    --token-operator: #0184bc;
    --token-punctuation: #383a42;
}

:root.dark {
    --bg: #0a0a0a;
    --bg-card: #111111;
    --bg-subtle: #1a1a1a;
    --bg-nav: rgba(10, 10, 10, 0.92);
    --t1: #f4f4f4;
    --t2: #a0a0a0;
    --t3: #555555;
    --border: #2a2a2a;
    --border-h: #f4f4f4;
    --accent: #f4f4f4;

    /* Syntax Highlighting Tokens (Dark Mode) */
    --token-keyword: #c678dd;
    --token-string: #98c379;
    --token-comment: #5c6370;
    --token-function: #61afef;
    --token-number: #d19a66;
    --token-operator: #56b6c2;
    --token-punctuation: #abb2bf;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::selection {
    background: var(--t1);
    color: var(--bg);
}

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

body {
    background: var(--bg);
    color: var(--t2);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

/* ── Custom Scrollbars (Global) ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-h);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-sans);
    color: var(--t1);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-weight: 600;
}

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

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

ul,
ol {
    list-style: none;
}

button {
    cursor: pointer;
    font: inherit;
    border: none;
    background: none;
}

/* ── Layout ── */
.wrapper {
    width: 100%;
    max-width: 780px;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.spacer {
    flex: 1;
}

/* =========================================================
   HEADER / NAV
   ========================================================= */
header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 200;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s, border-color 0.3s;
}

header nav,
header nav.article-nav {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 1200px;
    margin-inline: auto;
    padding: 0 1.5rem;
    height: 56px;
}

header nav img {
    height: 26px;
    width: auto;
    display: block;
    transition: opacity 0.2s;
}

header nav img:hover {
    opacity: 0.6;
}

/* Nav links — underline slide animation */
header nav a:not(:first-child) {
    position: relative;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--t2);
    padding: 0.35rem 0.75rem;
    transition: color 0.2s;
}

header nav a:not(:first-child)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0.75rem;
    right: 0.75rem;
    height: 1px;
    background: var(--t1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

header nav a:not(:first-child):hover {
    color: var(--t1);
}

header nav a:not(:first-child):hover::after {
    transform: scaleX(1);
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    color: var(--t2);
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.theme-toggle:hover {
    background: var(--t1);
    color: var(--bg);
    border-color: var(--t1);
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 8rem 1.5rem 5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg);
}

/* Drifting grid background pattern with radial vignette fade — only on landing page hero */
.hero:not(.article-hero) {
    background-image: 
        radial-gradient(circle at center, transparent 20%, var(--bg) 95%),
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 100% 100%, 48px 48px, 48px 48px;
    background-position: center;
    overflow: hidden;
    animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
    0% {
        background-position: center, 0px 0px, 0px 0px;
    }
    100% {
        background-position: center, 48px 48px, 48px 48px;
    }
}

/* Subtle moving scanner line effect for artsy grunge vibe — only on landing page hero */
.hero:not(.article-hero)::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.05) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 4px, 6px 100%;
    opacity: 0.85;
}

:root.dark .hero:not(.article-hero)::before {
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(255, 255, 255, 0.03) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 4px, 6px 100%;
}

/* Clean, flat, distraction-free hero for articles */
.hero.article-hero {
    min-height: auto;
    padding: 6.5rem 1.5rem 2.5rem;
    background-image: none !important;
    background-color: var(--bg);
}

.hero.article-hero::before {
    display: none !important;
}

.hero h1 {
    position: relative;
    font-family: var(--font-sans);
    font-size: clamp(2.6rem, 7vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--t1);
    margin-bottom: 1.25rem;
    line-height: 1.15;
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.02);
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

:root.dark .hero h1 {
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

.hero h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero p {
    position: relative;
    font-size: 1.05rem;
    color: var(--t2);
    max-width: 520px;
    margin-inline: auto;
    animation: fadeUp 0.6s 0.08s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Code-style italic word on landing page */
.span-code {
    font-family: var(--font-mono);
    font-style: italic;
    color: var(--t1);
    border-bottom: 3px solid var(--t1);
    padding-bottom: 2px;
}

/* =========================================================
   SECTIONS
   ========================================================= */
.section-1 {
    max-width: 1200px;
    margin-inline: auto;
    padding: 7rem 0;
    border-bottom: 1px solid var(--border);
}

.section-center {
    padding: 7rem 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

.section-center .wrapper {
    max-width: 580px;
    margin-inline: auto;
}

.section-1>h2,
.section-center .wrapper>h2 {
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    margin-bottom: 2rem;
}

/* Direct children after h2 get a consistent top rhythm */
.section-1>.article-grid,
.section-1>.category-list,
.section-1>.news-list {
    margin-top: 0;
}

.section-1 h4 {
    font-size: larger;
    margin: 1rem 0;
}

/* =========================================================
   ARTICLE GRID
   ========================================================= */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.article-grid.g3 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* =========================================================
   ARTICLE CARD
   ========================================================= */
.article-card {
    background: transparent;
    padding: 1.1rem;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.article-card:hover {
    border-color: var(--border-h);
}

.article-card img {
    width: 100%;
    margin-top: 1rem;
    border: 1px solid var(--border);
    height: 180px;
    object-fit: cover;
    margin-bottom: 0.25rem;
    transition: filter 0.3s;
    filter: grayscale(15%);
}

.article-card:hover img {
    filter: grayscale(0%);
}

.article-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--t1);
    line-height: 1.25;
}

.article-card p {
    font-size: 0.875rem;
    color: var(--t2);
    line-height: 1.6;
    flex: 1;
    margin: 0;
}

/* Push date and tags to the bottom of the card */
.article-card .article-date {
    margin-top: auto;
    padding-top: 0.5rem;
}

.article-card .tags {
    margin-top: 0.25rem;
}

.article-date {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--t3);
    font-family: var(--font-mono);
}

.article-date i {
    font-size: 0.4rem;
}

.article-date .bi-circle-fill {
    font-size: 0.38rem;
}

/* Premium inline metadata badge strip in article hero */
.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    column-gap: 0.85rem;
    row-gap: 0.4rem;
    margin: 0 auto 1.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--t2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: fit-content;
    animation: fadeUp 0.6s 0.08s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.article-meta p {
    margin: 0 !important;
    animation: none !important;
}

.article-meta .article-date {
    color: var(--t2) !important;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.article-meta .article-date b {
    color: var(--t1);
    font-weight: 600;
}

/* Metadata separator dot */
.meta-sep {
    display: inline-flex;
    align-items: center;
    color: var(--border-h);
    font-size: 0.35rem;
}

/* Dynamic Top Back Button styling */
.top-back-btn {
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: center;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.article-meta .article-date .bi-circle-fill {
    font-size: 0.38rem !important;
    color: var(--t3);
    position: static !important;
    display: inline-block;
    margin: 0;
}

/* Stagger */
.article-card:nth-child(1) {
    animation-delay: 0.04s;
}

.article-card:nth-child(2) {
    animation-delay: 0.08s;
}

.article-card:nth-child(3) {
    animation-delay: 0.12s;
}

.article-card:nth-child(4) {
    animation-delay: 0.16s;
}

.article-card:nth-child(5) {
    animation-delay: 0.20s;
}

.article-card:nth-child(6) {
    animation-delay: 0.24s;
}

/* =========================================================
   CATEGORY LIST
   ========================================================= */
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.category-card {
    background: transparent;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.category-card:hover {
    border-color: var(--border-h);
}

.category-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.category-card p {
    font-size: 0.85rem;
    color: var(--t2);
    flex: 1;
}

/* =========================================================
   NEWS LIST  — notification-pill style
   ========================================================= */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.news-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    background: transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.news-item:hover {
    border-color: var(--border-h);
    transform: translateY(-4px);
}

.news-item h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--t1);
}

.news-item p {
    font-size: 0.85rem;
    color: var(--t2);
    line-height: 1.55;
}

.news-item .date {
    font-size: 0.72rem;
    color: var(--t3);
    font-family: var(--font-mono);
    margin-top: 0.15rem;
}

/* =========================================================
   SEARCHBAR
   ========================================================= */
.searchbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.65rem 1rem;
    max-width: 440px;
    transition: border-color 0.2s;
}

.searchbar:focus-within {
    border-color: var(--t1);
}

.searchbar svg {
    flex-shrink: 0;
    opacity: 0.4;
}

.searchbar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--t1);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.searchbar input::placeholder {
    color: var(--t3);
}

/* =========================================================
   TAGS
   ========================================================= */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--t2);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.2rem 0.65rem;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

/* No ::after pseudo so button-text styles don't apply */
.tag::after {
    display: none !important;
}

.tag:hover {
    border-color: var(--t1);
    color: var(--t1);
    background: transparent;
}

.tag i {
    font-size: 0.65rem;
}

/* =========================================================
   BUTTONS
   ========================================================= */

/* Primary button — background-position wipe (text always visible) */
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-image: linear-gradient(to right, var(--bg) 50%, var(--t1) 50%);
    background-size: 202% 100%;
    background-position: right center;
    color: var(--bg);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.7rem 1.6rem;
    border: 1.5px solid var(--t1);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background-position 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        color 0.35s;
    animation: fadeUp 0.6s 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.button:hover {
    background-position: left center;
    color: var(--t1);
}

/* Icon nudge on button hover */
.button:hover i {
    transform: translateY(3px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Text button — underline slide + icon move */
.button-text {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--t2);
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s;
}

.button-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--t1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.button-text:hover {
    color: var(--t1);
}

.button-text:hover::after {
    transform: scaleX(1);
}

.button-text i {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* All arrow icons slide right — never diagonal */
.button-text:hover i {
    transform: translateX(4px);
}

/* Inline icon text button */
.button-text-i {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--t1);
    font-family: var(--font-sans);
    position: relative;
    padding-bottom: 1px;
    transition: color 0.2s;
}

.button-text-i::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--t1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.button-text-i:hover::after {
    transform: scaleX(1);
}

.button-text-i i {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.button-text-i:hover i {
    transform: translateX(4px);
}

/* =========================================================
   ARTICLE CONTENT LAYOUT  — TOC on the RIGHT
   ========================================================= */
.article-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: start;
    padding-top: 0;
}

/* Article section gets less top padding since hero provides spacing */
section.article-content.section-1 {
    padding-top: 3rem;
    padding-bottom: 5rem;
    min-height: unset;
    /* Keep display:grid — do NOT override to block */
}

@media (min-width: 900px) {
    .article-content {
        /* article first, TOC second (right column) */
        grid-template-columns: 1fr 240px;
    }

    /* Move TOC card to second grid cell visually */
    .article-content-card {
        order: 2;
    }

    .article-content>article {
        order: 1;
    }
}

/* TOC card */
.article-content-card {
    position: sticky;
    top: 76px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.article-content-card .card h3 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--t3);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* TOC autogen links */
.autogen-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: var(--t2);
    padding: 0.4rem 0;
    border-bottom: 1px solid transparent;
    margin-top: 0.1rem;
    transition: color 0.15s, padding-left 0.2s;
}

.autogen-link:hover {
    color: var(--t1);
    padding-left: 0.4rem;
}

/* =========================================================
   ARTICLE BODY
   ========================================================= */
article {
    color: var(--t2);
    font-size: 1.05rem;
    line-height: 1.9;
    max-width: 100% !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

#article-body {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

article h3 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--t1);
    margin: 3rem 0 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

article h3::before {
    display: none;
}

article p {
    margin-bottom: 1.6rem;
}

article hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

article ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1.75rem;
}

article ol {
    counter-reset: ol-counter;
    list-style: none;
    padding-left: 0;
    margin-bottom: 1.75rem;
}

article ul > li {
    display: block;
    position: relative;
    padding-left: 1.6rem;
    margin-bottom: 1rem;
    line-height: 1.75;
    color: var(--t2);
}

/* Beautiful custom dot bullet for unordered list items using Bootstrap Icons code point */
article ul > li::before {
    content: "\F287";
    font-family: "bootstrap-icons" !important;
    position: absolute;
    left: 0;
    top: 0.6rem;
    font-size: 0.35rem;
    color: var(--t1);
}

article ol > li {
    counter-increment: ol-counter;
    display: block;
    position: relative;
    padding-left: 1.85rem;
    margin-bottom: 1rem;
    line-height: 1.75;
    color: var(--t2);
}

/* Premium bold numbered bullet for ordered list items */
article ol > li::before {
    content: counter(ol-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 800;
    color: var(--t1);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.75;
}

/* Bold label inside li — space after it */
article li b,
article li strong {
    font-weight: 700;
    color: var(--t1);
    margin-right: 0.35rem;
}

article img:not(.article-card img) {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    border: 1px solid var(--border);
    margin: 2rem 0;
    filter: grayscale(15%);
    transition: filter 0.3s;
}

article img:hover {
    filter: grayscale(0%);
}

/* Summary card & Markdown blockquotes */
.summary-card,
article blockquote {
    background: var(--bg-subtle);
    border-left: 4px solid var(--t1);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
}

article blockquote p {
    margin-bottom: 0 !important;
    font-size: 0.95rem;
    color: var(--t2);
}

.summary-card h3 {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--t3);
    border-bottom: none;
    margin: 0 0 0.6rem;
    padding-bottom: 0;
}

.summary-card h3::before {
    display: none;
}

.summary-card p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* =========================================================
   TABLES
   ========================================================= */
.table-container {
    width: 100% !important;
    border: 1px solid var(--border);
    overflow-x: auto;
    margin: 2rem 0;
    background: var(--bg-card);
}

.table-container table {
    width: 100% !important;
    display: table !important;
    border-collapse: collapse;
    text-align: left;
    margin: 0;
    padding: 0;
}

.table-container th {
    background: var(--bg-subtle);
    color: var(--t1);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--border);
}

.table-container td {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--t2);
    border-bottom: 1px solid var(--border);
}

.table-container tr:last-child td {
    border-bottom: none;
}

.table-container tr:hover td {
    background: var(--bg-subtle);
}



/* Article Body Links & Animations */
#article-body a:not(.share-btn):not(.button-text-i) {
    color: var(--t1);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    position: relative;
}

#article-body a:not(.share-btn):not(.button-text-i):hover {
    color: #000000 !important;
}

:root.dark #article-body a:not(.share-btn):not(.button-text-i):hover {
    color: #ffffff !important;
}

#article-body a:not(.share-btn):not(.button-text-i)::after {
    content: "\F144";
    /* bi-arrow-up-right */
    font-family: "bootstrap-icons" !important;
    font-size: 0.78em;
    margin-left: 2px;
    display: inline-block;
    opacity: 0;
    width: 0;
    transform: translate(-4px, 4px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#article-body a:not(.share-btn):not(.button-text-i):hover::after {
    opacity: 1;
    width: 1em;
    transform: translate(0, 0);
}

/* Article Unordered Lists with bi-circle-fill Bullets */
#article-body ul:not(.external-sources-list) {
    list-style: none;
    padding-left: 0;
    margin: 1.5rem 0;
}

#article-body ul:not(.external-sources-list) > li {
    position: relative;
    padding-left: 1.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

#article-body ul:not(.external-sources-list) > li::before {
    content: "\F287";
    /* bi-circle-fill */
    font-family: "bootstrap-icons" !important;
    position: absolute;
    left: 0;
    top: 0.38em;
    font-size: 0.85em;
    /* As big as the font text */
    color: var(--t3);
    display: inline-block;
    line-height: 1;
}

/* External Sources List formatting */
.external-sources-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 1.75rem 0 !important;
}

.external-sources-list li {
    position: relative !important;
    padding-left: 0 !important;
    margin-bottom: 1rem !important;
    line-height: 1.6 !important;
}

.external-sources-list li::before {
    display: none !important;
    /* Hide standard bullets completely */
}

.external-sources-list li a {
    text-decoration: none !important;
    color: var(--t1);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    position: relative;
    padding-bottom: 2px;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    transition: background-size 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.external-sources-list li a:hover {
    background-size: 100% 1px;
}

.external-sources-list li a:hover {
    color: #000000 !important;
}

:root.dark .external-sources-list li a:hover {
    color: #ffffff !important;
}

.external-sources-list li a::before {
    content: "\F470";
    /* bi-link-45deg */
    font-family: "bootstrap-icons" !important;
    margin-right: 6px;
    font-size: 0.95em;
    color: var(--t3);
    display: inline-block;
    transition: color 0.2s ease;
}

.external-sources-list li a::after {
    content: "\F144";
    /* bi-arrow-up-right */
    font-family: "bootstrap-icons" !important;
    margin-left: 4px;
    font-size: 0.78em;
    display: inline-block;
    transform: translate(-3px, 3px);
    opacity: 0;
    width: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.external-sources-list li a:hover::after {
    opacity: 1;
    width: 1em;
    transform: translate(0, 0);
}


/* GitHub Alert Boxes */
article blockquote.alert-box {
    background: var(--bg-subtle);
    border-left: 4px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin: 1.75rem 0;
}

article blockquote.alert-box p {
    margin-bottom: 0 !important;
}

.alert-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

article blockquote.alert-note {
    border-left-color: #3b82f6;
}

.alert-note .alert-title {
    color: #3b82f6;
}

article blockquote.alert-tip {
    border-left-color: #10b981;
}

.alert-tip .alert-title {
    color: #10b981;
}

article blockquote.alert-important {
    border-left-color: #8b5cf6;
}

.alert-important .alert-title {
    color: #8b5cf6;
}

article blockquote.alert-warning {
    border-left-color: #f59e0b;
}

.alert-warning .alert-title {
    color: #f59e0b;
}

article blockquote.alert-caution {
    border-left-color: #ef4444;
}

.alert-caution .alert-title {
    color: #ef4444;
}


/* Social Share Buttons */
.article-share-section {
    margin-top: 3.5rem;
    border-top: 1px solid var(--border);
    padding-top: 2.25rem;
}

.share-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--t2);
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-buttons {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--t1);
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.share-btn:hover {
    background: var(--t1);
    color: var(--bg);
    border-color: var(--t1);
    transform: translateY(-3px);
}

.copy-toast {
    margin-top: 0.95rem;
    font-size: 0.85rem;
    color: #10b981;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Dynamic Back to Articles Button */
.back-to-articles {
    margin-top: 3.5rem;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    display: flex;
}

.back-to-articles .button-text-i {
    font-size: 0.95rem;
    font-weight: 600;
}

/* =========================================================
   FOOTER
   ========================================================= */
footer#legal {
    border-bottom: none;
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem;
    background: transparent;
}

footer .wrapper {
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2rem;
    padding-inline: 0;
}

/* Logo + copyright — left column */
.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    /* push nav links all the way right */
    flex: 1;
}

footer img {
    height: 22px;
    width: auto;
    opacity: 0.5;
}

footer p {
    font-size: 0.78rem;
    color: var(--t3);
    font-family: var(--font-mono);
}

/* Nav links — right side */
footer nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: right;
}

footer nav>p {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--t3);
    margin-top: 0.6rem;
}

footer nav .button-text {
    font-size: 0.85rem;
    justify-content: flex-end;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Dynamic Markdown Custom Styles ── */
.article-figure {
    margin: 2rem 0;
    width: 100%;
}

.article-figure img {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    border: 1px solid var(--border);
    filter: grayscale(15%);
    transition: filter 0.3s;
}

.article-figure:hover img {
    filter: grayscale(0%);
}

.article-figcaption {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--t3);
    margin-top: 0.5rem;
    text-align: left;
}

.article-figcaption i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* Heading anchors */
article h3 {
    position: relative;
}

.heading-anchor {
    position: absolute;
    right: 100%;
    padding-right: 0.5rem;
    opacity: 0;
    color: var(--t3);
    transition: opacity 0.2s, color 0.2s;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

article h3:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor:hover {
    color: var(--t1);
}

/* Pre / Code syntax highlighting custom rules for monochrome feel */
pre[class*="language-"],
code[class*="language-"] {
    font-family: var(--font-mono) !important;
    font-size: 0.875rem !important;
    text-shadow: none !important;
    background: var(--bg-subtle) !important;
    color: var(--t1) !important;
}

pre {
    background: var(--bg-subtle) !important;
    border: 1px solid var(--border);
    padding: 1.25rem !important;
    margin: 1.5rem 0 !important;
    overflow-x: auto;
    position: relative;
    /* to support absolute positioned language popup badge */
}

/* Dynamic Syntax Highlighting Token Overrides */
code[class*="language-"] .token.comment,
code[class*="language-"] .token.prolog,
code[class*="language-"] .token.doctype,
code[class*="language-"] .token.cdata {
    color: var(--token-comment) !important;
    font-style: italic;
}

code[class*="language-"] .token.punctuation {
    color: var(--token-punctuation) !important;
}

code[class*="language-"] .token.keyword,
code[class*="language-"] .token.selector,
code[class*="language-"] .token.attr-name,
code[class*="language-"] .token.boolean,
code[class*="language-"] .token.atrule,
code[class*="language-"] .token.attr-value {
    color: var(--token-keyword) !important;
    font-weight: 500;
}

code[class*="language-"] .token.string,
code[class*="language-"] .token.char,
code[class*="language-"] .token.regex,
code[class*="language-"] .token.variable {
    color: var(--token-string) !important;
}

code[class*="language-"] .token.function,
code[class*="language-"] .token.class-name {
    color: var(--token-function) !important;
}

code[class*="language-"] .token.number {
    color: var(--token-number) !important;
}

code[class*="language-"] .token.operator,
code[class*="language-"] .token.entity,
code[class*="language-"] .token.url {
    color: var(--token-operator) !important;
}

/* Cute Language Popup Badge in Top Right */
pre[data-language]::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    background: var(--border);
    color: var(--t2);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    z-index: 10;
    pointer-events: none;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

:not(pre)>code {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 0.15rem 0.35rem;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: var(--t1);
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {

    /* Language popup badge invisible on mobile */
    pre[data-language]::before {
        display: none !important;
    }

    /* Layout & Spacing */
    .wrapper {
        padding-inline: 1.25rem;
    }

    .hero {
        min-height: auto;
        padding: 5.5rem 1.25rem 3.5rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .section-1 {
        padding: 4rem 1.25rem;
    }

    .section-center {
        padding: 4rem 1.25rem;
    }

    /* Grids & Cards */
    .article-grid,
    .article-grid.g3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .article-meta .article-date {
        font-size: 0.7rem;
    }

    .category-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Typography inside Articles */
    article {
        font-size: 1rem;
        line-height: 1.8;
    }

    article h3 {
        font-size: 1.6rem;
        margin: 2.5rem 0 1rem;
    }

    article blockquote,
    .summary-card,
    article blockquote.alert-box {
        padding: 1.1rem 1.25rem;
        margin: 1.5rem 0;
    }

    /* Nav Header */
    header nav {
        padding: 0 1.25rem;
        height: 52px;
    }

    header nav img {
        height: 22px;
    }

    /* Article layout: hide Table of Contents for a clean linear read */
    .article-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .article-content-card {
        display: none !important;
    }

    /* Social Share Block adjustments */
    .article-share-section {
        margin-top: 2.5rem;
        padding-top: 1.75rem;
    }

    .share-buttons {
        gap: 0.6rem;
    }

    .share-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    /* Footer Adjustments */
    footer#legal {
        padding: 2.5rem 1.25rem;
    }

    footer .wrapper {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }

    footer nav {
        text-align: left;
        gap: 0.5rem;
    }

    footer nav .button-text {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {

    /* Narrow mobile screens */
    .wrapper {
        padding-inline: 1rem;
    }

    .hero {
        padding-top: 5rem;
    }

    .hero h1 {
        font-size: 1.85rem;
    }

    .category-list {
        grid-template-columns: 1fr;
    }

    .section-1 {
        padding: 3rem 1rem;
    }

    .news-item h3 {
        font-size: 1.25rem;
    }

    header nav a:not(:first-child) {
        padding: 0.25rem 0.45rem;
        font-size: 0.8rem;
    }
}

/* ── iOS PWA Modal & Notifications CSS ── */
.ios-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ios-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ios-modal {
    background: var(--bg-card, #111111);
    border: 1px solid var(--border, #2a2a2a);
    padding: 2rem 2.25rem;
    max-width: 440px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-sans);
    text-align: center;
    border-radius: var(--r-card, 0px);
}

.ios-modal-overlay.active .ios-modal {
    transform: translateY(0);
}

.ios-modal h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--t1);
    letter-spacing: -0.02em;
}

.ios-modal p {
    font-size: 0.88rem;
    color: var(--t2);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.ios-steps {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-bottom: 2rem;
}

.ios-step {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    font-size: 0.88rem;
    color: var(--t1);
}

.ios-step-num {
    background: var(--t1);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ios-step-text {
    line-height: 1.5;
    flex: 1;
}

.ios-step-text i {
    font-size: 1.05rem;
    color: var(--t1);
    vertical-align: middle;
    margin: 0 2px;
}

.ios-modal-close {
    width: 100%;
}

/* =========================================================
   ARTICLE HERO & COVER IMAGE
   ========================================================= */
.hero.article-hero {
    min-height: auto;
    padding: 8rem 1.5rem 3.5rem;
    text-align: center;
    border-bottom: none;
}

.hero.article-hero h1 {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    line-height: 1.25;
    margin-bottom: 0.85rem;
    letter-spacing: -0.03em;
}

.hero-cover-container {
    max-width: 100%;
    width: 780px;
    margin: 2.25rem auto 0;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: block;
    animation: fadeUp 0.6s 0.12s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-cover-img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    display: block;
    filter: grayscale(12%);
    transition: filter 0.3s ease;
}

.hero-cover-img:hover {
    filter: grayscale(0%);
}

@media (max-width: 768px) {
    .hero.article-hero {
        padding: 6.5rem 1.25rem 2.5rem;
    }
    .hero-cover-img {
        height: 240px;
    }
}

/* =========================================================
   KODE WATERMARK OVERLAY
   ========================================================= */
.kode-image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
}

.kode-image-wrapper::after {
    content: "";
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    background-image: url('/web/resources/svg/light-logo-icon-kode.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    mix-blend-mode: difference;
    pointer-events: none;
    z-index: 5;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.kode-image-wrapper:hover::after {
    opacity: 1;
    transform: translateY(-1px);
}

/* Adapt homepage & search cards to the new image wrapper */
.article-card .kode-image-wrapper {
    width: 100%;
    margin-top: 1rem;
    border: 1px solid var(--border);
    height: 180px;
    margin-bottom: 0.25rem;
    transition: border-color 0.2s;
}

.article-card .kode-image-wrapper img {
    margin-top: 0 !important;
    border: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    margin-bottom: 0 !important;
    transition: filter 0.3s ease;
    filter: grayscale(15%);
}

.article-card:hover .kode-image-wrapper img {
    filter: grayscale(0%);
}

/* Adjust inline article figures */
.article-figure .kode-image-wrapper {
    border: 1px solid var(--border);
}

.article-figure .kode-image-wrapper img {
    width: 100%;
    object-fit: cover;
}

/* ── Remove Browser Tap Highlight ── */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ── Responsive Tables in Articles ── */
.article-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

/* ── Premium Custom Toasts ── */
.custom-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--t1);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.88rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 99999;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.custom-toast i {
    font-size: 1.25rem;
    color: var(--t1);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(1.5rem) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(1rem) scale(0.95);
    }
}

/* Mobile Toast Overlays */
@media (max-width: 768px) {
    .custom-toast {
        bottom: 1.5rem;
        left: 1.5rem;
        right: 1.5rem;
        padding: 0.88rem 1.25rem;
        font-size: 0.85rem;
    }
}