/* ==========================================================================
   ACTA Digital Library
   Interface stylesheet — light scholarly database, sans-serif UI,
   orange brand accent, blue links and actions, hairline structure.
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --font-serif: Baskerville, "Iowan Old Style", "Palatino Linotype", Palatino,
    Georgia, "Times New Roman", serif;

  --ink: #24272b;
  --ink-2: #454c54;
  --muted: #656d77;
  --faint: #8a929b;

  --line: #dbdfe4;
  --line-soft: #eceef1;
  --band: #f5f6f7;
  --paper: #ffffff;
  --wash: #fafbfc;

  --brand: #e2731f;
  --brand-ink: #a94f0c;
  --link: #1a5ba6;
  --link-hover: #103f75;
  --action: #1a55c4;
  --action-hover: #123f92;

  --radius: 4px;
  --ring: 0 0 0 3px rgba(26, 85, 196, 0.16);
  --container: 1200px;
  --gutter: 32px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.12s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

::selection {
  background: #f8ddc6;
  color: #24272b;
}

:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 14px;
}

.skip-link:focus {
  top: 0;
  color: #fff;
  text-decoration: none;
}

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ic-sm {
  width: 15px;
  height: 15px;
}

.ic-lg {
  width: 22px;
  height: 22px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 44px;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  flex: none;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: auto;
  height: 30px;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  font-size: 15.5px;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--brand-ink);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--ink);
  font-weight: 600;
}

.nav-link .ic {
  width: 17px;
  height: 17px;
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.lang-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--link);
  white-space: nowrap;
}

.lang-link .ic {
  width: 16px;
  height: 16px;
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: #b9c0c7;
}

.nav-toggle .ic {
  width: 19px;
  height: 19px;
}

/* --------------------------------------------------------------------------
   Type and page heads
   -------------------------------------------------------------------------- */

.display {
  font-size: clamp(32px, 3.2vw, 40px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--ink);
}

.page-hero {
  padding-top: 46px;
}

.page-title {
  font-size: clamp(30px, 2.9vw, 38px);
  line-height: 1.16;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.page-lede {
  margin-top: 12px;
  max-width: 680px;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--muted);
}

.section {
  padding-top: 64px;
}

.section-head {
  max-width: 760px;
}

.section-title {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.section-sub {
  margin-top: 9px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
}

.rule {
  height: 0;
  margin: 56px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.text-link {
  font-size: 14.5px;
  color: var(--link);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   Modes (tab strip) and hero search
   -------------------------------------------------------------------------- */

.hero {
  padding-top: 54px;
}

.modes {
  display: flex;
  align-items: flex-end;
  gap: 34px;
  margin-top: 34px;
  border-bottom: 1px solid var(--line);
}

.mode {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0 1px 13px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.mode:hover {
  color: var(--ink);
}

.mode[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.modes-tail {
  margin-left: auto;
  padding-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--link);
}

.modes-tail .ic {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Search form
   -------------------------------------------------------------------------- */

.search-panel {
  margin-top: 26px;
}

.search-row {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

.fieldbox {
  position: relative;
  height: 64px;
  border: 1px solid #828b95;
  border-radius: var(--radius);
  background: #fff;
}

.fieldbox:focus-within {
  border-color: var(--action);
  box-shadow: var(--ring);
}

.fieldbox-label {
  position: absolute;
  left: 14px;
  top: 9px;
  z-index: 1;
  font-size: 12px;
  line-height: 1.2;
  color: var(--link);
  pointer-events: none;
}

.fieldbox select {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 24px 42px 6px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

.fieldbox select:focus {
  outline: none;
}

.fieldbox .chev {
  position: absolute;
  right: 14px;
  top: 50%;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: #5e6772;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 64px;
  border: 1px solid #828b95;
  border-radius: var(--radius);
  background: #fff;
  padding: 0 16px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
}

.search-input::placeholder {
  color: #8a929b;
  opacity: 1;
}

.search-input:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: var(--ring);
}

.extra-fields {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.extra-field {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 38px;
  gap: 16px;
  align-items: center;
}

.field-remove {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.field-remove:hover {
  border-color: #b9c0c7;
  color: var(--ink);
}

.field-remove .ic {
  width: 15px;
  height: 15px;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 20px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.2;
  color: var(--link);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  font-family: inherit;
}

.action-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.action-link .ic {
  width: 16px;
  height: 16px;
}

.search-submit {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    color 0.12s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--action);
  border-color: var(--action);
  color: #fff;
}

.btn-primary:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
  color: #fff;
}

.btn-quiet {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover {
  border-color: #aeb5bd;
  color: var(--ink);
}

.btn-sm {
  height: 40px;
  padding: 0 17px;
  font-size: 14px;
}

.btn .ic {
  width: 17px;
  height: 17px;
}

/* --------------------------------------------------------------------------
   Home: history + promo
   -------------------------------------------------------------------------- */

.home-lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 64px;
  margin-top: 34px;
  align-items: start;
}

.rule-form {
  margin-top: 42px;
}

.history-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.history-title {
  margin-bottom: -1px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0 0 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.2;
  color: var(--link);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.history-body {
  margin-top: 20px;
}

.history-empty {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 22px 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--wash);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.history-empty .empty-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef1f5;
  color: #5f6b7a;
}

.history-empty .empty-mark .ic {
  width: 17px;
  height: 17px;
}

.history-empty strong {
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.history-empty p {
  margin: 0;
}

.history-list {
  border-top: 1px solid var(--line-soft);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}

.history-query {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.history-meta {
  flex: none;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.history-run {
  flex: none;
  font-size: 14px;
}

.promo {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 24px 24px 26px;
  background: #fff;
}

.promo-eyebrow {
  margin: 0 0 13px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand-ink);
}

.promo-title {
  margin: 0 0 11px;
  font-size: 24px;
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.promo-text {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
}

.promo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Subject browse grid
   -------------------------------------------------------------------------- */

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px 32px;
  margin-top: 32px;
}

.subject-name {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
}

.subject-list {
  display: grid;
  gap: 13px;
}

.subject-list a {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  color: var(--link);
}

.subject-list a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.subject-list .abbr {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Grey band
   -------------------------------------------------------------------------- */

.band {
  margin-top: 72px;
  padding: 52px 0 56px;
  background: var(--band);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.band-title {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.band-text {
  margin-top: 13px;
  max-width: 840px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.band-links {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Journal tabs, toolbar, records
   -------------------------------------------------------------------------- */

.subject-tabs {
  display: flex;
  gap: 30px;
  margin-top: 34px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.subject-tabs::-webkit-scrollbar {
  display: none;
}

.subject-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0 1px 13px;
  font-size: 15.5px;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.subject-tab:hover {
  color: var(--ink);
}

.subject-tab[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 0;
}

.filter-input {
  width: 300px;
  max-width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
}

.filter-input::placeholder {
  color: var(--faint);
}

.filter-input:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: var(--ring);
}

.count {
  margin-left: auto;
  font-size: 13.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.journal-group {
  padding-top: 36px;
  scroll-margin-top: 96px;
}

.journal-group-title {
  font-size: 19px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
}

.record-list {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}

.record-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px 1px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--ink-2);
}

.record-title {
  font-size: 18.5px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.record-title a {
  color: var(--link);
}

.record-title a:hover {
  color: var(--link-hover);
}

.record-latin {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.record-meta {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.record-meta .sep {
  padding: 0 4px;
  color: #b3bac2;
}

.record-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  font-size: 13.5px;
  color: var(--link);
  white-space: nowrap;
}

.record-action .ic {
  width: 14px;
  height: 14px;
}

.filter-empty {
  margin-top: 40px;
  padding: 28px 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--wash);
  font-size: 15px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Search results page
   -------------------------------------------------------------------------- */

.search-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 52px;
  margin-top: 34px;
  padding-bottom: 56px;
  align-items: start;
}

.refine {
  position: static;
}

.refine-title {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.refine-within {
  margin-top: 18px;
}

.refine-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-2);
}

.refine-input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.refine-input[readonly] {
  cursor: default;
}

.refine-label {
  margin-top: 24px;
  padding-bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-group {
  border-bottom: 1px solid var(--line-soft);
}

.filter-title {
  margin: 0;
  padding: 14px 0 10px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

.filter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 0 10px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.filter-toggle:hover {
  color: var(--brand-ink);
}

.filter-toggle .chev-sm {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ink-2);
  transition: transform 0.15s ease;
}

.filter-group.is-collapsed .filter-toggle .chev-sm {
  transform: rotate(-90deg);
}

.filter-group.is-collapsed .filter-body {
  display: none;
}

.filter-body {
  padding-bottom: 16px;
}

.filter-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  cursor: pointer;
}

.filter-opt input {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: var(--action);
  flex: none;
}

.year-mode {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.year-mode label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: default;
}

.year-mode input {
  width: 15px;
  height: 15px;
  accent-color: var(--action);
  flex: none;
}

.year-scale {
  position: relative;
  height: 40px;
  margin: 16px 0 12px;
}

.year-track {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: #c3c9d1;
}

.year-handle {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

.year-handle-start {
  left: 0;
}

.year-handle-end {
  right: 0;
}

.year-ticks {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  height: 10px;
}

.year-ticks span {
  width: 1px;
  height: 100%;
  background: var(--line);
}

.year-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-inputs input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--muted);
}

.year-inputs input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.year-inputs input[readonly] {
  cursor: default;
}

.year-inputs .dash {
  flex: none;
  color: var(--faint);
}

.filter-note {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.filter-note .ic {
  width: 15px;
  height: 15px;
  color: #2e6b3f;
}

.recent-list {
  display: grid;
  gap: 8px;
  padding: 0 0 14px;
  font-size: 13.5px;
}

.recent-list a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-empty {
  font-size: 13.5px;
  color: var(--faint);
}

.aside-card {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.aside-title {
  margin-bottom: 11px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.field-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.results-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.results-count {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.results-query {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.results-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding-bottom: 2px;
}

.sort-label {
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.sort-select {
  height: 34px;
  max-width: 168px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--muted);
}

.sort-select:disabled {
  background: #fbfbfc;
  opacity: 1;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.view-toggle button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  color: var(--faint);
  cursor: default;
}

.view-toggle button:first-child {
  border-left: 0;
}

.view-toggle button[aria-pressed="true"] {
  background: var(--band);
  color: var(--ink-2);
}

.view-toggle .ic {
  width: 17px;
  height: 17px;
}

.table-scroll {
  overflow-x: auto;
}

.result-table {
  width: 100%;
  margin-top: 4px;
  border-collapse: collapse;
  table-layout: fixed;
}

.result-table th {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink);
  vertical-align: bottom;
}

.result-table .th-check {
  width: 34px;
  padding-left: 2px;
}

.result-table .th-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--action);
}

.result-table .th-authors {
  width: 24%;
}

.result-table .th-source {
  width: 30%;
}

.result-table .th-year {
  width: 64px;
}

.result-table .table-note {
  padding: 22px 14px 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

#results-list > .empty:first-child {
  margin-top: 26px;
}

.titles-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.titles-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
}

.empty {
  margin-top: 24px;
  padding: 30px 28px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--wash);
}

.empty-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #eaeff7;
  color: var(--action);
}

.empty-icon .ic {
  width: 19px;
  height: 19px;
}

.empty-title {
  margin-bottom: 6px;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}

.empty-text {
  max-width: 540px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
}

.empty-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 16px;
  font-size: 14.5px;
}

.results > .empty:first-child {
  margin-top: 0;
}

.callout-page {
  margin-bottom: 64px;
}

.quick-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 18px;
  font-size: 14.5px;
}

.quick-subjects a {
  color: var(--link);
}

.noscript-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Document pages (about, help)
   -------------------------------------------------------------------------- */

.doc-head {
  padding-top: 46px;
}

.doc-title {
  font-family: var(--font-serif);
  font-size: clamp(31px, 3.1vw, 39px);
  line-height: 1.16;
  font-weight: 400;
  letter-spacing: -0.006em;
  color: var(--ink);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.doc-meta span + span::before {
  content: "·";
  padding: 0 9px;
  color: #b3bac2;
}

.doc-nav {
  position: sticky;
  top: 76px;
  z-index: 40;
  padding-top: 24px;
  background: var(--paper);
}

.doc-tabs {
  display: flex;
  gap: 30px;
  margin-top: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.doc-tabs::-webkit-scrollbar {
  display: none;
}

.doc-tab {
  flex: none;
  padding: 0 1px 12px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
}

.doc-tab:hover {
  color: var(--ink);
  text-decoration: none;
}

.doc-tab.is-current {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 64px;
  margin-top: 38px;
  align-items: start;
}

.doc-aside {
  position: sticky;
  top: 104px;
  padding-left: 22px;
  border-left: 1px solid var(--line-soft);
}

.doc-aside-title {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.fact-list {
  display: grid;
  gap: 13px;
  margin: 0 0 28px;
}

.fact-list dt {
  margin-bottom: 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.fact-list dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.aside-links {
  display: grid;
  gap: 9px;
  font-size: 14px;
}

.doc-body {
  max-width: 780px;
}

.doc-section {
  padding-top: 4px;
  margin-bottom: 46px;
  scroll-margin-top: 152px;
}

.doc-section h2 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.doc-section h3 {
  margin: 28px 0 8px;
  font-size: 16.5px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}

.doc-section p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.doc-section p:last-child {
  margin-bottom: 0;
}

.doc-section ul,
.doc-section ol {
  margin: 0 0 16px;
  padding-left: 22px;
  list-style: disc;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.doc-section ol {
  list-style: decimal;
}

.doc-section li {
  margin-bottom: 6px;
}

.doc-section li::marker {
  color: var(--faint);
}

.table {
  width: 100%;
  margin: 8px 0 0;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.6;
}

.table th {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  color: var(--ink);
}

.table td {
  padding: 11px 16px 11px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink-2);
}

.table td:last-child,
.table th:last-child {
  padding-right: 0;
}

.table th:first-child {
  width: 34%;
}

.callout {
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--band);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.callout p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
}

.title-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 28px;
  margin-top: 18px;
  padding-left: 0;
  list-style: none;
  font-size: 14.5px;
}

.doc-section ul.title-cols {
  margin-top: 18px;
  padding-left: 0;
  list-style: none;
}

.title-cols a {
  color: var(--link);
}

.title-cols .abbr {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  margin-left: 7px;
}

.faq details {
  border-top: 1px solid var(--line-soft);
  padding: 14px 0;
}

.faq details:last-of-type {
  border-bottom: 1px solid var(--line-soft);
}

.faq summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.faq summary::marker {
  color: var(--faint);
}

.faq p {
  margin: 10px 0 0;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.notfound {
  padding: 84px 0 96px;
}

.nf-code {
  margin: 0 0 18px;
  font-size: clamp(64px, 9vw, 104px);
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.045em;
  color: var(--brand);
}

.nf-title {
  max-width: 640px;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.018em;
  color: var(--ink);
}

.nf-text {
  margin-top: 14px;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}

.nf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.nf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
  font-size: 14px;
  color: var(--muted);
}

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

.site-footer {
  padding-top: 52px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 40px;
  padding-bottom: 44px;
}

.footer-heading {
  margin: 0 0 16px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.footer-links {
  display: grid;
  gap: 9px;
  font-size: 14px;
}

.footer-titles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 28px;
  font-size: 14px;
}

.footer-titles a,
.footer-links a {
  color: var(--link);
}

.footer-rule {
  height: 1px;
  background: var(--line);
}

.footer-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  padding-top: 22px;
  padding-bottom: 34px;
}

.footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 10px;
  font-size: 13px;
}

.footer-legal {
  max-width: 780px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.footer-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: none;
  color: var(--ink);
  padding-top: 2px;
}

.footer-wordmark:hover {
  color: var(--ink);
  text-decoration: none;
}

.footer-wordmark .ic-mark {
  width: auto;
  height: 27px;
  flex: none;
}

.footer-wordmark .word {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.footer-wordmark .word small {
  display: block;
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
}

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

@media (max-width: 1080px) {
  .home-lower {
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 44px;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px 36px;
  }

  .search-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 38px;
  }

  .doc-layout {
    grid-template-columns: minmax(0, 1fr) 214px;
    gap: 44px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr 1.9fr;
    gap: 32px;
  }
}

@media (max-width: 920px) {
  .nav-toggle {
    display: inline-flex;
  }

  .header-inner {
    position: relative;
    gap: 18px;
    height: 66px;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 20px 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 14px 26px rgba(24, 30, 40, 0.07);
  }

  .site-header.is-open .site-nav {
    display: flex;
  }

  .nav-link {
    padding: 13px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .nav-link.is-active {
    border-bottom-color: var(--line-soft);
  }

  .nav-actions {
    margin-left: auto;
  }

  .home-lower {
    grid-template-columns: 1fr;
    gap: 38px;
    margin-top: 38px;
  }

  .promo {
    max-width: 560px;
  }

  .search-layout {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .refine {
    position: static;
  }

  .search-layout .results {
    order: -1;
  }

  .aside-card {
    max-width: 460px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
    gap: 34px;
    margin-top: 30px;
  }

  .doc-aside {
    position: static;
    padding-left: 0;
    padding-top: 18px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .fact-list {
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
    max-width: 560px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

  .footer-grid > .footer-col-titles {
    grid-column: 1 / -1;
  }

  .footer-titles {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 920px) {
  .doc-nav {
    top: 66px;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 20px;
  }

  .brand-sub {
    display: none;
  }

  .brand-mark {
    height: 26px;
  }

  .brand-name {
    font-size: 21px;
  }

  .hero {
    padding-top: 38px;
  }

  .modes {
    gap: 24px;
    margin-top: 26px;
  }

  .modes-tail {
    display: none;
  }

  .search-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .extra-field {
    grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-areas:
      "field field"
      "input remove";
    gap: 10px;
  }

  .extra-field .fieldbox {
    grid-area: field;
    height: 58px;
  }

  .extra-field .search-input {
    grid-area: input;
    height: 58px;
  }

  .extra-field .field-remove {
    grid-area: remove;
  }

  .fieldbox {
    height: 58px;
  }

  .search-input {
    height: 58px;
    font-size: 16px;
  }

  .search-actions {
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 18px;
  }

  .search-submit {
    margin-left: 0;
    width: 100%;
    margin-top: 4px;
  }

  .page-hero {
    padding-top: 34px;
  }

  .page-lede {
    font-size: 15.5px;
  }

  .section {
    padding-top: 48px;
  }

  .section-title,
  .band-title {
    font-size: 23px;
  }

  .subject-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 24px;
  }

  .band {
    margin-top: 52px;
    padding: 40px 0 44px;
  }

  .history-item {
    flex-wrap: wrap;
    gap: 4px 14px;
  }

  .history-query {
    flex-basis: 100%;
  }

  .subject-tabs {
    gap: 22px;
    margin-top: 26px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .filter-input {
    width: 100%;
  }

  .count {
    margin-left: 0;
    width: 100%;
  }

  .record {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .record-action {
    grid-column: 1;
    padding-top: 2px;
  }

  .record-title {
    font-size: 17px;
  }

  .results-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .results-tools {
    flex-wrap: wrap;
    gap: 10px;
  }

  .sort-select {
    max-width: 150px;
  }

  .result-table .th-authors,
  .result-table .th-source {
    width: auto;
  }

  .empty {
    padding: 24px 20px;
  }

  .title-cols {
    grid-template-columns: 1fr;
  }

  .doc-section h2 {
    font-size: 22px;
  }

  .doc-section p,
  .doc-section ul,
  .doc-section ol {
    font-size: 15px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    padding-bottom: 36px;
  }

  .footer-titles {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 22px;
    padding-top: 20px;
    padding-bottom: 30px;
  }

  .notfound {
    padding: 56px 0 64px;
  }
}

@media (max-width: 560px) {
  .result-table {
    min-width: 520px;
  }
}

@media (max-width: 460px) {
  .site-nav {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lang-link {
    font-size: 13px;
  }

  .display {
    font-size: 29px;
  }

  .mode {
    font-size: 16px;
  }

  .history-empty {
    padding: 18px;
  }

  .promo {
    padding: 20px;
  }

  .promo-title {
    font-size: 22px;
  }

  .promo-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .nf-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .refine,
  .promo,
  .modes-tail,
  .search-panel {
    display: none !important;
  }

  .search-layout,
  .doc-layout {
    display: block;
  }

  body {
    font-size: 12pt;
  }

  a {
    color: #000;
  }
}
