:root {
  color-scheme: light;
  --brand-bg: #e7dfd2;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #2b2520;
  --muted: #675d53;
  --gold-dark: #6c5538;
  --gold: #a89068;
  --gold-light: #d7b56d;
  --gold-1: #6c5538;
  --gold-2: #a89068;
  --gold-3: #c8a570;
  --gold-4: #e8c080;
  --line: rgba(77, 58, 36, 0.22);
  --line-strong: rgba(108, 85, 56, 0.5);
  --blue: #204f86;
  --blue-soft: #edf5ff;
  --danger: #9d2c2c;
  --shadow: 0 16px 45px rgba(70, 53, 34, 0.13);
  --content-max: 1180px;
  --header-max: 1920px;
  --safe-left: max(calc(16px + env(safe-area-inset-left, 0px)), calc((100vw - var(--header-max)) / 2 + 16px + env(safe-area-inset-left, 0px)));
  --button: #6c5538;
  --focus: #185fa9;
}

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

html {
  min-width: 320px;
  background: var(--brand-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: var(--brand-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.62;
  overflow-x: hidden;
}

a {
  color: var(--blue);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

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

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ex-header-wrap {
  position: relative;
  width: 100%;
  height: 150px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.22);
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2), var(--gold-3), var(--gold-4), var(--gold-3), var(--gold-2), var(--gold-1));
  background-size: 240% 240%;
  animation: gradientWave 18s ease-in-out infinite;
  overflow: visible;
  isolation: isolate;
}

.ex-header-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  background: linear-gradient(180deg, rgba(30, 24, 18, 0.25) 0%, rgba(30, 24, 18, 0.15) 55%, rgba(30, 24, 18, 0.22) 100%), radial-gradient(90% 85% at 75% 15%, rgba(255, 225, 165, 0.12), transparent 60%);
  box-shadow: inset 0 12px 24px rgba(255, 255, 255, 0.12), inset 0 -24px 36px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.gloss-layer { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.gloss-layer::before {
  content: "";
  position: absolute;
  inset: -60% -20%;
  background: radial-gradient(60% 18% at 20% 0%, rgba(255, 255, 255, 0.25), transparent 72%), radial-gradient(50% 16% at 82% 0%, rgba(255, 255, 255, 0.18), transparent 75%), linear-gradient(90deg, transparent 0%, rgba(255, 235, 190, 0.12) 35%, transparent 72%, rgba(255, 235, 190, 0.08) 100%);
  mix-blend-mode: overlay;
  opacity: 0.75;
  animation: glassSheen 20s ease-in-out infinite;
}

.ex-logo { position: absolute; top: 16px; left: var(--safe-left); z-index: 2000; display: flex; align-items: center; justify-content: flex-start; width: clamp(288px, 20.8vw, 416px); }
.ex-logo > a { display: block; width: 100%; }
.ex-logo img { width: 100%; height: auto; display: block; }
.ex-logo-brand { position: absolute; top: 50%; left: calc(100% + 2cm); transform: translateY(-50%); height: 100%; width: auto; display: block; }
.ex-nav { position: absolute; top: 53px; right: max(calc(30px + env(safe-area-inset-right, 0px)), calc((100vw - var(--header-max)) / 2 + 16px + env(safe-area-inset-right, 0px))); z-index: 4000; }
#exToggle { display: none; }
.ex-btn { width: 48px; height: 48px; border: 2px solid var(--gold-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--brand-bg); cursor: pointer; }
.ex-icon { position: relative; width: 26px; height: 20px; }
.ex-line { position: absolute; top: 2px; width: 2px; height: 16px; border-radius: 2px; background: var(--gold-light); }
.ex-line:nth-child(1) { left: 4px; }
.ex-line:nth-child(2) { left: 12px; }
.ex-line:nth-child(3) { left: 20px; }
#exToggle:checked + label .ex-icon { transform: rotate(90deg); }
.ex-menu { position: absolute; top: 54px; right: 0; z-index: 9999; width: 260px; padding: 6px 0; border: 1px solid var(--gold-light); border-radius: 10px; background: var(--brand-bg); opacity: 0; pointer-events: none; transform-origin: top center; transform: perspective(700px) rotateX(-90deg); transition: 0.45s; }
#exToggle:checked ~ .ex-menu { opacity: 1; pointer-events: auto; transform: perspective(700px) rotateX(0); }
.ex-menu a { display: block; padding: 7px 18px; color: #000; font-size: 0.9rem; font-weight: 400; line-height: 1.25; text-decoration: none; }
.ex-menu a:hover, .ex-menu a[aria-current="page"] { background: var(--gold-light); }
.after-banner-space { height: 44px; }

.page-content {
  width: min(var(--content-max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.search-panel,
.results-region,
.empty-region {
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: clamp(22px, 4vw, 44px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-dark);
  font-size: 0.76rem;
  font-weight: 790;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--ink);
  line-height: 1.16;
  text-wrap: balance;
}

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 760;
  letter-spacing: -0.025em;
}

.intro {
  max-width: 820px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1rem;
}

.help-note { margin: 0 0 26px; padding: 14px 16px; border: 1px solid var(--line); border-left: 5px solid var(--gold-3); border-radius: 13px; background: rgba(255, 255, 255, 0.52); font-size: 0.92rem; }

.search-form label {
  display: inline-block;
  margin-bottom: 9px;
  font-weight: 720;
}

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

.search-row input {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 13px 17px;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: inset 0 1px 2px rgba(45, 32, 20, 0.05);
}

.search-row input::placeholder {
  color: #81776d;
  opacity: 1;
}

.search-row input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(157, 44, 44, 0.13);
}

.primary-button {
  min-height: 58px;
  min-width: 230px;
  border: 1px solid #51402b;
  border-radius: 13px;
  padding: 13px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: var(--button);
  box-shadow: 0 8px 20px rgba(81, 64, 43, 0.22);
  font-weight: 720;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 13px 26px rgba(77, 58, 36, 0.27);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.button-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 650ms linear infinite;
}

.primary-button.is-loading .button-spinner {
  display: inline-block;
}

.input-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.quick-topics {
  margin-top: clamp(30px, 5vw, 52px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.quick-topics h2 {
  margin-bottom: 14px;
  font-size: 0.95rem;
  letter-spacing: 0.015em;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.topic-list button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  font-size: 0.9rem;
  font-weight: 620;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.topic-list button:hover {
  border-color: var(--gold-dark);
  background: #fff;
  transform: translateY(-1px);
}

.results-region,
.empty-region {
  margin-top: 28px;
  padding: clamp(22px, 4vw, 44px);
}

.results-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.results-heading h2,
.empty-region h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
}

.results-count {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.results-list {
  display: grid;
  gap: 14px;
}

.ambiguity-options {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.ambiguity-option {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 5px 16px rgba(54, 39, 24, 0.06);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.ambiguity-option:hover {
  border-color: var(--gold-dark);
  background: #fff;
  transform: translateY(-1px);
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: clamp(18px, 3vw, 28px);
  background: #fff;
  box-shadow: 0 7px 22px rgba(54, 39, 24, 0.06);
}

.result-topline {
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.document-label {
  border: 1px solid rgba(32, 79, 134, 0.22);
  border-radius: 999px;
  padding: 4px 9px;
  color: #143f70;
  background: var(--blue-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-reference {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.result-card h3 {
  margin-bottom: 8px;
  font-size: clamp(1.08rem, 2.2vw, 1.35rem);
}

.result-context {
  margin: -1px 0 13px;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-excerpt {
  margin: 0 0 17px;
  color: #372f29;
  line-height: 1.7;
  white-space: pre-line;
}

.result-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  font-weight: 720;
}

.empty-region {
  background: rgba(255, 253, 248, 0.96);
}

.empty-region p {
  max-width: 780px;
  margin: 13px 0 0;
  color: var(--muted);
}

.fallback-links {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.fallback-links a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.site-footer {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 max(34px, env(safe-area-inset-bottom, 0px));
  color: #5f554c;
  font-size: 0.82rem;
  text-align: center;
}

.site-footer p {
  margin: 0 auto;
  max-width: 840px;
}

.noscript-message {
  display: block;
}

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

[hidden] {
  display: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes gradientWave { 0% { background-position: 0 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes glassSheen { 0%, 100% { transform: translateX(0); opacity: 0.6; } 50% { transform: translateX(16px); opacity: 0.85; } }

@media (max-width: 1000px) {
  .ex-header-wrap { height: 250px; }
  .ex-logo { top: 12px; left: 50%; width: clamp(240px, 70vw, 340px); align-items: center; justify-content: flex-start; flex-direction: column; transform: translateX(-50%); }
  .ex-logo-brand { position: static; width: 100%; height: auto; margin-top: calc(2cm - 30px); transform: none; }
  .ex-nav { top: 37px; right: 12px; }

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

  .primary-button {
    width: 100%;
    min-width: 0;
  }

  .ambiguity-option {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .page-content,
  .site-footer {
    width: min(100% - 24px, var(--content-max));
  }

  .page-content { padding-top: 20px; padding-bottom: 55px; }
  .ex-menu { width: min(260px, calc(100vw - 24px)); }

  .search-panel,
  .results-region,
  .empty-region {
    border-radius: 17px;
  }

  .search-panel {
    padding: 22px 17px 24px;
  }

  .search-row input {
    min-height: 56px;
    padding-inline: 14px;
  }

  .input-meta {
    align-items: flex-end;
    flex-direction: column;
    gap: 3px;
    text-align: right;
  }

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .results-count {
    white-space: normal;
  }

  .result-card {
    padding: 18px 16px;
  }

  .topic-list button {
    flex: 1 1 auto;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .search-panel,
  .results-region,
  .empty-region,
  .result-card,
  .topic-list button,
  .search-row input,
  .primary-button {
    border: 1px solid CanvasText;
  }

  .ambiguity-option {
    border: 1px solid CanvasText;
  }
}
