:root {
    --canvas: #f7f8fc;
    --surface: #ffffff;
    --surface-blue: #eef1ff;
    --ink: #17182d;
    --muted: #60647a;
    --line: #dfe3f0;
    --accent: #4b45d6;
    --accent-dark: #302a9e;
    --lime: #d4f86a;
    --code: #17182d;
    --shadow: 0 20px 60px rgba(45, 48, 120, .09);
}

html[data-theme="dark"] {
    --canvas: #111225;
    --surface: #1a1b35;
    --surface-blue: #222550;
    --ink: #f5f6ff;
    --muted: #b4b7d0;
    --line: #363957;
    --accent: #9b94ff;
    --accent-dark: #beb9ff;
    --lime: #d4f86a;
    --code: #0b0c1a;
    --shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Host Grotesk", sans-serif;
    font-weight: 400;
    line-height: 1.65;
    transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--lime); outline-offset: 4px; }
.site-header, main, .site-footer { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.35rem; font-weight: 700; letter-spacing: -.04em; }
.brand::before { width: 18px; height: 18px; border-radius: 50%; background: var(--lime); content: ""; }
.brand span { color: var(--accent); }
nav { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; }
nav a { padding: 9px 14px; border-radius: 999px; }
nav a:hover { background: var(--surface); color: var(--accent); }
button { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.theme-toggle { width: 38px; height: 38px; margin-left: 4px; border: 1px solid var(--line); border-radius: 50%; font-size: 1.1rem; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.hero { position: relative; overflow: hidden; min-height: 610px; display: flex; flex-direction: column; justify-content: center; padding: 82px 0 110px; }
.hero::after { position: absolute; right: 2%; bottom: 4%; width: 180px; height: 180px; border: 1px solid var(--accent); border-radius: 42% 58% 60% 40%; opacity: .18; content: ""; transform: rotate(28deg); }
.eyebrow, .post-meta { margin-bottom: 12px; color: var(--accent); font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 850px; margin-bottom: 28px; font-size: clamp(3.6rem, 9vw, 8.2rem); font-weight: 600; line-height: .94; letter-spacing: -.075em; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 600; line-height: 1; letter-spacing: -.055em; }
h3 { font-size: 1.45rem; font-weight: 600; line-height: 1.15; letter-spacing: -.035em; }
.lede { max-width: 630px; color: var(--muted); font-size: 1.2rem; }
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 34px; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 13px 20px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 10px 24px rgba(75, 69, 214, .2); }
.button:hover { background: var(--accent-dark); transform: translateY(-2px); }
.text-link { color: var(--accent); font-weight: 600; }
.text-link:hover { color: var(--accent-dark); }
.section-heading { display: flex; justify-content: space-between; align-items: end; padding: 72px 0 28px; border-top: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 0; }
.topic-section { margin-bottom: 72px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-blue); }
.topic-heading { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 24px; }
.topic-heading h2 { margin-bottom: 0; }
.topic-heading > p { max-width: 380px; margin-bottom: 4px; color: var(--muted); }
.topic-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.topic-tabs a { display: flex; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; transition: border-color .2s ease, color .2s ease, transform .2s ease; }
.topic-tabs a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 120px; }
.post-card { min-height: 300px; display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); transition: transform .25s ease, border-color .25s ease; }
.post-card:nth-child(2) { background: var(--surface-blue); }
.post-card:hover { border-color: var(--accent); transform: translateY(-6px); }
.post-card h3 { margin-bottom: 14px; }
.post-card p:not(.post-meta) { color: var(--muted); }
.post-card .text-link { margin-top: auto; width: fit-content; font-size: .9rem; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 30px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer a { color: var(--accent); }
.page-intro { padding: 94px 0 60px; max-width: 850px; }
.page-intro.compact { padding-bottom: 48px; }
.topic-intro { padding-bottom: 48px; }
.page-intro h1, .article h1 { font-size: clamp(3rem, 7vw, 6.4rem); }
.prose { max-width: 780px; color: var(--muted); }
.prose h2, .prose h3 { margin-top: 54px; color: var(--ink); }
.prose h2:first-child { margin-top: 0; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.about-details { padding-bottom: 120px; }
.about-details li { margin: 10px 0; padding-left: 5px; }
.post-list { padding-bottom: 120px; border-top: 1px solid var(--line); }
.post-row { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 36px; align-items: center; padding: 30px 22px; border-bottom: 1px solid var(--line); border-radius: 12px; transition: background .2s ease; }
.post-row:hover { background: var(--surface); }
.post-row h2 { margin: 0; font-size: 1.7rem; }
.post-row > p { margin: 0; color: var(--muted); }
.topic-results { padding-bottom: 120px; }
.topic-empty { max-width: 650px; padding: 42px; border: 1px dashed var(--accent); border-radius: 18px; background: var(--surface); }
.topic-empty h3 { margin-bottom: 10px; }
.topic-empty p:last-child { margin-bottom: 0; color: var(--muted); }
.article { max-width: 850px; padding: 64px 0 120px; }
.back-link { display: inline-block; margin-bottom: 72px; color: var(--accent); font-weight: 600; }
.article-intro { max-width: 680px; color: var(--muted); font-size: 1.2rem; margin-bottom: 56px; }
.markdown { border-top: 1px solid var(--line); padding-top: 48px; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote { max-width: 720px; }
.markdown h2 { margin-top: 52px; }
.markdown a { color: var(--accent); text-decoration: underline; }
.markdown pre { padding: 22px; overflow-x: auto; border-radius: 14px; background: var(--code); color: #f5f6ff; }
.markdown code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.genai-intro { padding-bottom: 42px; }
.genai-workspace { margin-bottom: 120px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-blue); box-shadow: var(--shadow); }
.genai-heading { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 28px; }
.genai-heading h2 { margin-bottom: 0; }
.genai-heading > p { max-width: 360px; margin-bottom: 4px; color: var(--muted); }
.genai-form { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.genai-form label { display: block; margin-bottom: 10px; font-weight: 600; }
.genai-form textarea { display: block; width: 100%; min-height: 170px; resize: vertical; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); color: var(--ink); font: inherit; line-height: 1.5; }
.genai-form textarea:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.genai-form-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 14px; }
.genai-count { color: var(--muted); font-size: .8rem; }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.genai-response { min-height: 180px; margin-top: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--code); color: #f5f6ff; }
.genai-response .eyebrow { color: var(--lime); }
.genai-placeholder { margin-bottom: 0; color: #b4b7d0; }
.genai-output { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.65; }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.hero, .page-intro, .post-grid, .post-list, .article, .genai-workspace { animation: rise-in .65s ease both; }

@media (max-width: 720px) {
    .site-header, main, .site-footer { width: min(100% - 32px, 1180px); }
    .site-header { padding: 18px 0; }
    nav { gap: 2px; }
    nav a { padding: 8px 9px; }
    .hero { min-height: 580px; padding: 60px 0 90px; }
    .hero::after { width: 110px; height: 110px; }
    .hero-actions, .site-footer { align-items: flex-start; flex-direction: column; }
    .post-grid { grid-template-columns: 1fr; gap: 12px; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
    .topic-section { padding: 22px; }
    .topic-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .topic-tabs { grid-template-columns: 1fr; }
    .genai-workspace { padding: 22px; }
    .genai-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .genai-form-footer { align-items: flex-start; flex-direction: column; }
    .post-row { grid-template-columns: 1fr auto; gap: 8px 20px; padding-inline: 0; }
    .post-row > p { grid-column: 1 / -1; }
    .page-intro { padding: 72px 0 48px; }
}
:root {
    --paper: #f4f1ea;
    --ink: #20231f;
    --muted: #6f756c;
    --line: #d8d7ce;
    --accent: #b44a2d;
    --soft: #e8e7dd;
}

html[data-theme="dark"] {
    --paper: #20231f;
    --ink: #f4f1ea;
    --muted: #b9b9ac;
    --line: #494b44;
    --accent: #e98b67;
    --soft: #2d302b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Rubik", sans-serif;
    font-weight: 300;
    line-height: 1.7;
    transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.site-header, main, .site-footer { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--line); }
.brand { font-size: 1.35rem; letter-spacing: .08em; text-transform: lowercase; }
.brand span { color: var(--accent); }
nav { display: flex; align-items: center; gap: 28px; font-size: .88rem; }
nav a:hover, .text-link:hover { color: var(--accent); }
button { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.theme-toggle { font-size: 1.2rem; line-height: 1; }
.hero { min-height: 620px; display: flex; flex-direction: column; justify-content: center; max-width: 820px; padding: 72px 0; }
.eyebrow, .post-meta { color: var(--accent); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 780px; margin-bottom: 28px; font-size: clamp(3.3rem, 9vw, 7.5rem); font-weight: 300; line-height: .98; letter-spacing: -.04em; }
h2 { font-size: 2rem; font-weight: 300; line-height: 1.1; }
h3 { font-size: 1.5rem; font-weight: 300; line-height: 1.2; }
.lede { max-width: 620px; color: var(--muted); font-size: 1.2rem; }
.hero-actions { display: flex; align-items: center; gap: 28px; margin-top: 36px; }
.button { padding: 12px 18px; background: var(--accent); color: #fff; }
.text-link { border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; border-top: 1px solid var(--line); padding: 56px 0 26px; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 110px; }
.post-card { min-height: 270px; display: flex; flex-direction: column; padding: 24px; background: var(--soft); transition: transform .2s ease; }
.post-card:hover { transform: translateY(-5px); }
.post-card h3 { margin-bottom: 14px; }
.post-card p:not(.post-meta) { color: var(--muted); }
.post-card .text-link { margin-top: auto; width: fit-content; font-size: .9rem; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.page-intro { padding: 100px 0 64px; max-width: 800px; }
.page-intro.compact { padding-bottom: 48px; }
.page-intro h1, .article h1 { font-size: clamp(3rem, 7vw, 6rem); }
.two-column { display: grid; grid-template-columns: repeat(2, 1fr); gap: 80px; padding-bottom: 120px; }
.prose { color: var(--muted); }
.prose h2, .prose h3 { color: var(--ink); }
.post-list { border-top: 1px solid var(--line); padding-bottom: 120px; }
.post-row { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 36px; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-row h2 { margin: 0; }
.post-row > p { margin: 0; color: var(--muted); }
.article { max-width: 820px; padding: 64px 0 120px; }
.back-link { display: inline-block; margin-bottom: 80px; color: var(--muted); font-size: .9rem; }
.article-intro { max-width: 650px; color: var(--muted); font-size: 1.2rem; margin-bottom: 56px; }
.markdown { border-top: 1px solid var(--line); padding-top: 48px; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote { max-width: 700px; }
.markdown h2 { margin-top: 48px; }
.markdown a { color: var(--accent); text-decoration: underline; }
.markdown pre { padding: 18px; overflow-x: auto; background: var(--soft); }

@media (max-width: 720px) {
    .site-header, main, .site-footer { width: min(100% - 32px, 1120px); }
    nav { gap: 16px; }
    .hero { min-height: 560px; padding: 56px 0; }
    .hero-actions, .site-footer { align-items: flex-start; flex-direction: column; }
    .post-grid, .two-column { grid-template-columns: 1fr; gap: 12px; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .post-row { grid-template-columns: 1fr auto; gap: 8px 20px; }
    .post-row > p { grid-column: 1 / -1; }
    .page-intro { padding: 72px 0 48px; }
}

@media (max-width: 560px) {
    .site-header {
        align-items: flex-start;
        gap: 18px;
    }

    nav {
        width: 100%;
        justify-content: space-between;
        gap: 2px;
        font-size: .8rem;
    }

    nav a {
        padding: 7px 4px;
    }

    .theme-toggle {
        flex: 0 0 36px;
        margin-left: 2px;
    }

    h1,
    .page-intro h1,
    .article h1 {
        font-size: clamp(2.6rem, 14vw, 4.5rem);
        overflow-wrap: anywhere;
    }

    h2 { font-size: clamp(1.7rem, 9vw, 2.4rem); }
    .lede, .article-intro { font-size: 1.05rem; }
    .hero { min-height: 500px; padding: 42px 0 64px; }
    .hero-actions { align-items: stretch; }
    .hero-actions .button { width: 100%; }
    .topic-section, .genai-workspace { padding: 18px; border-radius: 14px; }
    .post-card { min-height: 0; padding: 20px; }
    .post-row { grid-template-columns: minmax(0, 1fr) auto; }
    .post-row h2, .post-row > p { overflow-wrap: anywhere; }
    .article { padding: 42px 0 72px; }
    .back-link { margin-bottom: 48px; }
    .markdown { padding-top: 32px; }
    .markdown pre, .markdown table { max-width: 100%; overflow-x: auto; }
    .markdown table { display: block; }
    .markdown img { max-width: 100%; height: auto; }
    .genai-form, .genai-response { padding: 16px; }
    .genai-form .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
