/* Paradise Scooters SOP site: same layout as the ROLL'N Knowledge Centre.
   Colours from projects/paradise-site/BRAND.md: Night Navy #14213D for text,
   Coral for the accent (darkened to #D2401E so links pass contrast on white). */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #55607a;
  --accent: #d2401e;
  --accent-dark: #a92f12;
  --accent-soft: #fff1ec;
  --accent-line: #ffd3c5;
  --border: #e5eaf3;
  --diagram-bg: #ffffff;
  --retired-bg: #fdf6e7;
  --retired-border: #ecd9a8;
  --retired-ink: #7c6118;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 35, 90, 0.07);
  --shadow-lift: 0 16px 40px rgba(20, 35, 90, 0.12);
}

/* Dark mode: manual toggle wins (data-theme), otherwise follow the system. */
[data-theme="dark"] {
  --bg: #0d1424;
  --card: #16213a;
  --ink: #e9ecf4;
  --muted: #9aa5bb;
  --accent: #ff7a57;
  --accent-dark: #ff9b7e;
  --accent-soft: #3a1f17;
  --accent-line: #5c2f22;
  --border: #263354;
  --diagram-bg: #eef0f6;
  --retired-bg: #2b2415;
  --retired-border: #574722;
  --retired-ink: #d9b45e;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424;
    --card: #16213a;
    --ink: #e9ecf4;
    --muted: #9aa5bb;
    --accent: #ff7a57;
    --accent-dark: #ff9b7e;
    --accent-soft: #3a1f17;
    --accent-line: #5c2f22;
    --border: #263354;
    --diagram-bg: #eef0f6;
    --retired-bg: #2b2415;
    --retired-border: #574722;
    --retired-ink: #d9b45e;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { letter-spacing: -0.02em; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.site-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-name::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  margin-right: 10px;
}
.site-name:hover { color: var(--accent); }
.site-tag { color: var(--muted); font-size: 0.92rem; }
.nav-toggle {
  display: none;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  padding: 6px 14px;
  cursor: pointer;
}
.theme-toggle {
  margin-left: auto;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-line); }

/* Layout: sidebar + content */
.layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
  padding-top: 36px;
  padding-bottom: 72px;
}
main { flex: 1; min-width: 0; }

/* Sidebar directory */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; font-size: 0.93rem; }
.sidebar a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 10px;
  line-height: 1.4;
  font-weight: 500;
}
.sidebar a:hover { background: var(--accent-soft); color: var(--ink); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-home { font-weight: 700; color: var(--ink) !important; margin-bottom: 6px; }
.nav-home.active { color: var(--accent) !important; }
.nav-group { margin-bottom: 8px; }
.nav-section-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  padding: 16px 12px 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-cat {
  font-weight: 700 !important;
  font-size: 0.88rem;
  color: var(--ink) !important;
}
.nav-cat.active { color: var(--accent) !important; }
.nav-sop { padding-left: 24px !important; }

/* Breadcrumbs */
.crumbs { margin: 0 0 24px; color: var(--muted); font-size: 0.9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { margin: 0 8px; color: var(--border); }

/* Home hero + search */
.hero { margin: 12px 0 36px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: 22px;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.hero h1 {
  margin: 0 0 14px;
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.hero h1 .accent {
  color: var(--accent);
  background: linear-gradient(transparent 82%, var(--accent-line) 82%);
}
.lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 26px; max-width: 36em; }
.search {
  width: 100%;
  max-width: 620px;
  padding: 15px 20px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search::placeholder { color: #9aa7bd; }
.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
}
.home-section {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 38px 0 16px;
}

/* Cards */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
}
.card h2, .card h3 { margin: 0 0 8px; line-height: 1.3; }
.card h2 { font-size: 1.25rem; font-weight: 700; }
.card h3 { font-size: 1.08rem; font-weight: 700; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 0.95rem; }
.card-meta { color: var(--accent); font-size: 0.84rem; font-weight: 600; margin: 0; }
.no-results { color: var(--muted); }

/* SOP page */
.sop h1 {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 4px 0 20px;
}
.kb-updated { color: var(--muted); font-size: 0.9rem; margin: -10px 0 26px; }

.meta-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 32px;
}
.meta-item { display: flex; flex-direction: column; padding: 4px 8px; }
.meta-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}
.meta-value { font-size: 0.95rem; font-weight: 600; }

.sop-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
}
.sop-body ol, .sop-body ul { padding-left: 26px; }
.sop-body ol li, .sop-body ul li { margin-bottom: 10px; }
.sop-body ol li::marker { color: var(--accent); font-weight: 700; }
.sop-body table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 16px 0;
  font-size: 0.93rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sop-body th, .sop-body td {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}
.sop-body tr:last-child td { border-bottom: none; }
.sop-body th {
  background: var(--accent-soft);
  font-weight: 700;
  color: var(--ink);
}
.sop-body blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: 0 10px 10px 0;
  box-shadow: var(--shadow);
}

/* Flowcharts (Mermaid) */
.sop-body pre.mermaid {
  display: flex;
  justify-content: center;
  /* Diagrams are rendered with light-theme colours, so they keep a light
     panel even in dark mode. */
  background: var(--diagram-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 20px 0;
  overflow-x: auto;
}
.sop-body pre.mermaid svg { max-width: 100%; height: auto; }
/* Hide raw diagram text until mermaid replaces it with an SVG */
.sop-body pre.mermaid:not([data-processed]) { color: transparent; min-height: 60px; }

/* Past versions */
.past-versions { margin-top: 56px; }
.past-versions h2 {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.no-past { color: var(--muted); font-size: 0.93rem; }
.past-version {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.past-version summary {
  cursor: pointer;
  padding: 15px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}
.past-version .past-body {
  padding: 6px 26px 22px;
  border-top: 1px solid var(--border);
  opacity: 0.9;
}
.retired-note {
  background: var(--retired-bg);
  border: 1px solid var(--retired-border);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 16px 0 20px;
}
.retired-label {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--retired-ink);
  margin-bottom: 4px;
}
.retired-note p { margin: 0; font-size: 0.94rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 24px 0 44px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Tablet & mobile: sidebar collapses behind the Menu button */
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .layout { display: block; }
  .sidebar {
    display: none;
    width: auto;
    position: static;
    max-height: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 28px;
  }
  .sidebar.open { display: block; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .sop h1 { font-size: 1.55rem; }
}

/* Print: current version only, clean black-on-white */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-header, .site-footer, .crumbs, .past-versions, .search, .sidebar, .nav-toggle, .badge { display: none; }
  .meta-box { background: none; border: 1pt solid #000; box-shadow: none; }
  .card, .past-version { border-color: #000; box-shadow: none; }
  .sop-body table, .sop-body pre.mermaid, .sop-body blockquote { box-shadow: none; border-color: #000; }
}

/* ---------- Resource Finder ---------- */
.hero-link { margin: 14px 0 0; }
.hero-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.hero-link a:hover { text-decoration: underline; }
.res-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.res-chip {
  font: inherit; font-size: 0.85rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
}
.res-chip:hover { border-color: var(--accent-line); }
.res-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.res-card { display: flex; flex-direction: column; }
.res-card[hidden], .res-group[hidden] { display: none; }
.res-actions { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.res-open { color: var(--accent); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.res-open:hover, .res-guide:hover { text-decoration: underline; }
.res-guide { color: var(--muted); font-size: 0.9rem; text-decoration: none; }
