/* A soy cruet pours the switch between warm paper and dark paper. */
:root{color-scheme:light}
html[data-theme="dark"] .article-card.journal-card{--card-hover-shadow-color:#c4a17b}
.theme-toggle{flex:0 0 auto;display:grid;place-items:center;width:50px;height:50px;padding:3px;border:1.5px solid #184f62;border-radius:50%;background:#fbf7e9;box-shadow:2px 2px 0 #a3382d;cursor:pointer}
.theme-toggle svg{width:40px;height:40px;overflow:visible}
.theme-bottle{transform-origin:23px 24px;transform:rotate(-20deg);transition:transform .25s ease}
.theme-toggle:hover .theme-bottle{transform:rotate(-35deg)}
.theme-toggle[aria-pressed="true"] .theme-bottle{transform:rotate(-45deg)}
.theme-moon{display:none}.theme-sun{display:block}
.theme-toggle[aria-pressed="true"] .theme-moon{display:block}.theme-toggle[aria-pressed="true"] .theme-sun{display:none}
.theme-toggle[aria-pressed="true"]{background:#352b21;border-color:#d6b895;box-shadow:2px 2px 0 #dca571}
html[data-theme="dark"]{color-scheme:dark;--paper:#1d1a16;--cream:#28231d;--ink:#b7a68b;--red:#d69a70;--muted:#bfb49f;--line:#b7a68b66;--theme-text:#f3ecdf}
/* Legacy components set black directly; keep every text surface readable in dark mode. */
html[data-theme="dark"] body,html[data-theme="dark"] body *{color:var(--theme-text)!important}
html[data-theme="dark"] body{background-color:var(--paper);background-image:linear-gradient(#1d1a16ed,#1d1a16ed),url('/assets/washi-paper.svg')}
html[data-theme="dark"] .site-header{background:#242019fa;border-color:#a46e4c}
html[data-theme="dark"] .admin-session{background:#27221c!important;border-color:#78634e!important}
html[data-theme="dark"] :is(.admin-session button,.article-home .filter,.search-submit,.button,.article-home .article-search input){background:#2d2720;border-color:#b5a28a}
html[data-theme="dark"] .article-home .filter.active{background:#543a25;border-color:#f0d1a4}
html[data-theme="dark"] :is(.article-home .filter:hover,.search-submit:hover,.button:hover,.admin-session button:hover){background:#483626}
html[data-theme="dark"] .site-menu summary{background:#372a21;border-color:#d1b38d}
html[data-theme="dark"] .menu-panel{background-image:linear-gradient(#1d1a16ed,#1d1a16ed),url('/assets/waves.svg')}
html[data-theme="dark"] .site-footer{background-color:#242019;background-image:linear-gradient(#242019ed,#242019ed),url('/assets/waves.svg')}
html[data-theme="dark"] :is(.card-art,.card-art .article-thumbnail,.article-cover>a){background:#26231e;border-color:#76664f}
html[data-theme="dark"] :is(.journal-card,.toc,.takeaway,.contact-box,.sidebar-note,.mobile-toc details,.empty-state){border-color:#88775e}
html[data-theme="dark"] :is(.toc,.takeaway,.contact-box,.sidebar-note,.mobile-toc details,.empty-state){background:#2b251e}
html[data-theme="dark"] .article-home .card-tags>a:hover{background:#4b3828}
html[data-theme="dark"] .soy-scroll{background:#2c241bd9;border-color:#9e7f5d}
html[data-theme="dark"] :focus-visible{outline-color:#f9e8bd;box-shadow:0 0 0 6px #765424}
html[data-theme="dark"] input::placeholder{color:#cfc3b0;opacity:1}
@media(max-width:850px){.site-header .theme-toggle{margin-left:auto}.site-header .site-menu{margin-left:0}}
@media(max-width:600px){.site-header{gap:10px}.site-header .brand-name>span{font-size:22px}.theme-toggle{width:44px;height:44px;padding:3px}.theme-toggle svg{width:34px;height:34px}}
@media(max-width:360px){.site-header{gap:8px}.site-header .brand-name>span{font-size:18px}.site-header>.brand .brand-seal{width:24px;height:24px;font-size:19px}.site-header>.brand{gap:5px}.theme-toggle{width:40px;height:40px}.theme-toggle svg{width:32px;height:32px}.site-header .site-menu summary{width:42px;height:42px}}
@media(prefers-reduced-motion:reduce){.theme-bottle{transition:none}}

html[data-theme="dark"] .article-sort{color:#f4e8d6}
html[data-theme="dark"] .sort-control select{background:#2d2720;border-color:#b5a28a;color:#f4e8d6;color-scheme:dark}
html[data-theme="dark"] .sort-control select:hover{background:#483626}

/* Reading surfaces and controls share the same contrast scale in both themes. */
.article-home {
  --feed-surface: #fffefa;
  --feed-text: #29231f;
  --feed-secondary: #625a52;
  --feed-border: #d6cfc6;
  --feed-hover: #f3eee7;
  --feed-action: #38271f;
  --feed-on-action: #fff;
  --feed-focus: #2167a4;
}
html[data-theme="dark"] .article-home {
  --feed-surface: #26221f;
  --feed-text: #f7f3ed;
  --feed-secondary: #c8c0b7;
  --feed-border: #63594f;
  --feed-hover: #38312b;
  --feed-action: #f1ddc4;
  --feed-on-action: #27221c;
  --feed-focus: #8ecaff;
}
.article-home .journal { padding-block: clamp(24px, 4vw, 56px); }
.article-home .feed-title {
  margin: 0 0 24px;
  font-size: clamp(1.75rem, 3.4vw, 3rem);
  line-height: 1.25;
  letter-spacing: -.035em;
  color: var(--feed-text);
}
.article-home .journal-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid var(--feed-border);
  border-radius: 12px;
  background: var(--feed-surface);
}
.article-home .article-search { width: 100%; min-width: 0; }
.article-home .filters { justify-content: flex-start; gap: 6px; }
html .article-home :is(.filter, .sort-control select, .article-search input, .pagination button) {
  background: var(--feed-surface);
  border: 1px solid var(--feed-border);
  border-radius: 7px;
  min-height: 44px;
}
html .article-home :is(.filter, .sort-control select) { font-size: .9375rem; }
html .article-home .filter { padding: 8px 12px; }
html .article-home :is(.filter, .sort-control select, .pagination button:enabled):hover {
  border-color: var(--feed-secondary);
  background: var(--feed-hover);
}
html .article-home :is(.filter.active, .search-submit, .page-numbers button[aria-current="page"],
  .category-dropdown:has(.filter.active) > summary) {
  border: 1px solid var(--feed-action);
  border-radius: 7px;
  background: var(--feed-action);
  color: var(--feed-on-action);
  text-decoration: none;
}
html[data-theme="dark"] .article-home :is(.filter.active, .search-submit, .page-numbers button[aria-current="page"],
  .category-dropdown:has(.filter.active) > summary, .category-dropdown:has(.filter.active) > summary .category-arrow) {
  color: var(--feed-on-action) !important;
}
html .article-home .filter.active:hover { background: var(--feed-action); }
html .article-home .category-children {
  border: 1px solid var(--feed-border);
  border-radius: 8px;
  background: var(--feed-surface);
}
.article-home .article-sort { margin-block: 16px 12px; }
.article-home .search-status { font-size: .875rem; color: var(--feed-secondary); }
html .article-home .journal-card {
  padding: clamp(12px, 1.3vw, 20px);
  border: 1px solid var(--feed-border);
  border-radius: 12px;
  background: var(--feed-surface);
}
.article-home .article-grid { row-gap: 16px; }
.article-home .card-body { gap: 12px; }
.article-home .journal-card h3 { font-size: clamp(1.125rem, 1.4vw, 1.375rem); line-height: 1.5; }
.article-home .card-art { border-radius: 6px; }
.article-home .card-tags > a { font-size: .875rem; text-underline-offset: .2em; }
html .article-home :focus-visible { outline: 3px solid var(--feed-focus); outline-offset: 2px; }
@media (min-width: 1100px) {
  .article-home .journal-toolbar { grid-template-columns: minmax(0, 1fr) minmax(240px, 32%); }
}
