/* docs.typepper.com: the game's look (its palette is index.html's) */
@font-face { font-family: "Departure Mono"; src: url("assets/DepartureMono-Regular.woff2") format("woff2"); font-display: block; }
/* the game's palette, from index.html */
:root { --bg: #000; --ink: #c8c4cc; --dim: #6e6a74; --line: #1d1b20; --chip: #121114; --hot: #ff8c00;
        --gold: #ffd700; --green: #2daf37; --red: #d72319; --logo: #eeeae2; --flash: #fff4c0; }
[data-theme="light"] { --bg: #faf7f0; --ink: #2a2630; --dim: #8a8590; --line: #e6e0d4; --chip: #efe9de; --hot: #c25a00;
        --gold: #8a6d00; --green: #1f7a27; --red: #a51a12; --logo: #1c1a1e; --flash: #c25a00; }
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 15px/1.65 "Departure Mono", Menlo, Consolas, monospace; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--dim); }
::selection { background: var(--gold); color: #000; }

/* one centered frame: the header and the body share its left edge, so the logo and the toc line up at any width */
:root { --frame: max(28px, calc((100% - 1360px) / 2 + 28px)); }
header { display: flex; align-items: center; gap: 14px; padding: 18px var(--frame); border-bottom: 1px solid var(--line); }
header > a { border: 0; display: flex; align-items: center; }
header .tag { color: var(--dim); }
header .spacer { flex: 1; }
/* the wordmark, in the theme's colors */
#logo img { height: 20px; width: auto; display: block; }
#logo .light, [data-theme="light"] #logo .dark { display: none; }
[data-theme="light"] #logo .light { display: block; }

.chip { color: var(--dim); background: var(--chip); border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; font: inherit; cursor: pointer; transition: color .15s, border-color .15s; }
.chip:hover { color: var(--hot); border-color: var(--hot); }
.chip:active { transform: translateY(1px); }

.wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr) 200px; gap: 48px; padding: 36px var(--frame) 60px; }
main { max-width: 760px; min-width: 0; }

/* the right rail: on this page, then the page's pepper scene */
#rail { position: sticky; top: 24px; align-self: start; font-size: 13px; }
#rail h4 { margin: 4px 0 10px; color: var(--dim); font-weight: normal; letter-spacing: .35em; font-size: 12px; text-transform: uppercase; }
#toc { position: relative; list-style: none; margin: 0 0 28px; padding: 0 0 0 18px; }
#toc li { position: relative; }
#toc li::before { content: "·"; position: absolute; left: -15px; top: 2px; color: var(--dim); }
#toc a { display: block; border: 0; color: var(--dim); padding: 2px 0; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s, transform .2s; }
#toc a:hover { color: var(--ink); transform: translateX(2px); }
#toc a.on { color: var(--ink); }
/* menu.rs `dots`: the active dot stretches toward the next like a worm, then catches up */
#worm { position: absolute; left: 1px; width: 6px; border-radius: 3px; background: var(--gold); }
#stagebox { border-top: 1px dashed var(--line); padding-top: 16px; }
#stage { margin: 0 auto; font: 6px/1 "Departure Mono", monospace; letter-spacing: 0; white-space: pre; width: max-content; }
[data-theme="light"] #stage { filter: brightness(.72) saturate(1.3); }
#caption { margin: 10px 0 0; font-size: 12px; text-align: center; min-height: 1.4em; transition: color .3s; }

/* nav: sections headed by a spinning pepper, one per heat rank */
nav { position: sticky; top: 24px; align-self: start; font-size: 14px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: none; }
/* each section: its pepper standing in a left column, the heading and links beside it */
nav .sec { position: relative; display: grid; grid-template-columns: 78px 1fr; column-gap: 4px; margin-top: 18px; }
nav .sec:first-child { margin-top: 0; }
nav .sec .pep { grid-row: 1 / span 2; align-self: start; }
nav h4 a { border: 0; color: inherit; padding: 0; }
nav h4 a:hover { padding: 0; }
nav h4 { margin: 4px 0 2px 10px; color: var(--dim); font-weight: normal; letter-spacing: .35em; font-size: 12px; text-transform: uppercase; transition: color .3s; }
nav .sec.here h4 { color: var(--ink); }
.pep { margin: 0; font: 5px/1 "Departure Mono", monospace; letter-spacing: 0; width: 78px; height: 70px; overflow: hidden; white-space: pre; opacity: .45; transition: opacity .3s; }
nav .sec.here .pep, nav .sec:hover .pep { opacity: 1; }
nav .sec.jump .pep { animation: jump .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes jump { 40% { transform: translateY(-6px); } }
[data-theme="light"] .pep { filter: brightness(.72) saturate(1.3); }

nav .links { position: relative; }
nav a { position: relative; z-index: 1; display: block; border: 0; padding: 2px 10px; color: var(--dim); transition: color .2s, padding .2s; }
nav a:hover { color: var(--ink); padding-left: 14px; }
nav a.on { color: #000; padding-left: 24px; }
nav a.soon { opacity: .45; }
/* the menu's length chip: one highlight that slides between options, overshooting a little */
#chip { position: absolute; top: 0; left: 0; right: 0; height: 0; background: var(--gold); border-radius: 3px; opacity: 0;
        transition: transform .38s cubic-bezier(.34, 1.56, .64, 1), height .38s, opacity .2s; }
#chip::before { content: "▸"; position: absolute; left: 9px; color: #000; line-height: inherit; animation: breathe 1.6s ease-in-out infinite; }
[data-theme="light"] nav a.on, [data-theme="light"] #chip::before { color: var(--bg); }
/* a wrong key: the letter shakes and blinks red */
.miss { animation: shake .28s steps(4) !important; color: var(--red) !important; }
@keyframes shake { 0% { transform: translateX(2px); } 25% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 75% { transform: none; } }

main { animation: open .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes open { from { opacity: 0; transform: translateY(8px); } }
main h1 { margin: 0 0 4px; font-weight: normal; font-size: 15px; letter-spacing: .5em; text-transform: uppercase; color: var(--gold); min-height: 1.65em; }
main h1 .k { display: inline-block; white-space: pre; animation: pop .35s ease-out; }
@keyframes pop { from { color: var(--flash); background: color-mix(in srgb, var(--gold) 45%, transparent); } }
.caret { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.2em; background: var(--gold); animation: blink 1s steps(1) infinite; margin-left: -.3em; }
@keyframes blink { 50% { opacity: 0; } }
main h1 + p, main .lede { color: var(--dim); margin: 0 0 28px; }
/* h2 rules draw out like a comet once they scroll in */
main h2 { font-weight: normal; font-size: 15px; color: var(--hot); margin: 44px 0 12px; display: flex; gap: 12px; align-items: center; }
main h2::after { content: ""; flex: 1; border-top: 1px dashed var(--line); transform-origin: left; transform: scaleX(0); transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
main h2.seen::after { transform: none; }
main h3, main h4 { font-weight: normal; font-size: 15px; margin: 28px 0 6px; color: var(--gold); }
main h3 code, main h2 code { color: inherit; background: none; padding: 0; }
main p { margin: 8px 0; }
main ul, main ol { padding-left: 22px; margin: 8px 0; }
main ul { list-style: none; padding-left: 18px; }
main ul > li::before { content: "·"; color: var(--hot); margin-left: -16px; width: 16px; display: inline-block; }
main li { margin: 4px 0; }
main strong { font-weight: normal; color: var(--hot); }
main blockquote { margin: 16px 0; padding: 4px 16px; border-left: 2px solid var(--gold); color: var(--dim); }
main hr { border: 0; border-top: 1px dashed var(--line); margin: 32px 0; }
/* links: a finished word's bright head sweeping across */
main a:hover { border-color: var(--hot); color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, var(--hot) 42%, var(--flash) 50%, var(--hot) 58%); background-size: 300% 100%;
  animation: sweep .5s ease-out forwards; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
.dim { color: var(--dim); }
code { font: inherit; background: var(--chip); padding: 1px 6px; border-radius: 3px; }

/* terminal block, with a copy button that throws sparks */
.term { position: relative; }
main pre { font: inherit; margin: 12px 0; padding: 14px 16px; background: var(--chip); border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; line-height: 1.55; transition: border-color .4s; }
.term:hover pre { border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
pre code { background: none; padding: 0; }
pre .p { color: var(--dim); user-select: none; }
pre .ok { color: var(--green); }
pre .err { color: var(--red); }
pre .c { color: var(--dim); }
pre .me { color: var(--gold); }
.term .chip { position: absolute; top: 8px; right: 8px; font-size: 12px; opacity: 0; transition: opacity .2s, color .15s, border-color .15s; }
.term:hover .chip, .term .chip:focus-visible { opacity: 1; }
.spark { position: fixed; pointer-events: none; z-index: 9; font-size: 13px; }

.mermaid { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; text-align: center; }
.mermaid svg { max-width: 100%; height: auto; }

main table { display: block; overflow-x: auto; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
th { text-align: left; font-weight: normal; color: var(--dim); letter-spacing: .2em; font-size: 12px; text-transform: uppercase; }
th, td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr { transition: background .2s; }
tbody tr:hover { background: var(--chip); }

/* the menu card: its border glints white as it lands, then cools to gold */
.card { border: 1px solid var(--gold); border-radius: 2px; padding: 14px 18px; margin: 20px 0; animation: glint 1.1s ease-out; }
@keyframes glint { 0%, 15% { border-color: var(--flash); box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 50%, transparent); } }
.card b { font-weight: normal; color: var(--gold); letter-spacing: .3em; font-size: 12px; display: block; margin-bottom: 4px; }

/* ◂ ▸ to the neighbors: breathing while idle, nudged outward on hover */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager a { border: 0; color: var(--dim); display: flex; gap: 10px; align-items: center; transition: color .2s; }
.pager a:hover { color: var(--ink); background: none; animation: none; }
.pager .arr { color: var(--gold); animation: breathe 1.6s ease-in-out infinite; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.pager a:hover .arr { animation: none; }
.pager .prev:hover .arr { transform: translateX(-5px); }
.pager .next:hover .arr { transform: translateX(5px); }
@keyframes breathe { 50% { opacity: .35; } }

/* the game's key-hint line; it also carries the one dim line of news */
footer { border-top: 1px solid var(--line); padding: 10px 16px; text-align: center; color: var(--dim); font-size: 13px; min-height: 42px; }
footer kbd { font: inherit; color: var(--ink); }
footer kbd.hit { animation: pop .35s ease-out; }
footer .news { color: var(--red); }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

/* settings → calm, from the OS */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  main h2::after { transform: none; }
}

@media (max-width: 1200px) {
  .wrap { grid-template-columns: 250px minmax(0, 1fr); }
  #rail { display: none; }
}

@media (max-width: 820px) {
  .wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 18px 48px; }
  nav { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px 14px; }
  nav h4, #chip, .pep { display: none; }
  nav .sec, nav .links { display: contents; }
  nav a.on { color: #000; background: var(--gold); border-radius: 3px; }
  main h1 { letter-spacing: .3em; }
  header { padding: 14px 18px; }
  header .tag { display: none; }
}

/* until a page draws its peppers and slides its chip: the plain version */
nav .sec:has(.pep:empty) { grid-template-columns: 1fr; }
.pep:empty { display: none; }
nav .links:not(:has(#chip)) a.on { background: var(--gold); border-radius: 3px; padding-left: 10px; }
nav .links:not(:has(#chip)) a.on::before { content: "▸ "; }
