/* Chess Library: static article pages in the same obsidian, bone and oxblood look as the Gambithall app.
   Colours mirror the app's Tailwind palette; dark mode follows the app's theme switch. */
:root {
  --bg: #efe8da;
  --surface: rgba(247, 243, 234, 0.94);
  --surface-2: #f7f3ea;
  --surface-solid: #f7f3ea;
  --line: #ddd4c2;
  --text: #0e0d0c;
  --muted: #4a443c;
  --soft: #5e574d;
  --accent: #8e1b1b;
  --accent-2: #8e1b1b;
  --accent-soft: #fbefec;
  --violet: #8a6a27;
  --amber: #d97706;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
  --font: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --chess: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", serif;
  color-scheme: light;
}
.dark {
  --bg: #0e0d0c;
  --surface: rgba(27, 25, 23, 0.92);
  --surface-2: #1b1917;
  --surface-solid: #1b1917;
  --line: #2a2622;
  --text: #efe8da;
  --muted: #c9c1b3;
  --soft: #a79f92;
  --accent: #e8745f;
  --accent-2: #ee9784;
  --accent-soft: rgba(232, 116, 95, 0.12);
  --violet: #c8a24a;
  --amber: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.7 var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    repeating-conic-gradient(rgba(15, 23, 42, 0.04) 0% 25%, transparent 0% 50%);
  background-size: 96px 96px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.dark body {
  background-image:
    repeating-conic-gradient(rgba(255, 255, 255, 0.025) 0% 25%, transparent 0% 50%);
  background-size: 96px 96px;
}
a { color: var(--accent-2); text-underline-offset: 2px; }
.dark a { color: var(--accent); }
:focus-visible { outline: 2px solid #b83226; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.royal { font-family: var(--display); letter-spacing: -0.01em; font-weight: 400; }
.label { margin: 0 0 8px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: none; margin: 0; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 1.25rem; }
.brand { font-size: 1.6rem; }
.brand .mark { width: 36px; height: 36px; }
.brand .mark .head { fill: var(--accent); }
.app-nav { display: flex; gap: 2px; margin-left: 12px; }
.app-nav a { color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.app-nav a:hover { color: var(--text); }
.app-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-btn .sun { display: none; }
.dark .theme-btn .sun { display: inline; }
.dark .theme-btn .moon { display: none; }
.menu-btn { display: none; flex-direction: column; gap: 4px; place-content: center; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
  color: #efe8da !important; text-decoration: none; background: #8e1b1b; border-radius: 999px; transition: transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }

/* ---------- layout ---------- */
.wrap { max-width: none; margin: 0; padding: 24px 16px 40px; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: 24px; align-items: start; }
.libnav { display: grid; gap: 16px; align-self: start; }
.libnav-card, .article { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.libnav-card { padding: 16px; }
.libnav nav { display: grid; }
.libnav nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-left: 3px solid transparent; border-radius: 0 8px 8px 0;
  color: var(--muted); text-decoration: none; font-family: var(--display); letter-spacing: 0; font-weight: 400; font-size: 1.02rem; }
.libnav nav a:hover { background: var(--surface-2); color: var(--text); }
.libnav nav a[aria-current="page"] { border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent); color: var(--accent-2); }
.libnav .g { width: 20px; text-align: center; font-family: var(--chess); color: var(--soft); }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(2, 6, 23, 0.5); }

.article { padding: clamp(20px, 4vw, 40px); min-width: 0; }
.article > * { max-width: 46rem; }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); }
h1 { font-family: var(--display); letter-spacing: -0.01em; font-weight: 400; font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.12; margin: 6px 0 14px; text-wrap: balance; }
h2 { font-family: var(--display); letter-spacing: -0.01em; font-weight: 400; font-size: 1.55rem; margin: 2.2em 0 .5em; line-height: 1.2; scroll-margin-top: 80px; text-wrap: balance; }
h3 { font-size: 1.08rem; margin: 1.6em 0 .3em; }
.lede { font-size: 1.15rem; color: var(--muted); }
p, li, dd { color: var(--text); }
.muted { color: var(--soft); }
.small, small { font-size: 0.875rem; }
code, .mono { font-family: var(--mono); }
ul, ol { padding-left: 1.3em; }
li { margin: .25em 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 52rem !important; }
.callout { margin: 20px 0; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent); }
.next { margin-top: 32px; padding: 16px; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.toc { margin: 18px 0; padding: 14px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.toc ol { margin: 0; columns: 2; column-gap: 24px; }

/* Diagrams (drawn at build time) */
figure.diagram { margin: 22px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 46rem; }
figure.diagram svg { width: min(360px, 100%); height: auto; border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 6px 0 #0b2530, 0 18px 30px rgba(2,6,23,.35); }
figure.diagram figcaption { font-size: 0.9rem; color: var(--soft); text-align: center; max-width: 52ch; }
.diagram-play { white-space: nowrap; font-weight: 600; margin-left: 4px; }

/* Annotated moves */
.moves-annot { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.moves-annot li { margin: 0; padding: 4px 8px; border-radius: 8px; font-size: .95rem; }
.moves-annot li:nth-child(4n+1), .moves-annot li:nth-child(4n+2) { background: var(--surface-2); }
.moves-annot b { font-family: var(--mono); font-weight: 600; color: var(--text); }
.replay { margin: 16px 0 8px; }

/* Library index cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 14px; max-width: none !important; margin: 20px 0; }
.cards a { display: grid; gap: 4px; padding: 16px; border-radius: 16px; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
.cards a::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: #8e1b1b; }
.cards a:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(15,23,42,.45); }
.cards .ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; font: 22px/1 var(--chess); color: #fff;
  background: #8e1b1b; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 0 rgba(15,23,42,.25); }
.cards a:nth-child(3n+2) .ic { background: linear-gradient(135deg, #a78bfa, #4f46e5); }
.cards a:nth-child(3n) .ic { background: linear-gradient(135deg, #fcd34d, #f97316); }
.cards b { font-family: var(--display); letter-spacing: -0.01em; font-weight: 400; font-size: 1.15rem; }
.cards small { color: var(--soft); line-height: 1.5; }
.card-list { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); max-width: none !important; }
/* Each opening is one card: the name and code link on top, its first moves underneath. */
.card-list li { margin: 0; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; transition: border-color .15s, transform .15s; }
.card-list li:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-list a { display: block; padding: 10px 14px 2px; text-decoration: none; color: var(--text); }
.card-list li > span { display: block; padding: 0 14px 10px; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.card-list a:only-child { padding-bottom: 10px; }
.card-list small { display: block; color: var(--soft); }

/* FAQ accordion and glossary */
.accordion { display: grid; gap: 8px; }
.acc-item { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 0 16px; }
.acc-item summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.acc-body { padding-bottom: 12px; }
.gloss-search { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.gloss-search input { flex: 1; min-width: 14rem; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; }
.gl-letter { font-size: 1.3rem; margin-top: 1.4em; color: var(--accent-2); }
.gl-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.gl-item dt { font-weight: 700; }
.gl-item dd { margin: 2px 0 0; color: var(--muted); }

/* Store and gear */
.store-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: center; max-width: 56rem !important; }
.price-row { display: flex; align-items: baseline; gap: 12px; margin: 12px 0; }
.price { font-size: 2.2rem; font-weight: 800; color: var(--accent-2); }
.buy { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 12px; font-weight: 700; text-decoration: none;
  color: #fff !important; background: #8e1b1b; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 0 rgba(15,23,42,.25); }
.buy.small { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
.buy.gift { background: linear-gradient(180deg, #a78bfa, #6d28d9); }
.pay-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.pay { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.gear-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.gear-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.gear-list span { grid-column: 1; color: var(--soft); font-size: .9rem; }
.gear-list .buy { grid-row: 1 / span 2; grid-column: 2; }
table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: .95rem; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }

/* ---------- ad spaces ---------- */
.ad-slot { display: none; }
.ad-slot.ad-on, .ad-slot.ad-placeholder { display: block; margin: 24px 0; max-width: 46rem; text-align: center; }
.ad-slot .ad-label { display: block; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; }
.ad-slot.ad-placeholder .ad-box { display: grid; place-items: center; min-height: 120px; border: 2px dashed color-mix(in srgb, var(--soft) 45%, transparent); border-radius: 14px; color: var(--soft); font-size: .85rem; background: var(--surface-2); }
.libnav .ad-slot.ad-placeholder .ad-box { min-height: 250px; }
.libnav .ad-slot { margin: 0; }

/* ---------- promo + footer ---------- */
.promo { max-width: none; margin: 0 16px 24px; padding: 14px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 18px; color: #fff; background: linear-gradient(120deg, #1b1917, #0e0d0c); box-shadow: var(--shadow); width: calc(100% - 32px); }
.promo .btn { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.foot { border-top: 1px solid var(--line); padding: 24px 16px 32px; text-align: center; color: var(--soft); font-size: .875rem; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 8px; }
.foot a { display: inline-block; padding-block: 4px; color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

/* ---------- small screens ---------- */
@media (max-width: 1023px) {
  .app-nav { display: none; }
  .menu-btn { display: flex; }
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .libnav { position: fixed; z-index: 40; inset: 8px auto 8px 8px; width: min(19rem, calc(100vw - 16px)); max-height: none; transform: translateX(-110%); transition: transform .2s; }
  body.nav-open .libnav { transform: none; }
  .libnav-card { height: 100%; overflow: auto; background: var(--surface-solid); box-shadow: 0 20px 50px rgba(2, 6, 23, 0.45); }
  .libnav > .ad-slot { display: none !important; }
}
@media (max-width: 640px) {
  .two, .store-hero, .moves-annot { grid-template-columns: minmax(0, 1fr); }
  .toc ol { columns: 1; }
  .top-actions .btn { display: none; }
  .gear-list li { grid-template-columns: 1fr; }
  .gear-list .buy { grid-row: auto; grid-column: 1; justify-self: start; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Diagrams follow the board style chosen in the app (board-themes.css). */
.diagram svg .dg-frame { fill: var(--frame-2); }
.diagram svg .dg-l { fill: var(--sq-light); }
.diagram svg .dg-d { fill: var(--sq-dark); }
.diagram svg .dg-co { fill: var(--pw-2); }
.diagram svg .dg-w { fill: var(--pw-1); stroke: var(--pw-stroke); stroke-width: 1.1px; }
.diagram svg .dg-b { fill: var(--pb-2); stroke: var(--pb-stroke); stroke-width: 0.6px; }

/* Sign-up box at the end of an article preview. */
.gate { margin: 2.5rem 0 1rem; padding: 1.75rem; border-radius: 1.25rem; position: relative;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.gate::before { content: ''; position: absolute; left: 0; right: 0; top: -6rem; height: 6rem; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface-solid, #fff)); }
.gate h2 { margin-top: .25rem; }
.gate-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.btn-ghost { background: transparent !important; color: inherit !important; box-shadow: inset 0 0 0 1px currentColor; }

/* ---------------------------------------------------------------- 3D frames and chess ornaments */
.libnav-card, .article, .callout, .card-list li, .acc-item, .contact-card, .blog-write, .diagram svg {
  border: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 0 color-mix(in srgb, var(--accent) 25%, transparent), 0 4px 0 rgba(15, 23, 42, 0.1), 0 14px 28px -12px rgba(15, 23, 42, 0.3);
}
.dark .libnav-card, .dark .article, .dark .callout, .dark .card-list li, .dark .acc-item, .dark .contact-card, .dark .blog-write {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 0 color-mix(in srgb, var(--accent) 20%, transparent), 0 4px 0 rgba(0, 0, 0, 0.45), 0 14px 28px -12px rgba(0, 0, 0, 0.7);
}
.diagram svg { border-radius: 12px; }
.article { position: relative; overflow: hidden; }
.article::before, .article::after { position: absolute; font-family: var(--chess); line-height: 1; pointer-events: none; color: color-mix(in srgb, var(--accent) 9%, transparent); }
.article::before { content: "\265A\FE0E"; top: -0.6rem; right: 1rem; font-size: 7rem; }
.article::after { content: "\265E\FE0E"; bottom: -1rem; right: 2.5rem; font-size: 5rem; transform: scaleX(-1); }
.article > * { position: relative; }
h1::after { content: ""; display: block; width: 5rem; height: 4px; margin-top: 10px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, color-mix(in srgb, var(--accent) 25%, transparent) 10px 20px); }

/* ---------------------------------------------------------------- header search and phone tab bar */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.top-search input { height: 36px; width: 12rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); padding: 0 12px; font: inherit; font-size: .875rem; }
.top-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .top-search { display: none; }
  .tabbar { position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface-solid); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(15, 23, 42, .12); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; font-size: .7rem; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a span { font-family: var(--chess); font-size: 1.25rem; line-height: 1; }
  .tabbar a[aria-current="page"] { color: var(--accent-2); }
  body { padding-bottom: 64px; }
  .promo { bottom: 64px; }
}

/* ---------------------------------------------------------------- FAQ: thick accordion borders */
.acc-item { border-width: 3px; border-color: var(--accent); border-radius: 16px; margin: 0 0 14px; }
.acc-item summary { font-size: 1.05rem; }
.acc-item[open] { border-color: var(--violet); background: var(--surface-solid); }
.acc-item[open] summary { border-bottom: 2px dashed color-mix(in srgb, var(--violet) 45%, transparent); margin-bottom: 8px; }

/* ---------------------------------------------------------------- blog: marquee, cards, writing */
.marquee { overflow: hidden; margin: 8px 0 24px; border-radius: 14px; max-width: none !important;
  background: #1b1917; color: #efe8da; border: 1px solid #2a2622; box-shadow: 0 10px 22px -10px rgba(15, 23, 42, .5); }
.marquee-track { display: inline-flex; gap: 3rem; padding: 10px 0; white-space: nowrap; animation: marquee 45s linear infinite; padding-left: 16px; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee a { color: #ee9784; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; white-space: normal; flex-wrap: wrap; gap: .5rem 2rem; } }
.blog-cards { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 14px; }
.blog-cards li { background: #1b1917; border-color: #2a2622; border-radius: 16px; }
.blog-cards li a { color: #fff; padding: 16px 18px 6px; }
.blog-cards li a b { font-size: 1.05rem; }
.blog-cards li > span { color: #a79f92; padding: 0 18px 16px; line-height: 1.5; }
.blog-cards li:hover { border-color: var(--accent); }
.blog-cards button.linkish { all: unset; cursor: pointer; display: block; padding: 16px 18px 6px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.blog-cards button.linkish:focus-visible { outline: 2px solid #ee9784; outline-offset: -4px; border-radius: 12px; }
.blog-cards .del { all: unset; cursor: pointer; margin: 0 18px 14px; font: 600 .75rem var(--font); color: #fda4af; }
.mb-status { color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.pager button { min-width: 40px; min-height: 40px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-solid); color: var(--text); font: 600 .9rem var(--font); cursor: pointer; }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }
.blog-write { margin-top: 24px; padding: 18px; border-radius: 16px; background: var(--surface-solid); }
.blog-write h3 { margin-top: 0; }
.blog-write label, .contact-form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
.blog-write input, .blog-write textarea, .contact-form input, .contact-form textarea, .contact-form select {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 400 1rem var(--font); }
.blog-write textarea, .contact-form textarea { resize: vertical; }
.form-msg { min-height: 1.2em; font-size: .9rem; font-weight: 600; }
.form-msg.ok { color: var(--accent); }
.form-msg.err { color: #e11d48; }
.blog-reader { margin-top: 24px; padding: 20px; border-radius: 16px; background: var(--surface-solid); border: 2px solid var(--accent); }
.blog-reader .meta { font-family: var(--mono); color: var(--soft); font-size: .85rem; }

/* ---------------------------------------------------------------- contact card */
.contact-card { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); border-radius: 20px; overflow: hidden; margin: 24px 0; max-width: none !important; background: var(--surface-solid); }
.contact-side { position: relative; padding: 22px; color: #efe8da; background: linear-gradient(160deg, #2a0808, #0e0d0c 70%); }
.contact-side h2 { color: #fff; margin-top: 0; }
.contact-side ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; font-size: .9rem; }
.contact-side li b { display: block; color: #ee9784; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.contact-side a { color: #fff; }
.contact-glyph { position: absolute; right: 10px; bottom: -14px; margin: 0; font-family: var(--chess); font-size: 6rem; color: rgba(255, 255, 255, .08); }
.contact-form { padding: 22px; }
.contact-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-form .hp { position: absolute; left: -9999px; }
@media (max-width: 640px) {
  .contact-card, .contact-form .row2 { grid-template-columns: 1fr; }
}
.feature .btn { margin-left: 8px; }
.member-blog, .blog-reader { max-width: none !important; }
.member-blog > p, .member-blog > h2, .blog-write { max-width: 46rem; }
.app-nav a { white-space: nowrap; }
@media (max-width: 1240px) { .top-search { display: none; } }

/* ---------------------------------------------------------------- light mode: deeper page, black borders */
:root:not(.dark) {
  --bg: #e6dcc8;
  --line: rgba(14, 13, 12, 0.28);
}
:root:not(.dark) :is(.libnav-card, .article, .callout, .card-list li, .acc-item, .contact-card, .blog-write, .diagram svg, .top, .marquee) {
  border-color: rgba(14, 13, 12, 0.28);
}
:root:not(.dark) .acc-item[open] { border-color: #8e1b1b; }
.btn, .app-nav a, .top-actions a { white-space: nowrap; }
/* Top menu: one line, spread evenly across the bar on every library page. */
.app-nav { flex: 1; justify-content: space-evenly; margin: 0 8px; min-width: 0; }
.top-actions { margin-left: 0; flex-shrink: 0; }
@media (max-width: 1699px) { .top-search { display: none; } }
@media (max-width: 1279px) { .app-nav a { padding: 8px 6px; font-size: 0.8125rem; } }

/* Framed like the rest of the site: one quiet line. */
.libnav-card, .article { border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- page photo */
.page-photo { display: block; max-width: none !important; margin: 0 0 22px; border-radius: 16px; overflow: hidden; background: #0e0d0c; }
.page-photo img { display: block; width: 100%; height: clamp(9rem, 22vw, 15rem); object-fit: cover; }
.dark .brand { color: var(--text); }
