/* Clari & the Fourth Crusade — step-through route map.
   Rides on style.css; every class is prefixed cl- so nothing here can reach
   the Crusades reference page or the Map Trainer. */

.cl-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 1.25rem 3rem;
}

/* ---------- head ---------- */

.cl-head {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.cl-head > div:first-child { flex: 1 1 26rem; }

.cl-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}
.cl-wrap h1 { margin: 0 0 0.5rem; font-size: clamp(1.75rem, 4vw, 2.4rem); text-wrap: balance; }
.cl-dek { margin: 0; max-width: 62ch; color: var(--muted); }

.cl-tools { flex: 0 0 auto; }

.cl-btn {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.45rem 0.95rem;
  line-height: 1.2;
}
.cl-btn:hover { border-color: var(--accent); color: var(--accent); }
.cl-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cl-btn[disabled] { opacity: 0.35; cursor: default; }
.cl-btn[disabled]:hover { border-color: var(--border); color: var(--text); }

/* ---------- step rail ---------- */

.cl-rail {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.cl-step {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex: 0 0 auto;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  white-space: nowrap;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
}
.cl-step:hover { color: var(--text); background: var(--bg-soft); }
.cl-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl-step-n { font-variant-numeric: tabular-nums; font-size: 0.76rem; opacity: 0.6; }
.cl-step[aria-current="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 600;
}
.cl-step[aria-current="true"] .cl-step-n { opacity: 1; }

/* ---------- stage ---------- */

.cl-stage {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.cl-key {
  display: flex;
  gap: 1.3rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.cl-key span::before {
  content: "";
  display: inline-block;
  width: 24px;
  vertical-align: middle;
  margin-right: 0.4rem;
  border-top: 3px solid currentColor;
}
.cl-k1::before { color: var(--cl-sail); }
.cl-k2::before { color: var(--cl-ghost); border-top-style: dashed !important; }
.cl-k3::before { color: var(--cl-march); border-top-width: 2px !important; border-top-style: dotted !important; }

.cl-mapfig {
  margin: 0;
  background: var(--cl-sea);
  cursor: pointer;
  line-height: 0;
}
.cl-svg { display: block; width: 100%; height: auto; }

/* ---------- map ink ---------- */

body[data-page="history"] {
  --cl-sea: #dbe4e9;
  --cl-land: #f2eee5;
  --cl-coast: #a8a091;
  --cl-sail: #9d1f2b;
  --cl-ghost: #b45309;
  --cl-march: #5f6b74;
  --cl-ink: #26221c;
  --cl-inksoft: #6c6558;
}

.cl-land { fill: var(--cl-land); stroke: var(--cl-coast); stroke-width: 1.1; stroke-linejoin: round; }

.cl-layer { opacity: 0; transition: opacity 0.45s ease; }
.cl-layer.on { opacity: 1; }
.cl-layer.dim { opacity: 0.28; }

.cl-route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s ease;
}
.cl-layer.on .cl-route, .cl-layer.dim .cl-route { stroke-dashoffset: 0; }
.cl-sail  { stroke: var(--cl-sail); stroke-width: 5; }
.cl-ghost { stroke: var(--cl-ghost); stroke-width: 4; stroke-dasharray: 0.012 0.012; stroke-dashoffset: 0; }
.cl-march { stroke: var(--cl-march); stroke-width: 2.4; stroke-dasharray: 0.008 0.01; stroke-dashoffset: 0; }

.cl-dot     { fill: var(--cl-land); stroke: var(--cl-march); stroke-width: 3; }
.cl-port    { fill: var(--cl-sail); stroke: var(--cl-land); stroke-width: 3; }
.cl-goaldot { fill: none; stroke: var(--cl-ghost); stroke-width: 4; }
.cl-halo    { fill: none; stroke: var(--cl-sail); stroke-width: 3; opacity: 0.55; }

.cl-svg text { font-family: "Inter", system-ui, sans-serif; }
.cl-lbl  { font-size: 22px; font-weight: 700; letter-spacing: 0.07em; fill: var(--cl-ink); }
.cl-sub  { font-size: 20px; font-style: italic; fill: var(--cl-inksoft); }
.cl-note { font-size: 20px; font-style: italic; fill: var(--cl-inksoft); }
.cl-city {
  font-weight: 700;
  letter-spacing: 0.08em;
  fill: var(--cl-ink);
  paint-order: stroke;
  stroke: var(--cl-land);
  stroke-width: 5px;
  stroke-linejoin: round;
}
.cl-city-goal { fill: var(--cl-ghost); }
.cl-sea { font-size: 25px; letter-spacing: 0.4em; fill: var(--cl-inksoft); opacity: 0.5; }
.cl-scale text { font-size: 17px; fill: var(--cl-inksoft); letter-spacing: 0.1em; }
.cl-scale line { stroke: var(--cl-inksoft); stroke-width: 2; }

/* ---------- caption ---------- */

.cl-cap {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.cl-cap > .cl-nav { flex: 0 0 auto; }
.cl-cap-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.15rem; }
.cl-cap-n {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--accent);
}
.cl-cap-when {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.cl-cap-t { margin: 0; max-width: 74ch; }
.cl-cap > div:first-child { flex: 1 1 auto; min-width: 0; }
.cl-nav { display: flex; gap: 0.4rem; }
.cl-nav .cl-btn { font-size: 1.15rem; padding: 0.35rem 0.75rem; }

.cl-hint {
  margin: 0;
  padding: 0.55rem 1rem 0.7rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
.cl-hint kbd {
  font: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05rem 0.32rem;
  background: var(--bg);
}

/* ---------- notes ---------- */

.cl-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1rem;
  margin-top: 1.6rem;
}
.cl-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--bg);
}
.cl-card h2 { margin: 0 0 0.5rem; font-size: 1.12rem; }
.cl-card p { margin: 0 0 0.7rem; }
.cl-card p:last-child { margin-bottom: 0; }

.cl-quote {
  border-left: 3px solid var(--accent);
  padding-left: 0.85rem;
  font-size: 0.97rem;
}
.cl-quote span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.cl-colophon { margin-top: 1.8rem; font-size: 0.9rem; color: var(--muted); }
.cl-colophon a { color: var(--accent); }

/* ---------- present mode ---------- */

.cl-present-exit { position: fixed; top: 0.8rem; right: 0.9rem; z-index: 60; display: none; }
body.cl-presenting .cl-present-exit { display: block; }
body.cl-presenting .site-header,
body.cl-presenting .cl-head,
body.cl-presenting .cl-notes,
body.cl-presenting .cl-colophon,
body.cl-presenting .cl-hint { display: none; }
body.cl-presenting { background: var(--bg); }
body.cl-presenting .cl-wrap { max-width: none; padding: 0.7rem 0.9rem 0.9rem; }
body.cl-presenting .cl-stage { border: 0; border-radius: 0; }
body.cl-presenting .cl-svg { max-height: 76vh; }
body.cl-presenting .cl-mapfig { display: flex; justify-content: center; }
body.cl-presenting .cl-cap-t { font-size: 1.1rem; }
body.cl-presenting .cl-cap-n { font-size: 1.45rem; }

@media (max-width: 760px) {
  .cl-key { font-size: 0.7rem; gap: 0.8rem; }
  .cl-cap { flex-direction: column; gap: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cl-layer, .cl-route { transition: none; }
}
