/* Portfolia: a cool technical journal. System fonts; no decorative motion. */
:root {
  color-scheme: light;
  --canvas: #f3f6fa;
  --paper: #fff;
  --paper-raised: #eaf0f7;
  --ink: #1c2b3a;
  --muted: #536476;
  --rule: #d5dee8;
  --link: #234da2;
  --link-hover: #153776;
  --accent-soft: #e7eefb;
  --code-paper: #f0f4f8;
  --font-display: Georgia, "Times New Roman", serif;
  --font-reading: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); font-size: 1rem; line-height: 1.65; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: .22em; text-decoration-thickness: .07em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; }
::selection { background: #cfdef7; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; }
h1, h2 { text-wrap: balance; }
h1 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.04em; }
p { margin: 0 0 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 20; padding: .65rem 1rem; background: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.site-shell { width: min(100% - 3rem, 72rem); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: 6rem; border-bottom: 1px solid var(--rule); }
.site-name { color: var(--ink); font-size: 1.05rem; font-weight: 650; text-decoration: none; letter-spacing: -.025em; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 1.75rem; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-header nav a:hover { color: var(--link); }
.site-header nav [aria-current="page"] { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .55em; }
.content { width: 100%; min-height: calc(100vh - 13rem); margin-inline: auto; padding: 3.5rem 0 5rem; }
.breadcrumbs { margin: 0 0 1.75rem; color: var(--muted); font-size: .85rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li + li::before { content: "/"; margin-right: .5rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.page-intro { margin-bottom: 2.75rem; }
.page-intro h1 { margin: 0 0 1rem; font-size: clamp(2.8rem, 2rem + 3vw, 4.5rem); }
.page-intro p { max-width: 58ch; color: var(--muted); font-size: 1.12rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading h2, .demo-list > h2, .project-list > h2 { margin: 0; font-size: 1.1rem; font-weight: 650; letter-spacing: -.02em; }
.section-heading > a { font-size: .9rem; }
.text-action { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .93rem; font-weight: 550; }

/* Home: one strong identity; real writing and projects below it. */
.introduction { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; align-items: center; gap: clamp(2rem, 6vw, 6rem); padding: 1rem 0 3.75rem; border-bottom: 1px solid var(--rule); }
.introduction:not(:has(.portrait)) { grid-template-columns: 1fr; }
.introduction h1 { margin: 0 0 1.25rem; font-size: clamp(3.4rem, 2rem + 5vw, 6rem); line-height: 1.02; }
.role { color: var(--link); font-weight: 550; font-size: 1.1rem; }
.intro-copy > p:not(.role) { max-width: 48ch; font-size: 1.15rem; line-height: 1.7; }
.portrait { width: 15rem; aspect-ratio: 1; object-fit: cover; border-radius: .2rem; }
.quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.5rem; margin-top: 1.25rem; }
.quick-links a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .93rem; }
.quick-links a:first-child { padding: .4rem .95rem; background: var(--link); color: #fff; border-radius: .2rem; text-decoration: none; }
.home-work { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); margin-top: 3rem; }
.recent-posts { margin: 0; padding: 0; list-style: none; }
.recent-posts li { padding: 0 0 1.65rem; }
.recent-posts li + li { padding-top: 1.65rem; border-top: 1px solid var(--rule); }
.recent-posts time { color: var(--muted); font-size: .82rem; }
.home-work h3 { margin: .4rem 0 .65rem; font-family: var(--font-display); font-size: 1.55rem; font-weight: 400; line-height: 1.3; }
.home-work h3 a { color: var(--ink); text-decoration: none; }
.home-work h3 a:hover { color: var(--link); text-decoration: underline; }
.home-work p { color: var(--muted); font-size: .97rem; }
.home-project { min-width: 0; }
.home-tool { padding-bottom: 1.5rem; }
.home-tool + .home-tool { padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* Writing: filters are a toolbar; the articles get the width. */
.blog-content { max-width: 60rem; }
.blog-layout { margin-top: 2rem; }
.tag-filter { display: flex; align-items: start; flex-wrap: wrap; gap: 1rem 1.5rem; padding: 1.2rem 0; border-block: 1px solid var(--rule); }
.writing-search { display: flex; align-items: center; flex: 1 1 22rem; gap: .75rem; min-height: 2.75rem; }
.search-icon { display: flex; width: 1.1rem; height: 1.1rem; flex-shrink: 0; color: var(--muted); }
.search-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }
.writing-search input { width: 100%; min-width: 0; border: 0; border-bottom: 1px solid var(--rule); padding: .6rem .2rem; background: transparent; color: var(--ink); border-radius: 0; }
.writing-search input::placeholder { color: var(--muted); opacity: 1; }
.topic-disclosure { flex: 0 1 13rem; min-width: 0; }
.topic-disclosure > summary { min-height: 2.75rem; padding: .55rem .75rem; border: 1px solid var(--rule); border-radius: .2rem; background: var(--paper); color: var(--ink); }
.topic-disclosure[open] { flex-basis: 100%; }
.tag-filter-set { margin: 1.25rem 0 0; padding: 0; border: 0; }
.tag-all { margin-bottom: 1rem; max-width: 18rem; }
.tag-group { display: inline-block; width: 30%; min-width: 14rem; margin: 0 3% 1.25rem 0; vertical-align: top; }
.tag-group h3 { margin: 0 0 .6rem; color: var(--ink); font-size: .85rem; font-weight: 650; }
.tag-options { display: flex; flex-direction: column; gap: .15rem; }
.tag-choice { display: block; position: relative; cursor: pointer; }
.tag-choice input { position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); }
.tag-pill { display: flex; align-items: center; gap: .5rem; min-height: 2.25rem; padding: .3rem .6rem; color: var(--muted); font-size: .9rem; border-radius: .15rem; }
.tag-choice:hover .tag-pill { background: var(--paper-raised); color: var(--ink); }
.tag-choice input:checked + .tag-pill { color: var(--link); background: var(--accent-soft); }
.tag-choice input:focus-visible + .tag-pill { outline: 3px solid var(--link); outline-offset: 2px; }
.tag-count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.filter-status { margin: 0; color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; }
.filter-clear { padding: .4rem .7rem; border: 1px solid var(--rule); border-radius: .2rem; color: var(--link); background: var(--paper); font-size: .85rem; white-space: nowrap; min-height: 2.75rem; }
.post-list { margin: 0; padding: 0; list-style: none; }
.post-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 2rem; padding: 1.75rem 0; border-top: 1px solid var(--rule); }
.post-date { padding-top: .3rem; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.post-summary { min-width: 0; }
.post-summary h2 { margin: 0; font-family: var(--font-display); font-size: 1.65rem; font-weight: 400; line-height: 1.25; text-wrap: pretty; }
.post-title { color: var(--ink); text-decoration: none; }
.post-title:hover { color: var(--link); text-decoration: underline; }
.post-description { max-width: 65ch; margin: .7rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.post-labels, .article-labels { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin: .75rem 0 0; padding: 0; list-style: none; font-family: var(--font-ui); font-size: .82rem; }
.post-source-link { color: var(--muted); }
.post-tag { min-height: 1.7rem; padding: .2rem 0; border: 0; background: transparent; color: var(--link); font-size: .82rem; text-decoration: underline; text-underline-offset: .22em; }
.search-empty { padding: 2rem 0 3rem; }
.search-empty h2 { font-size: 1.35rem; }
.search-empty p { color: var(--muted); }
.study-disclosure { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; }
.study-disclosure summary { width: fit-content; min-height: 2.5rem; }
.study-choice { display: flex; align-items: center; gap: .6rem; max-width: 22rem; margin-top: .6rem; min-height: 2.75rem; cursor: pointer; }
.study-choice input { accent-color: var(--link); }
/* Study archive is opt-in even without JavaScript. */
.writing-index:not(:has([data-study-filter]:checked)) .post-item[data-study-note="true"],
.writing-index:not(:has([data-study-filter]:checked)) .tag-choice[data-writing-count="0"],
.writing-index:not(:has([data-study-filter]:checked)) .tag-group:not(:has(.tag-choice:not([data-writing-count="0"]))),
.writing-index:not(:has([data-study-filter]:checked)) .archive-count,
.writing-index:has([data-study-filter]:checked) .writing-count { display: none; }
.writing-index:not(.writing-filter-ready) .tag-filter,
.writing-index:not(.writing-filter-ready) .results-heading { display: none; }

/* Article reader. Draft decks, figures and accounting tables remain supported. */
.article-content { width: min(100%, 48rem); margin-top: 2.5rem; padding: 2.5rem clamp(1.25rem, 3vw, 3rem) 4rem; background: var(--paper); }
.article-header { margin-bottom: 2.5rem; }
.article-header h1 { margin: 0 0 1.5rem; font-size: clamp(2.3rem, 1.5rem + 2.5vw, 3.7rem); line-height: 1.12; overflow-wrap: anywhere; }
.article-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; color: var(--muted); font-size: .85rem; }
.article-meta a { color: var(--muted); }
.article-labels { margin-top: 1rem; }
.post-body { font-family: var(--font-reading); font-size: 1.25rem; line-height: 1.75; overflow-wrap: break-word; }
.post-body h1, .post-body h2 { margin: 2.5rem 0 1rem; font-family: var(--font-reading); font-size: 1.7rem; line-height: 1.3; letter-spacing: -.025em; font-weight: 650; }
.post-body h3 { margin: 2rem 0 .7rem; font-size: 1.3rem; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body table { margin: 0 0 1.25rem; }
.post-body ul, .post-body ol { padding-left: 1.3rem; }
.post-body blockquote { padding: .2rem 0 .2rem 1.25rem; border-left: 3px solid var(--rule); color: var(--muted); }
.post-body pre { max-width: 100%; margin: 1.5rem 0; padding: 1rem; overflow-x: auto; background: var(--code-paper); font-size: .85rem; line-height: 1.6; }
.post-body code { font-family: var(--font-mono); font-size: .84em; }
.post-body pre code { font-size: inherit; }
.post-body :not(pre) > code { padding: .05em .2em; background: var(--code-paper); color: var(--link-hover); }
.post-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 1rem; }
.post-body th, .post-body td { padding: .55rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.post-body math[display="block"] { max-width: 100%; overflow-x: auto; padding-block: .25rem; }
.post-body .article-deck { margin-bottom: 2rem; color: var(--muted); font-size: 1.35rem; line-height: 1.5; }
.post-body figure { margin: 2.25rem 0; }
.post-body figcaption { margin-top: .75rem; color: var(--muted); font-family: var(--font-ui); font-size: .88rem; line-height: 1.5; }
.post-body figcaption p { margin: 0; }
.post-body figure table { display: table; width: 100%; table-layout: fixed; font-family: var(--font-ui); font-size: .95rem; }
.post-body figure th, .post-body figure td { padding: .65rem .55rem; border: 1px solid var(--rule); }
.post-body figure th { background: var(--paper-raised); }
.post-body figure td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.original-source { margin: 2rem 0 0; color: var(--muted); font-size: .9rem; }
.related-posts { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.related-posts h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.related-posts ul { margin: 0; padding: 0; list-style: none; }
.related-posts li + li { margin-top: 1rem; }
.related-posts a { display: grid; gap: .3rem; color: var(--ink); text-decoration: none; }
.related-posts a:hover > span { color: var(--link); text-decoration: underline; }
.related-posts small { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.article-nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.article-nav a { display: grid; gap: .4rem; color: var(--ink); text-decoration: none; font-size: .95rem; }
.article-nav a:hover { color: var(--link); }
.article-nav span { color: var(--muted); font-size: .8rem; }
.article-nav a[rel="next"] { grid-column: 2; text-align: right; }
.bottom-back-link { margin: 2rem 0 0; font-size: .9rem; }

/* Projects: working demos followed by actual case notes. */
.demo-list { margin: 0 0 4rem; }
.demo-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3rem; margin-top: 1.5rem; }
.demo-entry { min-width: 0; }
.demo-entry h3 { margin: 1.5rem 0 .6rem; font-family: var(--font-display); font-size: 1.65rem; font-weight: 400; }
.demo-entry h3 a { color: var(--ink); text-decoration: none; }
.demo-entry h3 a:hover { color: var(--link); }
.demo-entry p { max-width: 52ch; color: var(--muted); }
.demo-preview { height: 12rem; padding: 1.25rem; overflow: hidden; }
.worksheet-preview { border: 1px solid #becdd9; background: #fff; color: #273c4c; font: .8rem/1.5 Arial,sans-serif; }
.worksheet-preview > span { display: block; margin-bottom: .7rem; font-weight: bold; }
.worksheet-preview > div { display: grid; grid-template-columns: 1.5fr 1fr 1fr; }
.worksheet-preview > div > * { padding: .35rem .5rem; border: 1px solid #d4dee7; }
.worksheet-preview > div:nth-child(2) { background: #c6d9f0; }
.worksheet-preview > div:not(:nth-child(2)) > :first-child { background: #fff2cc; }
.worksheet-preview > div:last-child { background: #edf2f8; }
.model-preview { display: flex; flex-direction: column; justify-content: space-between; background: #e3ebf6; color: #284268; }
.model-preview > span { font-size: .8rem; }
.model-preview strong { font-family: var(--font-display); font-size: 2rem; font-weight: 400; line-height: 1.2; }
.project-list { scroll-margin-top: 2rem; }
.project-list > h2 { margin-bottom: 1.5rem; }
.project-card { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.65fr); gap: 3rem; padding: 2rem 0; border-top: 1px solid var(--rule); }
.project-card h3 { margin: 0 0 .75rem; font-size: 1.2rem; font-weight: 600; }
.project-meta { color: var(--muted); font-size: .86rem; line-height: 1.7; }
.project-copy { min-width: 0; }
.project-copy > p { margin-bottom: .7rem; }
.project-technologies { color: var(--muted); font-size: .85rem; }
.project-details { margin-top: .8rem; font-size: .9rem; }
.project-details summary { color: var(--link); min-height: 2.5rem; width: fit-content; }
.project-details ul { margin: .5rem 0; padding-left: 1.2rem; color: var(--muted); }
.project-details li + li { margin-top: .5rem; }
.project-action { margin-top: .75rem; font-size: .9rem; }

/* Resume and browser experiment. */
.resume-heading, .resume-content, .chat-intro, .chat-demo, .chat-credit { max-width: 54rem; margin-inline: auto; }
.download-links { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 1.5rem; }
.download-links a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.download-primary { padding: .4rem 1rem; border-radius: .2rem; background: var(--link); color: #fff; text-decoration: none; }
.download-primary:hover { background: var(--link-hover); color: #fff; }
.resume-content { padding: 2rem clamp(1rem,3vw,2.5rem); background: var(--paper); font-size: .97rem; overflow-wrap: anywhere; }
.resume-content h2 { margin: 2rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--rule); font-size: 1.15rem; }
.resume-content h2:first-child { margin-top: 0; }
.resume-content p { margin-bottom: .9rem; }
.resume-content ul { padding-left: 1.3rem; margin-bottom: 1.75rem; }
.resume-content li + li { margin-top: .5rem; }
.chat-demo { border: 1px solid var(--rule); padding: 1.5rem; background: var(--paper); }
.chat-model-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.chat-model-name { margin: 0 0 .25rem; font-weight: 600; }
.chat-model-meta, .chat-status, .chat-credit { color: var(--muted); font-size: .85rem; }
.chat-model-meta { margin: 0; }
.chat-load-button, .chat-actions button { min-height: 2.75rem; padding: .5rem .85rem; border: 1px solid var(--rule); border-radius: .2rem; color: var(--link); background: var(--paper); font-size: .9rem; }
.chat-load-button:hover, .chat-actions button:not(:disabled):hover { background: var(--accent-soft); }
.chat-progress { width: 100%; margin-top: 1rem; accent-color: var(--link); }
.chat-status { min-height: 1.5rem; margin: .8rem 0; }
.chat-log { min-height: 14rem; max-height: 32rem; overflow-y: auto; border-block: 1px solid var(--rule); }
.chat-empty { margin: 0; padding: 2rem 0; color: var(--muted); }
.chat-message { display: grid; grid-template-columns: 4.5rem minmax(0,1fr); gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.chat-message-label { font-size: .8rem; color: var(--muted); }
.chat-message[data-role="user"] .chat-message-label { color: var(--link); }
.chat-message-content { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-composer { margin-top: 1rem; }
.chat-composer textarea { display: block; width: 100%; resize: vertical; min-height: 5rem; padding: .75rem; border: 1px solid var(--rule); border-radius: .2rem; background: var(--canvas); color: var(--ink); }
.chat-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.chat-actions .chat-send-button { color: #fff; background: var(--link); }
.chat-credit { margin-top: 1.5rem; }

.site-footer { display: flex; justify-content: space-between; gap: 1.5rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--rule); font-size: .85rem; }
.site-footer > a { color: var(--muted); }
.site-resources { max-width: 32rem; text-align: right; color: var(--muted); }
.site-resources summary { min-height: 2.5rem; }
.site-resources nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem 1rem; margin-top: .75rem; }
.site-resources a { color: var(--muted); }
.empty-state { color: var(--muted); margin-top: 2rem; }

@media (max-width: 760px) {
  .site-shell { width: calc(100% - 2.25rem); }
  .site-header { min-height: 5rem; gap: 1rem; }
  .site-name { font-size: .92rem; }
  .site-header nav { gap: 1rem; }
  .site-header nav a { font-size: .87rem; }
  .content { padding: 2rem 0 3rem; }
  .introduction { grid-template-columns: minmax(0,1fr) 6rem; align-items: start; gap: 1rem; padding: .75rem 0 2.5rem; }
  .introduction h1 { font-size: clamp(2.5rem, 1.4rem + 5vw, 4rem); }
  .portrait { width: 6rem; }
  .intro-copy > p:not(.role) { font-size: 1.04rem; }
  .role { font-size: 1rem; }
  .home-work { grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
  .home-work h3 { font-size: 1.4rem; }
  .home-project { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
  .page-intro h1 { font-size: 3rem; }
  .page-intro p { font-size: 1.04rem; }
  .demo-layout { gap: 2rem; }
  .project-card { grid-template-columns: 1fr; gap: .5rem; }
  .project-meta { margin-bottom: .5rem; }
  .post-row { gap: 1.25rem; grid-template-columns: 6.7rem minmax(0,1fr); }
  .post-summary h2 { font-size: 1.4rem; }
  .tag-group { width: 46%; min-width: 0; }
  .article-content { margin-top: 1.5rem; padding: 1.75rem 1.25rem 2.5rem; }
  .article-header h1 { font-size: 2.4rem; }
  .post-body { font-size: 1.17rem; }
  .post-body figure table { font-size: .84rem; }
  .post-body figure th, .post-body figure td { padding: .5rem .35rem; overflow-wrap: anywhere; }
  .chat-model-row { flex-direction: column; align-items: start; gap: 1rem; }
  .chat-demo { padding: 1rem; }
  .site-footer { flex-direction: column; gap: .5rem; }
  .site-resources { text-align: left; }
  .site-resources nav { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .site-header { flex-wrap: wrap; gap: .3rem; padding: .75rem 0; }
  .site-header nav { gap: 1.25rem; }
  .introduction { position: relative; display: block; padding-top: 0; }
  .introduction h1 { max-width: 5ch; margin-bottom: 1.5rem; font-size: 3.1rem; }
  .portrait { position: absolute; top: .35rem; right: 0; width: 5.5rem; }
  .introduction:not(:has(.portrait)) h1 { max-width: none; }
  .quick-links { gap: .5rem 1rem; }
  .demo-layout { grid-template-columns: 1fr; gap: 2.25rem; }
  .post-row { grid-template-columns: 1fr; gap: .5rem; }
  .post-date { padding-top: 0; }
  .post-summary h2 { font-size: 1.45rem; }
  .writing-search { flex-basis: 100%; }
  .topic-disclosure { flex-basis: 100%; }
  .tag-group { width: 100%; margin-right: 0; }
  .results-heading { align-items: start; padding-block: 1rem; }
  .article-content { padding: 1.5rem 1rem 2.5rem; }
  .article-nav { grid-template-columns: 1fr; gap: 1.25rem; }
  .article-nav a[rel="next"] { grid-column: 1; text-align: left; }
  .post-body h2 { font-size: 1.5rem; }
  .chat-message { grid-template-columns: 1fr; gap: .4rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media print {
  :root { --canvas: #fff; --ink: #000; --muted: #333; --rule: #999; }
  .site-header, .site-footer, .skip-link, .article-nav, .related-posts, .download-links { display: none; }
  .site-shell, .article-content, .resume-content { width: 100%; max-width: none; padding: 0; margin: 0; }
  .content { min-height: 0; padding: 0; }
  a { color: inherit; }
  h1, h2, h3 { break-after: avoid; }
  figure, pre { break-inside: avoid; }
}

/* Hornet follows the source workbook's market / contract / risk section colors. */
/* MiniSystem: shared market strip, contract cells, and one risk line per trade. */
.site-shell:has(.hornet-content) { width: min(100% - 2rem, 100rem); }
.hornet-content { width: 100%; padding-top: 1.5rem; }
.hornet-intro h1 { margin: 0; font-size: 1.8rem; }
.hornet-workbook {
  --sheet-ink: #1d2b36;
  --sheet-muted: #52616c;
  --sheet-rule: #c3ccd2;
  --sheet-input: #fff2cc;
  --sheet-focus: #17598a;
  --sheet-negative: #a52a28;
  margin-top: 1rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #94a6b3;
  background: #fff;
  color: var(--sheet-ink);
  color-scheme: light;
  font: 12px/1.4 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.hornet-workbook-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .85rem .8rem; background: #eef2f5; border-bottom: 1px solid var(--sheet-rule); }
.hornet-workbook-heading h2 { margin: 0; font: bold 14px Arial, sans-serif; }
.hornet-workbook-heading h2 span { margin-left: .6rem; color: var(--sheet-muted); font-size: 12px; font-weight: normal; }
.hornet-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.hornet-date-label { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin-right: .3rem; font-size: 11px; }
.hornet-date-label input { border: 1px solid var(--sheet-rule); padding: 3px; color: #134f80; background: var(--sheet-input); font: 11px Arial,sans-serif; }
.hornet-actions button { min-height: 48px; padding: .35rem .65rem; border: 1px solid #a4b3be; background: #fff; color: #234b66; font: inherit; cursor: pointer; }
.hornet-actions button:disabled { color: #647783; cursor: default; }
.hornet-market { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--sheet-rule); border-bottom: 1px solid var(--sheet-rule); }
.hornet-market-cell { min-width: 0; border-right: 1px solid var(--sheet-rule); }
.hornet-market-cell:last-child { border-right: 0; }
.hornet-market label { display: block; padding: .3rem .4rem; background: #fde9d9; white-space: nowrap; font-size: 11px; }
.hornet-market label small { display: block; color: var(--sheet-muted); font-size: 9px; }
.hornet-number { position: relative; display: flex; align-items: center; background: var(--sheet-input); min-width: 0; }
.hornet-number input { width: 100%; min-width: 0; height: 50px; padding: 0 29px 0 5px; border: 0; border-radius: 0; background: transparent; color: #134f80; text-align: right; font: 12px Arial, sans-serif; font-variant-numeric: tabular-nums; }
.hornet-stepper { display: flex; flex-direction: column; width: 24px; position: absolute; right: 1px; top: 1px; bottom: 1px; }
.hornet-stepper button { flex: 1; padding: 0; border: 0; background: transparent; color: #52616c; font: 12px/1 Arial, sans-serif; cursor: pointer; }
.hornet-stepper button:hover { background: #e2d6ad; color: #134f80; }
.hornet-step-size { position: absolute; bottom: 100%; right: 0; z-index: 5; padding: 3px 5px; border: 1px solid #94a6b3; background: #fff; color: #134f80; font-size: 10px; white-space: nowrap; visibility: hidden; pointer-events: none; }
.hornet-number:hover .hornet-step-size, .hornet-number:focus-within .hornet-step-size { visibility: visible; }
.hornet-workbook input[aria-invalid="true"] { outline: 2px solid var(--sheet-negative); outline-offset: -2px; }
.hornet-workbook :is(input,select,button):focus-visible { outline: 2px solid var(--sheet-focus); outline-offset: -2px; }
.hornet-book-scroll { position: relative; width: 100%; overflow-x: auto; padding-top: .7rem; }
.hornet-book-scroll:focus-visible { outline: 2px solid var(--sheet-focus); outline-offset: -2px; }
.hornet-book { width: 100%; min-width: 1330px; table-layout: fixed; border-collapse: collapse; }
.hornet-row-col { width: 28px; }
.hornet-kind-col { width: 94px; }
.hornet-side-col { width: 64px; }
.hornet-notional-col { width: 117px; }
.hornet-strike-col { width: 92px; }
.hornet-tenor-col { width: 113px; }
.hornet-expiry { width: 100%; min-width: 0; height: 48px; border: 0; padding: 0 3px; color: #134f80; background: var(--sheet-input); font: 10px Arial,sans-serif; }
.hornet-risk-col { width: 87px; }
.hornet-delete-col { width: 28px; }
.hornet-book th, .hornet-book td { border: 1px solid var(--sheet-rule); padding: 5px; white-space: nowrap; text-align: right; }
.hornet-book tr > :first-child { border-left: 0; }
.hornet-book tr > :last-child { border-right: 0; }
.hornet-book thead th { background: #d6e3bc; font-size: 10px; font-weight: normal; height: 48px; }
.hornet-book thead .hornet-risk-head { background: #c6d9f0; }
.hornet-book thead small { display: block; color: var(--sheet-muted); font-size: 9px; }
.hornet-book .hornet-groups th { height: 23px; padding: 4px 6px; text-align: left; font-size: 11px; font-weight: bold; }
.hornet-book .hornet-groups th:nth-child(2) { background: #c6d9f0; }
.hornet-book .hornet-groups small { display: inline; margin-left: 5px; font-weight: normal; }
.hornet-book tbody td:has(input), .hornet-book tbody td:has(select) { padding: 0; background: var(--sheet-input); }
.hornet-book select { width: 100%; height: 48px; border: 0; border-radius: 0; background: var(--sheet-input); color: #134f80; font: 11px Arial, sans-serif; padding: 0 3px; }
.hornet-book tbody th { background: #f4f6f7; font-weight: normal; text-align: center; }
.hornet-book tbody tr > :first-child, .hornet-book thead tr:last-child > :first-child { position: sticky; left: 0; z-index: 2; }
.hornet-book tbody tr > :nth-child(2), .hornet-book thead tr:last-child > :nth-child(2) { position: sticky; left: 28px; z-index: 2; }
.hornet-book tfoot th { position: sticky; left: 0; z-index: 2; background: #edf2f8; }
.hornet-book tfoot { background: #edf2f8; font-weight: bold; }
.hornet-book tfoot th { text-align: left; }
.hornet-book tfoot td { height: 30px; }
.hornet-book output[data-negative="true"] { color: var(--sheet-negative); }
.hornet-remove { border: 0; background: transparent; color: var(--sheet-muted); padding: 0; width: 100%; height: 28px; font: 16px Arial, sans-serif; cursor: pointer; }
.hornet-remove:hover { color: var(--sheet-negative); background: #f9e8e5; }
.hornet-help { position: relative; display: inline-block; width: 24px; height: 24px; padding: 0; border: 1px solid #6b8297; border-radius: 50%; background: transparent; color: #405c75; font: 11px/22px Arial, sans-serif; cursor: help; }
.hornet-help [role="tooltip"] { position: fixed; left: 0; top: 0; width: 210px; padding: 7px; border: 1px solid #94a6b3; background: #fff; color: var(--sheet-ink); font: 12px/1.5 Arial, sans-serif; white-space: normal; text-align: left; visibility: hidden; z-index: 6; }
.hornet-help:hover [role="tooltip"], .hornet-help:focus [role="tooltip"] { visibility: visible; }
.hornet-help[data-dismissed="true"] [role="tooltip"] { visibility: hidden; }
.hornet-status { padding: .5rem .7rem; margin: 0; font-size: 12px; color: var(--sheet-muted); }
.hornet-status:empty { display: none; }
.hornet-status[data-state="error"] { color: var(--sheet-negative); }
.hornet-method { margin-top: .7rem; max-width: 80ch; color: var(--muted); font-size: .75rem; }
.hornet-method summary { width: fit-content; cursor: pointer; }
.hornet-method p { margin: .5rem 0 0; }
@media (max-width: 1000px) { .hornet-market { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 500px) { .hornet-intro h1 { font-size: 1.5rem; } .hornet-content { padding-top: 1rem; } }

.hornet-market-group { min-width: 0; margin: 0; padding: 0; border: 0; background: #fff; }
.hornet-market-group legend { float: left; width: 100%; padding: 6px 8px; background: #fde9d9; font-weight: bold; }
.hornet-market-fields { clear: both; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.hornet-market-fields label { background: #f9f2ec; }
.hornet-market-cell:focus-within { box-shadow: inset 0 0 0 2px var(--sheet-focus); }
.hornet-actions #hornet-add { background: #245987; color: #fff; border-color: #245987; }
.hornet-book tbody tr:focus-within > td:not(:has(input)):not(:has(select)) { background: #f3f7fb; }
.hornet-book-scroll { scrollbar-color: #a3b1bf #edf2f5; }
.hornet-help [role="tooltip"] { pointer-events: none; }
@media (max-width: 760px) { .hornet-market { grid-template-columns: 1fr; } .hornet-actions { gap: .5rem; } .hornet-date-label { width: 100%; } }
