/* AI design builder page. Same language as the rest of the site: bone paper, forest ink,
   one green accent, thin lines and calm cards. No build step: edit and reload. */

.ai-page {
    --ai-card: #f7f8f2;
    --ai-code: #0f1a14;
    --ai-code-ink: #e8ece0;
    --ai-subnav-h: 49px;
    --ai-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Sticky page menu sits under the sticky site header, so anchors need room for both. */
html:has(.ai-page) { scroll-padding-top: calc(var(--header-h) + var(--ai-subnav-h) + 16px); }

.ai-js-only { display: none; }
.ai-js .ai-js-only { display: grid; }

.ai-page code { font-family: var(--ai-mono); font-size: .9em; }

/* ── Hero ────────────────────────────────────────────────────── */

.ai-hero { padding-block: clamp(36px, 5vw, 72px) 0; }

.ai-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(28px, 4.5vw, 64px);
    align-items: center;
}

.ai-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-2);
    font-size: .8125rem;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ai-hero h1 {
    margin-top: 16px;
    max-width: 14em;
    font-size: clamp(2rem, .9rem + 3.1vw, 3.5rem);
    font-weight: 800;
    font-stretch: 104%;
    line-height: 1.06;
    letter-spacing: -.028em;
    text-wrap: balance;
}

.ai-lede {
    margin-top: 20px;
    max-width: 36em;
    color: var(--ink-2);
    font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
    line-height: 1.55;
    text-wrap: pretty;
}

.ai-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.ai-chat {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: clamp(16px, 2vw, 24px);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--ai-card);
}
.ai-chat-label { color: var(--ink-2); font-size: .6875rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.ai-bubble { max-width: 92%; padding: 12px 16px; border-radius: 14px; font-size: .9688rem; line-height: 1.5; }
.ai-bubble p + p, .ai-bubble img { margin-top: 10px; }
.ai-bubble--you { justify-self: end; border-bottom-right-radius: 3px; background: var(--ink); color: var(--paper); }
.ai-bubble--agent { justify-self: start; width: 92%; border-bottom-left-radius: 3px; background: var(--paper-2); }
.ai-chat-art { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.ai-chat-meta { color: var(--ink-2); font-size: .875rem; }

.ai-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 28px;
    margin-top: clamp(40px, 6vw, 80px);
    padding-bottom: clamp(36px, 5vw, 64px);
}
.ai-points li { padding-top: 16px; border-top: 2px solid var(--ink); }
.ai-points h2 { font-size: 1.25rem; font-weight: 700; font-stretch: 105%; letter-spacing: -.01em; }
.ai-points p { margin-top: 8px; max-width: 26em; color: var(--ink-2); font-size: .9688rem; line-height: 1.5; }

/* ── Page menu ───────────────────────────────────────────────── */

.ai-subnav {
    position: sticky;
    top: var(--header-h);
    z-index: 40;
    border-block: 1px solid var(--line);
    background: var(--paper);
}
.ai-subnav-list {
    display: flex;
    gap: 2px;
    margin-inline: -14px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}
.ai-subnav-list::-webkit-scrollbar { display: none; }
.ai-subnav a {
    display: inline-flex;
    align-items: center;
    height: calc(var(--ai-subnav-h) - 1px);
    padding: 0 14px;
    border-bottom: 2px solid transparent;
    font-size: .9375rem;
    font-weight: 500;
    text-decoration: none;
}
.ai-subnav a:hover { background: var(--paper-2); }
.ai-subnav a[aria-current="true"] { border-bottom-color: var(--accent-strong); color: var(--accent-strong); font-weight: 650; }

/* ── Sections ────────────────────────────────────────────────── */

.ai-section { padding-block: clamp(44px, 6vw, 88px); border-bottom: 1px solid var(--line); }
.ai-section-head { max-width: 46rem; }
.ai-section-head h2 { font-size: clamp(1.5rem, 1.15rem + 1.1vw, 2.125rem); font-weight: 750; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.ai-section-head p { margin-top: 10px; color: var(--ink-2); line-height: 1.55; }
.ai-note { margin-top: 20px; max-width: 52rem; color: var(--ink-2); font-size: .9375rem; line-height: 1.55; }
.ai-label { color: var(--ink-2); font-size: .75rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.ai-cta-row { margin-top: 28px; }

/* Buttons that copy */
.ai-copy { height: 36px; padding: 0 14px; font-size: .875rem; }
.ai-copy.is-copied { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }

/* ── Connect ─────────────────────────────────────────────────── */

/* One card: the address on top, then the two ways to connect as tabs, and inside each the apps as tabs. */
.ai-connect { margin-top: 28px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--ai-card); }
.ai-connect-address { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.ai-endpoint-url { display: block; margin-top: 4px; font-size: 1.0625rem; font-weight: 600; word-break: break-all; }
.ai-switchbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.ai-switch-tab { display: grid; gap: 2px; padding: 14px 22px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.ai-switch-tab + .ai-switch-tab { border-left: 1px solid var(--line); }
.ai-switch-tab:hover { background: var(--paper-2); }
.ai-switch-tab[aria-selected="true"] { border-bottom-color: var(--accent-strong); color: var(--ink); }
.ai-switch-tab:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: -4px; }
.ai-switch-title { font-size: 1rem; font-weight: 700; }
.ai-switch-sub { font-size: .8125rem; color: var(--ink-2); }
.ai-switch-panel { padding: 22px; }
.ai-switch-panel + .ai-switch-panel { border-top: 1px solid var(--line); }
.ai-connect.is-tabs .ai-switch-panel { display: none; border-top: 0; }
.ai-connect.is-tabs .ai-switch-panel.is-active { display: block; }
/* Without JavaScript both ways are listed one after the other, so the bar that switches them has nothing to do. */
html:not(.ai-js) .ai-switchbar { display: none; }
.ai-lead { max-width: 52rem; color: var(--ink-2); line-height: 1.55; }
.ai-lead strong { color: var(--ink); }
.ai-switch-panel .ai-note { margin-top: 18px; font-size: .875rem; }

/* Numbered steps joined by a line; the names on the assistant's own screen are small labels. */
.ai-stepper { max-width: 46rem; margin: 16px 0 0; padding: 0; list-style: none; counter-reset: ai-step; }
.ai-stepper li { position: relative; padding: 2px 0 18px 40px; line-height: 1.55; counter-increment: ai-step; }
.ai-stepper li::before { content: counter(ai-step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-strong); color: #fff; font-size: .75rem; font-weight: 700; }
.ai-stepper li::after { content: ""; position: absolute; left: 12px; top: 30px; bottom: 2px; width: 2px; background: var(--line-strong); }
.ai-stepper li:last-child { padding-bottom: 2px; }
.ai-stepper li:last-child::after { display: none; }
/* A name on the assistant's own screen: a small key-like label that sits on the line without making it taller. */
.ui-label { display: inline-block; margin-inline: 1px; padding: 0 8px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: #fff; box-shadow: 0 1px 0 rgba(15, 26, 20, .05); color: var(--ink); font-size: .875em; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.ai-tip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; max-width: 46rem; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line-strong); border-left: 3px solid var(--accent-strong); border-radius: 8px; background: var(--paper-2); font-size: .875rem; line-height: 1.55; }
.ai-tip-label { color: var(--accent-strong); font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ai-assistants { margin-top: 18px; }

.ai-images { margin-top: 18px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--ai-card); }
.ai-images summary { padding: 14px 20px; font-weight: 650; cursor: pointer; }
.ai-images[open] summary { border-bottom: 1px solid var(--line); }
.ai-images p { max-width: 52rem; padding: 14px 20px 18px; color: var(--ink-2); line-height: 1.55; }
.ai-sub { margin-top: 32px; font-size: 1.0625rem; font-weight: 700; }

.ai-clients { margin-top: 16px; }
.ai-tablist { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-tab {
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: 600 .9375rem/1 var(--font);
    cursor: pointer;
}
.ai-tab:hover { background: var(--paper-2); }
.ai-tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.ai-client { margin-top: 16px; }
.ai-client + .ai-client { margin-top: 28px; }
.ai-client-name { font-size: 1.0625rem; font-weight: 700; }
.ai-client-where { margin: 4px 0 12px; color: var(--ink-2); font-size: .9688rem; }
.ai-clients.is-tabs .ai-client { display: none; margin-top: 16px; }
.ai-clients.is-tabs .ai-client.is-active { display: block; }
.ai-clients.is-tabs .ai-client-name {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.ai-code-wrap { position: relative; }
.ai-code {
    margin: 0;
    padding: 18px 20px;
    overflow: auto;
    border-radius: 10px;
    background: var(--ai-code);
    color: var(--ai-code-ink);
    font: .875rem/1.65 var(--ai-mono);
    tab-size: 2;
}
.ai-code code { font: inherit; white-space: pre; }
.ai-section-head + .ai-code-wrap { margin-top: 28px; }
.ai-code-wrap .ai-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    height: 32px;
    border-color: rgba(232, 236, 224, .32);
    background: rgba(232, 236, 224, .08);
    color: var(--ai-code-ink);
}
.ai-code-wrap .ai-copy:hover { background: var(--ai-code-ink); color: var(--ai-code); }
.ai-code-wrap .ai-copy.is-copied { border-color: #7fc79c; background: #7fc79c; color: var(--ai-code); }
.ai-code-wrap .ai-code { padding-right: 96px; }

.ai-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; margin-top: 32px; padding: 0; list-style: none; counter-reset: ai-step; }
.ai-steps li { padding-top: 16px; border-top: 2px solid var(--ink); counter-increment: ai-step; }
.ai-steps h3 { display: flex; align-items: baseline; gap: 10px; font-size: 1.125rem; font-weight: 700; }
.ai-steps h3::before { content: counter(ai-step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-strong); color: #fff; font-size: .8125rem; font-weight: 700; }
.ai-steps p { margin-top: 8px; color: var(--ink-2); font-size: .9688rem; line-height: 1.5; }

/* ── Prompts ─────────────────────────────────────────────────── */

.ai-prompts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; margin-top: 28px; }
.ai-prompt {
    display: grid;
    gap: 12px;
    grid-template-rows: auto 1fr auto;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--ai-card);
}
.ai-prompt h3 { font-size: 1.0625rem; font-weight: 700; }
.ai-prompt p { color: var(--ink-2); font-size: .9688rem; line-height: 1.55; }
.ai-prompt .ai-copy { justify-self: start; }

/* ── Looks ───────────────────────────────────────────────────── */

.ai-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; margin-top: 28px; }
.ai-look { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--ai-card); }
.ai-look img { width: 100%; height: auto; aspect-ratio: 900 / 330; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.ai-look-body { flex: 1; display: flex; flex-direction: column; padding: 14px 16px 16px; }
.ai-look h3 { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.ai-look p { margin-top: 2px; color: var(--ink-2); font-size: .9375rem; line-height: 1.45; }
.ai-look-code { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; }
.ai-look-code code { flex: 1; min-width: 0; padding: 6px 8px; overflow-x: auto; border-radius: 4px; background: var(--paper-2); font-size: .8125rem; white-space: nowrap; }
.ai-icon-copy {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: transparent;
    color: var(--ink);
    font: 600 .8125rem/1 var(--font);
    cursor: pointer;
}
.ai-icon-copy:hover { background: var(--ink); color: var(--paper); }
.ai-icon-copy.is-copied { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }

/* ── Fonts ───────────────────────────────────────────────────── */

.ai-font-tools {
    grid-template-columns: minmax(220px, 1.1fr) auto minmax(0, 2fr);
    gap: 16px 28px;
    align-items: end;
    margin-top: 28px;
}
.ai-field { display: grid; gap: 6px; min-width: 0; }
.ai-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--ai-card);
    color: var(--ink);
    font: 500 1rem/1 var(--font);
}
.ai-seg { display: inline-flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; }
.ai-seg-btn { min-width: 46px; height: 42px; border: 0; background: transparent; color: var(--ink); font: 650 .9375rem/1 var(--font); cursor: pointer; }
.ai-seg-btn + .ai-seg-btn { border-left: 1px solid var(--line-strong); }
.ai-seg-btn:hover { background: var(--paper-2); }
.ai-seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip {
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: 600 .9375rem/1 var(--font);
    cursor: pointer;
}
.ai-chip:hover { background: var(--paper-2); }
.ai-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.ai-chip-count { margin-left: 4px; opacity: .65; font-weight: 500; }

.ai-fonts {
    --ai-sample-size: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 20px;
    margin-top: 24px;
}
.ai-font {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px 20px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--ai-card);
}
.ai-font-sample {
    min-height: calc(var(--ai-sample-size) * 2.4);
    font-family: var(--ai-font, var(--font));
    font-size: var(--ai-sample-size);
    font-weight: 400;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.ai-font-name { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.ai-font-sub { margin-top: 2px; color: var(--ink-2); font-size: .875rem; line-height: 1.45; }
.ai-font-sub a { text-underline-offset: 3px; }
.ai-weights { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.ai-weights li {
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: var(--ai-font, var(--font));
    font-size: .9375rem;
    font-weight: var(--ai-weight, 400);
    line-height: 1.5;
}
/* With JavaScript, a font is only fetched when its card is about to be seen. */
.ai-js .ai-font:not(.is-live) { --ai-font: var(--font); }

/* ── Templates ───────────────────────────────────────────────── */

.ai-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 28px; margin-top: 32px; }
.ai-cards li { padding-top: 16px; border-top: 2px solid var(--ink); }
.ai-cards h3 { font-size: 1.125rem; font-weight: 700; font-stretch: 105%; letter-spacing: -.01em; }
.ai-cards p { margin-top: 8px; color: var(--ink-2); font-size: .9688rem; line-height: 1.5; }

.ai-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 40px 0 0; }
.ai-limits div { padding-block: 12px; border-top: 1px solid var(--line); }
.ai-limits dt { color: var(--ink-2); font-size: .75rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.ai-limits dd { margin: 2px 0 0; }

.ai-control { margin-top: 40px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); }
.ai-control h3 { font-size: 1.25rem; font-weight: 700; }
.ai-control ul { display: grid; gap: 10px; margin-top: 14px; max-width: 52rem; }
.ai-control li { position: relative; padding-left: 28px; color: var(--ink-2); line-height: 1.5; }
.ai-control li::before { content: ""; position: absolute; left: 4px; top: .35em; width: 12px; height: 7px; border-left: 2px solid var(--accent-strong); border-bottom: 2px solid var(--accent-strong); transform: rotate(-45deg); }

/* ── Tools ───────────────────────────────────────────────────── */

.ai-tools-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 28px; }
.ai-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: .875rem; }
.ai-legend li { display: inline-flex; align-items: center; gap: 8px; }
.ai-acc-all { height: 36px; padding: 0 14px; font-size: .875rem; }
.ai-js .ai-acc-all.ai-js-only { display: inline-flex; }

.ai-acc-list { margin-top: 16px; border-top: 1px solid var(--line); }
.ai-acc { border-bottom: 1px solid var(--line); }
.ai-acc-head {
    display: flex;
    align-items: center;
    gap: 12px 20px;
    padding: 18px 4px;
    list-style: none;
    cursor: pointer;
}
.ai-acc-head::-webkit-details-marker { display: none; }
.ai-acc-head:hover .ai-acc-name { color: var(--accent-strong); }
.ai-acc-head:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; border-radius: 6px; }
.ai-acc-title { display: grid; flex: 1; min-width: 0; gap: 2px; }
.ai-acc-name { font-size: 1.125rem; font-weight: 700; transition: color .15s; }
.ai-acc-note { color: var(--ink-2); font-size: .9375rem; line-height: 1.4; }
.ai-acc-count { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); font-size: .8125rem; font-weight: 650; white-space: nowrap; }
.ai-acc-chevron {
    position: relative;
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    transition: background-color .15s, border-color .15s, color .15s;
}
.ai-acc-chevron::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    margin: -6px 0 0 -4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s;
}
.ai-acc-head:hover .ai-acc-chevron { border-color: var(--accent-strong); color: var(--accent-strong); }
.ai-acc[open] .ai-acc-chevron,
.ai-acc[open] .ai-acc-head:hover .ai-acc-chevron { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }
.ai-acc[open] .ai-acc-chevron::before { margin-top: -2px; transform: rotate(-135deg); }
@media (prefers-reduced-motion: reduce) {
    .ai-acc-chevron, .ai-acc-chevron::before, .ai-acc-name { transition: none; }
}
.ai-acc .ai-tools { margin-bottom: 8px; border-top: 1px solid var(--line); }
.ai-acc .ai-tool { padding-inline: 4px; }
.ai-acc .ai-tool:last-child { border-bottom: 0; }

.ai-tool {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto;
    gap: 8px 20px;
    align-items: baseline;
    padding-block: 14px;
    border-bottom: 1px solid var(--line);
}
.ai-tool-name { justify-self: start; padding: 3px 8px; border-radius: 4px; background: var(--paper-2); font-size: .8125rem; }
.ai-tool-title { font-weight: 650; }
.ai-tool-text { margin-top: 2px; color: var(--ink-2); font-size: .9375rem; line-height: 1.45; }
.ai-kind { padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.ai-kind--write { border-color: var(--accent-strong); color: var(--accent-strong); }
.ai-kind--delete { border-color: var(--error); color: var(--error); }

/* ── Example template ────────────────────────────────────────── */

.ai-example {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: 32px clamp(28px, 4vw, 52px);
    align-items: start;
    margin-top: 28px;
}
.ai-sample { position: relative; margin: 0; overflow: hidden; border-radius: 12px; background: var(--ai-code); color: var(--ai-code-ink); }
.ai-sample-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 20px; border-bottom: 1px solid rgba(232, 236, 224, .14); }
.ai-sample-file { font: 600 .8125rem var(--ai-mono); }
.ai-sample-meta { margin-right: auto; color: rgba(232, 236, 224, .55); font-size: .8125rem; }
.ai-sample .ai-copy {
    height: 32px;
    border-color: rgba(232, 236, 224, .32);
    background: rgba(232, 236, 224, .08);
    color: var(--ai-code-ink);
}
.ai-sample .ai-copy:hover { background: var(--ai-code-ink); color: var(--ai-code); }
.ai-sample .ai-copy.is-copied { border-color: #7fc79c; background: #7fc79c; color: var(--ai-code); }
.ai-sample-code {
    margin: 0;
    padding: 16px 0 18px;
    overflow-x: auto;
    font: .8125rem/1.7 var(--ai-mono);
    tab-size: 2;
    counter-reset: ai-line;
    scrollbar-width: thin;
    scrollbar-color: rgba(232, 236, 224, .3) transparent;
}
.ai-sample-code code { display: block; width: max-content; min-width: 100%; padding-right: 20px; font: inherit; white-space: pre; }
/* The numbers are drawn by CSS, so they are never selected or copied with the text. */
.ai-line { counter-increment: ai-line; }
.ai-line::before {
    content: counter(ai-line);
    display: inline-block;
    width: 3.2em;
    padding-right: 1.3em;
    color: rgba(232, 236, 224, .35);
    text-align: right;
    user-select: none;
}
.j-key { color: #8fd1a9; }
.j-str { color: #e8c98c; }
.j-num { color: #8fbcf0; }
.j-lit { color: #e29ac8; }

/* With JavaScript the example starts as a short view with a fade; without it the whole text shows. */
.ai-sample-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: 0;
    border-top: 1px solid rgba(232, 236, 224, .14);
    background: transparent;
    color: var(--ai-code-ink);
    font: 600 .875rem/1 var(--font);
    cursor: pointer;
}
.ai-js .ai-sample-toggle.ai-js-only { display: flex; }
.ai-sample-toggle:hover { background: rgba(232, 236, 224, .08); }
.ai-sample-toggle:focus-visible { outline: 2px solid #7fc79c; outline-offset: -2px; }
.ai-sample.is-collapsible:not(.is-open) .ai-sample-code { max-height: 26rem; overflow-y: hidden; }
.ai-sample.is-collapsible:not(.is-open)::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 48px;
    left: 0;
    height: 110px;
    background: linear-gradient(to bottom, rgba(15, 26, 20, 0), var(--ai-code));
    pointer-events: none;
}

.ai-example-notes h3 { font-size: 1.125rem; font-weight: 700; }
.ai-reading { margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ai-reading li { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ai-reading code { justify-self: start; padding: 2px 8px; border-radius: 4px; background: var(--paper-2); font-size: .8125rem; }
.ai-reading strong { font-weight: 650; }
.ai-reading p { color: var(--ink-2); font-size: .9375rem; line-height: 1.5; }

/* ── Closing ─────────────────────────────────────────────────── */

.ai-closing { padding-block: clamp(36px, 5vw, 64px); background: var(--paper-2); }
.ai-closing-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; }
.ai-closing h2 { font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem); font-weight: 750; letter-spacing: -.02em; }
.ai-closing p { margin-top: 6px; color: var(--ink-2); }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .ai-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; }
}
@media (max-width: 960px) {
    .ai-hero-grid { grid-template-columns: minmax(0, 1fr); }
    .ai-chat { max-width: 640px; }
    .ai-font-tools { grid-template-columns: minmax(0, 1fr); }
    .ai-steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .ai-switchbar { grid-template-columns: minmax(0, 1fr); }
    .ai-switch-tab + .ai-switch-tab { border-left: 0; border-top: 1px solid var(--line); }
    .ai-switch-panel { padding: 18px 16px; }
    .ai-connect-address { padding: 14px 16px; }
    .ai-example { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    .ai-points { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .ai-limits { grid-template-columns: minmax(0, 1fr); }
    .ai-tool { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .ai-kind { justify-self: start; }
    .ai-acc-head { flex-wrap: wrap; }
    .ai-acc-title { flex-basis: calc(100% - 52px); }
    .ai-acc-count { order: 3; }
    .ai-acc-chevron { order: 2; margin-left: auto; }
}
@media (max-width: 560px) {
    .ai-cards { grid-template-columns: minmax(0, 1fr); }
    .ai-hero-actions .btn { flex: 1 1 100%; }
    .ai-bubble { max-width: 100%; }
    .ai-bubble--agent { width: 100%; }
    .ai-code-wrap .ai-code { padding-right: 20px; padding-top: 52px; }
    .ai-sample-bar { padding-left: 14px; }
    .ai-line::before { width: 2.6em; padding-right: 1em; }
}
