/* ==========================================================================
   tech Danilo v2 — Technical Minimalist Showcase (inspired by jmswrnr.com)
   Blue-anchored Light & Dark system · Saira + JetBrains Mono
   ========================================================================== */

:root,
[data-theme="light"] {
    --bg-canvas: #F7F8FA;
    --bg-surface: #FFFFFF;
    --bg-subtle: #EDF1F7;
    --bg-pill: rgba(255, 255, 255, 0.84);
    --bg-code: #F1F5F9;

    --ink-primary: #111827;
    --ink-secondary: #4B5563;
    --ink-muted: #7C8798;

    --border-hairline: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);

    --accent: #1D63D8;
    --accent-hover: #154BB0;
    --accent-soft: rgba(29, 99, 216, 0.09);
    --accent-border: rgba(29, 99, 216, 0.28);

    --cta-bg: #111827;
    --cta-fg: #FFFFFF;
    --cta-hover: #1D63D8;

    --shadow-pill: 0 2px 14px -4px rgba(15, 23, 42, 0.08);
    --shadow-sheet: 0 10px 36px -14px rgba(15, 23, 42, 0.09);
    --shadow-card-hover: 0 14px 30px -14px rgba(29, 99, 216, 0.25);

    --font-display: var(--gh-font-heading, 'Saira'), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-sans: var(--gh-font-body, 'Saira'), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --container-max: 1120px;
}

[data-theme="dark"] {
    --bg-canvas: #090D16;
    --bg-surface: #111827;
    --bg-subtle: #182236;
    --bg-pill: rgba(17, 24, 39, 0.82);
    --bg-code: #0B1220;

    --ink-primary: #F1F5F9;
    --ink-secondary: #A1B0C6;
    --ink-muted: #6C7A92;

    --border-hairline: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.24);

    --accent: #60A5FA;
    --accent-hover: #93C5FD;
    --accent-soft: rgba(96, 165, 250, 0.14);
    --accent-border: rgba(96, 165, 250, 0.34);

    --cta-bg: #2563EB;
    --cta-fg: #FFFFFF;
    --cta-hover: #3B82F6;

    --shadow-pill: 0 6px 24px -6px rgba(0, 0, 0, 0.55);
    --shadow-sheet: 0 18px 48px -18px rgba(0, 0, 0, 0.65);
    --shadow-card-hover: 0 16px 32px -14px rgba(59, 130, 246, 0.35);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background: var(--bg-canvas);
    color: var(--ink-primary);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--ink-primary);
    background: var(--bg-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

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

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

.td-skip-link {
    position: absolute;
    left: -9999px;
    top: 12px;
    z-index: 200;
    padding: 0.5rem 0.9rem;
    background: var(--accent);
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.td-skip-link:focus {
    left: 16px;
}

/* Reading Progress Bar */
.td-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 150;
    pointer-events: none;
}

.td-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.08s linear;
}

/* Shell */
.td-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.td-main {
    flex: 1 0 auto;
}

.td-container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 2.25rem);
}

/* ==========================================================================
   Floating Pill Header (jmswrnr-inspired)
   ========================================================================== */
.td-header-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem clamp(1rem, 4vw, 2.25rem) 0.5rem;
    pointer-events: none;
}

.td-header-pill {
    pointer-events: auto;
    max-width: 920px;
    margin: 0 auto;
    height: 54px;
    padding: 0 0.75rem 0 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-pill);
    border: 1px solid var(--border-hairline);
    border-radius: 999px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-pill);
}

.td-brand {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.1rem;
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-primary);
    flex-shrink: 0;
}

.td-brand-tm {
    font-size: 0.58em;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
    margin-top: 0.15rem;
}

.td-brand-logo {
    max-height: 28px;
    width: auto;
}

.td-nav {
    position: relative;
    margin-left: auto;
    margin-right: 0.35rem;
}

.td-nav-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    height: 32px;
    border-radius: 999px;
    background: var(--bg-subtle);
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), width 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.16s ease;
}

.td-nav .nav {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.td-nav .nav a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 0.85rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-secondary);
    transition: color 0.15s ease;
}

.td-nav .nav a:hover,
.td-nav .nav .nav-current a {
    color: var(--ink-primary);
}

.td-nav .nav .nav-current a {
    color: var(--accent);
    font-weight: 600;
}

.td-header-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.td-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--ink-secondary);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.td-icon-btn:hover {
    background: var(--bg-subtle);
    color: var(--ink-primary);
}

[data-theme="light"] .td-icon-sun { display: none; }
[data-theme="dark"] .td-icon-moon { display: none; }

.td-menu-btn { display: none; }
.td-menu-btn .td-icon-close { display: none; }
.td-menu-btn[aria-expanded="true"] .td-icon-menu { display: none; }
.td-menu-btn[aria-expanded="true"] .td-icon-close { display: inline-flex; }

/* Mobile Drawer */
.td-mobile-nav {
    pointer-events: auto;
    max-width: 920px;
    margin: 0.5rem auto 0;
    padding: 1rem 1.25rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sheet);
}

.td-mobile-nav .nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.td-mobile-nav .nav a {
    display: block;
    padding: 0.5rem 0.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-secondary);
}

.td-mobile-nav .nav .nav-current a {
    color: var(--accent);
    font-weight: 600;
}

.td-mobile-links {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-hairline);
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-secondary);
}

/* ==========================================================================
   Centered Minimalist Hero (jmswrnr-inspired)
   ========================================================================== */
.td-hero {
    padding: clamp(4.5rem, 11vh, 8.25rem) 0 clamp(3.75rem, 9vh, 6.5rem);
}

.td-hero-center {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.td-hero-statement {
    margin: 0 0 1.65rem;
    font-family: var(--font-display);
    font-size: clamp(1.38rem, 2.4vw, 1.8rem);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--ink-primary);
}

.td-hero-cta {
    margin-bottom: 1.5rem;
}

.td-cta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 1.2rem;
    border-radius: var(--radius-sm);
    background: var(--cta-bg);
    color: var(--cta-fg);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.td-cta-pill:hover {
    background: var(--cta-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px -8px rgba(29, 99, 216, 0.45);
}

.td-cta-pill-sm {
    padding: 0.5rem 0.95rem;
    font-size: 0.85rem;
}

.td-social-dock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.td-social-dock-left {
    justify-content: flex-start;
    margin-top: 0.75rem;
}

.td-dock-link {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.td-dock-link:hover {
    color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.td-divider {
    border: 0;
    border-top: 1px solid var(--border-hairline);
    margin: 0;
}

/* ==========================================================================
   Sections & 4-Column Visual Card Grids
   ========================================================================== */
.td-section {
    padding: clamp(2.5rem, 5vw, 3.75rem) 0;
}

.td-section-tight {
    padding-top: 1rem;
}

.td-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.td-section-head-bare {
    align-items: flex-end;
    flex-wrap: wrap;
}

.td-section-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.td-section-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink-primary);
}

.td-section-title-sm {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.td-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.52rem;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
}

.td-section-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-muted);
    transition: color 0.15s ease;
}

.td-section-more:hover {
    color: var(--accent);
}

/* Blog 4-Column Grid */
.td-blog-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.65rem 1.35rem;
}

.td-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.td-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0B1222;
    border: 1px solid var(--border-hairline);
    margin-bottom: 0.75rem;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.td-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.32s ease;
}

.td-card-link:hover .td-card-media {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-border);
}

.td-card-link:hover .td-card-media img {
    transform: scale(1.04);
}

/* Generative Cobalt Wave Cover (when a Ghost post has no feature_image) */
.td-card-cover-mesh {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #07122B 0%, #102B6B 52%, #1D4ED8 100%);
    overflow: hidden;
}

.td-cover-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(191, 219, 254, 0.22) 1px, transparent 1px);
    background-size: 16px 16px;
}

.td-cover-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(26px);
}

.td-cover-orb-a {
    width: 160px;
    height: 160px;
    top: -40px;
    right: -30px;
    background: rgba(96, 165, 250, 0.65);
}

.td-cover-orb-b {
    width: 140px;
    height: 140px;
    bottom: -55px;
    left: -20px;
    background: rgba(56, 189, 248, 0.45);
}

.td-cover-tag {
    position: absolute;
    left: 12px;
    bottom: 10px;
    padding: 0.16rem 0.5rem;
    border-radius: 6px;
    background: rgba(9, 13, 22, 0.58);
    border: 1px solid rgba(191, 219, 254, 0.28);
    backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #DBEAFE;
}

.td-card-title {
    margin: 0 0 0.3rem;
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--accent);
    transition: color 0.15s ease;
    overflow-wrap: anywhere;
}

.td-card-link:hover .td-card-title,
.td-artifact-card:hover .td-card-title {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.td-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--ink-muted);
}

.td-card-meta-read {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ==========================================================================
   Artifacts / Projects 4-Column Square Dark Showcase Grid (jmswrnr-inspired)
   ========================================================================== */
.td-artifacts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.65rem 1.35rem;
}

.td-artifact-card {
    display: flex;
    flex-direction: column;
}

.td-artifact-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 0%, #14223E 0%, #090D16 68%, #05070C 100%);
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 1.15rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.td-artifact-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.18), transparent 65%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.td-artifact-card:hover .td-artifact-stage {
    transform: translateY(-3px);
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: var(--shadow-card-hover);
}

.td-artifact-card:hover .td-artifact-stage::after {
    opacity: 1;
}

/* Miniature Dark HUD Scenes inside Artifact Cards */
.td-hud {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 190px;
    padding: 0.8rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #E2E8F0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.75);
}

.td-hud-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    font-size: 0.62rem;
    color: #94A3B8;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.td-hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3B82F6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.85);
}

.td-hud-screen {
    padding: 0.65rem;
    border-radius: 6px;
    background: #080E1C;
    border: 1px solid rgba(96, 165, 250, 0.26);
    margin-bottom: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.td-hud-line {
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
}

.td-hud-line.is-blue {
    width: 78%;
    background: linear-gradient(90deg, #2563EB, #60A5FA);
}

.td-hud-line.is-short {
    width: 48%;
}

.td-hud-pills {
    display: flex;
    gap: 0.3rem;
}

.td-hud-pills span {
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    font-size: 0.58rem;
    background: rgba(148, 163, 184, 0.12);
    color: #94A3B8;
}

.td-hud-pills span.is-on {
    background: rgba(37, 99, 235, 0.28);
    color: #93C5FD;
}

.td-hud-code {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    line-height: 1.4;
}

.td-hud-code .is-accent { color: #60A5FA; }
.td-hud-code .is-dim { color: #64748B; }
.td-hud-code .is-ok { color: #34D399; }

.td-hud-alert {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 0.75rem;
}

.td-hud-ring {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.32), transparent 70%);
}

.td-hud-core {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1D4ED8;
    color: #EFF6FF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    box-shadow: 0 0 18px rgba(37, 99, 235, 0.65);
}

.td-hud-caption {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    color: #94A3B8;
}

.td-hud-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem;
}

.td-hud-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.5rem;
    border-radius: 5px;
    color: #CBD5E1;
}

.td-hud-row.is-active {
    background: #1D4ED8;
    color: #FFFFFF;
}

.td-hud-row.is-dim {
    color: #64748B;
}

.td-hud-metric {
    font-size: 1.35rem;
    font-weight: 600;
    color: #EFF6FF;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.td-hud-metric span {
    font-size: 0.7rem;
    color: #60A5FA;
    margin-left: 0.2rem;
}

.td-hud-spark {
    width: 100%;
    height: 30px;
}

.td-hud-repo-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #F8FAFC;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-hud-repo-desc {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    line-height: 1.4;
    color: #94A3B8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.td-projects-status {
    margin: 1.25rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-muted);
}

/* ==========================================================================
   Archive / Filters / Pagination
   ========================================================================== */
.td-archive-head {
    padding: clamp(2.25rem, 5vw, 3.5rem) 0 1.25rem;
}

.td-kicker {
    margin: 0 0 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
}

.td-archive-title {
    margin: 0 0 0.55rem;
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.6vw, 2.55rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.td-archive-desc {
    margin: 0;
    max-width: 60ch;
    font-size: 1rem;
    color: var(--ink-secondary);
}

.td-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.35rem;
}

.td-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.td-chip:hover {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.td-chip.is-active {
    background: var(--cta-bg);
    color: var(--cta-fg);
    border-color: var(--cta-bg);
}

.td-chip-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    opacity: 0.68;
}

.td-author-head {
    display: flex;
    align-items: flex-start;
    gap: 1.35rem;
}

.td-avatar-lg {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-hairline);
    flex-shrink: 0;
}

.td-empty {
    padding: 2rem 0;
    color: var(--ink-secondary);
}

.td-error {
    padding: clamp(4.5rem, 12vh, 8rem) 0;
}

.td-error .td-hero-cta {
    margin-top: 1.75rem;
}

.td-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 2.5rem 0 0.5rem;
}

.td-pagination-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.td-pagination-next {
    justify-self: end;
}

.td-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--ink-primary);
    transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* ==========================================================================
   Article & Page Sheet Layout (jmswrnr-inspired Card + Floating Rail)
   ========================================================================== */
.td-article-shell {
    padding: 1.25rem 0 3.5rem;
}

.td-article-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 1.5rem;
    align-items: start;
}

.td-page-wrap {
    max-width: 860px;
}

.td-sheet {
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sheet);
    overflow: hidden;
}

.td-sheet-note {
    margin-top: 2.5rem;
}

.td-sheet-hero {
    position: relative;
    height: clamp(190px, 26vw, 275px);
    overflow: hidden;
    background: #09132A;
}

.td-sheet-hero.is-compact {
    height: clamp(130px, 16vw, 175px);
}

.td-sheet-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-sheet-hero-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 68% 90% at 18% 20%, rgba(37, 99, 235, 0.92), transparent 62%),
        radial-gradient(ellipse 60% 85% at 84% 25%, rgba(56, 189, 248, 0.72), transparent 58%),
        radial-gradient(ellipse 55% 70% at 52% 0%, rgba(99, 102, 241, 0.65), transparent 60%),
        linear-gradient(180deg, #09142F 0%, #153478 55%, var(--bg-surface) 100%);
}

.td-sheet-hero-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 28%, color-mix(in srgb, var(--bg-surface) 72%, transparent) 78%, var(--bg-surface) 100%);
}

.td-sheet-body {
    padding: 0 clamp(1.5rem, 5vw, 3.75rem) clamp(2rem, 5vw, 3.5rem);
}

.td-sheet-note .td-sheet-body {
    padding-top: clamp(1.75rem, 4vw, 2.5rem);
}

.td-sheet-header {
    position: relative;
    margin-top: -1.5rem;
    padding-bottom: 1.75rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-hairline);
}

.td-sheet-title {
    margin: 0 0 0.75rem;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.45rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink-primary);
}

.td-sheet-excerpt {
    margin: 0 0 1.4rem;
    font-size: 1.04rem;
    line-height: 1.6;
    color: var(--ink-secondary);
}

.td-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 480px;
}

.td-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.td-meta-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-muted);
}

.td-meta-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink-primary);
}

.td-meta-value a:hover {
    color: var(--accent);
}

/* Sticky Right Sidebar (Action Pill + TOC Card) */
.td-rail-sticky {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.td-action-pill {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.55rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: 14px;
    box-shadow: var(--shadow-pill);
}

.td-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-secondary);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.td-action-btn:hover {
    background: var(--bg-subtle);
    color: var(--accent);
}

.td-action-sep {
    width: 1px;
    height: 18px;
    background: var(--border-hairline);
}

.td-toc-card {
    padding: 1.15rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: 16px;
    box-shadow: var(--shadow-pill);
}

.td-toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.td-toc-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--ink-muted);
    transition: color 0.15s ease;
}

.td-toc-item.is-sub {
    padding-left: 0.75rem;
    font-size: 0.8rem;
}

.td-toc-marker {
    width: 7px;
    height: 7px;
    margin-top: 0.38rem;
    flex-shrink: 0;
    position: relative;
}

.td-toc-marker::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 7px;
    height: 1.5px;
    background: var(--border-strong);
    border-radius: 2px;
    transition: all 0.18s ease;
}

.td-toc-item:hover {
    color: var(--ink-primary);
}

.td-toc-item.is-active {
    color: var(--ink-primary);
    font-weight: 600;
}

.td-toc-item.is-active .td-toc-marker::before {
    top: 0;
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 2px;
}

/* ==========================================================================
   Prose & Ghost Koenig Cards
   ========================================================================== */
.td-prose {
    font-size: 1.03rem;
    font-weight: 400;
    line-height: 1.78;
    color: var(--ink-secondary);
}

.td-prose > * + * {
    margin-top: 1.25rem;
}

.td-prose strong {
    color: var(--ink-primary);
    font-weight: 600;
}

.td-prose h2,
.td-prose h3,
.td-prose h4 {
    position: relative;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--ink-primary);
    scroll-margin-top: 90px;
}

.td-prose h2 {
    margin-top: 2.4rem;
    font-size: clamp(1.32rem, 2.2vw, 1.6rem);
}

.td-prose h3 {
    margin-top: 1.85rem;
    font-size: 1.2rem;
}

.td-prose h4 {
    margin-top: 1.5rem;
    font-size: 1.02rem;
}

.td-heading-anchor {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    color: var(--ink-muted);
    opacity: 0;
    font-size: 0.78em;
    vertical-align: middle;
    text-decoration: none !important;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.td-prose h2:hover .td-heading-anchor,
.td-prose h3:hover .td-heading-anchor,
.td-heading-anchor:focus-visible {
    opacity: 1;
    color: var(--accent);
}

.td-prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-border);
    text-underline-offset: 3px;
}

.td-prose a:hover {
    text-decoration-color: var(--accent);
}

.td-prose ul,
.td-prose ol {
    padding-left: 1.4rem;
}

.td-prose li + li {
    margin-top: 0.45rem;
}

.td-prose blockquote {
    margin: 1.75rem 0;
    padding: 0.5rem 0 0.5rem 1.25rem;
    border-left: 3px solid var(--accent);
    color: var(--ink-primary);
    font-size: 1.08rem;
}

.td-prose hr {
    border: 0;
    border-top: 1px solid var(--border-hairline);
    margin: 2.25rem 0;
}

.td-prose code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-subtle);
    padding: 0.15em 0.4em;
    border-radius: 5px;
    color: var(--ink-primary);
}

.td-prose pre {
    position: relative;
    margin: 1.65rem 0;
    padding: 1.15rem 1.3rem;
    background: var(--bg-code);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    overflow-x: auto;
    line-height: 1.6;
}

.td-prose pre code {
    background: transparent;
    padding: 0;
    font-size: 0.86rem;
    color: var(--ink-primary);
}

.td-copy-code {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.22rem 0.58rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.td-copy-code:hover,
.td-copy-code.is-copied {
    color: var(--accent);
    border-color: var(--accent-border);
}

.td-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    margin: 1.75rem 0;
    overflow-x: auto;
    display: block;
}

.td-prose th,
.td-prose td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-hairline);
}

.td-prose th {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--ink-primary);
}

/* Required Ghost Koenig Card Widths & Refinements */
.kg-width-wide,
.kg-width-full {
    width: 100%;
    max-width: 100%;
}

.kg-card {
    margin-top: 1.85rem;
    margin-bottom: 1.85rem;
}

.kg-image-card img,
.kg-gallery-image img {
    border-radius: var(--radius-md);
}

.kg-card figcaption {
    margin-top: 0.6rem;
    text-align: center;
    font-size: 0.84rem;
    color: var(--ink-muted);
}

.kg-callout-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-hairline);
}

.kg-bookmark-card .kg-bookmark-container {
    background: var(--bg-canvas);
    color: var(--ink-primary);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    text-decoration: none;
}

.td-sheet-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 2.25rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-hairline);
}

.td-comments {
    margin-top: 2.25rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border-hairline);
}

.td-related {
    border-top: 1px solid var(--border-hairline);
}

/* ==========================================================================
   Minimalist Footer (jmswrnr-inspired)
   ========================================================================== */
.td-footer {
    border-top: 1px solid var(--border-hairline);
    padding: 1.75rem 0;
    margin-top: auto;
}

.td-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.td-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
}

.td-footer-links a:hover {
    color: var(--accent);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1020px) {
    .td-blog-grid,
    .td-artifacts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .td-article-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .td-rail {
        display: none;
    }
}

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

    .td-menu-btn {
        display: inline-flex;
    }

    .td-header-pill {
        padding: 0 0.55rem 0 1.1rem;
    }

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

@media (max-width: 540px) {
    .td-blog-grid,
    .td-artifacts-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .td-author-head {
        flex-direction: column;
    }
}

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