/* ════════════════════════════════════════════════════════════════
   X-Area — how-to guides
   Extends the ink & paper system from styles.css
   ════════════════════════════════════════════════════════════════ */

/* ── focus rings ──
   Browsers draw a heavy dark ring on focused links by default. Replace it with
   the house cyan ring, and only on keyboard focus so a mouse click stays clean. */
.guides-toc a:focus,
.guide a:focus,
.guides-search input:focus,
.guides-search button:focus { outline: none; }

.guides-toc a:focus-visible,
.guide a:focus-visible,
.guides-search button:focus-visible {
  outline: 2px solid var(--cyan-deep);
  outline-offset: 3px;
}

/* The search input deliberately has NO ring of its own — an outline on the
   input draws a hard rectangle inside the pill. The wrapper's :focus-within
   state below is the focus indicator instead. */
.guides-search input:focus-visible { outline: none; }

/* ── search ── */
.guides-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto clamp(36px, 5vw, 52px);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.guides-search:focus-within {
  border-color: var(--cyan-deep);
  box-shadow: 0 0 0 4px rgba(46, 194, 212, 0.13);
}

.guides-search > svg { color: rgba(17, 53, 63, 0.4); min-width: 17px; }

.guides-search input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  padding: 10px 0;
  min-width: 0;
}
.guides-search input::placeholder { color: rgba(17, 53, 63, 0.38); }
.guides-search input::-webkit-search-cancel-button { display: none; }

/* keyboard hint — hidden once you start typing */
.search-hint {
  display: flex;
  gap: 3px;
  align-items: center;
  padding-right: 8px;
  pointer-events: none;
}
.search-hint span {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(17, 53, 63, 0.45);
  background: rgba(17, 53, 63, 0.06);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 2px 6px;
  line-height: 1.4;
}

.search-clear {
  display: none;
  border: none;
  background: rgba(17, 53, 63, 0.07);
  color: rgba(17, 53, 63, 0.6);
  width: 30px; height: 30px;
  min-width: 30px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.search-clear:hover { background: rgba(17, 53, 63, 0.13); color: var(--ink); }
.guides-search.has-query .search-clear { display: flex; }
.guides-search.has-query .search-hint { display: none; }

.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;
}

.search-count {
  text-align: center;
  font-size: 0.83rem;
  color: rgba(17, 53, 63, 0.5);
  margin: -34px auto clamp(30px, 4vw, 44px);
  letter-spacing: 0.02em;
}
/* No query, no text — collapse it so it can't push the layout around */
.search-count:empty { display: none; }

.search-empty {
  text-align: center;
  padding: clamp(40px, 7vw, 70px) 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--hairline);
  border-radius: 20px;
}
.search-empty p {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.search-empty span { font-size: 0.9rem; color: rgba(17, 53, 63, 0.55); }

/* matched text inside a guide */
mark {
  background: rgba(59, 195, 212, 0.32);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.guides-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

/* ── sticky table of contents ── */
.guides-toc {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.guides-toc h4 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(17, 53, 63, 0.45);
  margin: 22px 0 8px;
}
.guides-toc h4:first-child { margin-top: 0; }

.guides-toc a {
  position: relative;
  font-size: 0.87rem;
  color: rgba(17, 53, 63, 0.72);
  text-decoration: none;
  padding: 7px 12px 7px 15px;
  border-radius: 9px;
  transition: background 0.2s, color 0.2s;
  line-height: 1.35;
}
.guides-toc a:hover {
  background: rgba(46, 194, 212, 0.09);
  color: var(--ink);
}

/* The active marker is a pseudo-element, not a border-left. A border on one
   side only gets tapered around border-radius corners, which reads as a hook. */
.guides-toc a::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 3px;
  height: 0;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--cyan-deep);
  transition: height 0.22s var(--ease);
}
.guides-toc a.active::before { height: 15px; }

.guides-toc a.active {
  background: rgba(46, 194, 212, 0.12);
  color: var(--ink);
  font-weight: 500;
}

/* ── role intro ── */
.role-block { scroll-margin-top: 110px; }
.role-block + .role-block { margin-top: clamp(56px, 8vw, 88px); }

.role-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.role-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  letter-spacing: -0.015em;
  color: var(--ink);
}
.role-pill {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  background: rgba(46, 194, 212, 0.14);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.role-intro {
  font-size: 0.97rem;
  color: rgba(17, 53, 63, 0.68);
  line-height: 1.7;
  margin-bottom: 30px;
  max-width: 65ch;
}

/* ── one guide ── */
.guide {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: clamp(24px, 3.5vw, 38px);
  margin-bottom: 20px;
  scroll-margin-top: 110px;
}

.guide-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.guide-num {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: rgba(46, 194, 212, 0.85);
  line-height: 1;
}
.guide h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.42rem);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.guide-meta {
  font-size: 0.75rem;
  color: rgba(17, 53, 63, 0.45);
  letter-spacing: 0.04em;
}
.guide-lede {
  font-size: 0.93rem;
  color: rgba(17, 53, 63, 0.7);
  line-height: 1.7;
  margin-bottom: 22px;
  max-width: 62ch;
}

/* ── video slot ── */
.guide-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(17, 53, 63, 0.055);
  border: 1px solid var(--hairline);
  margin-bottom: 26px;
}
.guide-video iframe,
.guide-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}
.video-placeholder svg { color: rgba(46, 194, 212, 0.5); }
.video-placeholder span {
  font-size: 0.82rem;
  color: rgba(17, 53, 63, 0.45);
  letter-spacing: 0.03em;
}

/* ── steps ── */
.guide-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.guide-steps li {
  counter-increment: step;
  position: relative;
  padding: 11px 0 11px 44px;
  font-size: 0.93rem;
  line-height: 1.65;
  color: rgba(17, 53, 63, 0.85);
  border-bottom: 1px solid rgba(17, 53, 63, 0.055);
}
.guide-steps li:last-child { border-bottom: none; }
.guide-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(46, 194, 212, 0.13);
  color: var(--cyan-deep);
  font-size: 0.76rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-steps b { font-weight: 600; color: var(--ink); }

/* UI labels the reader has to click */
kbd {
  font-family: var(--sans);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(17, 53, 63, 0.06);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}

/* a path within the app, e.g. Sessions → Schedule Session */
.guide-steps code {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--cyan-deep);
  background: rgba(46, 194, 212, 0.1);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ── callout ── */
.guide-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(46, 194, 212, 0.07);
  border: 1px solid rgba(46, 194, 212, 0.22);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 20px;
  font-size: 0.87rem;
  line-height: 1.6;
  color: rgba(17, 53, 63, 0.8);
}
.guide-note svg { color: var(--cyan-deep); min-width: 17px; margin-top: 2px; }
.guide-note b { color: var(--ink); }

/* ── responsive ── */
@media (max-width: 960px) {
  .guides-layout { grid-template-columns: 1fr; }
  .guides-toc {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 32px;
  }
  .guides-toc h4 { width: 100%; margin: 10px 0 4px; }
  /* Pills on narrow screens — the left bar makes no sense here, so drop it
     and let the whole outline carry the active state instead. */
  .guides-toc a { border: 1px solid var(--hairline); padding-left: 12px; }
  .guides-toc a::before { display: none; }
  .guides-toc a.active { border-color: var(--cyan-deep); }
}

@media (max-width: 560px) {
  .guide-steps li { padding-left: 36px; font-size: 0.89rem; }
  .guide-steps li::before { width: 22px; height: 22px; font-size: 0.7rem; }
}
