:root {
  --bg: #f7f1e8;
  --surface: #fffaf2;
  --surface-alt: #efe6d8;
  --text: #1f1c18;
  --muted: #5c5349;
  --border: #dfd3c2;
  --primary: #b42843;
  --primary-hover: #8f1d33;
  --accent: #0c625b;
  --on-primary: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

:root[data-theme="night"] {
  --bg: #0c101b;
  --surface: #151c2c;
  --surface-alt: #1c2538;
  --text: #eef2f9;
  --muted: #9aa5bc;
  --border: #2a354d;
  --primary: #b42843;
  --primary-hover: #8f1d33;
  --accent: #0c625b;
}

:root[data-theme="night"] a:not(.btn-primary):not(.btn-outline):not(.brand):not(.related-card) {
  color: var(--text);
  text-decoration-color: var(--primary);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--primary);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 18px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--primary);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle:focus-visible,
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-main {
  padding: 32px 0 64px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.stamp-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--text);
  margin-top: 0;
}

h1 {
  font-size: 48px;
  margin: 12px 0 16px;
}

h2 {
  font-size: 28px;
  margin: 48px 0 16px;
}

h3 {
  font-size: 22px;
  margin: 24px 0 12px;
}

.hero-dossier {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 48px;
}

.hero-lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 24px;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dossier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.dossier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.status-pill {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-primary);
  font-size: 12px;
}

.dossier-list {
  margin: 0;
}

.dossier-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.dossier-row:last-child {
  border-bottom: none;
}

.dossier-row dt {
  color: var(--muted);
  font-weight: 600;
}

.dossier-row dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.page-head {
  margin-bottom: 32px;
}

.dossier-prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.dossier-prose p,
.dossier-prose li {
  max-width: 70ch;
}

.dossier-prose ul,
.dossier-prose ol {
  padding-left: 24px;
}

.dossier-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.dossier-prose th,
.dossier-prose td {
  padding: 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.dossier-prose th {
  background: var(--surface-alt);
  font-weight: 700;
}

.tool-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 32px;
}

.related-strip,
.faq-card,
.comments-box {
  margin-top: 48px;
}

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

.related-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
}

.related-card:hover {
  border-color: var(--primary);
}

.related-card span {
  font-size: 14px;
  color: var(--muted);
}

.faq-card details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  margin-bottom: 12px;
}

.faq-card summary {
  font-weight: 700;
  cursor: pointer;
}

.faq-card details p {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.engage-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.action-btn[data-gf-liked],
.action-btn[aria-pressed="true"] {
  border-color: var(--primary);
  color: var(--primary);
}

.comments-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.comments-intro,
.share-msg,
.comment-msg {
  font-size: 14px;
  color: var(--muted);
}

.comment-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item[data-gf-owner] {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.comment-owner {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
}

.comment-time,
.reply-to {
  font-size: 12px;
  color: var(--muted);
}

.reply-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.comment-replies {
  margin: 12px 0 0 24px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.comment-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row label {
  font-size: 14px;
  font-weight: 600;
}

.form-row input,
.form-row textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

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

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}

.not-found {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 640px) {
  h1 {
    font-size: 32px;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 12px 20px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .hero-dossier,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .dossier-prose {
    padding: 20px;
  }

  .hero-actions a,
  .form-actions .btn-primary {
    width: 100%;
  }
}
