/* ==========================================================================
   DDC Finder — Swiss Technical Precision Design System
   UI/UX Pro Max Architecture for Library Science Tools
   ========================================================================== */

:root {
  color-scheme: light;

  /* Swiss Technical Color Tokens */
  --bg-canvas: #f4f4f0;
  --surface: #ffffff;
  --surface-subtle: #f9f9f7;
  --surface-muted: #f0f0eb;
  
  --ink: #0f141c;
  --ink-muted: #4e5764;
  --ink-faint: #7a8492;

  --line: #d6d9d0;
  --line-strong: #9ca396;
  --line-hairline: 1.5px;

  --cobalt: #004be8;
  --cobalt-dark: #0036a8;
  --cobalt-soft: #eef3ff;
  --cobalt-border: #b8cffc;

  --emerald: #028050;
  --emerald-dark: #015c3a;
  --emerald-soft: #eaf6ef;
  --emerald-border: #a3d9bc;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --rose: #d92d20;

  /* Typography */
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 20, 28, 0.05);
  --shadow-card: 0 4px 16px -2px rgba(15, 20, 28, 0.06), 0 1px 2px rgba(15, 20, 28, 0.04);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #090d16;
  --surface: #101623;
  --surface-subtle: #161e30;
  --surface-muted: #1e283d;
  
  --ink: #f0f4fc;
  --ink-muted: #9aa8be;
  --ink-faint: #677790;

  --line: #222d42;
  --line-strong: #374869;

  --cobalt: #3b82f6;
  --cobalt-dark: #2563eb;
  --cobalt-soft: rgba(59, 130, 246, 0.15);
  --cobalt-border: rgba(59, 130, 246, 0.35);

  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --emerald-border: rgba(16, 185, 129, 0.35);

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --amber-border: rgba(245, 158, 11, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background-color: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Layout Shell
   -------------------------------------------------------------------------- */
.page-shell {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding-bottom: 60px;
}

/* --------------------------------------------------------------------------
   Header / Top Navigation
   -------------------------------------------------------------------------- */
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--line-hairline) solid var(--line);
  background-color: transparent;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  letter-spacing: -0.3px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #ffffff;
  background: var(--cobalt);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.brand-text {
  font-weight: 500;
  color: var(--ink);
}

.brand-text strong {
  font-weight: 700;
  color: var(--cobalt);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--ink-muted);
}

.top-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.top-link {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.top-link:hover {
  color: var(--cobalt);
}

.arrow-ext {
  font-size: 0.75rem;
  margin-left: 2px;
  display: inline-block;
  color: var(--cobalt);
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero {
  max-width: 760px;
  margin: 64px auto 44px;
  text-align: center;
}

.eyebrow, .section-kicker {
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 99px;
  background-color: var(--cobalt-soft);
  border: 1px solid var(--cobalt-border);
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  background: var(--cobalt);
  border-radius: 50%;
}

h1 {
  margin: 20px 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.5vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: -1.8px;
  color: var(--ink);
}

h1 em {
  color: var(--cobalt);
  font-style: normal;
}

.hero-copy {
  max-width: 620px;
  margin: 0 auto;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Swiss Workspace Grid (Dual Column on Desktop)
   -------------------------------------------------------------------------- */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
}

/* When results are visible on large screens, automatically arrange side-by-side */
@media (min-width: 960px) {
  .workspace-grid:has(.results-section:not([hidden])) {
    grid-template-columns: minmax(460px, 1fr) minmax(460px, 1.05fr);
    align-items: start;
  }
}

/* --------------------------------------------------------------------------
   Search / Form Card
   -------------------------------------------------------------------------- */
.search-card {
  background: var(--surface);
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  padding: 32px 36px;
  box-shadow: var(--shadow-card);
}

.card-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 4px 0 2px;
  color: var(--ink);
}

.card-subtitle {
  color: var(--ink-faint);
  font-size: 0.8125rem;
  margin: 0;
}

/* Sample Quick-Try Pills */
.sample-pills-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sample-pills-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sample-pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sample-pill:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt-border);
  transform: translateY(-1px);
}

.sample-pill:active {
  transform: translateY(0);
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kbd-hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

label {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.1px;
}

.required {
  color: var(--rose);
  font-weight: 700;
  margin-left: 2px;
}

.optional, .recommended {
  margin-left: 6px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
}

.recommended {
  color: var(--cobalt);
}

.field-hint {
  color: var(--ink-faint);
  font-size: 0.6875rem;
  line-height: 1.45;
  margin-top: -2px;
}

/* Inputs & Selects with High Contrast & Clear Placeholders */
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background-color: var(--surface);
  color: var(--ink);
  outline: none;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input, select {
  height: 46px;
  padding: 0 14px;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%234e5764' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
}

/* Transparent Example Placeholder Text */
input::placeholder, textarea::placeholder {
  color: #929ba6;
  opacity: 0.85;
  font-style: normal;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(0, 75, 232, 0.12);
}

input:invalid:not(:placeholder-shown), select:invalid:not(:placeholder-shown) {
  border-color: var(--rose);
}

/* Primary Submit Button */
.submit-button {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  padding: 0 20px;
  border: 0;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  background: var(--cobalt);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.submit-button:hover {
  background: var(--cobalt-dark);
}

.submit-button:active {
  transform: translateY(1px);
}

.submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.button-arrow {
  font-size: 1.125rem;
  line-height: 1;
}

.form-note {
  margin: 14px 0 0;
  color: var(--ink-faint);
  text-align: center;
  font-size: 0.75rem;
}

.form-note span {
  color: var(--cobalt);
}

/* --------------------------------------------------------------------------
   Classification Context (Collapsible Drawer)
   -------------------------------------------------------------------------- */
.context-details {
  margin: 20px 0 10px;
  padding: 16px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.context-details summary {
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  user-select: none;
}

.context-details summary:hover {
  color: var(--cobalt);
}

.context-details summary .summary-sub {
  margin-left: 8px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
  font-weight: 400;
  font-family: var(--font-body);
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.context-wide {
  grid-column: 1 / -1;
}

.context-details > .field-hint {
  display: block;
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   Results Section (Swiss Technical Result Card)
   -------------------------------------------------------------------------- */
.results-section {
  width: 100%;
}

.result-card {
  padding: 32px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

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

.result-label {
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.confidence {
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-dark);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
}

/* Big Monospaced DDC Number Callout */
.ddc-number {
  margin: 0;
  color: var(--cobalt);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  line-height: 1;
  letter-spacing: -1.5px;
}

.ddc-heading {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.result-description {
  margin: 12px 0 0;
  color: var(--ink-muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}

.meta-chip {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
}

.result-divider {
  height: 1px;
  margin: 24px 0;
  background: var(--line);
}

.result-subtitle {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.1px;
}

.result-reason {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  line-height: 1.65;
}

.result-reason strong {
  color: var(--ink);
}

/* Alternatives List */
.alternatives {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.alternatives li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-subtle);
  font-size: 0.8125rem;
}

.alternatives strong {
  font-family: var(--font-mono);
  color: var(--cobalt);
  white-space: nowrap;
}

/* Action Buttons */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.copy-button {
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-button:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt-border);
  color: var(--cobalt);
}

.copy-button-secondary {
  color: var(--ink-muted);
}

.copy-button-secondary:hover {
  background: var(--surface-muted);
  color: var(--rose);
  border-color: var(--line);
}

.result-caveat {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 4px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #78350f;
  font-size: 0.75rem;
  line-height: 1.6;
}

.empty-state {
  padding: 36px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Decision Box (In-Card Decision Logger)
   -------------------------------------------------------------------------- */
.decision-box {
  margin-top: 24px;
  padding: 18px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.decision-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
}

.decision-label span {
  color: var(--ink-faint);
  font-weight: 400;
}

.decision-box select, .decision-box textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.8125rem;
}

.decision-box textarea {
  resize: vertical;
  line-height: 1.5;
}

.decision-save {
  margin-top: 14px;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--emerald);
  color: var(--emerald-dark);
}

.decision-save:hover {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border-color: var(--emerald);
}

/* --------------------------------------------------------------------------
   Local Work Log / Decision History Section
   -------------------------------------------------------------------------- */
.decision-history {
  margin: 36px auto 20px;
  max-width: 1100px;
  padding: 28px 32px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.history-heading h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 4px 0 0;
  color: var(--ink);
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-note {
  color: var(--ink-faint);
  font-size: 0.75rem;
  margin: 12px 0 16px;
}

.decision-list {
  display: grid;
  gap: 10px;
}

.decision-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.4fr);
  gap: 12px 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-subtle);
}

.decision-entry > div:first-child strong {
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--ink);
}

.decision-entry > div:first-child span, .decision-number span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
}

.decision-number strong {
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-size: 1rem;
}

.decision-entry p {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Batch Cataloguing Section
   -------------------------------------------------------------------------- */
.batch-card {
  margin: 36px auto 20px;
  max-width: 1100px;
  padding: 32px 36px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.batch-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.batch-intro h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 4px 0 4px;
  color: var(--ink);
}

.batch-intro p {
  max-width: 600px;
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
}

.batch-download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.batch-download-link:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt-border);
}

.batch-card > label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
}

.batch-card textarea {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  resize: vertical;
}

.batch-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.batch-controls .submit-button {
  width: auto;
  margin: 0;
  padding: 0 22px;
}

.batch-status-text {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Batch Results Table */
.batch-results {
  margin-top: 24px;
}

.batch-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.75rem;
}

.batch-table th, .batch-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.batch-table th {
  background: var(--surface-muted);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.batch-table td strong {
  font-family: var(--font-display);
  color: var(--ink);
}

.batch-table td span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
}

.batch-table td .batch-final-number {
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-weight: 600;
}

.batch-table tbody tr:last-child td {
  border-bottom: 0;
}

.batch-table tbody tr:hover td {
  background-color: var(--surface-subtle);
}

/* --------------------------------------------------------------------------
   Catalogue Evidence & Kerala-first Discovery
   -------------------------------------------------------------------------- */
.catalogue-evidence, .catalogue-discovery {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.catalogue-records, .catalogue-live-records {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.catalogue-records li, .catalogue-live-records li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  font-size: 0.8125rem;
}

.catalogue-records strong, .catalogue-live-records li strong {
  font-family: var(--font-mono);
  color: var(--cobalt);
}

.catalogue-link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.catalogue-link-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  text-decoration: none;
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
}

.catalogue-link-list a:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt-border);
}

/* --------------------------------------------------------------------------
   Methodology Steps Section
   -------------------------------------------------------------------------- */
.how-section {
  padding: 80px 0 60px;
  text-align: center;
}

.how-section h2 {
  margin: 14px 0 36px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.375rem);
  letter-spacing: -1px;
  color: var(--ink);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
  max-width: 1100px;
  margin: 0 auto;
}

.step {
  padding: 24px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.step-number {
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.step h3 {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.step p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Notice / Disclaimer Box
   -------------------------------------------------------------------------- */
.notice {
  display: flex;
  gap: 16px;
  padding: 22px 26px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  max-width: 1100px;
  margin: 0 auto;
}

.notice-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8125rem;
  border: 1px solid var(--cobalt-border);
}

.notice h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
}

.notice p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 32px 0 20px;
  margin-top: 48px;
  border-top: var(--line-hairline) solid var(--line);
  color: var(--ink-faint);
  font-size: 0.75rem;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cobalt);
  text-decoration: none;
}

.footer-sep {
  color: var(--line-strong);
}

.back-to-top {
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

.back-to-top:hover {
  color: var(--cobalt);
}

/* --------------------------------------------------------------------------
   Accessibility & Mobile Breakpoints
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Theme Toggle Button
   -------------------------------------------------------------------------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-soft);
  color: var(--cobalt);
}

.theme-icon {
  font-size: 0.8125rem;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   ISBN Scanner Button & Modal
   -------------------------------------------------------------------------- */
.isbn-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-subtle);
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.isbn-scan-btn:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt-border);
}

.scan-icon {
  font-size: 0.75rem;
}

.scanner-modal[hidden] {
  display: none;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.scanner-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.scanner-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}

.scanner-close-btn {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.scanner-close-btn:hover {
  color: var(--rose);
  background: var(--surface-muted);
}

.scanner-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--cobalt);
}

.scanner-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-reticle {
  position: absolute;
  inset: 20%;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  pointer-events: none;
}

.scanner-laser {
  position: absolute;
  top: 20%;
  left: 15%;
  right: 15%;
  height: 2px;
  background: #ff0055;
  box-shadow: 0 0 8px #ff0055;
  animation: scan-sweep 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes scan-sweep {
  0% { top: 20%; }
  100% { top: 80%; }
}

.scanner-hint {
  margin: 14px 0 6px;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.scanner-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cobalt);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Three-level DDC Number Browser
   -------------------------------------------------------------------------- */
.class-browser-card {
  margin: 36px auto 20px;
  max-width: 1100px;
  padding: 28px 32px;
  border: var(--line-hairline) solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

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

.browser-header h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 4px 0 2px;
  color: var(--ink);
}

.browser-header p {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  margin: 0;
  max-width: 660px;
  line-height: 1.6;
}

.browser-content {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.browser-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 16px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
}

.browser-legend strong {
  color: var(--ink-muted);
  font-weight: 700;
  margin-right: 4px;
}

.ddc-tree {
  display: grid;
  gap: 8px;
}

.ddc-level {
  min-width: 0;
}

.ddc-main-level {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.ddc-level-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.ddc-level-summary::-webkit-details-marker {
  display: none;
}

.ddc-level-summary::marker {
  content: "";
}

.ddc-level-summary:hover {
  background: var(--surface-muted);
}

.ddc-main-summary {
  min-height: 64px;
}

.ddc-code {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 5px 7px;
  border: 1px solid var(--cobalt-border);
  border-radius: 4px;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
}

.ddc-main-code {
  min-width: 58px;
  font-size: 0.9375rem;
}

.ddc-level-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.ddc-level-text strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
}

.ddc-level-text small {
  color: var(--ink-faint);
  font-size: 0.6875rem;
  line-height: 1.4;
}

.ddc-chevron {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1;
}

.ddc-division-list {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px 22px;
}

.ddc-division-level {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  overflow: hidden;
}

.ddc-division-summary {
  padding: 10px 12px;
}

.ddc-section-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 0 12px 12px;
}

.ddc-section-number {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--cobalt);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ddc-section-number strong {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
}

.ddc-section-number small {
  color: var(--ink-faint);
  font-family: var(--font-display);
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.25;
}

.ddc-section-number:hover small {
  color: rgba(255, 255, 255, 0.85);
}

.ddc-section-number:hover {
  border-color: var(--cobalt);
  background: var(--cobalt);
  color: #ffffff;
}

.ddc-browser-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--ink-faint);
  font-size: 0.6875rem;
}

.footer-attribution {
  margin-left: auto;
  max-width: 360px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
}

.footer-attribution summary {
  width: fit-content;
  cursor: pointer;
  color: var(--ink-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.footer-attribution-content {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  line-height: 1.6;
}

.footer-attribution-content p {
  margin: 0 0 8px;
}

.footer-attribution-content p:last-child {
  margin-bottom: 0;
}

.footer-attribution-content a {
  color: var(--cobalt);
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
  }

  .top-links {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .top-link {
    font-size: 0.75rem;
  }

  .hero {
    margin: 44px auto 28px;
  }

  h1 {
    letter-spacing: -1.2px;
  }

  .hero-copy {
    font-size: 0.875rem;
  }

  .search-card, .result-card, .batch-card, .decision-history {
    padding: 24px 20px;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .context-grid {
    grid-template-columns: 1fr;
  }

  .context-wide {
    grid-column: auto;
  }

  .batch-download-link {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
