/* ════════════════════════════════════════════════════════════════════
   Platform Engineering Guide — documentation surface
   A functional, dense reference styled in Sol del Sur. Used by platform.html
   ════════════════════════════════════════════════════════════════════ */

/* ── Top nav ───────────────────────────────────────────────────────── */
.pg-nav {
  position: sticky; top: 0; z-index: 60; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-10);
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.pg-nav .brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.pg-nav .right { display: flex; align-items: center; gap: var(--space-4); }
.pg-nav a.back { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); text-decoration: none; font-size: 0.82rem; }
.pg-nav a.back:hover { color: var(--text); }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); background: transparent; cursor: pointer; border-radius: var(--radius-btn); color: var(--text-muted); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 17px; height: 17px; }

/* ── Hero ──────────────────────────────────────────────────────────── */
.pg-hero { max-width: var(--width-app); margin: 0 auto; padding: clamp(3.5rem, 9vw, 6rem) var(--space-10) 2.5rem; }
.pg-hero .lead { font-size: 1.0625rem; color: var(--text-muted); max-width: 64ch; line-height: 1.7; margin-top: 1.1rem; }
.pg-status { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-top: 1.75rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.pg-status div { display: flex; flex-direction: column; gap: 2px; }
.pg-status .k { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.pg-status .v { font-family: var(--mono); font-size: 0.8rem; color: var(--text); }
.pg-status .v.live::before { content: '●'; color: var(--teal); font-size: 0.7em; margin-right: 0.4rem; vertical-align: 1px; }

/* ── Shell: sticky TOC + content ───────────────────────────────────── */
.pg-shell { max-width: var(--width-app); margin: 0 auto; padding: 0 var(--space-10) 4rem; display: grid; grid-template-columns: 220px 1fr; gap: var(--space-12); align-items: start; }

.pg-toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; }
.pg-toc .toc-title { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); padding: 0 0 0.7rem 0.7rem; }
.pg-toc ol { list-style: none; counter-reset: toc; }
.pg-toc li { counter-increment: toc; }
.pg-toc a {
  display: flex; gap: 0.6rem; align-items: baseline;
  padding: 0.32rem 0.7rem; border-radius: var(--radius-chip);
  color: var(--text-muted); text-decoration: none; font-size: 0.8rem; line-height: 1.4;
  border-left: 2px solid transparent; margin-left: -2px;
  transition: color var(--duration-default) var(--ease-smooth), background var(--duration-default) var(--ease-smooth);
}
.pg-toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--mono); font-size: 0.62rem; color: var(--text-subtle); flex: none; }
.pg-toc a:hover { color: var(--text); background: var(--surface-2); }
.pg-toc a.active { color: var(--accent); border-left-color: var(--accent); background: color-mix(in oklab, var(--accent) 7%, transparent); }
.pg-toc a.active::before { color: var(--accent); }

/* ── Sections ──────────────────────────────────────────────────────── */
.pg-main { min-width: 0; }
.pg-sec { padding: 2.75rem 0; border-top: 1px solid var(--border); scroll-margin-top: 76px; }
.pg-sec:first-child { border-top: none; padding-top: 0.5rem; }
.pg-sec > h2 { margin-bottom: 0.4rem; scroll-margin-top: 76px; }
.pg-sec .sec-no { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; color: var(--accent); display: block; margin-bottom: 0.3rem; }
.pg-sec > p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.75; max-width: 68ch; margin: 0.9rem 0; }
.pg-sec > p strong { color: var(--text); font-weight: 600; }
.pg-sec h3 { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; color: var(--text); margin: 1.9rem 0 0.7rem; }
.pg-sec h3:first-of-type { margin-top: 1.4rem; }
code.inl { font-family: var(--mono); font-size: 0.84em; background: var(--surface-2); color: var(--accent-text); padding: 1px 5px; border-radius: var(--radius-badge); white-space: nowrap; }
:root[data-theme="dark"] code.inl { color: var(--accent); }

/* ── Constraints (numbered cards) ──────────────────────────────────── */
.constraints { display: grid; gap: var(--space-3); margin-top: 1.3rem; }
.constraint { display: grid; grid-template-columns: 34px 1fr; gap: var(--space-4); padding: 1.1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.constraint .n { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; color: var(--accent); line-height: 1; }
.constraint h4 { font-family: var(--sans); font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.constraint p { font-size: 0.86rem; color: var(--text-muted); line-height: 1.65; margin: 0; }

/* ── Tables ────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; margin: 1.3rem 0 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 460px; }
table.tbl th { text-align: left; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-subtle); font-weight: 500; padding: 0.7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.tbl td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-muted); line-height: 1.55; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td:first-child { color: var(--text); font-weight: 500; }
table.tbl td .mono { font-family: var(--mono); font-size: 0.92em; }
table.tbl strong { color: var(--text); font-weight: 600; }

/* ── Code / tree / decision blocks ─────────────────────────────────── */
.code { position: relative; margin: 1.3rem 0 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-2); overflow: hidden; }
.code .label { display: flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); }
.code .label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.55; flex: none; }
.code pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 0.78rem; line-height: 1.75; color: var(--text); white-space: pre; }
.code .c { color: var(--text-subtle); }            /* comment */
.code .a { color: var(--accent-text); }            /* accent / path */
:root[data-theme="dark"] .code .a { color: var(--accent); }
.code .t { color: var(--teal-text); }              /* teal / keyword */
:root[data-theme="dark"] .code .t { color: var(--teal); }
.code .d { color: var(--error); }                  /* removed / danger */

/* ── Reject / banned list ──────────────────────────────────────────── */
.reject { display: grid; gap: var(--space-2); margin-top: 1.3rem; }
.reject li { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: baseline; list-style: none; font-size: 0.86rem; line-height: 1.6; color: var(--text-muted); padding: 0.5rem 0.2rem; border-bottom: 1px solid var(--border); }
.reject li:last-child { border-bottom: none; }
.reject .x { font-family: var(--mono); color: var(--error); font-weight: 600; flex: none; }
.reject b { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 0.92em; }

/* ── Rule list (code quality) ──────────────────────────────────────── */
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-6); margin-top: 1.3rem; counter-reset: rule; }
.rules li { counter-increment: rule; display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: baseline; list-style: none; font-size: 0.85rem; line-height: 1.55; color: var(--text-muted); padding: 0.45rem 0; }
.rules li::before { content: counter(rule); font-family: var(--mono); font-size: 0.66rem; color: var(--accent); background: var(--accent-tint); width: 20px; height: 20px; border-radius: var(--radius-badge); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.rules li b { color: var(--text); font-weight: 600; }

/* ── Callout ───────────────────────────────────────────────────────── */
.callout { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); margin: 1.5rem 0 0.5rem; padding: 1.1rem 1.3rem; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); }
.callout.teal { border-left-color: var(--teal); }
.callout .ico { color: var(--accent); display: flex; }
.callout.teal .ico { color: var(--teal); }
.callout .ico svg { width: 19px; height: 19px; }
.callout p { font-size: 0.87rem; line-height: 1.7; color: var(--text-muted); margin: 0; }
.callout p strong { color: var(--text); }

/* ── Phase cards (roadmap) ─────────────────────────────────────────── */
.phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); margin-top: 1.3rem; }
.phase { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.2rem; background: var(--surface); }
.phase .ph { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.phase h4 { font-family: var(--sans); font-weight: 600; font-size: 0.92rem; margin: 0.3rem 0 0.7rem; }
.phase ul { list-style: none; display: grid; gap: 0.45rem; }
.phase li { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; padding-left: 1.1rem; position: relative; }
.phase li::before { content: ''; position: absolute; left: 0; top: 0.5rem; width: 6px; height: 6px; border-radius: var(--radius-badge); border: 1px solid var(--border-strong); }
.phase.done li::before { background: var(--teal); border-color: var(--teal); }

/* ── Two-up grid for decision blocks ───────────────────────────────── */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: 1.3rem; }
.two .panel { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.1rem 1.2rem; background: var(--surface); }
.two .panel .ph { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.7rem; }
.two .panel.yes .ph { color: var(--teal); }
.two .panel.no .ph { color: var(--accent); }
.two .panel ul { list-style: none; display: grid; gap: 0.4rem; }
.two .panel li { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; padding-left: 1rem; position: relative; }
.two .panel li::before { content: '›'; position: absolute; left: 0; color: var(--text-subtle); }

/* ── Footer ────────────────────────────────────────────────────────── */
.pg-foot { max-width: var(--width-app); margin: 0 auto; border-top: 1px solid var(--border); padding: 2.5rem var(--space-10); }
.pg-foot p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.7; }
.pg-foot a { color: var(--accent); text-decoration: none; }
.pg-foot a:hover { text-decoration: underline; }

/* ── Mobile TOC toggle ─────────────────────────────────────────────── */
.toc-mobile { display: none; }

@media (max-width: 920px) {
  .pg-shell { grid-template-columns: 1fr; gap: 0; }
  .pg-toc { display: none; }
}
@media (max-width: 720px) {
  .pg-nav, .pg-hero, .pg-shell, .pg-foot { padding-left: var(--space-4); padding-right: var(--space-4); }
  .rules { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
