/* ==========================================================================
   HALFTASK — shared styles for Terms of Service & Privacy Policy
   Tokens mirror index.html so the legal pages sit inside the same visual
   system. Dark mode follows the same html.dark / .dark-mode hooks the rest
   of the site uses, and reads ht_theme from localStorage like every other page.
   ========================================================================== */

:root {
  --teal: #1890a8;
  --teal-dark: #0f6f95;
  --teal-deep: #0a3a52;
  --teal-light: #48c0c0;
  --bg: #d7e9ea;
  --surface: #ffffff;
  --ink: #0f2b3a;
  --muted: #5a7d88;
  --line: rgba(15, 43, 58, .12);
}

html.dark, body.dark-mode {
  --bg: #0a1622;
  --surface: #13202e;
  --ink: #e6f4f4;
  --muted: #8fb0ba;
  --line: rgba(255, 255, 255, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  transition: background .4s, color .4s;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ header */
header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hdr-logo { height: 52px; width: auto; display: block; }
.hdr-logo-dark { display: none; }
html.dark .hdr-logo-light, body.dark-mode .hdr-logo-light { display: none; }
html.dark .hdr-logo-dark,  body.dark-mode .hdr-logo-dark  { display: block; }

.hdr-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.icon-btn:hover { border-color: var(--teal); color: var(--teal); }
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--teal-dark);
  text-decoration: none; padding: 9px 16px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .2s, color .2s;
}
.btn-back:hover { border-color: var(--teal); color: var(--teal); }
.btn-back svg { transition: transform .2s; }
.btn-back:hover svg { transform: translateX(-2px); }

/* --------------------------------------------------------------- page head */
.doc-head { padding: 64px 0 36px; }
.doc-eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--teal); margin-bottom: 16px;
}
.doc-eyebrow span {
  width: 40px; height: 5px; border-radius: 5px;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
}
.doc-h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(30px, 4.2vw, 46px); font-weight: 800;
  letter-spacing: -.5px; line-height: 1.1; margin-bottom: 14px;
}
.doc-sub { font-size: 15.5px; color: var(--muted); line-height: 1.65; max-width: 640px; }
.doc-meta {
  margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 12.5px; color: var(--muted);
}
.doc-meta b {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 100px; padding: 6px 14px; font-weight: 600; color: var(--ink);
}

/* Draft banner — remove once a lawyer has signed the document off. */
.doc-flag {
  margin: 26px 0 0; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--teal); border-radius: 14px;
  font-size: 13.5px; color: var(--muted); line-height: 1.6;
}
.doc-flag b { color: var(--ink); }

/* ------------------------------------------------------------------ layout */
.doc-grid {
  display: grid; grid-template-columns: 250px 1fr; gap: 48px;
  align-items: start; padding-bottom: 90px;
}
.toc { position: sticky; top: 92px; }
.toc-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  font-weight: 700; color: var(--ink); margin-bottom: 14px;
}
.toc a {
  display: block; font-size: 13.5px; color: var(--muted);
  text-decoration: none; padding: 7px 12px; border-radius: 9px;
  border-left: 2px solid transparent; transition: color .2s, background .2s;
}
.toc a:hover { color: var(--teal); background: var(--surface); }
.toc a.active { color: var(--teal-dark); border-left-color: var(--teal); font-weight: 600; }

.doc-body { min-width: 0; }
.doc-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 32px; margin-bottom: 18px;
  scroll-margin-top: 92px;
}
.doc-section h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 20px; font-weight: 700; letter-spacing: -.2px;
  margin-bottom: 14px; display: flex; align-items: baseline; gap: 12px;
}
.doc-section h2 i {
  font-style: normal; font-size: 12px; font-weight: 700;
  color: var(--teal); letter-spacing: 1px; flex: 0 0 auto;
}
.doc-section h3 {
  font-size: 15px; font-weight: 700; margin: 22px 0 8px; color: var(--ink);
}
.doc-section p { font-size: 14.5px; line-height: 1.72; color: var(--muted); margin-bottom: 12px; }
.doc-section p:last-child, .doc-section ul:last-child { margin-bottom: 0; }
.doc-section strong { color: var(--ink); font-weight: 600; }
.doc-section a { color: var(--teal-dark); }
html.dark .doc-section a, body.dark-mode .doc-section a { color: var(--teal-light); }

.doc-section ul { margin: 0 0 12px; padding-left: 20px; }
.doc-section li {
  font-size: 14.5px; line-height: 1.72; color: var(--muted); margin-bottom: 7px;
}
.doc-section li::marker { color: var(--teal); }

/* Placeholders the site owner must fill in before publishing. */
.fill {
  background: rgba(24, 144, 168, .12); color: var(--teal-dark);
  border: 1px dashed var(--teal); border-radius: 6px;
  padding: 1px 7px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
html.dark .fill, body.dark-mode .fill { color: var(--teal-light); }

/* Reference table (data collected / retention) */
.doc-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.doc-table th, .doc-table td {
  text-align: left; padding: 11px 12px; font-size: 13.5px;
  border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.6;
}
.doc-table th { font-weight: 700; color: var(--ink); font-size: 12px;
  text-transform: uppercase; letter-spacing: .8px; }
.doc-table td { color: var(--muted); }
.doc-table tr:last-child td { border-bottom: none; }

/* Contact / grievance card */
.doc-contact {
  background: linear-gradient(135deg, var(--teal-deep), var(--teal-dark));
  border-radius: 18px; padding: 30px 32px; color: #eaf7fa; margin-top: 6px;
}
.doc-contact h2 { color: #fff; }
.doc-contact h2 i { color: var(--teal-light); }
.doc-contact p, .doc-contact li { color: rgba(234, 247, 250, .82); }
.doc-contact strong { color: #fff; }
.doc-contact .fill {
  background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .5);
}

/* ------------------------------------------------------------------ footer */
footer { padding: 40px 0; color: var(--muted); border-top: 1px solid var(--line); }
.foot-bot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; flex-wrap: wrap; gap: 10px;
}
.foot-bot a { color: var(--muted); text-decoration: none; }
.foot-bot a:hover { color: var(--teal); }

/* ----------------------------------------------------------------- mobile
   Phones and small tablets get their own structure rather than a squeezed
   desktop layout:
     - a slim sticky header with an icon-only Back button
     - the contents list becomes a sticky, swipeable row of chips under it
     - sections are flat, edge-to-edge reading blocks (no nested cards)
   ------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --hdr-h: 58px; }
  .wrap { padding: 0 16px; }

  /* Header */
  .hdr-inner { padding: 10px 16px; min-height: var(--hdr-h); }
  .hdr-logo { height: 36px; }
  .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .btn-back {                       /* icon only; aria-label keeps it named for screen readers */
    font-size: 0; gap: 0; width: 38px; height: 38px; padding: 0;
    justify-content: center; border-radius: 12px;
  }

  /* Page head */
  .doc-head { padding: 26px 0 18px; }
  .doc-eyebrow { font-size: 11px; margin-bottom: 10px; }
  .doc-eyebrow span { width: 26px; height: 4px; }
  .doc-h1 { font-size: 30px; letter-spacing: -.3px; margin-bottom: 10px; }
  .doc-sub { font-size: 15px; line-height: 1.6; }
  .doc-meta { margin-top: 16px; gap: 8px; }
  .doc-meta b { padding: 5px 12px; font-size: 12px; }
  .doc-flag { margin-top: 18px; font-size: 13px; }

  /* Layout: one column */
  .doc-grid { display: block; padding-bottom: 36px; }

  /* Contents -> sticky swipeable chip bar */
  .toc {
    position: sticky; top: var(--hdr-h); z-index: 40;
    margin: 0 -16px; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  .toc-title { display: none; }
  .toc-inner {
    display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .toc-inner::-webkit-scrollbar { display: none; }
  .toc a {
    flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap;
    border: 1px solid var(--line); border-radius: 100px; background: var(--surface);
    padding: 8px 14px; font-size: 13px; font-weight: 500;
  }
  .toc a:hover { background: var(--surface); }
  .toc a.active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }

  /* Sections: flat reading blocks separated by hairlines */
  .doc-section {
    background: transparent; border: 0; border-radius: 0;
    border-bottom: 1px solid var(--line);
    padding: 26px 0; margin: 0;
    scroll-margin-top: calc(var(--hdr-h) + 62px);
  }
  .doc-section h2 {
    font-size: 20px; line-height: 1.3; flex-direction: column; align-items: flex-start; gap: 8px;
  }
  .doc-section h2 i {
    font-size: 11px; padding: 3px 9px; border-radius: 100px;
    background: rgba(24, 144, 168, .12);
  }
  .doc-section h3 { font-size: 15.5px; margin-top: 18px; }
  .doc-section p, .doc-section li { font-size: 15px; line-height: 1.7; }
  .fill { white-space: normal; }

  /* Wide tables scroll sideways instead of breaking the page */
  .doc-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .doc-table th, .doc-table td { padding: 10px; min-width: 120px; }

  /* Contact card keeps its colour, loses the heavy padding */
  .doc-contact { border-bottom: 0; border-radius: 18px; padding: 24px 20px; margin: 26px 0 0; }

  /* Footer */
  footer { padding: 26px 0 calc(26px + env(safe-area-inset-bottom)); }
  .foot-bot { flex-direction: column; text-align: center; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}

html { scroll-behavior: smooth; }