/* =========================================================
   Facet — Legal & Help
   Light-first. Inter only. Warm authority, clean hierarchy.
   ========================================================= */

@charset "UTF-8";

:root {
  color-scheme: light dark;

  /* Surface */
  --bg: #FAFAF8;
  --bg-tint: #F4F2ED;
  --bg-card: #FFFFFF;
  --bg-code: #F0EDE6;

  /* Text */
  --fg: #1A1A1F;
  --text: #3D3D45;
  --secondary: #6E6E78;
  --muted: #9C9CA5;

  /* Borders */
  --rule: #E5E3DD;
  --rule-strong: #D0CEC6;

  /* Accents */
  --accent: #C49A6C;
  --accent-soft: #E8D5BF;
  --accent-bg: #FBF6F0;
  --link: #3066A8;
  --link-hover: #1E4A7D;
  --focus: #3066A8;

  /* Typography */
  --sans: "Inter var", "Inter", sans-serif;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;

  --leading: 1.65;
  --leading-tight: 1.3;

  /* Layout */
  --gutter: 1.25rem;
  --topbar-h: 3.25rem;
  --r: 10px;
  --r-sm: 6px;
  --max-w: 640px;
  --max-w-doc: 880px;
}

@media (min-width: 640px) {
  :root {
    --gutter: 2rem;
    --fs-2xl: 2rem;
    --fs-3xl: 2.5rem;
  }
}

@media (min-width: 1024px) {
  :root { --gutter: 2.5rem; }
}

/* ── Dark mode ────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --bg-tint: #19191D;
    --bg-card: #1E1E23;
    --bg-code: #1A1A1F;

    --fg: #EDEDF0;
    --text: #B5B5BF;
    --secondary: #8A8A94;
    --muted: #5C5C65;

    --rule: #2A2A30;
    --rule-strong: #3A3A42;

    --accent: #D4A574;
    --accent-soft: #3D2E1F;
    --accent-bg: #1E1914;
    --link: #7FA8D8;
    --link-hover: #A8C8EE;
  }
}

/* ── Resets ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 1.5rem); }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: var(--leading);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@supports (font-variation-settings: normal) {
  body { font-family: "Inter var", sans-serif; }
}

p { margin: 0 0 0.9em; }
p:last-child { margin-bottom: 0; }

h1, h2, h3 { color: var(--fg); line-height: var(--leading-tight); margin: 0; }
h1 { font-weight: 720; letter-spacing: -0.035em; }
h2 { font-weight: 660; letter-spacing: -0.025em; }
h3 { font-weight: 620; letter-spacing: -0.015em; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

strong { color: var(--fg); font-weight: 620; }

.skip-link {
  position: absolute; top: -3rem; left: 0;
  background: var(--fg); color: var(--bg);
  padding: 0.5rem 0.75rem; text-decoration: none;
  font-size: var(--fs-sm); z-index: 100;
}
.skip-link:focus { top: 0; }

/* ── Topbar ───────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
@supports (backdrop-filter: blur(14px)) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
  }
}

.topbar-inner {
  max-width: var(--max-w-doc);
  height: 100%; margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 1rem;
}

.brand {
  font-size: var(--fs-md);
  font-weight: 720;
  letter-spacing: -0.04em;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
  transition: color 0.15s;
}
.brand:hover { color: var(--accent); }

.topbar-nav {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 0.125rem;
}
.topbar-nav a {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: var(--fs-sm);
  font-weight: 480;
  color: var(--secondary);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}
.topbar-nav a:hover {
  color: var(--fg);
  background: var(--bg-tint);
}
.topbar-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  background: var(--bg-tint);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 0.3rem 0.625rem;
  font: 500 var(--fs-sm)/1 var(--sans);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
}
.menu-toggle:hover { border-color: var(--rule-strong); }

/* ── Layout columns ───────────────────────── */

.col {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.col-doc { max-width: var(--max-w-doc); }

/* ── HOME: Hero area ──────────────────────── */

.home-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--rule);
}

.home-hero h1 {
  font-size: var(--fs-2xl);
  margin-bottom: 0.375rem;
}

.home-hero p {
  font-size: var(--fs-base);
  color: var(--secondary);
  margin: 0;
}

/* ── HOME: FAQ ────────────────────────────── */

.faq-heading {
  font-size: var(--fs-lg);
  font-weight: 660;
  padding: 2rem 0 0;
  margin-bottom: 0.25rem;
}
.faq-subtext {
  font-size: var(--fs-sm);
  color: var(--secondary);
  margin: 0 0 0.75rem;
}

.faq-list { list-style: none; margin: 0; padding: 0; }
.faq-item { border-bottom: 1px solid var(--rule); }

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.875rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 580;
  color: var(--fg);
  text-align: left;
  list-style: none;
  transition: color 0.15s;
}
.faq-q:hover { color: var(--accent); }
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: "+";
  font-size: 1.125rem;
  font-weight: 350;
  color: var(--muted);
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  transition: transform 0.2s ease, color 0.15s;
}
details[open] > .faq-q::after {
  content: "\2212";
  color: var(--accent);
}

.faq-a {
  padding: 0 0 1rem;
  font-size: var(--fs-base);
  color: var(--text);
  line-height: var(--leading);
}
.faq-a a { font-weight: 520; }

/* ── HOME: Documents ──────────────────────── */

.doc-links-heading {
  font-size: var(--fs-lg);
  font-weight: 660;
  padding: 2.25rem 0 0;
  margin-bottom: 0.25rem;
}
.doc-links-subtext {
  font-size: var(--fs-sm);
  color: var(--secondary);
  margin: 0 0 0.75rem;
}

.doc-links { list-style: none; margin: 0; padding: 0; }
.doc-links li { border-bottom: 1px solid var(--rule); }
.doc-links li:first-child { border-top: 1px solid var(--rule); }

.doc-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  text-decoration: none;
  font-size: var(--fs-base);
  font-weight: 550;
  color: var(--fg);
  transition: color 0.15s;
}
.doc-links a:hover { color: var(--accent); }
.doc-links .arrow {
  color: var(--muted);
  font-weight: 350;
  font-size: 1.125rem;
  transition: transform 0.2s ease, color 0.15s;
}
.doc-links a:hover .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── HOME: Contact strip ──────────────────── */

.contact-strip {
  margin: 2.5rem 0 0;
  padding: 1.5rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r);
}
.contact-strip h2 {
  font-size: var(--fs-md);
  font-weight: 640;
  margin-bottom: 0.75rem;
}
.contact-strip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
}
@media (min-width: 480px) {
  .contact-strip-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
}
.contact-strip-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.contact-strip-item a {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--fg);
  text-decoration: none;
}
.contact-strip-item a:hover { color: var(--accent); text-decoration: underline; }
.contact-strip-item span {
  font-size: var(--fs-xs);
  color: var(--secondary);
}

/* ── Footer ───────────────────────────────── */

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 1.5rem var(--gutter);
  margin-top: 3.5rem;
}
.site-foot-inner {
  max-width: var(--max-w-doc);
  margin: 0 auto;
  font-size: var(--fs-xs);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  justify-content: space-between;
}
.site-foot-inner p { margin: 0; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--fg); text-decoration: underline; }

/* ── DOC PAGES: Header ────────────────────── */

.doc-page-header {
  padding: 1.75rem 0 0;
}
.doc-page-header .back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--secondary);
  text-decoration: none;
  margin-bottom: 1rem;
  transition: color 0.15s;
}
.doc-page-header .back:hover { color: var(--fg); }
.doc-page-header h1 {
  font-size: var(--fs-2xl);
  margin-bottom: 0.375rem;
}
.doc-page-header .meta {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
}

/* ── DOC PAGES: Layout (content + right TOC) ─ */

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 3rem;
  padding: 2rem 0 3.5rem;
}

/* Content column always comes first in DOM and visually */
.doc-content { order: 1; min-width: 0; }
.doc-toc-wrap { order: 2; }

/* ── TOC sidebar (right) ──────────────────── */

.doc-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 3rem);
  overflow-y: auto;
}
.doc-toc-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.625rem;
}
.doc-toc-list {
  list-style: none; margin: 0; padding: 0;
}
.doc-toc-list a {
  display: block;
  padding: 0.25rem 0.625rem;
  font-size: var(--fs-xs);
  color: var(--secondary);
  text-decoration: none;
  line-height: 1.45;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.doc-toc-list a:hover {
  color: var(--fg);
  border-left-color: var(--rule-strong);
}
.doc-toc-list a.is-active {
  color: var(--fg);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* ── Mobile TOC ───────────────────────────── */

.mobile-toc { display: none; margin: 0 0 1.5rem; }
.mobile-toc-summary {
  padding: 0.75rem 1rem;
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.mobile-toc-summary:hover { background: var(--bg-code); }
.mobile-toc-summary::-webkit-details-marker { display: none; }
.mobile-toc-summary::after {
  content: "\25BE";
  color: var(--muted);
  transition: transform 0.2s ease;
}
.mobile-toc[open] .mobile-toc-summary::after { transform: rotate(180deg); }
.mobile-toc-list {
  list-style: none; margin: 0;
  padding: 0.625rem 1rem 0.375rem;
}
.mobile-toc-list a {
  display: block;
  padding: 0.35rem 0;
  font-size: var(--fs-sm);
  color: var(--text);
  text-decoration: none;
}
.mobile-toc-list a:hover { color: var(--link); }

/* ── Doc sections ─────────────────────────── */

.doc-section {
  margin: 0 0 2.25rem;
  scroll-margin-top: calc(var(--topbar-h) + 1.5rem);
}
.doc-section:last-of-type { margin-bottom: 0; }

.doc-section h2 {
  font-size: var(--fs-lg);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.doc-section p,
.doc-section ul,
.doc-section ol {
  font-size: var(--fs-base);
}
.doc-section ul,
.doc-section ol {
  margin: 0.75rem 0;
  padding-left: 1.25rem;
}
.doc-section li { margin-bottom: 0.375rem; }

.doc-section address,
.doc-section .address {
  display: block;
  font-style: normal;
  white-space: pre-line;
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.875rem 1.125rem;
  margin: 0.875rem 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text);
}

/* ── Contact block at end of doc ──────────── */

.contact-block {
  margin: 2.75rem 0 0;
  padding: 1.5rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r);
}
.contact-block h2 {
  font-size: var(--fs-md);
  font-weight: 640;
  margin: 0 0 0.25rem;
}
.contact-block > p {
  margin: 0 0 0.75rem;
  font-size: var(--fs-sm);
  color: var(--secondary);
}
.contact-block-emails {
  list-style: none; margin: 0; padding: 0;
}
.contact-block-emails li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0;
  font-size: var(--fs-sm);
}
.contact-block-emails li + li {
  border-top: 1px solid color-mix(in srgb, var(--accent-soft) 60%, transparent);
}
.contact-block-emails a {
  font-weight: 620;
  min-width: 160px;
  color: var(--fg);
  text-decoration: none;
}
.contact-block-emails a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.contact-block-emails span {
  color: var(--secondary);
}

/* ── Responsive ───────────────────────────── */

@media (max-width: 768px) {
  .doc-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .doc-toc-wrap { display: none; }
  .doc-content { order: 1; }
  .mobile-toc { display: block; }

  .topbar-nav { display: none; }
  .topbar-nav.is-open {
    display: flex;
    position: absolute;
    top: var(--topbar-h);
    right: var(--gutter);
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    min-width: 160px;
  }
  @media (prefers-color-scheme: dark) {
    .topbar-nav.is-open {
      box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
    }
  }
  .topbar-nav.is-open a { width: 100%; }
  .menu-toggle { display: inline-flex; align-items: center; }

  .doc-page-header h1 { font-size: var(--fs-xl); }
  .doc-section h2 { font-size: var(--fs-md); }
  .home-hero h1 { font-size: var(--fs-xl); }
}

/* ── Print ────────────────────────────────── */

@media print {
  .topbar, .doc-toc-wrap, .mobile-toc, .site-foot, .contact-strip { display: none; }
  body { color: #000; background: #fff; font-size: 11pt; }
  .doc-layout { display: block; }
  a { color: #000; }
}
