/* Editorial shell. Scoped to .site so existing article styles remain compatible. */
.site {
  --surface: #fff;
  --surface-soft: #f7f7f5;
  --ink: #242724;
  --muted: #6b706b;
  --line: #e6e8e3;
  --accent: #aa452e;
  --accent-soft: #f8eee9;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
html[data-theme="dark"] .site {
  --surface: #171a18;
  --surface-soft: #202420;
  --ink: #eceee8;
  --muted: #a4aca3;
  --line: #323832;
  --accent: #edac96;
  --accent-soft: #352a25;
  background: var(--surface);
  color: var(--ink);
}
.site *, .site *::before, .site *::after { box-sizing: border-box; }
.site [hidden] { display: none !important; }
.site a { color: inherit; text-decoration: none; }
.site a:hover { color: var(--accent); }
html[data-theme="dark"] .site a { color: inherit; }
html[data-theme="dark"] .site a:hover { color: var(--accent); }
.site button, .site input, .site select { font: inherit; }
.site button, .site summary, .site select { cursor: pointer; }
.site input, .site select, .site button { color: var(--ink); }
.site h1, .site h2, .site h3, html[data-theme="dark"] .site h1, html[data-theme="dark"] .site h2 { color: var(--ink); }
.site :focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.site .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; padding: 12px 20px; background: var(--surface); z-index: 20; }
.skip-link:focus { top: 10px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { max-width: 1240px; min-height: 100px; padding: 20px 76px 20px 36px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: flex; gap: 13px; align-items: center; }
.brand-portrait { width: 76px; height: 76px; display: block; flex-shrink: 0; border-radius: 50%; overflow: hidden; border: 1px solid var(--line); }
.brand-mark { width: 100%; height: 100%; display: block; object-fit: cover; transform: scale(2.1); transform-origin: 51% 30%; }
.brand strong { display: block; font-size: 19px; line-height: 1.4; letter-spacing: -.5px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: .15px; }
.header-links { display: flex; align-items: center; gap: 26px; font-size: 13px; font-weight: 550; }
.site .header-links a[aria-current] { color: var(--accent); }
.site .header-home, html[data-theme="dark"] .site .header-home { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; white-space: nowrap; }
.site .header-home:hover, html[data-theme="dark"] .site .header-home:hover { background: var(--accent); color: var(--surface); }
/* Article typography stays outside .site; only the shared header uses its styles. */
body.paper-page { max-width: none; margin: 0; padding: 0; }
body.paper-page > #content { max-width: 800px; margin: 40px auto; padding: 0 20px; }
body.paper-page > #content img { max-width: 100%; height: auto; }
.site[data-page="paper"] .header-inner { flex-wrap: wrap; }
.paper-page > .theme-toggle { position: absolute; top: 40px; right: max(20px, calc((100vw - 1200px) / 2)); width: 36px; height: 36px; box-shadow: none; }
.site .theme-toggle { position: absolute; top: 40px; right: max(20px, calc((100vw - 1200px) / 2)); width: 36px; height: 36px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--ink); box-shadow: none; z-index: 3; }
.site .theme-toggle svg { width: 17px; height: 17px; }
.site-layout { max-width: 1240px; padding: 0 36px; margin: auto; display: grid; grid-template-columns: 215px minmax(0, 1fr); gap: 56px; min-height: calc(100vh - 190px); }
.sidebar { position: sticky; top: 24px; align-self: start; padding: 37px 24px 24px 0; border-right: 1px solid var(--line); min-height: 620px; }
.nav-group { display: grid; gap: 4px; }
.nav-group a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; font-size: 13px; border-radius: 6px; min-height: 42px; }
.nav-group a:hover { background: var(--surface-soft); }
.nav-group a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-icon { display: inline-flex; width: 18px; justify-content: center; font-size: 19px; line-height: 1; color: var(--muted); }
[aria-current] .nav-icon { color: inherit; }
.nav-caption { font-size: 10px; font-weight: 650; letter-spacing: 1.6px; color: var(--muted); margin: 34px 12px 12px; }
.sidebar-bottom { margin: 55px 12px 0; border-top: 1px solid var(--line); padding-top: 23px; font-size: 11px; font-weight: 550; }
.sidebar-bottom p { font-weight: 400; color: var(--muted); line-height: 1.7; margin: 9px 0 17px; }
.sidebar-bottom a { text-decoration: underline; text-underline-offset: 4px; }
.availability-dot { width: 6px; height: 6px; display: inline-block; background: #688471; margin: 0 6px 1px 0; border-radius: 50%; }
.site main { min-width: 0; padding: 42px 0 64px; }
.page-heading { margin-bottom: 30px; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 1.9px; font-weight: 650; margin-bottom: 12px; }
.heading-line { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.site h1 { font-size: clamp(30px, 3.2vw, 43px); letter-spacing: -1.5px; font-weight: 650; margin: 0; line-height: 1.18; }
.heading-count { font-size: 12px; color: var(--muted); }
.page-description { color: var(--muted); font-size: 14px; max-width: 600px; margin: 14px 0 0; line-height: 1.7; }
.filter-bar { display: flex; gap: 8px; align-items: stretch; position: relative; flex-wrap: wrap; }
.search-field { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface-soft); padding: 0 12px; border-radius: 6px; min-height: 42px; flex: 1 1 185px; }
.search-field > span:first-child { color: var(--muted); font-size: 23px; line-height: 1; }
.search-field input { border: 0; background: transparent; padding: 10px 0; min-width: 0; width: 100%; font-size: 12px; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-field input:focus { outline: none; }
.select-field select { border: 1px solid var(--line); border-radius: 6px; min-height: 42px; padding: 8px 26px 8px 11px; font-size: 12px; background: var(--surface); max-width: 165px; }
.topic-filter summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; background: var(--surface); }
.topic-filter summary::-webkit-details-marker { display: none; }
.topic-filter[open] summary { border-color: var(--accent); }
.topic-filter fieldset { position: absolute; z-index: 5; top: calc(100% + 6px); right: 0; width: min(390px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 12px 35px #00000014; max-height: 370px; overflow-y: auto; margin: 0; }
.topic-filter legend { float: left; width: 100%; font-size: 12px; font-weight: 650; padding: 0 0 10px; }
.topic-filter label { display: flex; gap: 10px; align-items: center; font-size: 12px; padding: 7px 3px; clear: both; cursor: pointer; }
.topic-filter input { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.results-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: 11px; color: var(--muted); }
.results-toolbar p { margin: 8px 0; }
.text-button { padding: 5px 0; border: 0; background: transparent; font-size: 11px !important; text-decoration: underline; text-underline-offset: 3px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.active-filters:not(:empty) { padding-bottom: 15px; }
.filter-chip { border: 0; border-radius: 4px; background: var(--accent-soft); color: var(--accent) !important; padding: 5px 9px; font-size: 11px !important; }
#posts { border-top: 1px solid var(--line); }
.post { padding: 27px 0; border-bottom: 1px solid var(--line); }
.post.has-thumbnail { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 30px; align-items: center; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 3px; font-size: 10px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
.post-kind { font-weight: 650; color: var(--accent) !important; }
.post-source { margin-left: auto; overflow-wrap: anywhere; }
.post h2 { margin: 0; font-size: 20px; font-weight: 620; line-height: 1.4; letter-spacing: -.4px; }
.post h2 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.post-description { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 9px 0 13px; }
.post-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-tag { font-size: 10px; border: 1px solid var(--line); padding: 2px 7px; border-radius: 4px; color: var(--muted) !important; line-height: 1.7; }
.topic-tag:hover { color: var(--accent) !important; background: var(--accent-soft); border-color: transparent; }
.post-thumbnail { display: block; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); background: #f7f7f5; }
.post-thumbnail img { width: 100%; height: auto; aspect-ratio: 1.6; display: block; object-fit: contain; }
.load-more, .outline-button { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 22px; font-size: 12px !important; }
.load-more { margin: 30px auto 0; min-width: 200px; }
.load-more span { margin-left: 15px; }
.load-more:hover, .outline-button:hover { border-color: var(--accent); color: var(--accent); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state > span { font-size: 40px; }
.empty-state h2 { font-size: 22px; margin: 10px 0; }
.empty-state p { font-size: 13px; }
.empty-state button { margin: 25px auto 0; }
.topic-search { max-width: 380px; margin-bottom: 24px; }
.topic-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.topic-card { border: 1px solid var(--line); border-radius: 8px; padding: 22px; transition: background .15s, border-color .15s; }
.topic-card:hover { background: var(--surface-soft); border-color: var(--accent); }
.topic-card-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); align-items: center; }
.topic-number { font-family: Georgia, serif; font-size: 20px; color: var(--accent); }
.topic-card h2 { font-size: 19px; line-height: 1.35; letter-spacing: -.3px; margin: 22px 0 8px; }
.topic-card p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0; }
.about { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 32px; border-top: 1px solid var(--line); padding-top: 30px; }
html[data-theme="dark"] .site[data-page="about"] .avatar { background: var(--surface); border-color: var(--surface); }
.avatar img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; object-position: center; }
.about p { margin: 0 0 18px; color: var(--ink) !important; }
.about-contact { margin-top: 36px; padding-top: 25px; border-top: 1px solid var(--line); }
.about-contact h2 { font-size: 24px; letter-spacing: -.5px; }
.about-contact p { font-size: 13px; }
.social { display: flex; gap: 10px; position: relative; }
.social-tooltip { position: absolute; top: calc(100% + 10px); left: 0; z-index: 10; width: 230px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 400; line-height: 1.5; visibility: hidden; opacity: 0; pointer-events: none; }
.header-social .social-tooltip { left: auto; right: 0; }
.icon-btn:hover .social-tooltip, .icon-btn:focus .social-tooltip { visibility: visible; opacity: 1; }
.icon-btn { display: flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-soft) !important; }
.icon-btn svg { width: 16px; height: 16px; fill: var(--ink); }
.site-footer { max-width: 1168px; margin: auto; border-top: 1px solid var(--line); padding: 24px 0; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
@media (min-width: 1400px) { .site-layout { gap: 66px; } }
@media (max-width: 1000px) {
  .site-layout { grid-template-columns: 175px minmax(0,1fr); gap: 30px; padding: 0 26px; }
  .sidebar { padding-right: 15px; }
  .nav-group a { font-size: 12px; padding-left: 8px; gap: 8px; }
  .post.has-thumbnail { grid-template-columns: minmax(0,1fr) 136px; gap: 20px; }
  .post h2 { font-size: 18px; }
  .site-footer { margin: 0 26px; }
  .header-inner { padding-left: 26px; }
  .search-field { flex-basis: 100%; }
}
@media (max-width: 700px) {
  .header-inner { min-height: 85px; padding: 18px 62px 18px 20px; gap: 16px; flex-wrap: wrap; }
  .brand { gap: 9px; }
  .brand-portrait { width: 56px; height: 56px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 9px; max-width: 200px; }
  .header-links { gap: 16px; font-size: 11px; }
  .site[data-page="feed"] .header-links { width: 100%; justify-content: space-between; }
  .site[data-page="paper"] .header-inner { padding-right: 20px; }
  .site[data-page="paper"] .brand { max-width: calc(100% - 42px); }
  .site[data-page="paper"] .header-links { width: 100%; flex-wrap: wrap; gap: 12px; }
  .site[data-page="paper"] .header-social { margin-left: auto; }
  .paper-page > .theme-toggle { top: 26px; right: 16px; width: 32px; height: 32px; }
  body.paper-page > #content { margin-top: 28px; }
  .header-links .header-github { display: none; }
  .header-social .social { gap: 6px; }
  .header-social .icon-btn { width: 32px; height: 32px; }
  .site .theme-toggle { top: 26px; right: 16px; width: 32px; height: 32px; }
  .site-layout { display: block; padding: 0 20px; }
  .sidebar { position: static; border: 0; border-bottom: 1px solid var(--line); min-height: auto; padding: 13px 0; display: flex; overflow-x: auto; gap: 14px; scrollbar-width: thin; }
  .nav-group { display: flex; gap: 4px; flex-shrink: 0; }
  .primary-nav { border-right: 1px solid var(--line); padding-right: 14px; }
  .nav-group a { white-space: nowrap; min-height: 34px; padding: 5px 10px; font-size: 12px; }
  .nav-icon, .nav-caption, .sidebar-bottom { display: none; }
  .site main { padding: 28px 0 45px; }
  .page-heading { margin-bottom: 24px; }
  .site h1 { font-size: 34px; letter-spacing: -1.1px; }
  .page-description { font-size: 13px; }
  .post.has-thumbnail { grid-template-columns: minmax(0,1fr) 105px; gap: 16px; }
  .post { padding: 22px 0; }
  .post h2 { font-size: 17px; line-height: 1.4; }
  .post-description { font-size: 12px; }
  .post-thumbnail { align-self: start; margin-top: 25px; }
  .post-meta { font-size: 10px; }
  .post-source { margin-left: 0; }
  .select-field select { padding-right: 19px; font-size: 11px; max-width: 145px; }
  .topic-filter summary { font-size: 11px; padding: 8px 10px; }
  .topic-directory { gap: 10px; }
  .topic-card { padding: 16px; }
  .topic-card h2 { font-size: 17px; margin-top: 16px; }
  .about { grid-template-columns: 1fr; gap: 24px; }
  .avatar img { width: 120px; height: 120px; }
  .site-footer { margin: 0 20px; font-size: 10px; flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .brand small { max-width: 160px; }
  .brand strong { font-size: 14px; }
  .post.has-thumbnail { grid-template-columns: minmax(0,1fr) 80px; gap: 12px; }
  .topic-directory { grid-template-columns: 1fr; }
  .filter-bar { gap: 6px; }
  .select-field select { max-width: 128px; padding-left: 8px; }
  .site-layout { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) { .site * { transition: none !important; } }
