/* The published guides. Same-origin, no script: fits the site's CSP as it stands. */
:root { --bg: #fbfaf7; --fg: #1d1d1b; --mute: #6b6a65; --line: #e3e0d8; --accent: #0d7a6f; }
@media (prefers-color-scheme: dark) { :root { --bg: #151514; --fg: #ecebe6; --mute: #9a988f; --line: #2e2d2a; --accent: #4fc2b3; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.6 Georgia, 'Iowan Old Style', serif; }
header { padding: 12px 16px; border-bottom: 1px solid var(--line); font: 15px system-ui, sans-serif; }
header a, main a { color: var(--accent); }
main { max-width: 42rem; margin: 0 auto; padding: 16px 16px 64px; }
h1 { font-size: 2rem; line-height: 1.2; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }
table { border-collapse: collapse; width: 100%; font: 15px/1.4 system-ui, sans-serif; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--accent); color: var(--mute); }
.cta { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font: 16px system-ui, sans-serif; }
ul.guides li { margin-bottom: 1rem; }

/* Exercise popovers: a link to /exercise/<id> opens the exercise over the article (render_exercise_popovers).
   Phone: a sheet over the whole screen. Wider screens: a centred window over a dimmed page. */
button.ex { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: inherit; }
.ex-pop { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--fg); overflow-y: auto; overscroll-behavior: contain; font: 16px/1.5 system-ui, sans-serif; }
.ex-pop::backdrop { background: rgb(0 0 0 / 0.5); }
.ex-bar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 17px; }
.ex-close { font: 28px/1 system-ui, sans-serif; color: var(--fg); background: none; border: 0; width: 44px; height: 44px; margin: -8px -10px -8px 0; cursor: pointer; }
.ex-body { padding: 12px 16px 24px; }
.ex-body h3 { font-size: 1rem; margin: 1.2rem 0 0.3rem; }
.ex-body ol, .ex-body ul { padding-left: 1.3rem; margin: 0.3rem 0; }
.ex-body li { margin-bottom: 0.35rem; }
.ex-frames { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex-frames img { width: 100%; height: 38vh; max-height: 320px; object-fit: contain; background: #fff; border-radius: 8px; }
.ex-meta { color: var(--mute); margin: 0.6rem 0 0; }
.ex-more { margin-top: 1.4rem; }
.ex-more a { color: var(--accent); }
body:has(.ex-pop:popover-open) { overflow: hidden; }
@media (min-width: 640px) {
  .ex-pop { inset: 0; margin: auto; width: min(34rem, calc(100% - 64px)); height: fit-content; max-height: calc(100vh - 64px);
    border-radius: 12px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.35); }
}
