/* Elite PM Frameworks track. Shared chrome tokens come from shared/harness.css. */
@import url('../shared/harness.css');

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--hx-top) + 24px); }
body {
  margin: 0;
  color: var(--hx-text);
  background: var(--hx-bg);
  font-family: var(--hx-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 3px; }
::selection { color: var(--hx-bg); background: var(--hx-accent); }
code { padding: 1px 5px; color: var(--hx-text); background: var(--hx-raised); border-radius: 4px; font-size: .88em; }

/* ---------- Layout + rail ---------- */
.fw-layout { display: grid; grid-template-columns: var(--hx-rail) minmax(0, 1fr); min-height: calc(100vh - var(--hx-top)); }
.fw-workspace { min-width: 0; }
.fw-rail {
  position: sticky;
  top: var(--hx-top);
  align-self: start;
  height: calc(100vh - var(--hx-top));
  padding: 24px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--hx-bg);
  border-right: 1px solid var(--hx-line);
  scrollbar-width: thin;
  scrollbar-color: var(--hx-line-strong) transparent;
}
.fw-rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fw-rail-head .hx-rail-title { margin: 0; }
.fw-rail-close,
.fw-scrim { display: none; }
.fw-progress { display: flex; justify-content: space-between; margin: 10px 16px 4px; color: var(--hx-muted); font-size: .82rem; }
.fw-progress strong { color: var(--hx-accent); }
.fw-rail-label { margin: 18px 16px 6px; color: var(--hx-muted); font: 650 .72rem/1.3 var(--hx-sans); letter-spacing: .08em; text-transform: uppercase; }
.fw-rail-list .hx-rail-item { display: flex; justify-content: space-between; gap: 10px; }
.fw-done::after { color: var(--hx-accent); }
.is-done .fw-done::after { content: "✓"; }

/* ---------- Article ---------- */
.fw-article { max-width: 780px; padding-bottom: 32px; }
.fw-hero { padding: 64px 0 32px; border-bottom: 1px solid var(--hx-line); }
.fw-article .fw-eyebrow { margin: 0 0 14px; color: var(--hx-accent); font: 650 .78rem/1.4 var(--hx-sans); letter-spacing: .08em; text-transform: uppercase; }
.fw-hero h1 { margin: 0; color: var(--hx-title); font: 500 clamp(2.6rem, 4.8vw, 4.2rem)/1.06 var(--hx-serif); letter-spacing: -.02em; }
.fw-deck { margin: 20px 0 0; color: var(--hx-soft); font: 400 1.18rem/1.7 var(--hx-sans); }
.fw-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.fw-meta span { padding: 4px 11px; color: var(--hx-muted); background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 999px; font-size: .78rem; font-weight: 600; }
.fw-hero-art { margin: 32px 0 0; }

.fw-article section { padding: 40px 0 8px; border-bottom: 1px solid var(--hx-line); }
.fw-article section:last-of-type { border-bottom: 0; }
.fw-article h2 { margin: 0 0 18px; color: var(--hx-title); font: 500 clamp(1.8rem, 3vw, 2.4rem)/1.15 var(--hx-serif); letter-spacing: -.015em; }
.fw-article h3 { margin: 30px 0 10px; color: var(--hx-text); font: 500 1.4rem/1.25 var(--hx-serif); }
.fw-article h4 { margin: 22px 0 6px; color: var(--hx-text); font: 650 1rem/1.4 var(--hx-sans); }
.fw-article p,
.fw-article li { color: var(--hx-soft); }
.fw-article p { margin: 0 0 18px; }
.fw-article strong { color: var(--hx-text); }
.fw-article ul,
.fw-article ol { margin: 0 0 20px; padding-left: 1.3rem; }
.fw-article li + li { margin-top: 8px; }
.fw-article a { color: var(--hx-accent); }
.fw-lead { color: var(--hx-text) !important; font-size: 1.12rem; }

.fw-callout { margin: 24px 0; padding: 18px 20px; background: var(--hx-surface); border: 1px solid var(--hx-line); border-left: 3px solid var(--hx-accent); border-radius: 12px; }
.fw-callout p:last-child { margin-bottom: 0; }
.fw-callout .fw-label,
.fw-label { display: block; margin-bottom: 6px; color: var(--hx-accent); font: 700 .72rem/1.4 var(--hx-sans); letter-spacing: .08em; text-transform: uppercase; }
.fw-callout.is-warning { border-left-color: #d9a23b; }
.fw-callout.is-warning .fw-label { color: #d9a23b; }
.fw-quote { margin: 28px 0; padding: 4px 0 4px 20px; color: var(--hx-text); border-left: 2px solid var(--hx-accent); font: 400 1.3rem/1.5 var(--hx-serif); }

.fw-steps { counter-reset: fw-step; list-style: none; padding: 0 !important; }
.fw-steps > li { position: relative; padding: 0 0 18px 48px; counter-increment: fw-step; }
.fw-steps > li::before {
  content: counter(fw-step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--hx-bg);
  background: var(--hx-accent);
  border-radius: 50%;
  font: 700 .85rem/1 var(--hx-sans);
}
.fw-steps > li > strong:first-child { display: block; color: var(--hx-text); }

.fw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 22px 0; }
.fw-mini { padding: 16px 18px; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 12px; }
.fw-mini strong { display: block; margin-bottom: 4px; color: var(--hx-text); }
.fw-mini p { margin: 0; font-size: .92rem; }

.fw-case,
.fw-example { margin: 26px 0; padding: 24px; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 14px; }
.fw-case h3,
.fw-example h3 { margin-top: 4px; }
.fw-source { margin: 14px 0 0 !important; color: var(--hx-muted) !important; font-size: .84rem; }

.fw-table { margin: 22px 0; overflow-x: auto; border: 1px solid var(--hx-line); border-radius: 12px; }
.fw-table table { width: 100%; min-width: 560px; border-collapse: collapse; background: var(--hx-surface); font-size: .92rem; }
.fw-table th,
.fw-table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hx-line); }
.fw-table tr:last-child td { border-bottom: 0; }
.fw-table th { color: var(--hx-text); background: var(--hx-raised); font-weight: 650; }
.fw-table td { color: var(--hx-soft); }
.fw-table td:first-child { color: var(--hx-text); font-weight: 600; }

/* ---------- Diagrams (inline SVG themed by class) ---------- */
.fw-figure { margin: 26px 0; padding: 20px; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 14px; }
.fw-figure svg { display: block; width: 100%; height: auto; overflow: visible; }
.fw-figure figcaption { margin-top: 12px; color: var(--hx-muted); font-size: .88rem; }
.fw-hero-art.fw-figure { padding: 12px; }
svg .d-box { fill: var(--hx-bg); stroke: var(--hx-line-strong); stroke-width: 1.5; }
svg .d-soft { fill: var(--hx-accent-soft); stroke: var(--hx-accent); stroke-width: 1.5; }
svg .d-fill { fill: var(--hx-accent); }
svg .d-raised { fill: var(--hx-raised); stroke: none; }
svg .d-line { fill: none; stroke: var(--hx-line-strong); stroke-width: 1.5; }
svg .d-accent { fill: none; stroke: var(--hx-accent); stroke-width: 2; }
svg .d-dash { fill: none; stroke: var(--hx-muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
svg .d-arrow { fill: var(--hx-line-strong); }
svg .d-arrow-accent { fill: var(--hx-accent); }
svg text { fill: var(--hx-soft); font: 500 13px var(--hx-sans); }
svg .t-title { fill: var(--hx-text); font: 650 14px var(--hx-sans); }
svg .t-big { fill: var(--hx-title); font: 500 20px var(--hx-serif); }
svg .t-small { fill: var(--hx-muted); font: 500 11px var(--hx-sans); }
svg .t-accent { fill: var(--hx-accent); font: 700 12px var(--hx-sans); letter-spacing: .04em; }
svg .t-on-accent { fill: var(--hx-bg); font: 700 13px var(--hx-sans); }

[data-stepper] [data-step] { opacity: .22; transition: opacity .35s ease; }
[data-stepper] [data-step].is-on { opacity: 1; }
[data-stepper] [data-step].is-current .d-box,
[data-stepper] [data-step].is-current .d-soft { stroke: var(--hx-accent); stroke-width: 2.5; }
.fw-step-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.fw-step-controls button {
  min-width: 40px;
  height: 36px;
  padding: 0 14px;
  color: var(--hx-text);
  background: var(--hx-raised);
  border: 1px solid var(--hx-line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.fw-step-controls button:hover { border-color: var(--hx-muted); }
.fw-step-count { color: var(--hx-muted); font-size: .85rem; }
.fw-step-notes { margin: 12px 0 0 !important; padding: 0 !important; list-style: none; }
.fw-step-notes li { margin: 0 !important; color: var(--hx-text); font-size: .95rem; }

/* ---------- Practice + quiz + related ---------- */
.fw-practice { margin: 24px 0; padding: 22px; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 14px; }
.fw-practice textarea {
  width: 100%;
  min-height: 180px;
  margin-top: 8px;
  padding: 14px;
  color: var(--hx-text);
  background: var(--hx-bg);
  border: 1px solid var(--hx-line);
  border-radius: 10px;
  resize: vertical;
}
.fw-practice textarea:focus { border-color: var(--hx-accent); outline: 0; }
.fw-save { margin: 6px 0 0 !important; color: var(--hx-muted) !important; font-size: .82rem; }
.fw-quiz details { margin: 10px 0; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 12px; }
.fw-quiz summary { padding: 14px 18px; color: var(--hx-text); cursor: pointer; font-weight: 600; }
.fw-quiz details > div { padding: 0 18px 16px; }
.fw-quiz details > div p:last-child { margin-bottom: 0; }
.fw-related { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 18px 0; }
.fw-related a { display: block; padding: 14px 16px; color: var(--hx-text) !important; background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 12px; text-decoration: none; }
.fw-related a:hover { border-color: var(--hx-muted); }
.fw-related a span { display: block; color: var(--hx-muted); font-size: .84rem; }

.fw-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 780px; margin: 8px 0 72px; }
.fw-pager a { display: block; padding: 16px 18px; color: var(--hx-text); border: 1px solid var(--hx-line); border-radius: 12px; text-decoration: none; }
.fw-pager a:hover { border-color: var(--hx-muted); }
.fw-pager a.next { text-align: right; }
.fw-pager small { display: block; color: var(--hx-muted); font-size: .78rem; }
.hx-top .hx-slot-end > .fw-complete[aria-pressed="true"] { color: var(--hx-text); background: transparent; border-color: var(--hx-line); }

/* ---------- Catalogue (frameworks/index.html) ---------- */
.fw-cat { padding: 32px 0 8px; }
.fw-cat h2 { display: flex; align-items: baseline; gap: 10px; }
.fw-cat h2 span { color: var(--hx-muted); font: 500 .9rem var(--hx-sans); }
.fw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.fw-card { position: relative; display: block; padding: 18px; color: var(--hx-text); background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 14px; text-decoration: none; }
.fw-card:hover { border-color: var(--hx-muted); }
.fw-card strong { display: block; margin: 4px 0 6px; color: var(--hx-title); font: 500 1.3rem/1.2 var(--hx-serif); }
.fw-card p { margin: 0 !important; color: var(--hx-soft); font-size: .9rem; line-height: 1.55; }
.fw-card-origin { color: var(--hx-accent); font-size: .74rem; font-weight: 650; letter-spacing: .03em; }
.fw-card.is-done .fw-card-state::after { content: "✓ Mastered"; position: absolute; top: 16px; right: 16px; color: var(--hx-accent); font-size: .75rem; font-weight: 700; }
.fw-note { color: var(--hx-muted); }

@media (max-width: 1180px) {
  .fw-hero { padding-top: 40px; }
}

@media (max-width: 900px) {
  .fw-layout { display: block; }
  .fw-rail {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 150;
    width: min(340px, 88vw);
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  .fw-menu-open .fw-rail { transform: none; }
  .fw-rail-close { display: grid; place-items: center; width: 40px; height: 40px; color: var(--hx-text); background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 8px; }
  .fw-scrim { position: fixed; inset: 0; z-index: 140; display: block; padding: 0; background: rgb(0 0 0 / .45); border: 0; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .fw-menu-open .fw-scrim { opacity: 1; pointer-events: auto; }
  .fw-hero { padding: 28px 0 24px; }
  .fw-hero h1 { font-size: clamp(2.3rem, 10vw, 3.2rem); }
  /* Keep diagram labels readable on phones: scroll the diagram, never the page. */
  .fw-figure { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fw-figure svg { min-width: 600px; }
  .fw-hero-art.fw-figure svg { min-width: 0; }
  .fw-step-controls { position: sticky; left: 0; }
  .fw-figure figcaption, .fw-step-notes { position: sticky; left: 0; max-width: calc(100vw - 66px); }
  .fw-case,
  .fw-example,
  .fw-practice { padding: 18px; }
  .fw-pager { grid-template-columns: 1fr; }
  .fw-pager a.next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fw-rail,
  .fw-scrim,
  [data-stepper] [data-step] { transition: none; }
}
