/* =============================================================================
 * Türk Eğitim İndeksi — design tokens
 *
 * Turquoise editorial palette: heritage turquoise for brand details, deep
 * turquoise for readable actions, and ink text on quiet neutral surfaces.
 * Keep foreground/background pairs together when adding component states.
 * ============================================================================= */

:root {
  /* Surfaces */
  --bg: #ffffff;
  --bg-subtle: #f5fafa;
  --bg-muted: #eef4f4;
  --bg-emphasis: #e7f7f6;

  /* Text */
  --text: #163438;
  --text-secondary: #364f54;
  --text-tertiary: #53666b;
  --text-muted: #5b6e72;
  --text-disabled: #98a8ab;

  /* Borders */
  --border-subtle: #eaf0f0;
  --border: #d9e5e5;
  --border-strong: #b7cbcb;
  --border-control: #819393;

  /* Accent and links */
  --brand: #48d1cc;
  --brand-ink: #163438;
  --accent: #006b6b;
  --accent-hover: #005656;
  --on-accent: #ffffff;
  --accent-soft: #e7f7f6;
  --accent-border: #87bdbb;
  --link: #006b6b;

  /* Semantic */
  --info-fg: #006b6b;
  --info-bg: #e7f7f6;
  --info-border: #87bdbb;
  --success-fg: #1a7f37;
  --success-bg: #e6f7ec;
  --success-border: #b9e3c6;
  --warning-fg: #8a5b00;
  --warning-bg: #fff4d6;
  --warning-border: #f5d27c;
  --danger-fg: #cf222e;
  --danger-hover: #a40e26;
  --on-danger: #ffffff;
  --danger-bg: #feeceb;
  --danger-border: #fbc6c2;
  --code-bg: #163438;
  --code-fg: #eef4f4;

  /* Entity categories (tints for type tags and avatars only) */
  --cat-articles-light: #eef4f4;
  --cat-articles-dark: #364f54;
  --cat-journals-light: #e7f7f6;
  --cat-journals-dark: #006b6b;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Elevation — extremely subtle */
  --elev-1: 0 3px 6px -2px rgba(0, 0, 0, .02), 0 1px 1px 0 rgba(0, 0, 0, .04);
  --elev-overlay: 0 12px 32px -8px rgba(0, 0, 0, .18), 0 4px 12px -4px rgba(0, 0, 0, .08);

  /* Layout */
  --page-max: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --rail-width: 280px;
  --side-width: 320px;
  --prose-max: 720px;

  --transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;

  color-scheme: light dark;
}

/* Native light-dark() colors follow the OS unless the visitor chooses a theme.
 * The declarations above remain the light fallback for older browsers. */
@supports (color: light-dark(white, black)) {
  :root {
    --bg: light-dark(#ffffff, #101b1e);
    --bg-subtle: light-dark(#f5fafa, #142326);
    --bg-muted: light-dark(#eef4f4, #1c3033);
    --bg-emphasis: light-dark(#e7f7f6, #193d3e);
    --text: light-dark(#163438, #e6f3f3);
    --text-secondary: light-dark(#364f54, #c0d3d4);
    --text-tertiary: light-dark(#53666b, #a0b7b9);
    --text-muted: light-dark(#5b6e72, #91aaad);
    --text-disabled: light-dark(#98a8ab, #627d80);
    --border-subtle: light-dark(#eaf0f0, #20383b);
    --border: light-dark(#d9e5e5, #304c50);
    --border-strong: light-dark(#b7cbcb, #49666a);
    --border-control: light-dark(#819393, #6b888b);
    --accent: light-dark(#006b6b, #48d1cc);
    --accent-hover: light-dark(#005656, #77dfda);
    --on-accent: light-dark(#ffffff, #102d30);
    --accent-soft: light-dark(#e7f7f6, #193d3e);
    --accent-border: light-dark(#87bdbb, #4f9290);
    --link: var(--accent);
    --info-fg: var(--accent);
    --info-bg: var(--accent-soft);
    --info-border: var(--accent-border);
    --success-fg: light-dark(#1a7f37, #86dfac);
    --success-bg: light-dark(#e6f7ec, #143626);
    --success-border: light-dark(#b9e3c6, #326549);
    --warning-fg: light-dark(#8a5b00, #f4d082);
    --warning-bg: light-dark(#fff4d6, #392d16);
    --warning-border: light-dark(#f5d27c, #786138);
    --danger-fg: light-dark(#cf222e, #ff9ea8);
    --danger-hover: light-dark(#a40e26, #ffb3bc);
    --on-danger: light-dark(#ffffff, #3d101b);
    --danger-bg: light-dark(#feeceb, #3d2229);
    --danger-border: light-dark(#fbc6c2, #854450);
    --code-bg: light-dark(#163438, #0c1517);
    --code-fg: light-dark(#eef4f4, #c0d3d4);
    --cat-articles-light: var(--bg-muted);
    --cat-articles-dark: var(--text-secondary);
    --cat-journals-light: var(--accent-soft);
    --cat-journals-dark: var(--accent);
    --elev-overlay: 0 12px 32px -8px light-dark(rgba(0, 0, 0, .18), rgba(0, 0, 0, .5)), 0 4px 12px -4px rgba(0, 0, 0, .08);
  }
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root { --transition: none; }
}

/* ----------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; transition: var(--transition); }
a:hover { text-decoration: underline; text-underline-offset: .18em; }

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--text); line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 1.625rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: 1.125rem; font-weight: 600; }
h3 { font-size: .9375rem; font-weight: 600; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border-subtle); }
strong, b { font-weight: 600; }
dl, dd { margin: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.icon { flex: none; width: 16px; height: 16px; vertical-align: middle; }

.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; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; padding: .6rem 1rem; border-radius: var(--radius-md); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { top: 1rem; }

.muted { color: var(--text-tertiary); }
.caption { font-size: .75rem; font-weight: 500; color: var(--text-tertiary); }
.dot { margin-inline: .4em; color: var(--text-muted); }

/* ----------------------------------------------------------------------------
 * Form controls
 * ------------------------------------------------------------------------- */

input, select, textarea, button { font: inherit; color: inherit; }

/* :where() keeps these defaults at element specificity so any component rule wins. */
:where(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"])),
:where(select, textarea) {
  width: 100%;
  min-height: 38px;
  padding: .5rem .75rem;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

:where(textarea) { min-height: 6rem; line-height: 1.55; resize: vertical; }

:where(select) {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23819393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 14px;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }

:where(input:not([type="checkbox"], [type="radio"]), select, textarea):hover { border-color: var(--text-tertiary); }
:where(input:not([type="checkbox"], [type="radio"]), select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0 .5rem 0 0; accent-color: var(--accent); vertical-align: -3px; }
input[type="file"] { max-width: 100%; font-size: .8125rem; }

label { font-weight: 500; }

/* ----------------------------------------------------------------------------
 * Buttons
 *
 * `.btn` is the current API. Bare <button>, `.button`, `.button-secondary`
 * and `.button-danger` remain for the publisher and staff portals.
 * ------------------------------------------------------------------------- */

.btn,
.button,
button:not([class]),
button.full-width {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 36px;
  padding: 0 .9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover,
.button:hover,
button:not([class]):hover,
button.full-width:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); text-decoration: none; }

.btn-secondary,
.button-secondary { border-color: var(--border); background: var(--bg); color: var(--text); }
.btn-secondary:hover,
.button-secondary:hover { border-color: var(--border-strong); background: var(--bg-muted); color: var(--text); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover,
.menu[open] > summary.btn-ghost { border-color: transparent; background: var(--bg-muted); color: var(--text); }

.button-danger { border-color: var(--danger-fg); background: var(--danger-fg); color: var(--on-danger); }
.button-danger:hover { border-color: var(--danger-hover); background: var(--danger-hover); color: var(--on-danger); }

.btn-sm { min-height: 30px; padding: 0 .6rem; font-size: .8125rem; }
.full-width { width: 100%; }
.inline-form { display: inline; margin: 0; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-button:hover, .menu[open] > .icon-button { background: var(--bg-muted); color: var(--text); }
.icon-button .icon { width: 20px; height: 20px; }

.theme-switch {
  position: relative;
  display: inline-grid;
  flex: none;
  grid-template-columns: repeat(2, 28px);
  gap: 2px;
  place-items: center;
  width: 66px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  color: var(--text-tertiary);
  cursor: pointer;
}
.theme-switch[hidden] { display: none; }
.theme-switch:hover { border-color: var(--accent); }
.theme-switch-thumb { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); transform: translateX(30px); transition: transform 180ms ease; }
.theme-glyph { position: relative; width: 21px; height: 21px; pointer-events: none; }
.theme-glyph-star { color: var(--on-accent); }
.theme-switch[aria-checked="true"] .theme-switch-thumb { transform: translateX(0); }
.theme-switch[aria-checked="true"] .theme-glyph-moon { color: var(--on-accent); }
.theme-switch[aria-checked="true"] .theme-glyph-star { color: var(--text-tertiary); }
.theme-system-reset { padding: 4px 0; border: 0; background: none; color: var(--link); font-size: .8125rem; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .theme-switch-thumb { transition: none; }
}

/* ----------------------------------------------------------------------------
 * Menus (<details data-menu>)
 * ------------------------------------------------------------------------- */

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary .icon:last-child { color: var(--text-muted); transition: transform 150ms ease; }
.menu[open] > summary .icon:last-child { transform: rotate(180deg); }

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  z-index: 300;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--elev-overlay);
}
.menu-panel-end { right: 0; }
.menu-panel form { margin: 0; }

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font-size: .8125rem;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.menu-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-item.is-active::after { content: "✓"; margin-left: auto; padding-left: 12px; font-weight: 600; }
.menu-heading { margin: 0; padding: 8px 10px 10px; font-size: .8125rem; font-weight: 600; color: var(--text); }
.menu-heading span { display: block; font-weight: 400; color: var(--text-tertiary); }
.menu-divider { margin: 6px 0; }

/* ----------------------------------------------------------------------------
 * Top bar
 * ------------------------------------------------------------------------- */

.topbar { position: relative; z-index: 200; border-top: 3px solid var(--brand); border-bottom: 1px solid var(--border); background: var(--bg); }
.topbar-inner { display: flex; align-items: center; gap: 24px; max-width: var(--page-max); height: 60px; margin: 0 auto; padding: 0 var(--gutter); }

.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; color: var(--text); font-size: .9375rem; font-weight: 650; letter-spacing: -.01em; text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-wordmark { display: block; width: 220px; }
.brand-logo { display: block; width: 100%; height: auto; }
.brand-logo-dark, .brand-compact { display: none; }
.brand-compact { width: 36px; height: 36px; }
:root[data-color-mode="dark"] .brand-logo-light { display: none; }
:root[data-color-mode="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-mode]) .brand-logo-light { display: none; }
  :root:not([data-color-mode]) .brand-logo-dark { display: block; }
}

.topbar-nav { display: flex; align-items: center; gap: 2px; }
.topbar-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: .875rem; font-weight: 500; text-decoration: none; }
.topbar-nav a:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.topbar-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); text-decoration: underline; text-underline-offset: .35em; text-decoration-thickness: 2px; }

.topbar-search { position: relative; width: min(340px, 100%); margin-left: auto; }
.topbar-search .icon, .mobile-search .icon { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.topbar-search input:not([type="hidden"]), .mobile-search input:not([type="hidden"]) { min-height: 34px; padding-left: 32px; border-color: var(--border-control); background: var(--bg-subtle); font-size: .875rem; }
.topbar-search input:not([type="hidden"]):hover { border-color: var(--text-tertiary); }
.topbar-search input:not([type="hidden"]):focus { background: var(--bg); }

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-search + .topbar-actions { margin-left: 0; }

.account-button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-secondary); font-size: .8125rem; font-weight: 500; }
.account-button:hover, .menu[open] > .account-button { background: var(--bg-muted); color: var(--text); }
.account-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mobile-menu { display: none; }
.mobile-panel { width: min(320px, calc(100vw - 32px)); padding: 10px; }
.mobile-search { position: relative; margin: 0 0 8px; }
.mobile-nav { display: grid; }
.mobile-nav a { display: flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; text-decoration: none; }
.mobile-nav a:hover { background: var(--bg-muted); color: var(--text); }
.mobile-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 2px; }

/* ----------------------------------------------------------------------------
 * Page frame
 * ------------------------------------------------------------------------- */

main { flex: 1 0 auto; }
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 32px var(--gutter) 24px; }
.narrow { max-width: 800px; margin-inline: auto; }

.page-header { max-width: 820px; margin-bottom: 24px; }
.page-header h1 { margin-bottom: .3rem; }
.page-header > p:not(.eyebrow), .page-header > div > p:not(.eyebrow):not(.meta) { color: var(--text-tertiary); font-size: .9375rem; }

.eyebrow { margin: 0 0 .5rem; color: var(--text-tertiary); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.lead { color: var(--text-tertiary); font-size: .9375rem; }
.meta { color: var(--text-tertiary); font-size: .875rem; }
.byline { color: var(--text-secondary); }

.messages { display: grid; gap: 8px; margin-bottom: 20px; }
.message { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); font-size: .875rem; }
.message.success { border-color: var(--success-border); background: var(--success-bg); color: var(--success-fg); }
.message.error { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); }
.message.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-fg); }
.message.info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-fg); }

.notice { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--warning-border); border-radius: var(--radius-md); background: var(--warning-bg); color: var(--warning-fg); font-size: .8125rem; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; max-width: 100%; margin-bottom: 16px; color: var(--text-tertiary); font-size: .8125rem; }
.breadcrumbs a { color: var(--text-tertiary); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span[aria-hidden="true"], .breadcrumbs > span:not([aria-current]) { color: var(--text-muted); }
.breadcrumbs [aria-current="page"] { overflow: hidden; max-width: min(40ch, 100%); color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }

.prose { max-width: var(--prose-max); color: var(--text-secondary); font-size: 1rem; line-height: 1.7; letter-spacing: -.003em; overflow-wrap: break-word; }
.prose a { text-decoration: underline; text-underline-offset: .18em; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose h2, .prose h3 { margin-top: 1.4em; color: var(--text); }

.clamp-toggle { display: inline-flex; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--link); font-size: .8125rem; font-weight: 500; cursor: pointer; }
.clamp-toggle:hover { text-decoration: underline; }
.js [data-clamp].is-clamped { max-height: 10.5em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent); }

.link-arrow { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-size: .875rem; font-weight: 500; text-decoration: none; }
.link-arrow:hover { color: var(--accent-hover); text-decoration: underline; }
.link-arrow .icon { width: 14px; height: 14px; transition: transform 150ms ease; }
.link-arrow:hover .icon { transform: translateX(2px); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-secondary); font-size: .8125rem; font-weight: 500; text-decoration: none; }
.chip:hover { border-color: var(--border-strong); background: var(--bg-muted); color: var(--text); text-decoration: none; }
.chip .icon { width: 14px; height: 14px; color: var(--text-tertiary); }
.chip .icon-trailing { width: 12px; height: 12px; color: var(--text-muted); }
.chip-static, .chip-static:hover { border-color: var(--border); background: var(--bg-subtle); color: var(--text-secondary); }
.chip-pending, .chip-pending:hover { border-style: dashed; background: var(--bg); color: var(--text-tertiary); font-weight: 400; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip-list .chip { min-height: 26px; padding: 3px 10px; line-height: 1.35; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-secondary); font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-decoration: none; }
a.tag:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.tag-semantic { height: 20px; margin-left: 6px; border-color: var(--info-border); background: var(--info-bg); color: var(--info-fg); font-weight: 500; letter-spacing: 0; vertical-align: 1px; cursor: help; }

/* ----------------------------------------------------------------------------
 * Avatars (journal logos and initials)
 * ------------------------------------------------------------------------- */

.avatar { display: grid; flex: none; place-items: center; border-radius: var(--radius-md); overflow: hidden; }
img.avatar { display: block; padding: 3px; border: 1px solid var(--border); background: #fff; object-fit: contain; }
.avatar-initial { background: var(--cat-journals-light); color: var(--cat-journals-dark); font-weight: 650; line-height: 1; text-transform: uppercase; }
.avatar-sm { width: 28px; height: 28px; font-size: .8125rem; }
.avatar-md { width: 40px; height: 40px; font-size: 1rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.25rem; }
.avatar-xl { width: 72px; height: 72px; border-radius: var(--radius-lg); font-size: 1.75rem; }

/* ----------------------------------------------------------------------------
 * Search fields
 * ------------------------------------------------------------------------- */

.search-field { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px; border: 1px solid var(--border-control); border-radius: var(--radius-lg); background: var(--bg); box-shadow: var(--elev-1); transition: var(--transition); }
.search-field:hover { border-color: var(--text-muted); }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--elev-1); }
.search-field-icon { width: 18px; height: 18px; color: var(--text-tertiary); }
.search-field input:not([type="hidden"]) { flex: 1; min-width: 0; min-height: 0; height: 100%; padding: 0; border: 0; background: transparent; font-size: 1rem; box-shadow: none; }
.search-field input:not([type="hidden"]):focus { outline: none; box-shadow: none; }
.search-field input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.search-field .search-field-select { flex: none; width: auto; max-width: 150px; min-height: 0; height: 28px; padding: 0 1.8rem 0 .75rem; border: 0; border-left: 1px solid var(--border); border-radius: 0; background-color: transparent; color: var(--text-secondary); font-size: .8125rem; font-weight: 500; box-shadow: none; cursor: pointer; }
.search-field .search-field-select:focus { box-shadow: none; color: var(--text); }
.search-field .search-field-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-field .btn { flex: none; min-height: 36px; padding: 0 1.1rem; }
.search-field-xl { height: 58px; padding-left: 18px; border-radius: 14px; }
.search-field-xl input:not([type="hidden"]) { font-size: 1.0625rem; }
.search-field-xl .btn { min-height: 44px; padding: 0 1.4rem; border-radius: 10px; font-size: .9375rem; }

/* ----------------------------------------------------------------------------
 * Home
 * ------------------------------------------------------------------------- */

.home-hero { max-width: 880px; margin: 0 auto; padding: clamp(56px, 11vh, 120px) var(--gutter) 48px; }
.hero-title { max-width: 780px; margin: 0 0 20px; color: var(--text); font-size: clamp(2.25rem, 5.6vw, 3.5rem); font-weight: 700; line-height: 1.05; letter-spacing: -.035em; }
.hero-lead { max-width: 640px; margin: 0 0 36px; color: var(--text-tertiary); font-size: clamp(1rem, 1.6vw, 1.1875rem); line-height: 1.6; }
.hero-search { max-width: 700px; }
.hero-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; color: var(--text-tertiary); font-size: .8125rem; }
.hero-examples span { margin-right: 2px; }
.hero-examples a { padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-secondary); text-decoration: none; }
.hero-examples a:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); text-decoration: underline; }

.home-stats { border-block: 1px solid var(--border-subtle); background: var(--bg-subtle); }
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; max-width: 880px; margin: 0 auto; padding: 24px var(--gutter); }
.stat-strip div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; }
.stat-strip dt { color: var(--text-tertiary); font-size: .8125rem; }
.stat-strip dd { color: var(--text); font-size: 1.75rem; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }

.home-body { display: grid; gap: 56px; max-width: var(--page-max); margin: 0 auto; padding: 56px var(--gutter) 24px; }
.home-columns { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(280px, 1fr); gap: 40px; align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 1.125rem; }
.section-title { margin: 0; font-size: 1rem; }
.section-title .muted { margin-left: 4px; font-weight: 500; }

.news-feed { border: 1px solid var(--border); border-radius: var(--radius-md); }
.news-item { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.news-item:last-child { border-bottom: 0; }
.news-item time { color: var(--text-tertiary); font-size: .75rem; font-weight: 500; }
.news-item h3 { margin: 3px 0 4px; font-size: .875rem; }
.news-item p { color: var(--text-tertiary); font-size: .8125rem; }
.news-feed > .muted { padding: 16px; }

.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.source-card { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: inherit; text-decoration: none; transition: var(--transition); }
.source-card:hover { border-color: var(--accent); box-shadow: var(--elev-1); text-decoration: none; }
.source-card:hover .source-card-name { text-decoration: underline; text-underline-offset: .18em; }
.source-card .avatar { margin-bottom: 10px; }
.source-card-name { color: var(--text); font-size: .875rem; font-weight: 600; line-height: 1.35; }
.source-card-meta { overflow: hidden; color: var(--text-tertiary); font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; }
.source-card-foot { margin-top: auto; padding-top: 10px; color: var(--text-tertiary); font-size: .75rem; font-variant-numeric: tabular-nums; }

.home-cta { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 32px; border: 1px solid var(--accent-border); border-radius: var(--radius-lg); background: var(--accent-soft); }
.home-cta h2 { margin: 0 0 6px; font-size: 1.25rem; }
.home-cta p { max-width: 600px; color: var(--text-tertiary); }
.cta-actions { display: flex; flex: none; flex-wrap: wrap; gap: 8px; }

/* ----------------------------------------------------------------------------
 * Search results (SERP) layout
 * ------------------------------------------------------------------------- */

.serp { display: grid; grid-template-areas: "main rail"; grid-template-columns: minmax(0, 1fr) var(--rail-width); gap: 32px; align-items: start; }
.serp-single { grid-template-areas: "main"; grid-template-columns: minmax(0, 1fr); }
.serp-main { grid-area: main; min-width: 0; }
.serp > .rail { grid-area: rail; }

.serp-search { max-width: 860px; }
.search-start { max-width: 640px; margin-top: 40px; }
.search-start h2 { font-size: 1.25rem; }
.search-start p { color: var(--text-tertiary); font-size: .9375rem; }
.search-start-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.tabs { display: flex; gap: 4px; margin: 20px 0 24px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; padding: 10px 12px; border-bottom: 2px solid transparent; color: var(--text-tertiary); font-size: .875rem; font-weight: 500; white-space: nowrap; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { border-bottom-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab-count { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--bg-muted); color: var(--text-tertiary); font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }

.results-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 8px; }
.results-total { margin: 0; color: var(--text-tertiary); font-size: .875rem; font-variant-numeric: tabular-nums; }
.results-group { margin-bottom: 28px; }
.results-group-title { margin: 0 0 8px; font-size: .9375rem; }
.results-more { margin-top: 10px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.chip-removable { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }
.chip-removable .icon { color: var(--accent); }
.chip-removable span { overflow: hidden; max-width: 320px; text-overflow: ellipsis; white-space: nowrap; }
.chip-removable:hover { border-color: var(--accent); background: var(--bg); }

.results-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); }
.result { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); transition: var(--transition); }
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--bg-subtle); }
.result-main { flex: 1; min-width: 0; }
.result-title { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.4; letter-spacing: -.005em; overflow-wrap: break-word; }
.result-title a { color: var(--text); }
.result-title a:hover { color: var(--accent); text-decoration: underline; }
.result-meta { margin: 3px 0 0; color: var(--text-secondary); font-size: .875rem; }
.result-source { margin: 2px 0 0; color: var(--text-tertiary); font-size: .875rem; }
.result-source a { color: var(--text-tertiary); }
.result-source a:hover { color: var(--text); }
.result-snippet { display: -webkit-box; margin: 6px 0 0; overflow: hidden; color: var(--text-tertiary); font-size: .875rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.result-aside { margin-top: 2px; }
.result-stat { flex: none; margin: 2px 0 0; color: var(--text-tertiary); font-size: .75rem; text-align: right; white-space: nowrap; }
.result-stat strong { display: block; color: var(--text); font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.results-empty { padding: 40px 24px; color: var(--text-tertiary); text-align: center; }
.results-empty h3 { margin-bottom: 4px; color: var(--text); font-size: .9375rem; }

/* Facet rail */
.rail { min-width: 0; }
.rail > summary { display: none; }
.rail-body { display: grid; gap: 20px; }
.facet-title { margin: 0 0 6px; color: var(--text); font-size: .875rem; font-weight: 600; }
.facet-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.facet-bucket { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; margin-inline: -8px; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: .8125rem; line-height: 1.35; text-decoration: none; }
.facet-bucket:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.facet-bucket.is-active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 var(--accent); font-weight: 600; }
.facet-bucket.is-active .icon { color: var(--accent); }
.facet-label { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.facet-count { flex: none; color: var(--text-tertiary); font-size: .75rem; font-variant-numeric: tabular-nums; }
.facet-bucket .icon { width: 14px; height: 14px; color: var(--text-tertiary); }
.facet-more > summary { display: inline-flex; margin-top: 4px; color: var(--text-tertiary); font-size: .8125rem; font-weight: 500; list-style: none; cursor: pointer; }
.facet-more > summary::-webkit-details-marker { display: none; }
.facet-more > summary::before { content: "+"; margin-right: 6px; }
.facet-more > summary:hover { color: var(--text); }
.facet-more[open] > summary { display: none; }
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 2px; }
.letter-grid a { display: grid; place-items: center; height: 30px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: .8125rem; font-weight: 500; text-decoration: none; }
.letter-grid a:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.letter-grid a.is-active { background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: underline; text-underline-offset: .2em; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.page-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.page-number, .page-gap { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: .8125rem; font-weight: 500; text-decoration: none; font-variant-numeric: tabular-nums; }
a.page-number:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.page-number[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.page-gap { color: var(--text-muted); }
.page-step { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-secondary); font-size: .8125rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
a.page-step:hover { border-color: var(--border-strong); background: var(--bg-muted); color: var(--text); text-decoration: none; }
.page-step[aria-disabled="true"] { border-color: var(--border-subtle); color: var(--text-disabled); }
.page-step .icon { width: 14px; height: 14px; }
.page-status { display: none; color: var(--text-tertiary); font-size: .8125rem; }

/* ----------------------------------------------------------------------------
 * Entity pages (article and journal detail)
 * ------------------------------------------------------------------------- */

.entity-header { margin-bottom: 24px; }
.entity-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.entity-kicker .breadcrumbs { margin: 0; }
.type-tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: var(--radius-sm); font-size: .75rem; font-weight: 600; }
.type-tag .icon { width: 14px; height: 14px; }
.type-article { background: var(--cat-articles-light); color: var(--cat-articles-dark); }
.type-journal { background: var(--cat-journals-light); color: var(--cat-journals-dark); }
.entity-identity { display: flex; align-items: center; gap: 18px; }
.entity-title { max-width: 960px; margin: 0; font-size: clamp(1.375rem, 2.6vw, 1.75rem); font-weight: 650; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: break-word; }
.entity-alt-title { max-width: 960px; margin: 6px 0 0; color: var(--text-tertiary); font-size: 1rem; font-style: italic; line-height: 1.45; }
.entity-byline { max-width: 960px; margin: 12px 0 0; color: var(--text-secondary); font-size: .875rem; }
.entity-sub { display: flex; flex-wrap: wrap; margin: 6px 0 0; color: var(--text-tertiary); font-size: .8125rem; }
.entity-sub span + span::before { content: "·"; margin-inline: 8px; color: var(--text-muted); }
.entity-sub a { color: var(--text-secondary); }
.linkouts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.linkouts .btn .icon { width: 15px; height: 15px; }

.entity-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-width); gap: 24px; align-items: start; }
.entity-main, .entity-side { display: grid; gap: 16px; min-width: 0; }
.entity-main > section:not(.card) { margin-top: 8px; }

.card { padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.card-loose { padding: 24px; }
.card-title { margin: 0 0 12px; font-size: .9375rem; font-weight: 600; }
.datum-section + .datum-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-subtle); }
.datum-list { display: grid; }
.datum-list > div { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border-subtle); font-size: .8125rem; }
.datum-list > div:first-child { border-top: 0; padding-top: 0; }
.prose ~ .datum-list { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.prose ~ .datum-list > div:first-child { padding-top: 9px; }
.datum-list dt { color: var(--text-tertiary); font-weight: 500; }
.datum-list dd { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-grid div { display: flex; flex-direction: column-reverse; gap: 2px; }
.metric-grid dt { color: var(--text-tertiary); font-size: .75rem; font-weight: 500; }
.metric-grid dd { font-size: 1.375rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card.facet .card-title { margin-bottom: 6px; }
.volume-summary { max-height: 320px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.volume-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border-subtle); font-size: .8125rem; }
.volume-summary li:first-child { border-top: 0; }
.volume-summary .muted { font-size: .75rem; text-align: right; }
.link-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

/* ----------------------------------------------------------------------------
 * News, content pages, status pages
 * ------------------------------------------------------------------------- */

.news-entry { padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); }
.news-entry:last-child { border-bottom: 0; }
.news-entry h2 { margin: 4px 0 8px; font-size: 1.0625rem; }
.news-list + .pagination { margin-top: 16px; }

.doc-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; align-items: start; }
.doc-nav { position: sticky; top: 24px; display: grid; gap: 1px; }
.doc-nav-title { margin: 0 0 6px; padding: 0 10px; color: var(--text-tertiary); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.doc-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: .875rem; text-decoration: none; }
.doc-nav a:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.doc-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 var(--accent); font-weight: 600; }
.content-page { max-width: 760px; }
.content-page .page-header { padding-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.managed-copy p { white-space: pre-line; }
.form-page { max-width: 640px; }

.status-page { max-width: 560px; margin: 48px auto; text-align: center; }
.status-page p:not(.eyebrow) { color: var(--text-tertiary); font-size: .9375rem; }
.status-actions, .hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }

/* ----------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------- */

.site-footer { margin-top: 72px; border-top: 1px solid var(--border); background: var(--bg-subtle); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 48px; max-width: var(--page-max); margin: 0 auto; padding: 48px var(--gutter) 32px; }
.footer-brand p { max-width: 340px; margin-top: 12px; color: var(--text-tertiary); font-size: .8125rem; }
.footer-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.footer-columns h2 { margin: 0 0 10px; font-size: .8125rem; font-weight: 600; letter-spacing: 0; }
.footer-columns a { display: block; padding: 3px 0; color: var(--text-tertiary); font-size: .8125rem; text-decoration: none; }
.footer-columns a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: var(--page-max); margin: 0 auto; padding: 16px var(--gutter) 32px; border-top: 1px solid var(--border-subtle); color: var(--text-tertiary); font-size: .75rem; }
.footer-bottom p { margin: 0; }

/* ----------------------------------------------------------------------------
 * Forms (accounts, contact, portals)
 * ------------------------------------------------------------------------- */

.panel { padding: clamp(20px, 3vw, 28px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.form-stack, .stacked-form { display: grid; gap: 16px; }
.stacked-form { margin-block: 20px; }
.two-column-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-column-form .form-actions, .two-column-form .form-errors { grid-column: 1 / -1; }
.form-row label, .form-field label { display: block; margin-bottom: 6px; color: var(--text); font-size: .8125rem; font-weight: 500; }
.form-row label span[aria-hidden], .form-field label span[aria-hidden] { color: var(--danger-fg); }
.form-row.has-error input, .form-row.has-error textarea, .form-row.has-error select,
.form-field.has-error input, .form-field.has-error textarea, .form-field.has-error select { border-color: var(--danger-fg); }
.help-text { margin-top: 6px; color: var(--text-tertiary); font-size: .75rem; }
.help-text ul { margin: 4px 0 0; padding-left: 1.1rem; }
.field-error, .field-errors, .form-errors { margin-top: 6px; color: var(--danger-fg); font-size: .8125rem; }
.field-errors ul, .form-errors ul { margin: 0; padding-left: 1.1rem; }
.form-errors { padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: var(--radius-md); background: var(--danger-bg); }
.form-actions { display: flex; gap: 8px; }
button:disabled { opacity: .55; cursor: not-allowed; }

.auth-layout { display: grid; place-items: start center; padding-top: clamp(8px, 4vh, 40px); }
.auth-card { width: min(100%, 440px); padding: clamp(24px, 4vw, 36px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); box-shadow: var(--elev-1); }
.auth-card-wide { width: min(100%, 720px); }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .stacked-form button { width: 100%; min-height: 40px; }
.auth-card .two-column-form .form-actions button { width: auto; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-block: 16px; font-size: .8125rem; }

/* ----------------------------------------------------------------------------
 * Publisher and staff portals
 * ------------------------------------------------------------------------- */

.section-block { margin-top: 40px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading > span { color: var(--text-tertiary); font-size: .8125rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card-grid .card h2, .card-grid .card h3 { font-size: 1rem; }
.publisher-journal-grid .card { display: flex; flex-direction: column; }
.publisher-journal-grid .button { margin-top: auto; }
.journal-logo { display: block; width: auto; max-width: 100%; height: 48px; margin-bottom: 12px; object-fit: contain; object-position: left center; }
.journal-logo-small { float: left; max-width: 80px; height: 40px; margin: 0 12px 8px 0; }
.journal-logo-detail { max-width: 200px; height: 96px; margin-bottom: 16px; }

.detail-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border-subtle); }
.detail-layout, .article-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-width); gap: 32px; align-items: start; }
.detail-layout .section-block:first-child, .detail-layout > div > .section-block:first-child { margin-top: 0; }
.sidebar-card { position: sticky; top: 16px; padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.sidebar-card h2 { margin: 20px 0 10px; font-size: .9375rem; }
.sidebar-card h2:first-child { margin-top: 0; }
.plain-list, .tag-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--border-subtle); font-size: .8125rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li { padding: 2px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .8125rem; }

.compact-facts > div, .detail-facts > div, .stacked-facts > div { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.compact-facts dt, .detail-facts dt, .stacked-facts dt, .summary-grid dt { color: var(--text-tertiary); font-size: .75rem; font-weight: 500; }
.compact-facts dd, .detail-facts dd, .stacked-facts dd, .summary-grid dd { margin-top: 2px; font-size: .875rem; overflow-wrap: anywhere; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin-bottom: 24px; }
.summary-grid > div { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.application-summary .prose { margin-top: 20px; }
.application-summary .prose h3 { margin-bottom: 4px; font-size: .875rem; }

.result-count { margin: 16px 0 8px; color: var(--text-tertiary); font-size: .875rem; }
.result-list { border-top: 1px solid var(--border-subtle); }
.result-item { padding: 14px 0; border-bottom: 1px solid var(--border-subtle); }
.result-item h2, .result-item h3 { margin-bottom: 4px; font-size: .9375rem; font-weight: 500; }
.empty-state { margin-block: 16px; padding: 40px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-tertiary); text-align: center; }
.empty-state h2, .empty-state h3 { color: var(--text); font-size: 1rem; }
.empty-state .button { margin-top: 12px; }
.alphabet { display: flex; flex-wrap: wrap; gap: 2px; }
.alphabet a { min-width: 30px; padding: 4px 6px; border-radius: var(--radius-sm); text-align: center; }
.alphabet a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }

.status-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-muted); color: var(--text-secondary); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.status-submitted, .status-under_review, .status-ready_for_decision, .status-in_progress { border-color: var(--info-border); background: var(--info-bg); color: var(--info-fg); }
.status-approved, .status-pass, .status-resolved, .status-published, .status-active { border-color: var(--success-border); background: var(--success-bg); color: var(--success-fg); }
.status-rejected, .status-fail { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); }
.status-changes_requested, .status-open, .status-draft { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-fg); }
.status-not_applicable, .status-spam, .status-withdrawn, .status-archived, .status-inactive { border-color: var(--border); background: var(--bg-muted); color: var(--text-tertiary); }

.application-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: none; }
.application-list { display: grid; gap: 8px; }
.application-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 16px 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); transition: var(--transition); }
.application-card:hover { border-color: var(--border-strong); }
.application-card h2 { margin-bottom: 2px; font-size: 1rem; }
.application-card h2 a { color: var(--text); }
.application-card p:not(.meta) { color: var(--text-tertiary); font-size: .8125rem; }
.application-status { display: grid; justify-items: end; gap: 6px; }
.application-status-large { align-content: start; padding-top: 4px; }
.application-form { padding: clamp(20px, 3vw, 28px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.application-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.application-form .field-description, .application-form .field-address, .application-form .field-review_process, .application-form .field-indexing_services_text, .application-form .field-submission_notes { grid-column: 1 / -1; }
.application-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.current-upload { margin-top: 12px; }
.decision-notice { margin-bottom: 24px; padding: 16px 18px; border: 1px solid var(--warning-border); border-radius: var(--radius-md); background: var(--warning-bg); }
.decision-notice h2 { margin-bottom: 4px; font-size: .9375rem; }
.decision-rejected { border-color: var(--danger-border); background: var(--danger-bg); }
.stacked-actions { display: grid; gap: 8px; }
.stacked-actions form { margin: 0; }
.publisher-manage-header .stacked-actions { align-content: start; }

.volume-list { display: grid; gap: 12px; }
.volume-card { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.volume-card > header { display: flex; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.volume-card h3 { margin-bottom: 2px; }
.issue-list { margin: 0; padding: 0; list-style: none; }
.issue-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); }
.issue-list li:last-child { border-bottom: 0; }
.issue-list .meta { display: block; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 14px; font-size: .8125rem; }
.row-actions form { margin: 0; }
.row-actions button, .text-danger { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--link); font-size: .8125rem; font-weight: 500; cursor: pointer; }
.row-actions .text-danger, .text-danger { color: var(--danger-fg); }
.row-actions button:hover, .text-danger:hover { text-decoration: underline; }
.publisher-article-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }

.content-form, .narrow-page { width: min(100%, 760px); }
.narrow-page { margin-inline: auto; }
.prose-card { width: min(100%, 900px); }
.prose-card > header { padding-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.managed-copy { margin-top: 24px; }

.staff-queue-summary { display: grid; min-width: 140px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; text-align: center; }
.staff-queue-summary strong { font-size: 2rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.staff-queue-summary span { color: var(--text-tertiary); font-size: .75rem; }

.advanced-search, .contact-filter, .lifecycle-filter, .audit-filter { display: grid; gap: 12px; align-items: end; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle); }
.advanced-search { grid-template-columns: minmax(0, 1fr) 220px auto; }
.staff-filter { grid-template-columns: minmax(0, 1fr) 260px auto; }
.contact-filter { grid-template-columns: minmax(0, 1fr) 200px 200px auto; }
.lifecycle-filter { grid-template-columns: minmax(0, 1fr) repeat(3, 170px) auto; }
.audit-filter { grid-template-columns: minmax(0, 1fr) 220px 160px 150px 150px auto; }
.advanced-search label, .contact-filter label, .lifecycle-filter label, .audit-filter label { display: block; margin-bottom: 6px; color: var(--text-tertiary); font-size: .75rem; font-weight: 600; }
.advanced-search button, .contact-filter button, .lifecycle-filter button, .audit-filter button { min-height: 38px; }

.review-history { display: grid; gap: 8px; }
.review-history article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; }
.review-history article p { margin-bottom: 0; }
.review-comment { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--border-subtle); color: var(--text-secondary); }
.review-formset { display: grid; gap: 12px; }
.criterion-card { min-width: 0; margin: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; }
.criterion-card legend { padding-inline: 6px; font-weight: 600; }
.criterion-fields { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(120px, .25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.compact-criteria { max-height: 320px; overflow: auto; font-size: .8125rem; }

.operations-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.operation-card { display: grid; gap: 4px; min-height: 160px; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); text-decoration: none; transition: var(--transition); }
.operation-card:hover { border-color: var(--border-strong); background: var(--bg-subtle); box-shadow: var(--elev-1); text-decoration: none; }
.operation-card strong { font-size: 2.25rem; font-weight: 650; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.operation-card span { align-self: end; font-weight: 600; }
.operation-card small { color: var(--text-tertiary); font-size: .75rem; }

.news-management-list, .contact-management-list, .lifecycle-list, .audit-list { border-top: 1px solid var(--border-subtle); }
.news-management-list article, .contact-management-list article, .lifecycle-list > article, .audit-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--border-subtle); }
.news-management-list h2, .contact-management-list h2, .lifecycle-list h2, .lifecycle-list h3, .audit-list h2 { margin-bottom: 4px; font-size: .9375rem; }
.lifecycle-list.compact > article { padding-block: 10px; }
.audit-list h2 { font-family: var(--font-mono); font-size: .875rem; letter-spacing: 0; }
.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.danger-zone form { margin: 0; }
.contact-message-body, .audit-message { box-shadow: none; }
.action-disclosure { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); }
.action-disclosure summary { font-weight: 600; cursor: pointer; }
.action-disclosure[open] summary { margin-bottom: 12px; }
.danger-disclosure { border-color: var(--danger-border); }
.danger-disclosure summary { color: var(--danger-fg); }
.metadata-block { max-width: 100%; overflow: auto; padding: 16px; border-radius: var(--radius-md); background: var(--code-bg); color: var(--code-fg); font-family: var(--font-mono); font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.managed-page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.content-editor-form textarea { min-height: 420px; }
.revision-list { display: grid; gap: 8px; }
.revision-list article { padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; }
.revision-list article p { margin-bottom: 4px; }
.revision-list details { margin-top: 10px; }
.revision-list summary { font-weight: 600; cursor: pointer; }
.revision-body { max-height: 360px; margin-top: 10px; padding-top: 10px; overflow: auto; border-top: 1px solid var(--border-subtle); }

.alternate-title { font-style: italic; }
.prominent { font-size: 1rem; }

/* ----------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .home-columns { grid-template-columns: minmax(0, 1fr); }
  .operations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lifecycle-filter, .audit-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .topbar-nav, .topbar-search { display: none; }
  .mobile-menu { display: block; }
  .topbar-actions, .topbar-search + .topbar-actions { margin-left: auto; }

  .serp { grid-template-areas: "rail" "main"; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .rail > summary { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: .8125rem; font-weight: 500; list-style: none; cursor: pointer; }
  .rail > summary::-webkit-details-marker { display: none; }
  .rail-caret { color: var(--text-muted); transition: transform 150ms ease; }
  .rail[open] .rail-caret { transform: rotate(180deg); }
  .rail[open] > .rail-body { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }

  .entity-layout, .detail-layout, .article-layout, .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .doc-nav-title { display: none; }
  .sidebar-card { position: static; }
  .detail-header { grid-template-columns: minmax(0, 1fr); }
  .source-grid, .card-grid, .managed-page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .home-cta { flex-direction: column; align-items: flex-start; }

  .advanced-search, .staff-filter, .criterion-fields { grid-template-columns: minmax(0, 1fr); }
  .contact-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .application-heading { flex-direction: column; align-items: flex-start; }
  .application-form-grid, .summary-grid, .two-column-form { grid-template-columns: minmax(0, 1fr); }
  .application-form .field-description, .application-form .field-address, .application-form .field-review_process, .application-form .field-indexing_services_text, .application-form .field-submission_notes { grid-column: auto; }
  .volume-card > header, .issue-list li { flex-direction: column; align-items: flex-start; }
  .row-actions { justify-content: flex-start; }
  .review-history article, .publisher-article-row, .news-management-list article, .contact-management-list article, .lifecycle-list > article, .audit-list article { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .review-comment { grid-column: auto; }
}

@media (max-width: 640px) {
  .topbar-inner { gap: 8px; }
  .topbar .brand-wordmark { display: none; }
  .topbar .brand-compact { display: block; }
  .page { padding-top: 20px; }
  .account-name, .topbar-auth.btn-ghost { display: none; }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stat-strip dd { font-size: 1.25rem; }
  .source-grid, .card-grid, .managed-page-grid, .operations-grid, .contact-filter, .lifecycle-filter, .audit-filter { grid-template-columns: minmax(0, 1fr); }
  .search-field { height: 48px; padding-left: 12px; }
  .search-field-icon { display: none; }
  .search-field .search-field-select { max-width: 104px; padding-left: .5rem; }
  .search-field .btn, .search-field-xl .btn { min-height: 36px; padding: 0 .8rem; }
  .result { padding: 12px 14px; }
  .result-journal .avatar { width: 32px; height: 32px; font-size: .875rem; }
  .entity-identity { align-items: flex-start; }
  .entity-identity .avatar-xl { width: 52px; height: 52px; font-size: 1.25rem; }
  .datum-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .page-numbers { display: none; }
  .page-status { display: block; }
  .application-card { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .application-status { justify-items: start; }
  .application-actions { flex-direction: column; align-items: stretch; }
  .footer-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-cta { padding: 24px; }
}

@media (max-width: 400px) {
  .topbar-auth.btn-primary { display: none; }
}
