/* Discover — guided-tour styling, SHOS dark theme (navy + blue accents).
   Hand-authored (no build step) so the image is fully self-contained and
   offline. Palette mirrors the SHOS login / Homepage aesthetic. */

:root {
  color-scheme: dark;
  --bg: #0c1018;
  --bg-glow: #1c2a44;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover: rgba(255, 255, 255, 0.07);
  --text: #e7ecf3;
  --muted: #aab6c6;
  --faint: #7f8da0;
  --accent: #8ecbff;
  --accent-strong: #63b3ed;
  --accent-bg: rgba(99, 179, 237, 0.14);
  --radius: 16px;
  --maxw: 60rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, var(--bg-glow) 0%, var(--bg) 55%);
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout shell ---- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.topbar .logo { font-size: 1.4rem; }
.topbar .spacer { flex: 1; }
.topbar .step-count { font-variant-numeric: tabular-nums; color: var(--faint); }
/* Whose tour this is. Small and quiet — it is reassurance ("these are MY
   ticks"), not a control. */
.topbar .viewer {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent);
  font-size: 0.8rem; max-width: 12rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* "Picking up June's tour — not June?" on the Welcome step: the honest
   escape hatch for a shared browser where nobody has signed in. */
.viewer-note {
  margin: 0 0 1.5rem; padding: 0.75rem 1rem;
  border: 1px solid var(--card-border); border-radius: var(--radius);
  background: var(--card); color: var(--muted); font-size: 0.95rem;
}
.linkish {
  border: 0; background: none; padding: 0; font: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}
.linkish:hover { color: var(--accent-strong); }

/* ---- Progress dots ---- */
.progress { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.progress button {
  width: 0.6rem; height: 0.6rem; padding: 0; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18); cursor: pointer; transition: all 0.2s;
}
.progress button.done { background: var(--accent-strong); }
.progress button.current { background: var(--accent); width: 1.6rem; }

/* ---- Step card ---- */
.step {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.5rem 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: rise 0.35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: inline-block; font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem;
}
.step h1 { font-size: 2rem; margin: 0 0 0.6rem; line-height: 1.15; }
.step h2 { font-size: 1.6rem; margin: 0 0 0.4rem; }
.step .lead { color: var(--muted); font-size: 1.08rem; line-height: 1.6; margin: 0 0 1.5rem; }

/* ---- Welcome highlights ---- */
.highlights { display: grid; gap: 0.75rem; margin: 1.5rem 0; }
@media (min-width: 40rem) { .highlights { grid-template-columns: 1fr 1fr; } }
.highlight {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.9rem 1rem; background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border); border-radius: 12px;
}
.highlight .ic { font-size: 1.3rem; line-height: 1.4; }
.highlight .t { font-weight: 600; }
.highlight .d { color: var(--muted); font-size: 0.9rem; }

/* ---- App cards grid ---- */
.cards { display: grid; gap: 0.9rem; grid-template-columns: 1fr; margin-top: 0.5rem; }
@media (min-width: 38rem) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; gap: 0.9rem; align-items: flex-start;
  padding: 1rem 1.1rem; background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border); border-radius: 14px;
  text-decoration: none; color: inherit; transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.card:hover { background: var(--card-hover); border-color: rgba(142,203,255,0.35); transform: translateY(-2px); }
.card .logo {
  width: 2.4rem; height: 2.4rem; flex: 0 0 auto; border-radius: 9px;
  display: grid; place-items: center; background: rgba(255,255,255,0.06); overflow: hidden;
}
.card .logo img { width: 1.7rem; height: 1.7rem; object-fit: contain; }
.card .logo .glyph { font-size: 1.3rem; }
.card .body { min-width: 0; }
.card .name { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.card .name .arrow { color: var(--faint); font-size: 0.85rem; }
.card .desc { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.4; margin-top: 0.15rem; }
.card .replaces {
  display: inline-block; margin-top: 0.5rem; font-size: 0.74rem; color: var(--accent);
  background: var(--accent-bg); padding: 0.12rem 0.5rem; border-radius: 999px;
}

/* ---- Machinery card (an app's `tour_note`) ----
   Not a link and it must not look like one: no lift on hover, no arrow,
   a recessed surface and a muted name, so "there is nothing to tap here"
   reads before the sentence explaining why does. */
.card-note {
  background: rgba(255,255,255,0.015);
  border-style: dashed;
  cursor: default;
}
.card-note:hover { background: rgba(255,255,255,0.015); border-color: var(--card-border); transform: none; }
.card-note .name { color: var(--muted); font-weight: 500; }
.card-note .logo { background: rgba(255,255,255,0.035); opacity: 0.7; }
.card-note .desc.note { color: var(--faint); }

/* ---- "Learn more" — where to read about an app (its `tour_docs`) ----
   Quieter than the card above it: the card is the door, these are the
   signposts beside it. Each link names its site, so a tap is no surprise. */
.app-docs { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.45rem; }
.docs-heading {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 0 0.2rem;
}
.doc-link {
  display: flex; align-items: center; gap: 0.6rem; min-width: 0;
  padding: 0.45rem 0.7rem; border-radius: 10px; text-decoration: none; color: var(--text);
  background: rgba(255,255,255,0.025); border: 1px solid var(--card-border);
  transition: background 0.18s, border-color 0.18s;
}
.doc-link:hover { background: var(--accent-bg); border-color: rgba(142,203,255,0.35); }
.doc-link .doc-ic { flex: 0 0 auto; font-size: 0.95rem; }
.doc-link .doc-text { display: flex; flex-direction: column; min-width: 0; }
.doc-link .doc-title { font-size: 0.85rem; line-height: 1.3; }
.doc-link .doc-site {
  font-size: 0.72rem; color: var(--accent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-link .doc-arrow { margin-left: auto; flex: 0 0 auto; color: var(--faint); font-size: 0.8rem; }
.doc-link:hover .doc-arrow { color: var(--accent); }

/* ---- Per-app "things to try" mini-course (the app's guide.yml) ---- */
.card-wrap { display: flex; flex-direction: column; min-width: 0; }
/* An expanded mini-course needs the full row — span both grid columns. */
.card-wrap.guide-open { grid-column: 1 / -1; }
.app-guide { margin-top: 0.45rem; }
.guide-toggle {
  display: flex; align-items: center; gap: 0.45rem; width: 100%;
  padding: 0.45rem 0.7rem; background: transparent; cursor: pointer;
  border: 1px dashed var(--card-border); border-radius: 10px;
  color: var(--muted); font: inherit; font-size: 0.85rem; text-align: left;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.guide-toggle:hover { background: var(--card-hover); border-color: rgba(142,203,255,0.35); color: var(--text); }
.guide-toggle .chev { color: var(--accent); flex: 0 0 auto; }
.guide-progress {
  margin-left: auto; font-size: 0.74rem; color: var(--faint);
  background: rgba(255,255,255,0.05); padding: 0.12rem 0.5rem; border-radius: 999px;
}
.guide-progress.all-done { color: var(--accent); background: var(--accent-bg); }
.guide-body { margin-top: 0.7rem; }
.guide-intro { color: var(--muted); font-size: 0.95rem; line-height: 1.55; margin: 0 0 0.4rem; }

/* ---- Footer nav ---- */
.nav { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.nav .spacer { flex: 1; }
.btn {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 0.65rem 1.2rem;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.05); color: var(--text);
  transition: background 0.18s, border-color 0.18s; text-decoration: none; display: inline-block;
}
.btn:hover { background: rgba(255,255,255,0.09); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #06121f; font-weight: 600; }
.btn.primary:hover { background: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }

.count-pill {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent); font-size: 0.8rem; margin-left: 0.5rem;
}

/* ---- Finish recap ---- */
.recap { display: flex; gap: 0.9rem; flex-wrap: wrap; margin: 1.5rem 0; }
.recap-stat {
  flex: 1 1 7rem; padding: 1rem 1.1rem; text-align: center;
  background: rgba(255,255,255,0.03); border: 1px solid var(--card-border); border-radius: 12px;
}
.recap-stat .n { display: block; font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.recap-stat .l { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.85rem; }

/* ---- Guide: learn-by-doing task list ---- */
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.85rem; border-radius: 8px; margin-top: 0.6rem; }
.tasks { list-style: none; counter-reset: task; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.task {
  counter-increment: task;
  background: rgba(255,255,255,0.03); border: 1px solid var(--card-border);
  border-radius: 14px; padding: 1rem 1.1rem; transition: border-color 0.18s, opacity 0.18s;
}
.task-done { opacity: 0.62; border-color: rgba(99,179,237,0.4); }
.task-head { display: flex; }
.task-check { display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; }
.task-check input { margin-top: 0.2rem; width: 1.1rem; height: 1.1rem; accent-color: var(--accent-strong); flex: 0 0 auto; }
.task-title { font-weight: 600; font-size: 1.05rem; }
.task-done .task-title { text-decoration: line-through; text-decoration-color: var(--faint); }
.task-opt {
  margin-left: 0.5rem; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--card-border); border-radius: 999px; padding: 0.05rem 0.45rem;
}
.task-steps { margin: 0.6rem 0 0; padding-left: 2.4rem; color: var(--text); }
.task-steps li { margin: 0.25rem 0; line-height: 1.45; }
.task-expect {
  margin: 0.7rem 0 0 2.4rem; color: var(--muted); font-size: 0.9rem;
  background: rgba(99,179,237,0.08); border-left: 2px solid var(--accent-strong);
  padding: 0.45rem 0.7rem; border-radius: 0 8px 8px 0;
}
.task-expect .expect-label { color: var(--accent); font-weight: 600; }
.task .btn.small { margin-left: 2.4rem; }

/* Inline links inside guide prose (steps / intro / expected). URLs the guide
   mentions (auth.<domain>, home.<domain>, full https:// links) are turned into
   real anchors by tour.js `linkify()`. */
.link {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: rgba(142, 203, 255, 0.45);
  text-underline-offset: 0.15em; word-break: break-word;
  transition: text-decoration-color 0.15s, color 0.15s;
}
.link:hover { color: var(--accent-strong); text-decoration-color: var(--accent-strong); }

/* Inline literal you copy but must NOT open (e.g. a Matrix homeserver
   address) — rendered by linkify() from `{{code:TEXT|INFO}}`. */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--card-border);
  border-radius: 6px; padding: 0.05em 0.4em; word-break: break-word;
  white-space: nowrap;
}
.code .info {
  display: inline-grid; place-items: center; width: 1.05em; height: 1.05em;
  margin-left: 0.3em; border-radius: 999px; font-family: system-ui, sans-serif;
  font-size: 0.72em; font-style: italic; font-weight: 700; line-height: 1;
  color: var(--accent); background: var(--accent-bg); cursor: help;
  vertical-align: 0.05em;
}
.code .info:hover, .code .info:focus { color: var(--accent-strong); outline: none; }

/* ---- Accessibility: visually-hidden but screen-reader-readable ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Small screens ---- */
@media (max-width: 32rem) {
  .shell { padding: 1.25rem 0.85rem 3rem; }
  .step { padding: 1.6rem 1.3rem 1.4rem; }
  .step h1 { font-size: 1.6rem; }
  .step h2 { font-size: 1.35rem; }
  .step .lead { font-size: 1rem; }
  .nav .btn { flex: 1 1 auto; text-align: center; }
}

[x-cloak] { display: none !important; }
