/* Soul Oracle — Legal Document Design System (production) */
:root {
  --bg: #f5f2eb;
  --bg-elevated: #fffcf7;
  --bg-muted: #ebe6db;
  --text: #1f1c18;
  --text-muted: #5a554c;
  --text-soft: #80796c;
  --border: #ddd5c6;
  --border-strong: #bfb49e;
  --accent: #7d6740;
  --accent-soft: #f1e9d8;
  --charcoal: #26231f;
  --shadow: 0 1px 2px rgba(31, 28, 24, 0.04), 0 10px 28px rgba(31, 28, 24, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font-serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --max-content: 46rem;
  --max-wide: 74rem;
  --header-h: 4.5rem;
  --toc-w: 17rem;
  --line: 1.75;
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.045rem;
  line-height: var(--line);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(141, 115, 64, 0.08), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.rtl {
  direction: rtl;
  text-align: right;
}

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

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

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 242, 235, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0.9rem 1.35rem;
  display: flex;
  align-items: center;
  gap: 1rem 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--charcoal);
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-soft);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 600;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
  flex: 1 1 auto;
  min-width: 12rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--charcoal);
  background: var(--accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-inline-start: auto;
  flex-wrap: wrap;
}

.lang-switcher {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem;
  background: var(--bg-elevated);
  box-shadow: 0 1px 2px rgba(31, 28, 24, 0.03);
}

.lang-switcher button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  min-width: 2.35rem;
  padding: 0.42rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}

.lang-switcher button:hover { color: var(--charcoal); }

.lang-switcher button[aria-pressed="true"] {
  background: var(--charcoal);
  color: #fff;
}

.btn-print,
.btn-ghost {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-print:hover,
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--charcoal);
  background: var(--accent-soft);
}

/* ─── Layout ─── */
.page-main {
  max-width: var(--max-wide);
  margin: 0 auto;
}

.layout-wide,
.page-shell {
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  gap: 1.75rem 2.25rem;
  align-items: start;
  padding: 2rem 1.35rem 4.25rem;
}

@media (max-width: 980px) {
  .layout-wide,
  .page-shell {
    grid-template-columns: 1fr;
    padding-top: 1.25rem;
  }
}

/* ─── TOC ─── */
.toc-sidebar,
.toc-panel { min-width: 0; }

.toc-card,
.toc-panel {
  position: sticky;
  top: calc(var(--header-h) + 0.85rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 0.95rem 0.95rem;
  max-height: calc(100vh - var(--header-h) - 1.75rem);
  overflow: auto;
}

@media (max-width: 980px) {
  .toc-card,
  .toc-panel {
    position: relative;
    top: 0;
    max-height: min(16rem, 40vh);
  }
}

.toc-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 0.7rem;
  font-weight: 700;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: none;
}

.toc-list li { margin: 0; }

.toc-list a {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
  padding: 0.4rem 0.55rem;
  border-radius: 7px;
  border-inline-start: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

body.rtl .toc-list a {
  border-inline-start: 0;
  border-inline-end: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a.is-active {
  color: var(--charcoal);
  background: var(--accent-soft);
  border-inline-start-color: var(--accent);
}

body.rtl .toc-list a:hover,
body.rtl .toc-list a.is-active {
  border-inline-start-color: transparent;
  border-inline-end-color: var(--accent);
}

/* ─── Document ─── */
.document,
.doc-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.15rem 2.35rem 2.5rem;
  min-width: 0;
}

@media (max-width: 640px) {
  .document,
  .doc-card { padding: 1.35rem 1.05rem 1.75rem; }
}

.doc-header { margin-bottom: 0.25rem; }

.doc-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 0.55rem;
  font-weight: 700;
}

.doc-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  line-height: 1.12;
  color: var(--charcoal);
  margin: 0 0 1.1rem;
  font-weight: 600;
  max-width: 18ch;
}

.doc-meta,
.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.35rem;
}

.meta-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
}

/* Soft notice — not draft wording */
.counsel-note {
  display: none; /* hidden on published pages; review notes live in HTML comments */
}

/* Emphasized legal callouts (AI disclaimer, no professional advice) */
.legal-callout {
  margin: 0.35rem 0 0.85rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border);
  border-inline-start: 3px solid #8a6d3b;
  border-radius: calc(var(--radius) - 2px);
  background: #faf7f0;
}

.legal-callout p {
  margin: 0 0 0.65rem;
}

.legal-callout p:last-child {
  margin-bottom: 0;
}

[dir="rtl"] .legal-callout {
  border-inline-start-width: 3px;
}

.summary-card {
  background: linear-gradient(165deg, #fbf8f1 0%, #f4efe4 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.25rem;
  margin: 0 0 2rem;
}

.summary-card h2,
.summary-title {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  margin: 0 0 0.75rem;
  color: var(--charcoal);
  font-weight: 600;
}

.summary-card ul,
.summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  display: grid;
  gap: 0.55rem;
}

.summary-card li,
.summary-list li {
  position: relative;
  margin: 0;
  padding-inline-start: 1.15rem;
  font-size: 0.96rem;
  line-height: 1.5;
}

.summary-card li::before,
.summary-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.legal-section {
  padding-top: 1.65rem;
  margin-top: 1.65rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.legal-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.section-heading,
.legal-section h2 {
  font-family: var(--font-serif);
  font-size: 1.42rem;
  line-height: 1.28;
  color: var(--charcoal);
  margin: 0 0 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.heading-text { flex: 1 1 auto; min-width: 0; }

.section-anchor {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-size: 0;
  line-height: 0;
}

.section-heading:hover .section-anchor,
.section-anchor:focus-visible {
  opacity: 0.85;
}

.section-anchor::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  background: currentColor;
  opacity: 0.85;
  /* link glyph via mask */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat;
}

.section-anchor:hover {
  opacity: 1;
  color: var(--accent);
  background: var(--accent-soft);
}

.section-body { max-width: var(--max-content); }

.legal-section h3 {
  font-size: 1.02rem;
  margin: 1.05rem 0 0.45rem;
  color: var(--charcoal);
}

.legal-section p,
.legal-section li { color: var(--text); }

.legal-section p { margin: 0 0 0.9rem; }

.legal-section ul,
.legal-section ol {
  margin: 0 0 0.95rem;
  padding-inline-start: 1.3rem;
}

.legal-section li { margin: 0.35rem 0; }

.placeholder {
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: inherit;
}

/* ─── Footer ─── */
.site-footer {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 1.75rem 1.35rem 2.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.footer-inner,
.footer-grid {
  display: grid;
  gap: 0.85rem;
}

.footer-text { margin: 0; color: var(--text-muted); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--charcoal);
  text-decoration: underline;
}

.footer-contact {
  margin: 0;
  color: var(--text-soft);
}

/* Legal hub */
.legal-hub {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.legal-hub h1 {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: 0 0 0.75rem;
}

.legal-hub .lead {
  color: var(--text-muted);
  margin: 0 0 2rem;
  font-size: 1.05rem;
}

.legal-hub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.legal-hub-list a {
  display: block;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--charcoal);
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.legal-hub-list a:hover {
  border-color: var(--border-strong);
  color: var(--accent);
}

.legal-hub-list span {
  display: block;
  margin-top: 0.35rem;
  font-weight: 400;
  color: var(--text-soft);
  font-size: 0.92rem;
}

@media print {
  .site-header,
  .toc-sidebar,
  .toc-panel,
  .header-actions,
  .section-anchor,
  .site-footer .no-print { display: none !important; }

  body { background: #fff; color: #000; }
  .layout-wide,
  .page-shell { display: block; padding: 0; }
  .document,
  .doc-card { box-shadow: none; border: 0; padding: 0; }
  .legal-section { break-inside: avoid; }
  .summary-card { background: #f7f7f7; }
}
