/* fuckingpython.lol: paper and a terminal. One 720px column, 16px gutters,
   44px tap targets, light and dark from the system. The red is the colour
   a traceback's last line deserves, used for little else. */
:root {
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --ink: #1B1D22;
  --muted: #5D616B;
  --line: #E3E1DC;
  --accent: #B3261E;
  --link: #1F4FA3;
  --tint: #FBEDEB;
  --term-bg: #17191F;
  --term-ink: #E6E4DF;
  --term-muted: #9EA3AD;
  --term-err: #FF8A80;
  --code-bg: #EFEDE8;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114; --surface: #181A1F; --ink: #E8E6E1; --muted: #A2A6AF; --line: #2A2D34;
    --accent: #FF8A80; --link: #8DB4FF; --tint: #2A1716;
    --term-bg: #0B0C0F; --term-ink: #E6E4DF; --term-muted: #8E939C; --term-err: #FF8A80;
    --code-bg: #1F2229;
  }
}
:root[data-theme="dark"] {
  --bg: #101114; --surface: #181A1F; --ink: #E8E6E1; --muted: #A2A6AF; --line: #2A2D34;
  --accent: #FF8A80; --link: #8DB4FF; --tint: #2A1716;
  --term-bg: #0B0C0F; --term-ink: #E6E4DF; --term-muted: #8E939C; --term-err: #FF8A80;
  --code-bg: #1F2229;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  overflow-wrap: break-word;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; text-wrap: balance; }
h1 { font-size: 1.9rem; letter-spacing: -.015em; }
h2 { font-size: 1.3rem; margin-top: 2.4rem; }
h3 { font-size: 1.05rem; margin-top: 1.4rem; }
p, ul, ol { margin: 0 0 .9rem; }
ul, ol { padding-left: 1.3rem; }
li { margin: .25rem 0; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .1em .3em; border-radius: 5px; }
strong { font-weight: 700; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* --------------------------------------------------------------- header */
.bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 16px;
  max-width: 720px; margin: 0 auto 1.2rem;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  border-bottom: 1px solid var(--line);
}
.mark {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
  font: 700 1rem/1 var(--mono); letter-spacing: -.02em; color: var(--ink); text-decoration: none;
  white-space: nowrap;
}
.mark:hover { color: var(--accent); }
.mark img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.bar nav { display: flex; gap: 2px 14px; flex-wrap: wrap; }
.bar nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: .92rem; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.bar nav a:hover { color: var(--accent); }

/* --------------------------------------------------------------- article */
.crumbs { font-size: .9rem; color: var(--muted); margin: 0 0 .4rem; }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
h1.msg {
  font: 700 1.45rem/1.35 var(--mono); letter-spacing: -.02em;
  color: var(--accent); overflow-wrap: anywhere; text-wrap: pretty;
}
.dates { font-size: .88rem; color: var(--muted); margin: 0 0 1rem; }
.lede { font-size: 1.08rem; color: var(--ink); }
.lede p:last-child { margin-bottom: 0; }

/* A file of the example: its name on a tab above the code. */
figure { margin: 1rem 0 1.2rem; }
pre {
  margin: 0; font: .86rem/1.55 var(--mono); tab-size: 8;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
figure.code figcaption {
  display: inline-block; font: 600 .78rem/1 var(--mono); color: var(--muted);
  background: var(--code-bg); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0; padding: 7px 10px 6px;
}
figure.code pre, pre.snippet, pre.cmd {
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 12px 14px;
}
pre.snippet, pre.cmd { border-radius: var(--radius); margin: 1rem 0 1.2rem; }
pre.cmd code::before { content: "$ "; color: var(--muted); user-select: none; -webkit-user-select: none; }
pre.cmd code { white-space: pre; }
.tab { background: var(--tint); box-shadow: inset 0 -2px 0 var(--accent); }

/* What the interpreter printed: a terminal, wrapped so the last line is
   readable on a phone without scrolling sideways. */
figure.term { background: var(--term-bg); color: var(--term-ink); border-radius: var(--radius); overflow: hidden; }
figure.term figcaption {
  font: 600 .75rem/1 var(--mono); letter-spacing: .02em; color: var(--term-muted);
  padding: 10px 14px 0;
}
figure.term pre { padding: 8px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; }
figure.term .err { color: var(--term-err); font-weight: 700; }
.nw { white-space: nowrap; }

/* The wording on every interpreter. */
table.versions { width: 100%; border-collapse: collapse; margin: 1rem 0 .4rem; font-size: .92rem; }
table.versions th, table.versions td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.versions thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 0; }
table.versions tbody th { font: 600 .86rem/1.5 var(--mono); white-space: nowrap; width: 1%; color: var(--ink); }
table.versions td code { background: none; padding: 0; font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; word-break: normal; }
.ran { font-size: .85rem; color: var(--muted); margin: 0 0 1rem; }

section > h2:first-child { margin-top: 2.4rem; }
.faq h3 { font-size: 1.02rem; }
.sources ul { padding-left: 1.1rem; }
.sources li { margin: .4rem 0; }

/* --------------------------------------------------------------- cards */
/* A card is one link: the whole card is the target, and it never
   underlines on hover. */
.cards { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 10px; }
.cards li { margin: 0; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; color: inherit; text-decoration: none;
}
.card:hover { border-color: var(--accent); color: inherit; }
.card .msg {
  display: block; background: none; padding: 0; font: 700 .95rem/1.4 var(--mono);
  color: var(--accent); overflow-wrap: anywhere;
}
.card span { display: block; margin-top: .3rem; color: var(--muted); font-size: .93rem; line-height: 1.5; }
.card span code { font-size: .85em; }

.toc { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin: .8rem 0 0; }
.toc li { margin: 0; }
.toc a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font: 600 .85rem/1 var(--mono); color: var(--ink); text-decoration: none;
}
.toc a:hover { border-color: var(--accent); color: var(--accent); }
.group h3 { font: 700 1rem/1.3 var(--mono); margin-top: 2rem; color: var(--muted); }
.group { scroll-margin-top: 12px; }

/* --------------------------------------------------------------- footer */
.foot {
  max-width: 720px; margin: 3rem auto 0; padding: 1rem 16px 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }

/* On a phone the header is one row: the 3.15 link, which the front page's
   first card also carries, steps out, and under 360px the mark tightens. */
@media (max-width: 480px) {
  .bar nav a.wide { display: none; }
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  h1.msg { font-size: 1.2rem; }
  pre { font-size: .8rem; }
  .mark { font-size: .92rem; }
  .bar nav { gap: 0 12px; }
}
@media (max-width: 360px) {
  .bar { gap: 0 12px; }
  .mark { font-size: .85rem; gap: 8px; }
  .mark img { width: 24px; height: 24px; border-radius: 6px; }
  .bar nav { gap: 0 10px; }
}
