/* Design system: Google-inspired — white canvas, grey surfaces,
   four brand primaries used as small meaningful accents, pill actions. */

:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #f1f3f4;
  --surface-3: #e8eaed;
  --ink: #202124;
  --ink-2: #3c4043;
  --muted: #5f6368;
  --line: #dadce0;
  --line-soft: #e8eaed;
  --accent: #1a73e8;
  --accent-hover: #1765cc;
  --accent-active: #1557b0;
  --accent-ink: #174ea6;
  --accent-container: #e8f0fe;
  --accent-container-strong: #d2e3fc;
  --danger: #b3261e;
  --danger-container: #fce8e6;
  --danger-line: #f2b8b5;
  --warn: #b06000;
  --warn-container: #fef7e0;
  --warn-line: #f2d48f;
  --c-ocr: #1967d2;
  --c-ocr-bg: #e8f0fe;
  --c-ocr-line: #a8c7fa;
  --c-pdf: #0b6e99;
  --c-pdf-bg: #e1f3fb;
  --c-pdf-line: #9fd7ec;
  --c-excel: #137333;
  --c-excel-bg: #e6f4ea;
  --c-excel-line: #a8dab5;
  --c-llm: #5f6368;
  --c-llm-bg: #f1f3f4;
  --c-llm-line: #c6cdd3;
  --c-agents: #a23b1f;
  --c-agents-bg: #fce8e6;
  --c-agents-line: #f2b6aa;
  --cat: var(--c-llm);
  --cat-container: var(--c-llm-bg);
  --cat-line: var(--c-llm-line);
  --font-display: "Google Sans", Roboto, Arial, sans-serif;
  --font-body: "Google Sans", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --shadow-2: 0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
  --focus-ring: 0 0 0 3px rgba(26, 115, 232, 0.24);
  --page: 1240px;
  --gutter: clamp(20px, 4vw, 52px);
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light;
}

[data-category="ocr"] {
  --cat: var(--c-ocr);
  --cat-container: var(--c-ocr-bg);
  --cat-line: var(--c-ocr-line);
}

[data-category="pdf"] {
  --cat: var(--c-pdf);
  --cat-container: var(--c-pdf-bg);
  --cat-line: var(--c-pdf-line);
}

[data-category="excel"] {
  --cat: var(--c-excel);
  --cat-container: var(--c-excel-bg);
  --cat-line: var(--c-excel-line);
}

[data-category="llm"] {
  --cat: var(--c-llm);
  --cat-container: var(--c-llm-bg);
  --cat-line: var(--c-llm-line);
}

[data-category="agents"] {
  --cat: var(--c-agents);
  --cat-container: var(--c-agents-bg);
  --cat-line: var(--c-agents-line);
}

[data-category="all"] {
  --cat: var(--accent);
  --cat-container: var(--accent-container);
  --cat-line: var(--accent-container-strong);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-container-strong);
  color: var(--accent-ink);
}

a {
  color: inherit;
}

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

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

button {
  cursor: pointer;
}

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

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: fixed;
  top: -96px;
  left: 16px;
  z-index: 200;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-2);
}

.skip-link:focus {
  top: 16px;
}

/* Shared labels */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.od-icon {
  stroke-width: 1.75;
}

.od-icon--sm {
  --od-icon-size: 15px;
}

.od-icon--md {
  --od-icon-size: 18px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

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

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
}

.button--primary:active {
  background: var(--accent-active);
  border-color: var(--accent-active);
  box-shadow: none;
}

.button--outline {
  background: var(--bg);
  border-color: var(--line);
  color: var(--accent);
}

.button--outline:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2);
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}

.button--ghost:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.button--compact {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.text-button:hover {
  background: var(--accent-container);
  color: var(--accent-hover);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.header-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hero */

.hero-section {
  padding-bottom: clamp(32px, 4vw, 48px);
  background: var(--bg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(56px, 7vw, 96px) clamp(40px, 5vw, 64px);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 14px 6px 11px;
  border: 1px solid var(--accent-container-strong);
  border-radius: var(--radius-pill);
  background: var(--accent-container);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.hero-eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-title {
  max-width: 13ch;
  margin: 24px 0 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.5vw, 78px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
}

.hero-title em {
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
}

.hero-lead {
  max-width: 52ch;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 32px;
}

/* Hero diagram */

.diagram {
  margin: 0;
  padding: 20px 22px 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
}

.diagram-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--muted);
}

.diagram-index {
  color: var(--accent);
}

.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
}

.dg-page {
  color: #5f6368;
}

.dg-blocks {
  color: #1a73e8;
}

.dg-table {
  color: #b06000;
}

.dg-arrow {
  color: #80868b;
}

.dg-ghost {
  color: #e8eaed;
}

.dg-labels text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  fill: var(--muted);
}

.diagram-caption {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* Hero stats */

.hero-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.15fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.hero-bar .stat {
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(30px, 3.2vw, 40px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-value--accent {
  color: var(--accent);
}

.stat--date .stat-value {
  font-size: clamp(20px, 2.1vw, 27px);
  line-height: 1.15;
}

.stat-label {
  display: block;
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.hero-bar-note {
  align-self: center;
  max-width: 34ch;
  margin: 0;
  padding: 22px 24px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* Catalog */

.catalog {
  padding-block: clamp(40px, 5vw, 64px) 0;
  scroll-margin-top: 88px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.catalog-aside {
  position: sticky;
  top: 96px;
  align-self: start;
}

.aside-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 14px 10px;
}

.aside-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-2);
}

.aside-count {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-filter {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  text-align: left;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.nav-filter:hover {
  background: var(--surface);
  border-color: var(--line-soft);
}

.nav-filter .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat);
}

.filter-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.filter-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.filter-count {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filter-track {
  display: block;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--line-soft);
  overflow: hidden;
}

.filter-bar {
  display: block;
  height: 100%;
  width: var(--ratio, 0%);
  border-radius: inherit;
  background: var(--cat);
  transition: width 320ms var(--ease);
}

.nav-filter[aria-pressed="true"] {
  background: var(--cat-container);
  border-color: var(--cat-line);
}

.nav-filter[aria-pressed="true"] .filter-label,
.nav-filter[aria-pressed="true"] .filter-count {
  color: var(--cat);
}

.nav-filter[aria-pressed="true"] .filter-track {
  background: rgba(255, 255, 255, 0.75);
}

.aside-note {
  margin: 14px 14px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Catalog main */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink);
  scroll-margin-top: 88px;
}

.section-title:focus {
  outline: none;
}

.result-count {
  margin: 0;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.section-note {
  max-width: 66ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px 16px;
  padding-top: 24px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.control > label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.search-field .od-icon {
  color: var(--muted);
}

.search-field input {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
}

.search-field input:focus-visible {
  outline: none;
}

.search-field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrap .od-icon {
  position: absolute;
  right: 16px;
  pointer-events: none;
  color: var(--muted);
}

.control select {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 44px 0 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.control select:hover {
  border-color: var(--line);
}

.control select:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-bottom: 10px;
}

.list-status,
.list-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.list-hint {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Entries */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry {
  --entry-bg: color-mix(in srgb, var(--cat-container) 62%, #ffffff);
  --entry-bg-hover: color-mix(in srgb, var(--cat-container) 88%, #ffffff);
  --entry-line: color-mix(in srgb, var(--cat-line) 78%, #ffffff);
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 48px;
  align-items: start;
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid var(--cat-line);
  border-color: var(--entry-line);
  border-radius: var(--radius);
  background: var(--cat-container);
  background: var(--entry-bg);
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.entry:hover {
  border-color: var(--cat-line);
  background: var(--entry-bg);
  background: var(--entry-bg-hover);
  box-shadow: var(--shadow-2);
}

.entry-index {
  display: grid;
  gap: 4px;
  padding-top: 3px;
}

.entry-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--cat);
  white-space: nowrap;
}

.entry-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.entry-content {
  min-width: 0;
}

.entry-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 1.9vw, 24px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.entry-trigger {
  display: inline-block;
  margin-block: -8px;
  padding: 8px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.entry:hover .entry-trigger,
.entry-trigger:hover {
  color: var(--accent);
}

.entry-trigger:focus-visible {
  color: var(--accent);
  outline-offset: 1px;
}

.entry-summary {
  max-width: 68ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.entry-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border: 1px solid color-mix(in srgb, var(--cat-line) 70%, #ffffff);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--cat);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.entry-cat::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.entry-badge {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-container);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.entry-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--entry-line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--cat);
  text-decoration: none;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.entry-arrow:hover {
  background: var(--cat-container);
  border-color: var(--cat-line);
  color: var(--cat);
}

.entry-arrow:focus-visible {
  outline-offset: 2px;
}

/* Empty and more */

.empty {
  margin-top: 12px;
  padding: 56px 24px 60px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-kicker {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
}

.empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.empty-text {
  max-width: 48ch;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.empty .button {
  margin-top: 24px;
}

.more {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.more .button {
  min-width: 240px;
}

.noscript {
  margin: 24px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

/* Footer */

.site-footer {
  margin-top: clamp(64px, 8vw, 112px);
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--ink);
  scroll-margin-top: 88px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: clamp(32px, 5vw, 88px);
  padding-block: clamp(48px, 6vw, 72px) 48px;
}

.footer-title {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.footer-text {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.footer-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.footer-actions {
  padding-left: clamp(24px, 3vw, 44px);
  border-left: 1px solid var(--line);
}

.footer-actions .footer-text {
  margin-top: 14px;
}

.footer-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.footer-actions .text-button {
  margin-top: 12px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px 30px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.footer-bottom p {
  margin: 0;
}

/* Dialogs */

dialog.sheet {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 940px);
  max-height: min(88dvh, 940px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(32, 33, 36, 0.28);
}

dialog.sheet[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

dialog.sheet::backdrop {
  background: rgba(32, 33, 36, 0.5);
}

dialog.sheet--narrow {
  width: min(680px, calc(100vw - 32px));
}

dialog.sheet--wide {
  width: min(800px, calc(100vw - 32px));
}

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

.sheet-eyebrow {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--muted);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--ink-2);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sheet-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 28px 36px;
}

.sheet-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--ink);
}

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 28px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.sheet-foot--end {
  justify-content: flex-end;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 16px;
}

.detail-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 3px 10px 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--cat-container);
  color: var(--cat);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.detail-cat::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.detail-date {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.5;
  color: var(--muted);
}

.detail-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.detail-summary {
  max-width: 66ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 16.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.detail-summary.is-muted {
  color: var(--muted);
  font-size: 15px;
}

.detail-local {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

/* Add form */

.add-intro {
  max-width: 58ch;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.form {
  display: grid;
  gap: 22px;
}

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

.field > label {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}

.req {
  color: var(--accent);
  font-weight: 500;
}

.input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input:hover {
  border-color: #bdc1c6;
}

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

textarea.input {
  min-height: 124px;
  resize: vertical;
}

select.input {
  cursor: pointer;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
}

.input[aria-invalid="true"] {
  background: var(--danger-container);
  border-color: var(--danger);
}

.form-errors {
  margin-bottom: 22px;
  padding: 14px 18px;
  background: var(--danger-container);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
}

.form-errors h3 {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

.form-errors a {
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.6;
}

.add-note {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Export */

.export-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

.export-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.seg-button {
  min-height: 40px;
  padding: 0 18px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

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

.seg-button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

.export-status {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.export-status.is-error {
  background: var(--danger-container);
  border-color: var(--danger-line);
  color: var(--danger);
}

.export-text {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 40vh;
  max-height: 40dvh;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  resize: vertical;
}

.export-text:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

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

/* Toast */

.toast {
  position: fixed;
  right: clamp(16px, 4vw, 32px);
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 20px;
  background: var(--accent-container);
  border: 1px solid var(--accent-container-strong);
  border-radius: var(--radius);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(32, 33, 36, 0.18);
  animation: toast-in 220ms var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */

@media (max-width: 1080px) {
  .catalog-grid {
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 36px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
    gap: 40px;
  }
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .diagram {
    max-width: 560px;
  }

  .hero-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-bar .stat:nth-of-type(3) {
    border-right: 0;
  }

  .hero-bar-note {
    grid-column: 1 / -1;
    max-width: none;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--line);
  }

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

  .catalog-aside {
    position: static;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .aside-note {
    display: none;
  }

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

  .footer-actions {
    padding-top: 28px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 860px) {
  .header-nav {
    display: none;
  }

  .header-inner {
    grid-template-columns: auto 1fr;
  }

  .header-actions {
    justify-self: end;
  }
}

@media (max-width: 768px) {
  .header-inner {
    min-height: 64px;
  }

  .hero {
    padding-block: 36px 40px;
  }

  .hero-title {
    max-width: 15ch;
    font-size: clamp(34px, 8vw, 54px);
  }

  .hero-lead {
    margin-top: 20px;
    font-size: 16px;
  }

  .hero-actions {
    margin-top: 26px;
  }

  .hero-actions .button {
    flex: 1 1 100%;
  }

  .controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry {
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 12px;
    padding: 18px 18px 20px;
  }

  .entry-index {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-top: 0;
  }

  .entry-content {
    grid-column: 1;
  }

  .entry-arrow {
    grid-column: 2;
    grid-row: 2;
  }

  .sheet-head {
    padding: 10px 10px 10px 20px;
  }

  .sheet-body {
    padding: 24px 20px 30px;
  }

  .sheet-foot {
    padding: 16px 20px;
  }

  .footer-grid {
    padding-top: 40px;
  }

  .footer-bottom {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 600px) {
  .brand-label {
    display: none;
  }

  .header-actions .button span {
    display: none;
  }

  .header-actions .button {
    min-width: 44px;
    padding: 0 14px;
  }

  .hero-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-bar .stat {
    padding: 18px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-bar .stat:last-of-type {
    border-bottom: 0;
  }

  .hero-bar-note {
    padding: 16px 20px 20px;
  }

  .stat-value {
    font-size: 34px;
  }

  .stat--date .stat-value {
    font-size: 24px;
  }

  .stat-label {
    margin-top: 6px;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-title {
    font-size: clamp(28px, 8vw, 38px);
  }

  .entry-title {
    font-size: 20px;
  }

  .search-field input,
  .control select,
  .input {
    font-size: 16px;
  }

  .entry-summary {
    font-size: 15px;
  }

  .empty {
    padding: 44px 16px 48px;
  }

  .footer-cluster .button {
    flex: 1 1 100%;
  }

  .export-actions-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .export-actions-group .button {
    width: 100%;
  }

  dialog.sheet {
    width: calc(100vw - 16px);
    max-height: 92vh;
    max-height: 92dvh;
  }

  .sheet-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-foot .button,
  .sheet-foot .text-button {
    width: 100%;
  }

  .export-toggle {
    width: 100%;
  }

  .seg-button {
    flex: 1 1 0;
  }
}

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

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

  .button:active {
    transform: none;
  }
}
