/* CJCH Horizon User Guide — shared styles */

:root {
  --brand: #E20613;
  --brand-dark: #9e040d;
  --brand-soft: #fdeaeb;
  --ink: #1a202c;
  --ink-soft: #4a5568;
  --ink-faint: #718096;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --line: #e2e8f0;
  --card: #ffffff;
  --code-bg: #f1f3f5;
  --ok: #1a7f4b;
  --warn: #b7791f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ec7178;
    --brand-dark: #f4a6aa;
    --brand-soft: #3a0104;
    --ink: #e6e8ec;
    --ink-soft: #b6bcc6;
    --ink-faint: #8b93a1;
    --bg: #14161a;
    --bg-alt: #1b1e24;
    --line: #2b3038;
    --card: #1b1e24;
    --code-bg: #23272f;
    --ok: #4ade80;
    --warn: #f0b45c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

nav.side {
  border-right: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 1.5rem 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Red brand block + stripe, matching the app sidebar (AdminSidebar.vue) */
.brand-block {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0 20px;
  background: #E20613;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.30em;
  text-indent: 0.30em;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.15s;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
a.brand-block { color: #fff; }
a.brand-block:hover { background: #C00510; color: #fff; text-decoration: none; }
@media (prefers-color-scheme: dark) {
  a.brand-block:hover { background: #F4434E; }
}
.brand-stripe { height: 3px; background: #ddd; }
@media (prefers-color-scheme: dark) {
  .brand-stripe { background: #3a3a48; }
}
.side .side-brand { margin: -1.5rem -1.25rem 1rem; }
.side-brand--hero {
  display: inline-block;
  min-width: 240px;
  margin: 0 0 1.75rem;
}

/* CJCH Solicitors logo (sidebar footer, as in the app) */
.brand-logo { width: 130px; height: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .logo-light { display: none; }
  .logo-dark { display: block; }
}
.side-foot {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.guide-version {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.back-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

.side-search { margin: 0 0 1.25rem; }
.side-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}
.side-search input::placeholder { color: var(--ink-faint); }
.side-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* Pagefind UI theming (search.html) */
#search {
  --pagefind-ui-primary: var(--brand);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--line);
  --pagefind-ui-tag: var(--bg-alt);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-font: 'Inter', system-ui, sans-serif;
  max-width: 720px;
}

.side h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 1.4rem 0 0.4rem;
}

.side ul { list-style: none; margin: 0; padding: 0; }
.side li a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.side li a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.side li a.active { background: var(--brand); color: #fff; }

main.content {
  padding: 2.5rem 3.5rem 4rem;
  max-width: none;
  width: 100%;
  min-width: 0;
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  main.content { padding: 1.5rem 1.25rem 3rem; }
}

/* ---------- Typography ---------- */

h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
}
.lede { color: var(--ink-soft); font-size: 1.05rem; margin: 0 0 2rem; }

h2 {
  clear: both;
  font-size: 1.4rem;
  margin: 2.8rem 0 0.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  letter-spacing: -0.01em;
}
h2:first-of-type { border-top: 0; padding-top: 0; }

h3 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }

p, ul.plain { color: var(--ink); }

kbd, .ui {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  font-size: 0.85em;
  font-family: inherit;
  white-space: nowrap;
}

/* ---------- Components ---------- */

.callout {
  border-left: 4px solid var(--brand);
  background: var(--bg-alt);
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 1.1rem;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}
.callout.tip { border-left-color: var(--ok); }
.callout.warn { border-left-color: var(--warn); }
.callout strong:first-child { display: inline-block; margin-right: 0.3rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 99px;
  padding: 0.1rem 0.6rem;
  vertical-align: middle;
}
.badge.manager { background: var(--brand-soft); color: var(--brand); }
.badge.admin { background: var(--brand); color: #fff; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 1.1rem 1.2rem;
  display: block;
  color: var(--ink);
}
a.card:hover { border-color: var(--brand); text-decoration: none; }
.card h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.card p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); }
.card .tag { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); }

/* Pipeline stage flow diagram */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.flow .stage {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.9rem;
}
.flow .stage.win { border-color: var(--ok); color: var(--ok); }
.flow .stage.lose { border-color: var(--warn); color: var(--warn); }
.flow .arrow { color: var(--ink-faint); }

/* ---------- Run sheets ---------- */

.runsheet {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 2rem 0;
  overflow: hidden;
  background: var(--card);
  max-width: 1100px;
}
.runsheet header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.runsheet header .rs-id {
  font-weight: 800;
  color: var(--brand);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}
.runsheet header h2 {
  margin: 0; padding: 0; border: 0;
  font-size: 1.15rem;
}
.runsheet header .meta {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.runsheet .rs-body { padding: 1.1rem 1.4rem 1.4rem; }
.runsheet .when {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}
.runsheet .when strong { color: var(--ink); }

ol.steps { margin: 0.5rem 0; padding-left: 0; counter-reset: step; list-style: none; }
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0.45rem 0 0.45rem 2.6rem;
  border-bottom: 1px dashed var(--line);
}
ol.steps > li:last-child { border-bottom: 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
ol.steps .why {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.checkline {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.92rem;
  padding: 0.2rem 0;
}
.checkline::before {
  content: "";
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid var(--ink-faint);
  border-radius: 4px;
  transform: translateY(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}

/* ---------- Tick-off (guide.js) ---------- */

.tickable { cursor: pointer; }
.tickable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
ol.steps > li.done { color: var(--ink-faint); }
ol.steps > li.done::before { content: "\2713"; background: var(--ok); }
.checkline.done { color: var(--ink-faint); }
.checkline.done::before { content: "\2713"; background: var(--ok); border-color: var(--ok); }

.rs-progress {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 99px;
  padding: 0.15rem 0.7rem;
  white-space: nowrap;
}
.rs-progress.all-done { color: #fff; background: var(--ok); }
.rs-progress:empty { display: none; }
.rs-reset {
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--ink-faint);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.rs-reset:hover { color: var(--brand); }
.sheet-note { font-size: 0.8rem; color: var(--ink-faint); margin: 1rem 0 0; }

/* ---------- Screenshots & lightbox ---------- */

figure.shot {
  float: right;
  clear: right;
  width: min(520px, 44%);
  margin: 0.25rem 0 1.1rem 2rem;
}
figure.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: zoom-in;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}
figure.shot figcaption {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 0.4rem;
  line-height: 1.4;
}
@media (max-width: 900px) {
  figure.shot { float: none; width: 100%; margin: 1.2rem 0; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(12, 13, 16, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

/* ---------- Pager ---------- */

.pager {
  clear: both;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}
.pager a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- Page footer ---------- */

.foot {
  clear: both;
  margin-top: 4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- Print ---------- */

@media print {
  :root {
    --ink: #000; --ink-soft: #333; --ink-faint: #555;
    --bg: #fff; --bg-alt: #f4f4f4; --line: #bbb; --card: #fff;
  }
  nav.side, .foot .no-print, .print-hide, .rs-reset, .sheet-note, .pager { display: none !important; }
  .logo-light { display: block !important; }
  .logo-dark { display: none !important; }
  .shell { display: block; }
  main.content { max-width: none; padding: 0; }
  .runsheet { break-inside: avoid; page-break-inside: avoid; border-color: #999; }
  .runsheet + .runsheet { page-break-before: always; }
  a { color: inherit; }
  ol.steps > li::before { background: #000; }
}
