:root {
  --bg: #eef1ed;
  --paper: #fffefa;
  --panel: #e3e8e3;
  --ink: #19211f;
  --muted: #5f6b66;
  --line: #c9c2b6;
  --line-soft: #e7e1d6;
  --accent: #145f52;
  --accent-dark: #0d4038;
  --warm: #7d2638;
  --code: #6d5f4c;
  --shadow: 0 18px 48px rgba(25, 33, 31, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 254, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  text-decoration: none;
}

.brand-wordmark {
  gap: 0.14em;
  max-width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 3.2vw, 52px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.brand-wordmark__name {
  color: #17221f;
}

.brand-wordmark__number {
  color: #b89a42;
}

.topnav {
  display: flex;
  gap: 18px;
  font-size: 15px;
}

.home-screen {
  min-height: calc(100vh - 73px);
  padding: clamp(18px, 3vw, 38px) clamp(18px, 4vw, 56px);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(360px, 1fr);
  gap: clamp(18px, 3vw, 34px);
  align-content: center;
  width: min(1280px, 100%);
  min-height: calc(100vh - 149px);
  margin: 0 auto;
}

.home-copy {
  align-self: center;
  min-width: 0;
}

.home-copy h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.96;
  font-weight: 700;
  text-wrap: balance;
}

.home-copy p {
  max-width: 520px;
  color: var(--muted);
  font-size: 19px;
  overflow-wrap: anywhere;
}

.home-topics {
  grid-column: 1 / -1;
  min-width: 0;
}

.home-topics .topic-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.home-topics .topic-card {
  min-height: 0;
  padding: 10px 12px;
  background: rgba(255, 254, 250, 0.68);
  box-shadow: none;
}

.home-topics .topic-card strong {
  font-size: 14px;
  line-height: 1.2;
}

.home-topics .topic-card small {
  font-size: 12px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 73px);
  padding: clamp(42px, 7vw, 92px) clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.hero h1,
.page-header h1 {
  max-width: 880px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1.02;
  font-weight: 700;
  text-wrap: balance;
}

.hero p,
.page-header p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.eyebrow,
.section-label {
  color: var(--warm);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.button.secondary {
  color: var(--accent-dark);
  background: transparent;
}

.hero-panel {
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel span {
  display: block;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 72px;
  line-height: 1;
}

.hero-panel strong,
.hero-panel small {
  display: block;
}

.hero-panel small {
  margin-top: 8px;
  color: var(--muted);
}

.section,
.page {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.page.narrow {
  width: min(840px, calc(100% - 36px));
}

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

.section-heading h2,
.content-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
}

.page-header {
  padding: 38px 0 24px;
}

.search {
  display: grid;
  gap: 8px;
  max-width: 520px;
  margin-top: 24px;
  color: var(--muted);
  font-weight: 700;
}

.search input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.article-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-list a {
  display: grid;
  gap: 6px;
  min-height: 64px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.article-list a:hover {
  border-color: var(--accent);
}

.article-list span {
  color: var(--accent);
  font-weight: 700;
}

.article-list strong {
  min-width: 0;
  font-weight: 700;
}

.article-list small {
  color: var(--muted);
}

.law-index {
  display: grid;
  gap: 32px;
}

.law-chapter {
  display: grid;
  gap: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.law-chapter:first-child {
  padding-top: 0;
  border-top: 0;
}

.law-chapter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.law-chapter__head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.law-chapter__head span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.law-index__articles {
  display: grid;
  gap: 10px;
}

.law-paragraph {
  display: grid;
  gap: 10px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line-soft);
}

.law-paragraph h3 {
  margin: 0;
  color: var(--warm);
  font-size: 16px;
}

.law-paragraph__empty {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

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

.topic-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.topic-card:hover {
  border-color: var(--accent);
}

.topic-card strong {
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.topic-card small,
.section-heading span {
  color: var(--muted);
  font-weight: 700;
}

.article-page {
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 84px;
}

.content-card {
  margin-bottom: 18px;
  padding: clamp(20px, 4vw, 44px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.content-card h1 {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

.content-card h2 {
  margin-top: 32px;
}

.content-card h3,
.content-card h4 {
  margin-top: 24px;
}

.content-card p,
.content-card li {
  font-size: 17px;
}

.law-text {
  padding: clamp(18px, 3vw, 34px) clamp(16px, 4vw, 42px);
  background:
    linear-gradient(90deg, rgba(227, 232, 227, 0.7) 0 216px, transparent 216px),
    var(--paper);
}

.law-text p {
  margin: 0;
  max-width: 76ch;
  text-indent: 2em;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.law-text h1 {
  max-width: 760px;
  margin-bottom: 16px;
}

.law-row {
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 92px;
}

.law-row > p {
  justify-self: start;
}

.law-row:first-of-type {
  border-top: 0;
}

.law-row--section {
  align-items: center;
  padding-top: 22px;
  padding-bottom: 8px;
  border-top-color: var(--line);
}

.law-marker {
  position: sticky;
  top: 90px;
  display: block;
  min-width: 0;
  padding-top: 2px;
  color: var(--code);
  font-family: "Consolas", "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}

.law-marker:hover {
  color: var(--warm);
  text-decoration: underline;
}

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

.law-subpoint-anchor {
  display: block;
  height: 0;
  scroll-margin-top: 92px;
}

.law-text h4 {
  color: var(--muted);
  font-size: 15px;
}

.question-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
}

.question-list li {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: #f8f5ed;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.question-list a {
  font-weight: 700;
}

.question-list small {
  color: var(--muted);
}

.empty-state {
  min-height: 280px;
}

.hermes-chat {
  position: static;
  z-index: auto;
  margin: 18px 0 20px;
  font-family: inherit;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.hermes-chat__toggle,
.hermes-chat__close {
  display: none;
}

.hermes-chat__panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: transparent;
}

.hermes-chat__header {
  display: none;
}

.hermes-chat__header span {
  display: none;
}

.hermes-chat__messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  max-height: 220px;
  padding: 0 0 10px;
  overflow-y: auto;
  background: transparent;
}

.hermes-chat__messages:empty {
  display: none;
}

.hermes-chat__message {
  max-width: 92%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #e1e4e1;
  border-radius: 6px;
  color: var(--ink);
  background: #f7f8f6;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  text-indent: 0;
  text-wrap: pretty;
}

.hermes-chat__message--user {
  justify-self: end;
  color: #fff;
  background: #242826;
  border-color: #242826;
}

.hermes-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: end;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid #d3dad5;
  border-radius: 22px;
  background: #fffefa;
  box-shadow: 0 2px 8px rgba(25, 33, 31, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.hermes-chat__form:focus-within {
  border-color: #9fa9a3;
  background: #fff;
  box-shadow: 0 3px 8px rgba(25, 33, 31, 0.08);
}

.hermes-chat__form textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 150px;
  resize: none;
  padding: 8px 4px 8px 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hermes-chat__form textarea::placeholder {
  color: #52615a;
  opacity: 1;
}

.hermes-chat__form button {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #242826;
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  transition: transform 160ms ease, background-color 160ms ease, opacity 160ms ease;
}

.hermes-chat__form button:hover {
  background: #101412;
}

.hermes-chat__form button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.hermes-chat__form button:disabled,
.hermes-chat__form textarea:disabled {
  cursor: wait;
  opacity: 0.68;
}

.law-text .hermes-chat p {
  max-width: none;
  text-indent: 0;
  white-space: pre-wrap;
}

.hermes-chat--home {
  align-self: center;
  margin: 0;
}

.hermes-chat--home .hermes-chat__panel {
  height: auto;
}

.hermes-chat--home .hermes-chat__messages {
  max-height: 260px;
}

.hermes-chat--home .hermes-chat__form {
  min-height: 92px;
  border-radius: 24px;
}

.hermes-chat--home .hermes-chat__form textarea {
  min-height: 72px;
}

.hermes-chat--home .hermes-chat__message {
  font-size: 14px;
}

.page-header .hermes-chat {
  max-width: 760px;
}

@media (max-width: 820px) {
  body {
    width: 100%;
  }

  .topbar,
  .topnav {
    align-items: flex-start;
  }

  .topbar,
  .home-hero,
  .hero,
  .article-page {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    display: grid;
  }

  .hero {
    min-height: auto;
  }

  .home-screen,
  .home-hero {
    min-height: auto;
  }

  .home-screen {
    padding-right: 18px;
    padding-left: 18px;
  }

  .section,
  .page,
  .article-page {
    width: calc(100vw - 56px);
  }

  .home-copy h1 {
    font-size: clamp(42px, 14vw, 58px);
  }

  .page-header h1 {
    font-size: clamp(32px, 10vw, 42px);
  }

  .page-header p {
    max-width: 31ch;
  }

  .page-header .hermes-chat {
    width: calc(100vw - 56px);
    max-width: calc(100vw - 56px);
  }

  .home-copy p {
    font-size: 18px;
  }

  .home-topics .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hermes-chat__header {
    align-items: flex-start;
    gap: 4px 10px;
  }

  .hermes-chat__header span {
    width: 100%;
  }

  .article-list.compact {
    grid-template-columns: 1fr;
  }

  .law-chapter__head {
    display: grid;
    gap: 4px;
  }

  .law-chapter__head span {
    white-space: normal;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .article-list a {
    grid-template-columns: 1fr;
  }

  .article-list small {
    grid-column: auto;
  }

  .law-text {
    background: var(--paper);
  }

  .law-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }

  .law-row--section {
    gap: 8px;
    padding-top: 18px;
  }

  .law-marker {
    position: static;
    color: var(--warm);
    font-size: 12px;
  }

  .law-text p {
    text-indent: 1.5em;
  }

  .hermes-chat__form {
    grid-template-columns: minmax(0, 1fr) 38px;
    border-radius: 20px;
  }

  .hermes-chat__form button {
    width: 38px;
    height: 38px;
  }
}
