/* Slyder Data Room. Modern document look: Inter body, Plus Jakarta Sans
   headings, SixSense brand purple, content on a white card over a cool
   light background. Screen and print in one sheet. */

:root {
  --ink: #182030;
  --ink-soft: #465062;
  --caption: #6b7280;
  --page: #f2f4f9;
  --card: #ffffff;
  --soft: #f7f8fc;
  --brand: #50439b;
  --brand-dark: #3c337d;
  --brand-light: #7366ae;
  --hairline: #e2e6ef;
  --error: #a33a2e;
  --head: "Plus Jakarta Sans", "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win, even over display rules below. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
}

/* ---------- Password gate ---------- */

/* Matches the SixSense Admin Portal sign in: light background, white card,
   brand purple, logo on top. */
#gate {
  position: fixed;
  inset: 0;
  background: var(--page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}

#gate-form {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2.25rem 1.75rem;
  text-align: center;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
}

.gate-logo {
  width: 84px;
  height: auto;
  margin: 0 auto 0.6rem;
  display: block;
}

.gate-brand {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--caption);
  margin: 0 0 1.5rem;
}

.gate-title {
  font-family: var(--head);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--brand);
}

.gate-subtitle {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0.45rem 0 2rem;
}

#gate-password {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #d6dae3;
  border-radius: 10px;
  text-align: center;
  letter-spacing: 0.12em;
}

#gate-password:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

#gate-submit {
  width: 100%;
  margin-top: 0.9rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.8rem;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#gate-submit:hover { background: var(--brand-dark); }
#gate-submit:disabled { opacity: 0.6; cursor: wait; }

#gate-error {
  font-size: 0.8125rem;
  color: var(--error);
  margin: 1rem 0 0;
}

.gate-footer {
  font-size: 0.75rem;
  color: var(--caption);
  margin: 1.75rem 0 0;
}

/* ---------- Toolbar ---------- */

#toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  background: rgba(242, 244, 249, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

body.editing #toolbar {
  background: rgba(243, 239, 255, 0.92);
  border-bottom-color: #d5ccf1;
}

.toolbar-brand {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--caption);
  flex: 1;
  white-space: nowrap;
}

#save-status {
  font-size: 0.75rem;
  color: var(--caption);
  white-space: nowrap;
}

#save-status.saving { color: var(--brand); }
#save-status.error { color: var(--error); }

.toolbar-actions { display: flex; gap: 0.5rem; }

#toolbar button {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid #d6dae3;
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

#toolbar button:hover { border-color: var(--brand); color: var(--brand); }

#toolbar .btn-accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

#toolbar .btn-accent:hover { background: var(--brand-dark); color: #fff; }

#toolbar .btn-quiet { border-color: transparent; background: transparent; color: var(--caption); }

/* ---------- Document ---------- */

#doc {
  max-width: 820px;
  margin: clamp(1rem, 4vw, 2.5rem) auto 4rem;
  padding: clamp(1.75rem, 5vw, 4rem) clamp(1.25rem, 5vw, 4rem) clamp(2rem, 5vw, 3rem);
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 6px 32px rgba(15, 23, 42, 0.07);
}

.doc-brand {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--caption);
  margin: 0 0 2rem;
}

.doc-title {
  font-family: var(--head);
  font-size: clamp(2.3rem, 7vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--brand);
  margin: 0;
}

.doc-subtitle {
  font-family: var(--head);
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  font-weight: 500;
  color: var(--ink-soft);
  margin: 0.45rem 0 0;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--caption);
  margin: 1.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
}

.meta-chip {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Table of contents */

.toc {
  margin: 2.5rem 0 0;
  padding: 1.4rem 1.7rem;
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: 12px;
}

.toc-title {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--caption);
  margin: 0 0 0.6rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.4rem;
}

.toc li { margin: 0.3rem 0; }

.toc li::marker {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--brand-light);
}

.toc a {
  color: var(--brand);
  font-weight: 500;
  text-decoration: none;
}

.toc a:hover { text-decoration: underline; }

/* Sections */

section.doc-section { margin-top: 3.25rem; }

.section-eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-light);
  margin: 0 0 0.5rem;
  padding-top: 1.7rem;
  border-top: 1px solid var(--hairline);
}

.section-title {
  font-family: var(--head);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--brand);
  margin: 0 0 1rem;
}

.doc-subtitle-block {
  font-family: var(--head);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2rem 0 0.4rem;
}

.doc-text {
  margin: 0.9rem 0;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  color: var(--ink-soft);
}

/* Figures */

figure.doc-figure {
  margin: 1.9rem 0;
  text-align: center;
}

.doc-figure .img-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.doc-figure img {
  max-width: 100%;
  max-height: 440px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--soft);
  padding: 8px;
}

.doc-figure figcaption {
  font-size: 0.8125rem;
  color: var(--caption);
  margin-top: 0.65rem;
}

.doc-figure .fig-number {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  border: 1px solid #cfc7ec;
  border-radius: 5px;
  padding: 0.1rem 0.45rem;
  margin-right: 0.55rem;
  vertical-align: 1px;
}

/* Spec table */

table.doc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.4rem 0;
  font-size: 0.9375rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
}

.doc-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  color: var(--ink-soft);
}

.doc-table tr:last-child td { border-bottom: none; }

.doc-table td:first-child {
  width: 32%;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--soft);
  border-right: 1px solid var(--hairline);
}

/* Split bar graphic */

.split-graphic {
  margin: 1.9rem 0;
  break-inside: avoid;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.split-bar {
  display: flex;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
}

.split-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--head);
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 52px;
}

.seg-hn { background: var(--brand); color: #fff; }
.seg-us { background: #ddd7f3; color: var(--brand-dark); }

.split-legend {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.legend-item { display: inline-flex; align-items: center; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.dot-hn { background: var(--brand); }
.dot-us { background: #ddd7f3; }

/* Callout panel */

.callout {
  margin: 1.9rem 0;
  padding: 1.3rem 1.6rem;
  background: #f3f0fb;
  border-left: 4px solid var(--brand);
  border-radius: 0 12px 12px 0;
  break-inside: avoid;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.callout-eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 0.7rem;
}

.callout-item {
  margin: 0.45rem 0;
  color: var(--ink-soft);
  text-align: left;
}

.callout-item strong {
  color: var(--ink);
  font-weight: 600;
}

/* Route map graphic */

.route-map-figure {
  margin: 1.9rem 0;
  break-inside: avoid;
  text-align: center;
}

.route-map {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.route-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.route-map-figure figcaption {
  font-size: 0.8125rem;
  color: var(--caption);
  margin-top: 0.65rem;
}

/* Footer */

.doc-footer {
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.75rem;
  color: var(--caption);
}

/* ---------- Edit mode ---------- */

body.editing [data-path] {
  cursor: text;
}

body.editing [data-path]:hover,
body.editing [data-path]:focus {
  outline: 1.5px dashed var(--brand-light);
  outline-offset: 4px;
  background: rgba(80, 67, 155, 0.05);
  border-radius: 2px;
}

body.editing [data-path]:focus { outline-style: solid; }

[data-path][contenteditable]:empty::before {
  content: "Tap to write";
  color: var(--caption);
  font-style: italic;
}

.replace-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  background: rgba(24, 32, 48, 0.85);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: none;
}

body.editing .replace-btn { display: block; }

.replace-btn:hover { background: var(--brand); }

/* ---------- Motion and focus ---------- */

@media (prefers-reduced-motion: no-preference) {
  #doc { animation: doc-in 0.45s ease-out; }
  @keyframes doc-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Mobile ---------- */

@media (max-width: 540px) {
  .toolbar-brand { display: none; }
  #toolbar { justify-content: flex-end; }
  #doc { margin: 0.75rem; border-radius: 14px; }
  .doc-table td:first-child { width: 38%; }
  .doc-text { hyphens: auto; }
}

/* ---------- Print: US Letter ---------- */

@page {
  size: Letter;
  margin: 0.9in 0.85in;
}

@media print {
  body { background: #fff; font-size: 10.5pt; line-height: 1.6; }
  #toolbar, #gate, .replace-btn, #btn-pdf { display: none !important; }
  #doc {
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
  }
  .toc { border: 1px solid #ddd; background: #fff; }
  .toc a { color: var(--ink); }
  section.doc-section { margin-top: 1.6rem; }
  .section-eyebrow { break-after: avoid; }
  .section-title { break-after: avoid; }
  .doc-subtitle-block { break-after: avoid; }
  figure.doc-figure { break-inside: avoid; }
  table.doc-table { break-inside: avoid; }
  .doc-figure img { max-height: 4.4in; padding: 0; border-color: #ccc; background: #fff; }
  .doc-footer { margin-top: 2rem; }
  a { text-decoration: none; color: inherit; }
}
