/* Web edition of the SemOps Manual. Palette from docs/diagram-style.md:
   ink #14243A, authoring orange #FD5B1C, automation teal #02B7D4. */
:root {
  --paper: #ffffff; --paper-2: #f6f7f9; --paper-3: #eceef2;
  --ink: #14243A; --ink-2: #3c4a5e; --ink-3: #6b7686;
  --rule: #dde1e7;
  --accent: #FD5B1C; --accent-soft: #FFE6DA;
  --link: #0a6f85;
  --code-bg: #f3f5f8;
  --sans: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Ubuntu Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11161e; --paper-2: #171d27; --paper-3: #212936;
    --ink: #e6e9ee; --ink-2: #b8c0cc; --ink-3: #8993a2;
    --rule: #2c3543;
    --accent: #ff7a45; --accent-soft: #3a1d10;
    --link: #5fd0e6;
    --code-bg: #1b222d;
  }
}
:root[data-theme="dark"] {
  --paper: #11161e; --paper-2: #171d27; --paper-3: #212936;
  --ink: #e6e9ee; --ink-2: #b8c0cc; --ink-3: #8993a2;
  --rule: #2c3543;
  --accent: #ff7a45; --accent-soft: #3a1d10;
  --link: #5fd0e6;
  --code-bg: #1b222d;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 64px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.65; }
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 24px; background: #14243A; color: #fff;
  border-bottom: 3px solid var(--accent);
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar .home { font-size: .85rem; opacity: .85; white-space: nowrap; }
.topbar .title { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar .title img { border-radius: 4px; background: #fff; }
.topbar .links { margin-left: auto; display: flex; gap: 18px; font-size: .85rem; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.rail {
  position: sticky; top: 55px; align-self: start; max-height: calc(100vh - 55px); overflow-y: auto;
  padding: 24px 16px 40px; border-right: 1px solid var(--rule);
}
.rail summary { display: none; }
.rail .part { margin: 18px 8px 6px; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li a {
  display: grid; grid-template-columns: 24px 1fr; gap: 6px; padding: 5px 8px; border-radius: 4px;
  color: var(--ink-2); text-decoration: none; font-size: .88rem; line-height: 1.35;
}
.rail li a:hover { background: var(--paper-3); color: var(--ink); }
.rail li a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.rail .n { color: var(--accent); font-variant-numeric: tabular-nums; }

main { padding: 32px 48px 64px; min-width: 0; }
article { max-width: 46em; }

/* ---------------------------------------------------------------- hero */
.hero { display: flex; gap: 24px; align-items: center; margin: 8px 0 32px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.hero img { border-radius: 12px; background: #fff; flex: none; }
.hero h1 { margin: 0 0 6px; font-size: 2.2rem; line-height: 1.15; }
.hero p { margin: 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- prose */
article h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 20px; }
article h2 { font-size: 1.4rem; line-height: 1.3; margin: 2.2em 0 .6em; padding-top: .2em; }
article h3 { font-size: 1.12rem; margin: 1.8em 0 .5em; }
article h1 + blockquote, article h1 + p > em:only-child { color: var(--ink-3); }
article hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }
article blockquote { margin: 1.2em 0; padding: .4em 1em; border-left: 4px solid var(--accent); background: var(--paper-2); color: var(--ink-2); }
article blockquote p { margin: .4em 0; }
article img { max-width: 100%; height: auto; }

code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .1em .3em; border-radius: 3px; }
pre { background: var(--code-bg); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; font-size: .82rem; }

table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.2em 0; font-size: .92rem; }
th, td { border: 1px solid var(--rule); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--paper-2); }

/* Diagrams are light-palette PNGs by design; keep them on white in dark mode too. */
figure.diagram { margin: 1.6em 0; padding: 12px; background: #fff; border: 1px solid var(--rule); border-radius: 6px; overflow-x: auto; text-align: center; }
figure.diagram img { max-width: 100%; height: auto; }

/* ---------------------------------------------------------------- pager & footer */
.pager { max-width: 46em; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--ink-3); }
.pager .next { text-align: right; grid-column: 2; }
.foot { border-top: 1px solid var(--rule); padding: 18px 24px; text-align: center; font-size: .8rem; color: var(--ink-3); }
.foot p { margin: 0; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule); padding: 8px 16px; }
  .rail summary { display: block; cursor: pointer; padding: 8px 0; font-weight: 600; }
  main { padding: 24px 16px 48px; }
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .topbar .links { gap: 12px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 1.8rem; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
