/* Shared policy navigation and readable legal documents. Load after theme.css. */
:root {
  --legal-surface: #202b24;
  --legal-text: #d7decf;
  --legal-muted: #b4c0a8;
  --legal-border: #5d6d52;
  --legal-accent: #ffd56a;
}

html[data-theme="day"] {
  --legal-surface: #eee9da;
  --legal-text: #35412f;
  --legal-muted: #5c6853;
  --legal-border: #abb49a;
  --legal-accent: #17693b;
}

.site-header {
  height: auto;
  min-height: 104px;
  padding-block: 14px;
  flex-wrap: wrap;
}

.theme-tools {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.remember-theme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  color: var(--legal-muted);
  font-family: var(--body);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.remember-theme input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--green);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  max-width: 100%;
  font-family: var(--display);
  font-size: 13px;
  line-height: 1.6;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--legal-text);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--legal-border);
  overflow-wrap: anywhere;
}

.footer-links a:hover,
.footer-links a[aria-current="page"] {
  color: var(--legal-accent);
  text-decoration-color: currentColor;
}

.site-footer {
  flex-wrap: wrap;
}

.site-footer .footer-links {
  flex-basis: 100%;
  order: 5;
  padding-top: 12px;
  border-top: 1px solid var(--legal-border);
}

.legal-main {
  padding-top: 62px;
  padding-bottom: 84px;
}

.legal-hero {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--legal-border);
}

.legal-hero h1 {
  max-width: 19ch;
  margin: 0 0 22px;
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

html[data-theme="day"] .legal-hero h1 {
  color: var(--ink);
}

.legal-summary {
  max-width: 69ch;
  margin: 0 0 22px;
  color: var(--legal-text);
  font-size: 20px;
  line-height: 1.7;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  color: var(--legal-muted);
  font-size: 13px;
  line-height: 1.65;
}

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

.legal-layout > * {
  min-width: 0;
}

.legal-toc {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid var(--legal-border);
  background: var(--legal-surface);
  padding: 20px;
}

.legal-toc h2,
.legal-toc h3 {
  margin: 0 0 15px;
  color: var(--legal-accent);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0;
}

.legal-toc nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legal-toc a {
  display: block;
  padding-block: 6px;
  color: var(--legal-text);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.legal-toc a:hover {
  color: var(--legal-accent);
  text-decoration-color: currentColor;
}

.legal-article {
  max-width: 76ch;
  color: var(--legal-text);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.legal-section {
  margin-bottom: 32px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--legal-border);
  scroll-margin-top: 30px;
}

.legal-section:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.legal-section h2 {
  margin: 0 0 17px;
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(24px, 2.4vw, 30px);
  line-height: 1.35;
  letter-spacing: 0;
}

.legal-section h3 {
  margin: 24px 0 12px;
  color: var(--cream);
  font-size: 20px;
  line-height: 1.4;
}

html[data-theme="day"] .legal-section :is(h2, h3) {
  color: var(--ink);
}

.legal-article p {
  margin: 0 0 18px;
}

.legal-article :is(ul, ol) {
  margin: 12px 0 22px;
  padding-inline-start: 26px;
}

.legal-article li {
  margin-block: 9px;
  padding-inline-start: 3px;
}

.legal-article li::marker {
  color: var(--legal-accent);
}

.legal-article a,
.legal-contact a {
  color: var(--legal-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-article a:hover,
.legal-contact a:hover {
  text-decoration-thickness: 2px;
}

.legal-article code {
  font-size: .9em;
  overflow-wrap: anywhere;
}

.legal-table {
  width: 100%;
  margin: 22px 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
  line-height: 1.65;
}

.legal-table caption {
  margin-bottom: 12px;
  text-align: left;
  font-weight: 700;
}

.legal-table :is(th, td) {
  padding: 13px;
  border: 1px solid var(--legal-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.legal-table th {
  background: var(--legal-surface);
  color: var(--legal-accent);
  font-weight: 700;
}

.legal-notice,
.legal-contact {
  margin: 26px 0;
  padding: 22px;
  border: 1px solid var(--legal-border);
  background: var(--legal-surface);
  color: var(--legal-text);
  font-style: normal;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.legal-notice {
  border-left: 4px solid var(--legal-accent);
}

.legal-notice :last-child,
.legal-contact :last-child,
.legal-section > :last-child {
  margin-bottom: 0;
}

.cookie-controls {
  display: grid;
  gap: 16px;
  margin-block: 24px;
  padding: 22px;
  border: 1px solid var(--legal-border);
  background: var(--legal-surface);
}

.cookie-controls label {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}

.cookie-controls input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 6px 0 0;
  accent-color: var(--green);
}

.cookie-controls button {
  justify-self: start;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid #69a46c;
  background: var(--green);
  color: #fff4d9;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.45;
  white-space: normal;
}

.cookie-controls button:hover {
  border-color: var(--legal-accent);
}

.preference-status {
  min-height: 1.7em;
  margin: 0;
  color: var(--legal-accent);
  font-size: 14px;
  line-height: 1.7;
}

.legal-page :is(a, button, input):focus-visible,
.theme-tools :is(button, input):focus-visible,
.footer-links a:focus-visible {
  outline: 3px solid var(--legal-accent);
  outline-offset: 4px;
}

@media (max-width: 1000px) {
  .legal-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 32px;
  }
  .legal-toc { padding: 17px; }
}

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-toc { position: static; max-height: none; overflow: visible; }
  .legal-toc nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 22px; }
  .legal-article { max-width: none; }
}

@media (max-width: 650px) {
  .site-header { min-height: 100px; padding-block: 12px; gap: 10px; }
  .theme-tools { gap: 4px; }
  .remember-theme { min-height: 28px; font-size: 11px; gap: 6px; }
  .remember-theme input { width: 15px; height: 15px; }
  .footer-links { gap: 4px 17px; font-size: 12px; }
  .footer-links a { min-height: 36px; }
  .legal-main { padding-top: 36px; padding-bottom: 48px; }
  .legal-hero { padding-bottom: 24px; }
  .legal-hero .eyebrow { margin-bottom: 18px; font-size: 11px; letter-spacing: .08em; }
  .legal-hero h1 { margin-bottom: 18px; }
  .legal-summary { font-size: 17px; line-height: 1.75; }
  .legal-meta { font-size: 12px; gap: 6px 14px; }
  .legal-layout { gap: 28px; margin-top: 26px; }
  .legal-toc nav { grid-template-columns: minmax(0, 1fr); }
  .legal-toc a { min-height: 34px; }
  .legal-article { font-size: 16px; line-height: 1.8; }
  .legal-section { margin-bottom: 26px; padding-bottom: 22px; }
  .legal-section h2 { font-size: 24px; }
  .legal-section h3 { font-size: 19px; }
  .legal-article :is(ul, ol) { padding-inline-start: 21px; }
  .legal-notice, .legal-contact, .cookie-controls { padding: 17px; font-size: 15px; }
  .legal-table { font-size: 13px; line-height: 1.6; }
  .legal-table :is(th, td) { padding: 9px 7px; }
}

@media print {
  .legal-page { background: #fff; color: #000; }
  .legal-page .legal-main { width: 100%; padding: 0; }
  .legal-page .legal-layout { display: block; }
  .legal-page .legal-article { max-width: none; color: #000; font-size: 11pt; }
  .legal-page :is(.site-header, .site-footer, .legal-toc, .cookie-controls) { display: none; }
  .legal-page :is(.eyebrow, .legal-hero h1, .legal-section h2, .legal-section h3, .legal-summary, .legal-meta) { color: #000; }
  .legal-page :is(.legal-notice, .legal-contact, .legal-table th) { background: #fff; color: #000; }
  .legal-page .legal-section h2 { break-after: avoid; }
  .legal-page :is(.legal-notice, .legal-contact) { break-inside: avoid; }
}
