/* =========================================================
   Nestaura — Legal Document Shell
   Shared by datapolicy.html and terms.html
   Restyled to match the Nestaura brand: exact teal #004d40,
   white-dominant surfaces, brass accent, Sora/Inter type.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root{
  --teal:#004d40;
  --teal-tint:#eef4f2;
  --teal-tint-strong:#dfeae6;
  --brass:#a97c43;
  --brass-deep:#85602f;
  --brass-tint:#f8eede;
  --brass-tint-strong:#f0dcbc;
  --paper:#ffffff;
  --ink:#14231e;
  --ink-soft:#4f5f59;
  --ink-muted:#7c8b85;
  --line:#e2e8e5;
  --line-strong:#d3dcd8;
  --shadow:0 12px 28px -18px rgba(0,77,64,.20);
  --radius-sm:8px;
  --radius-md:12px;
  --font-heading:'Sora',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-body:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --maxw:1220px;
  --topbar-h:64px;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *{animation-duration:.001ms !important; transition-duration:.001ms !important;}
}

body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
  line-height:1.7;
}

a{color:inherit;}
img{max-width:100%; display:block;}

/* ---------- Top app bar (matches site shell / signup.html) ---------- */
.pt-safe{ padding-top:env(safe-area-inset-top,0); }

.app-topbar{
  position:sticky; top:0; z-index:60;
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  height:var(--topbar-h);
  padding:0 20px;
  background:var(--paper);
  border-bottom:1px solid var(--line);
}
.app-topbar .back-arrow{
  display:inline-flex; align-items:center; gap:6px;
  font-family:var(--font-body); font-weight:600; font-size:.86rem;
  color:var(--teal); text-decoration:none;
  padding:8px 12px 8px 8px; margin-left:-8px;
  border-radius:999px;
  transition:background .15s ease, color .15s ease;
  white-space:nowrap;
}
.app-topbar .back-arrow svg{ width:19px; height:19px; fill:currentColor; flex:none; }
.app-topbar .back-arrow:hover,
.app-topbar .back-arrow:focus-visible{ background:var(--teal-tint); }
.app-topbar .brand-mark img{ height:28px; width:auto; }

.topbar-actions{ display:flex; align-items:center; gap:8px; }
.topbar-actions .ghost-btn{
  font-family:var(--font-body); font-weight:600; font-size:.82rem;
  border:1px solid var(--line-strong); background:var(--paper); color:var(--teal);
  padding:8px 14px; border-radius:999px; cursor:pointer;
  display:inline-flex; align-items:center; gap:6px;
  transition:border-color .15s ease, background .15s ease, opacity .15s ease;
}
.topbar-actions .ghost-btn svg{ width:15px; height:15px; }
.topbar-actions .ghost-btn:hover{ border-color:var(--teal); background:var(--teal-tint); }
.topbar-actions .ghost-btn.primary{ background:var(--teal); border-color:var(--teal); color:var(--paper); }
.topbar-actions .ghost-btn.primary:hover{ opacity:.88; background:var(--teal); }

/* ---------- Document header band ----------
   Light, not a dark block — teal shows up as text and a
   brass rule, not as a heavy background fill. */
.doc-header{
  background:var(--teal-tint);
  border-bottom:3px solid var(--brass);
  color:var(--ink);
  padding:44px 20px 36px;
}
.doc-header-inner{ max-width:var(--maxw); margin:0 auto; }
.doc-eyebrow{
  font-family:var(--font-body); font-weight:700; font-size:.72rem;
  letter-spacing:.04em; text-transform:uppercase;
  color:var(--brass-deep);
  margin:0 0 10px;
}
.doc-header h1{
  font-family:var(--font-heading); font-weight:800;
  font-size:clamp(1.7rem, 3.4vw, 2.5rem);
  line-height:1.18; margin:0 0 12px; max-width:20ch;
  color:var(--teal);
  letter-spacing:-0.01em;
}
.doc-header p.doc-dek{
  font-family:var(--font-body); font-size:1.02rem; color:var(--ink-soft);
  max-width:62ch; margin:0 0 22px;
}
.doc-meta{
  display:flex; flex-wrap:wrap; gap:10px 28px;
  font-family:var(--font-body); font-size:.82rem; color:var(--ink-muted);
}
.doc-meta strong{ color:var(--ink); font-weight:700; }
.doc-meta .meta-item{ display:flex; align-items:center; gap:7px; }
.doc-meta .dot{ width:4px; height:4px; border-radius:50%; background:var(--line-strong); }

/* ---------- Layout: nav + content ---------- */
.doc-layout{
  max-width:var(--maxw); margin:0 auto;
  padding:36px 20px 100px;
  display:grid;
  grid-template-columns:252px minmax(0,1fr);
  gap:52px;
  align-items:start;
}

/* Nav rail */
.doc-nav{
  position:sticky; top:calc(var(--topbar-h) + 20px);
  max-height:calc(100vh - var(--topbar-h) - 40px);
  overflow-y:auto;
  padding-right:6px;
}
.doc-nav::-webkit-scrollbar{ width:5px; }
.doc-nav::-webkit-scrollbar-thumb{ background:var(--line-strong); border-radius:4px; }

.nav-group-label{
  font-family:var(--font-body); font-weight:700; font-size:.68rem;
  letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-muted); margin:22px 0 8px; padding-left:14px;
}
.nav-group-label:first-child{ margin-top:0; }
.nav-list{ list-style:none; margin:0; padding:0; }
.nav-list li{ margin:1px 0; }
.nav-list a{
  display:flex; align-items:baseline; gap:9px;
  font-family:var(--font-body); font-size:.855rem; font-weight:500;
  color:var(--ink-soft); text-decoration:none;
  padding:7px 14px; border-radius:8px;
  border-left:2.5px solid transparent;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-list a .n{ font-variant-numeric:tabular-nums; color:var(--ink-muted); font-size:.78rem; flex:none; }
.nav-list a:hover{ background:var(--teal-tint); color:var(--teal); }
.nav-list a.active{
  background:var(--teal-tint); color:var(--teal);
  border-left-color:var(--brass); font-weight:700;
}
.nav-list a.active .n{ color:var(--brass-deep); }

/* Scope filter (terms.html only) */
.scope-filter{
  display:flex; gap:6px; flex-wrap:wrap;
  margin-bottom:18px; padding:10px; background:var(--paper);
  border:1px solid var(--line); border-radius:var(--radius-md);
}
.scope-filter button{
  font-family:var(--font-body); font-weight:600; font-size:.76rem;
  border:1px solid transparent; background:transparent; color:var(--ink-soft);
  padding:7px 11px; border-radius:8px; cursor:pointer;
  transition:background .15s ease, color .15s ease;
  flex:1; text-align:center;
}
.scope-filter button .count{ color:var(--ink-muted); font-weight:500; }
.scope-filter button:hover{ background:var(--teal-tint); }
.scope-filter button.is-active{ background:var(--teal); color:var(--paper); }
.scope-filter button.is-active .count{ color:#bfe0d9; }

/* Mobile nav trigger */
.mobile-nav-trigger{ display:none; }

/* ---------- Content column ---------- */
.doc-content{ min-width:0; max-width:748px; }

.doc-intro{
  background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:22px 24px; margin-bottom:36px;
  font-family:var(--font-body); font-size:.92rem; color:var(--ink-soft);
  box-shadow:var(--shadow);
}
.doc-intro strong{ color:var(--teal); }

.doc-section{ padding:30px 0; border-bottom:1px solid var(--line); scroll-margin-top:calc(var(--topbar-h) + 90px); }
.doc-section:first-of-type{ padding-top:0; }
.doc-section:last-of-type{ border-bottom:none; }

.section-head{ display:flex; align-items:flex-start; gap:14px; margin-bottom:14px; }
.section-num{
  flex:none; width:34px; height:34px; border-radius:10px;
  background:var(--teal-tint); color:var(--teal);
  font-family:var(--font-heading); font-weight:700; font-size:.82rem;
  display:flex; align-items:center; justify-content:center;
  margin-top:2px;
}
.section-head h2{
  font-family:var(--font-heading); font-weight:700; font-size:1.28rem;
  color:var(--teal); margin:0 0 6px; line-height:1.3;
}
.section-titlewrap{ flex:1; min-width:0; }
.scope-pill{
  display:inline-flex; align-items:center; gap:5px;
  font-family:var(--font-body); font-weight:700; font-size:.68rem;
  letter-spacing:.02em;
  padding:3px 9px; border-radius:999px;
}
.scope-pill.all{ background:var(--teal-tint); color:var(--teal); }
.scope-pill.host{ background:var(--brass-tint); color:var(--brass-deep); }
.scope-pill svg{ width:11px; height:11px; }

.doc-section h3{
  font-family:var(--font-heading); font-weight:700; font-size:.98rem;
  color:var(--ink); margin:20px 0 8px;
}
.doc-section p{ margin:0 0 13px; color:var(--ink-soft); font-size:1.01rem; }
.doc-section ul, .doc-section ol{ margin:0 0 13px; padding-left:22px; color:var(--ink-soft); }
.doc-section li{ margin:0 0 6px; padding-left:2px; }
.doc-section li::marker{ color:var(--brass-deep); }

.doc-section dl{ margin:0 0 13px; }
.doc-section dt{ font-family:var(--font-body); font-weight:700; color:var(--teal); margin-top:12px; }
.doc-section dd{ margin:3px 0 0; color:var(--ink-soft); }

.callout{
  background:var(--brass-tint); border:1px solid var(--brass-tint-strong);
  border-left:4px solid var(--brass); border-radius:10px;
  padding:16px 18px; margin:16px 0; font-size:.96rem; color:var(--ink-soft);
}
.callout strong{ color:var(--brass-deep); }
.callout.teal{ background:var(--teal-tint); border-color:var(--teal-tint-strong); border-left-color:var(--teal); }
.callout.teal strong{ color:var(--teal); }

.doc-table-wrap{ overflow-x:auto; margin:14px 0 18px; border:1px solid var(--line); border-radius:10px; }
table.doc-table{ width:100%; border-collapse:collapse; font-family:var(--font-body); font-size:.88rem; min-width:420px; }
table.doc-table th{
  background:var(--teal); color:var(--paper); text-align:left;
  font-weight:700; padding:11px 14px; white-space:nowrap;
}
table.doc-table td{ padding:11px 14px; border-top:1px solid var(--line); color:var(--ink-soft); }
table.doc-table tr:nth-child(even) td{ background:var(--teal-tint); }

.approval-block{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:14px; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:18px 20px; margin:14px 0;
  font-family:var(--font-body); font-size:.86rem;
}
.approval-block div span{ display:block; color:var(--ink-muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.04em; margin-bottom:3px; }
.approval-block div strong{ color:var(--teal); font-size:.95rem; }

/* ---------- Footer ----------
   White, not a dark block — matches the rest of the site,
   teal is used only for text/links here. */
.doc-footer{
  background:var(--paper); color:var(--ink-soft);
  border-top:1px solid var(--line);
  padding:40px 20px 26px; margin-top:20px;
}
.doc-footer-inner{ max-width:var(--maxw); margin:0 auto; display:flex; flex-wrap:wrap; justify-content:space-between; gap:28px; }
.doc-footer h4{ font-family:var(--font-heading); color:var(--teal); margin:0 0 10px; font-size:.95rem; font-weight:700; }
.doc-footer p, .doc-footer a{ font-family:var(--font-body); font-size:.85rem; color:var(--ink-soft); text-decoration:none; margin:0 0 6px; }
.doc-footer a{ color:var(--teal); }
.doc-footer a:hover{ text-decoration:underline; }
.doc-footer .foot-links{ display:flex; gap:18px; flex-wrap:wrap; }
.doc-footer .foot-bottom{
  max-width:var(--maxw); margin:26px auto 0; padding-top:18px;
  border-top:1px solid var(--line);
  font-family:var(--font-body); font-size:.78rem; color:var(--ink-muted);
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px;
}

/* ---------- Back to top ---------- */
.back-to-top{
  position:fixed; right:20px; bottom:22px; z-index:70;
  width:44px; height:44px; border-radius:50%;
  background:var(--teal); color:var(--paper); border:none;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 10px 24px -8px rgba(0,77,64,.45);
  cursor:pointer; opacity:0; visibility:hidden; transform:translateY(8px);
  transition:opacity .2s ease, transform .2s ease, opacity .15s ease;
}
.back-to-top.show{ opacity:1; visibility:visible; transform:translateY(0); }
.back-to-top:hover{ opacity:.88; }
.back-to-top svg{ width:18px; height:18px; }

/* ---------- Mobile nav drawer ---------- */
.nav-overlay{
  position:fixed; inset:0; background:rgba(10,20,17,.45);
  z-index:80; opacity:0; visibility:hidden; transition:opacity .2s ease;
}
.nav-overlay.show{ opacity:1; visibility:visible; }

@media (max-width:940px){
  .doc-layout{ grid-template-columns:1fr; padding-top:20px; }
  .mobile-nav-trigger{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    width:100%; margin-bottom:22px;
    background:var(--paper); border:1px solid var(--line); border-radius:var(--radius-md);
    padding:13px 16px; font-family:var(--font-body); font-weight:700; font-size:.9rem;
    color:var(--teal); cursor:pointer;
  }
  .mobile-nav-trigger svg{ width:17px; height:17px; flex:none; }
  .doc-nav{
    position:fixed; top:0; left:0; bottom:0; z-index:90;
    width:min(320px,84vw); background:var(--paper);
    padding:20px 18px 30px; overflow-y:auto; max-height:none;
    transform:translateX(-105%); transition:transform .25s ease;
    box-shadow:20px 0 40px rgba(0,0,0,.15);
  }
  .doc-nav.open{ transform:translateX(0); }
  .doc-nav-close{
    display:flex; align-items:center; justify-content:space-between;
    font-family:var(--font-body); font-weight:700; color:var(--teal);
    margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--line);
  }
  .doc-nav-close button{ background:none; border:none; font-size:1.4rem; line-height:1; color:var(--ink-muted); cursor:pointer; padding:4px; }
  .doc-header{ padding:32px 18px 30px; }
  .app-topbar{ padding:0 16px; }
  .app-topbar .back-arrow span.label{ display:none; }
  .topbar-actions .ghost-btn span.label{ display:none; }
}

@media (max-width:520px){
  .doc-header h1{ max-width:none; }
  .approval-block{ grid-template-columns:1fr 1fr; }
}

/* ---------- Print ---------- */
@media print{
  .app-topbar, .doc-nav, .mobile-nav-trigger, .back-to-top, .scope-filter, .nav-overlay, .doc-footer{ display:none !important; }
  .doc-header{ background:none !important; color:#000 !important; padding:0 0 16px; border-bottom:1px solid #ccc; }
  .doc-header h1{ color:#000 !important; }
  .doc-header .doc-meta, .doc-header .doc-eyebrow, .doc-header p.doc-dek{ color:#333 !important; }
  .doc-layout{ display:block; padding:0; }
  .doc-content{ max-width:none; }
  body{ background:#fff; }
  .doc-section{ break-inside:avoid-page; }
  [data-scope]{ display:block !important; }
}
