/* Deliberately dark in both system themes - it is a terminal.
     `theme amber|green|light` switches the phosphor (persisted). */
  :root {
    --bg: #0b0e12; --panel: #10141a; --fg: #d7e0ea; --muted: #7d8a97;
    --line: #1e2530; --green: #7ee787; --amber: #f0b429; --cyan: #79c0ff;
    --glow: #16202e; --shadow: 0 24px 60px rgba(0,0,0,0.45);
  }
  html[data-term-theme="amber"] {
    --bg: #140d00; --panel: #1a1102; --fg: #ecc077; --muted: #96733f;
    --line: #332508; --green: #ffb000; --amber: #ffd257; --cyan: #ffd98c; --glow: #241803;
  }
  html[data-term-theme="green"] {
    --bg: #021207; --panel: #04190b; --fg: #79e896; --muted: #3e8155;
    --line: #0c2b18; --green: #54f381; --amber: #b9f8c3; --cyan: #8df1ad; --glow: #052410;
  }
  html[data-term-theme="light"] {
    --bg: #f3efe4; --panel: #fbf8f1; --fg: #2c2b25; --muted: #6e685a;
    --line: #ded5c2; --green: #0a7d33; --amber: #8f6400; --cyan: #0b63b8; --glow: #e8e1cf;
    --shadow: 0 18px 50px rgba(80,66,30,0.18);
  }
  * { box-sizing: border-box; margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    background: var(--bg); color: var(--fg); min-height: 100vh;
    font: 15px/1.7 ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
    display: flex; flex-direction: column;
    background-image:
      radial-gradient(ellipse 90% 55% at 50% -8%, var(--glow) 0%, transparent 62%),
      radial-gradient(ellipse 70% 45% at 88% 112%,
                      color-mix(in srgb, var(--glow) 75%, transparent) 0%, transparent 72%);
  }
  ::selection { background: rgba(126,231,135,0.28); }
  a { color: var(--cyan); text-decoration: none; }
  a:hover, a:focus-visible { text-decoration: underline; }
  a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
  .wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 20px; }
  .term {
    position: relative; background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
  }
  .term-bar {
    display: flex; align-items: center; gap: 7px; padding: 11px 14px;
    border-bottom: 1px solid var(--line);
  }
  .term-bar i { width: 12px; height: 12px; border-radius: 50%; background: #2c3646;
                position: relative; }
  .term-bar i:nth-child(1) { background: #f25f58; }
  .term-bar i:nth-child(2) { background: #f0b429; }
  .term-bar i:nth-child(3) { background: #58c142; }
  /* the macOS move: hover the bar - the lights show their glyphs.
     NOTE: no font shorthand here - `inherit` inside a shorthand voids the whole
     declaration and the glyph renders at the inherited 15px/1.7, sliding off
     the 12px circle. Longhands + line-height centering are bulletproof. */
  .term-bar i::after {
    content: ""; position: absolute; left: 0; top: 0; width: 12px; height: 12px;
    text-align: center; line-height: 12px; font-size: 9px; font-weight: 700;
    color: rgba(0,0,0,0.55); opacity: 0; transition: opacity 0.12s;
  }
  .term-bar i:nth-child(1)::after { content: "×"; }
  .term-bar i:nth-child(2)::after { content: "-"; }
  .term-bar i:nth-child(3)::after { content: "+"; }
  .term-bar:hover i::after { opacity: 1; }
  .term-bar span { margin-left: 8px; color: var(--muted); font-size: 12px; }
  .term-body { padding: 22px 20px 26px; cursor: text; }
  .ps1 { color: var(--green); user-select: none; }
  .cmd { color: var(--fg); font-weight: 600; }
  .out { color: var(--muted); display: block; margin: 4px 0 18px; white-space: pre-wrap; }
  .out b { color: var(--fg); font-weight: 600; }
  .out .dir { color: var(--amber); font-weight: 600; }
  /* session replay: commands type themselves, outputs follow (--w width, --d delay) */
  .line, .out { opacity: 0; animation: appear 0.01s linear var(--d, 0s) forwards; }
  .type { display: inline-block; overflow: hidden; white-space: nowrap;
          vertical-align: bottom; width: 0;
          animation: typing 0.4s steps(12, end) var(--d, 0s) forwards; }
  /* +1ch of slack: Safari's bold monospace advances drift a fraction of a pixel
     per glyph past the computed ch width, and 15 glyphs are enough for
     overflow:hidden to clip the last one. The box has no background - the
     extra empty space is invisible. */
  @keyframes typing { to { width: calc(var(--w) + 1ch); } }
  @keyframes appear { to { opacity: 1; } }
  .out.shown, #shlog .line { opacity: 1; animation: none; }
  #shlog .out { margin-bottom: 10px; }
  @media (prefers-reduced-motion: reduce) {
    .line, .out { animation: none; opacity: 1; }
    .type { animation: none; width: auto; }
  }
  .shrow { display: flex; gap: 0 8px; align-items: baseline;
           opacity: 0; animation: appear 0.01s linear 4.3s forwards; }
  @media (prefers-reduced-motion: reduce) { .shrow { animation: none; opacity: 1; } }
  .shrow input {
    flex: 1; min-width: 60px; background: transparent; border: 0; outline: none;
    color: var(--fg); font: inherit; font-weight: 600; caret-color: var(--green);
  }
  footer { padding: 30px 0 44px; color: var(--muted); font-size: 12.5px;
           display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  /* macOS-style menu bar: our triangle where the apple sits, then real drop-down menus.
     Fixed to the top, translucent, and it follows whichever phosphor theme is on. */
  .menubar {
    position: fixed; top: 0; left: 0; right: 0; height: 28px; z-index: 90;
    display: flex; align-items: center; padding: 0 8px;
    background: color-mix(in srgb, var(--panel) 86%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
    font-size: 13px; line-height: 1;
  }
  .mb-menus { display: flex; align-items: center; gap: 0; min-width: 0; }
  .mb-slot { position: relative; }
  .menubar .mb-btn {
    display: inline-block; padding: 5px 9px; border-radius: 5px; border: 0;
    background: transparent; color: var(--fg); white-space: nowrap;
    font: inherit; cursor: default;
  }
  /* the studio button: icon and name in one target, bold like the app menu on a Mac */
  .mb-logo { font-weight: 700; margin-right: 4px; }
  .mb-logo .tri { display: inline-block; color: var(--green); }
  .mb-logo .tri.wink { animation: wink 0.9s ease; }
  @keyframes wink { 40% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
  .menubar .mb-btn:hover, .menubar .mb-btn:focus-visible,
  .menubar .mb-btn[aria-expanded="true"] {
    background: var(--cyan); color: var(--bg); text-decoration: none;
  }
  .menubar .mb-btn[aria-expanded="true"] .tri { color: var(--bg); }
  .menubar .mb-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
  .menubar .mb-btn[aria-current="page"] { color: var(--green); }
  .menubar .mb-btn[aria-current="page"]:hover,
  .menubar .mb-btn[aria-current="page"][aria-expanded="true"] { color: var(--bg); }
  /* the drop-down itself: a panel under the bar, same phosphor, mac-ish rounded corners */
  .mb-drop {
    display: none; position: absolute; top: 27px; left: 0; min-width: 210px;
    background: color-mix(in srgb, var(--panel) 97%, transparent);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border: 1px solid var(--line); border-radius: 8px; padding: 5px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.38); z-index: 91;
  }
  .mb-drop-right { left: auto; right: 0; min-width: 172px; }
  .mb-slot.open .mb-drop { display: block; }
  .mb-drop a, .mb-drop button {
    display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0;
    border-radius: 5px; background: transparent; color: var(--fg); font: inherit;
    text-decoration: none; white-space: nowrap; cursor: default;
  }
  .mb-drop a:hover, .mb-drop button:hover,
  .mb-drop a:focus-visible, .mb-drop button:focus-visible {
    background: var(--cyan); color: var(--bg); text-decoration: none; outline: none;
  }
  .mb-drop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 8px; }
  .mb-drop [aria-checked="true"]::before { content: "\2713 "; color: var(--green); }
  .mb-drop [aria-checked="true"]:hover::before { color: var(--bg); }
  .mb-right { margin-left: auto; padding-left: 10px; display: flex; align-items: center; gap: 4px; }
  .mb-status { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
  #mb-clock { padding: 0 6px; }
  body { padding-top: 28px; }
  @media (max-width: 700px) {
    /* narrow: the named menus fold into the studio menu under the triangle */
    .menubar { padding: 0 4px; font-size: 12px; }
    .mb-menus .mb-slot:not(:first-child) { display: none; }
    #mb-clock { display: none; }
  }
  /* the desktop: the window keeps the SAME gap below the menu bar on every page.
     Vertical centring was worse: the short front page floated in the middle while a long
     page had nothing to centre and stuck to the bar, so the window jumped between pages. */
  .wrap { padding-top: 40px; padding-bottom: 34px; }
  /* crt: scanlines + a soft phosphor glow, toggled by the `crt` command */
  html.crt body::after { content: ""; position: fixed; inset: 0; pointer-events: none;
    z-index: 80; background: repeating-linear-gradient(0deg,
      rgba(0,0,0,0.18) 0 1px, transparent 1px 3px); }
  html.crt .term-body { text-shadow: 0 0 5px color-mix(in srgb, var(--fg) 40%, transparent); }
  /* sl: the little train crosses the terminal */
  #train { position: absolute; top: 22%; left: 0; white-space: pre; font-size: 11px;
           line-height: 1.25; color: var(--muted); pointer-events: none; z-index: 5; }
  #train .dir { color: var(--amber); }
  /* konami confetti */
  .confetti { position: absolute; top: -16px; z-index: 6; pointer-events: none;
              animation: fall 1.4s ease-in var(--cd, 0s) forwards; }
  @keyframes fall { to { transform: translateY(var(--fy, 300px)) rotate(320deg); opacity: 0; } }
  /* screensaver: the triangle wanders like the old DVD logo */
  #saver { position: fixed; inset: 0; background: var(--bg); z-index: 100; display: none; }
  #saver.on { display: block; }
  #saver b { position: absolute; left: 0; top: 0; font-size: 56px; font-weight: 400;
             color: var(--green); will-change: transform; }

/* Page content INSIDE the terminal window: same phosphor, real typography.
   The palette, the window chrome and the desktop live in site.css - shared with the front
   page, never copied. This file is only the prose that goes in the window. */
/* the page is the command's output: it appears at once, right after the typing finishes */
.page { padding: 14px 0 6px; opacity: 0; animation: appear 0.01s linear var(--d, 0s) forwards; }
@media (prefers-reduced-motion: reduce) { .page { animation: none; opacity: 1; } }
.page h1 { font-size: 19px; line-height: 1.35; font-weight: 700; margin: 0 0 4px; }
.page .lede { color: var(--muted); margin-bottom: 22px; max-width: 68ch; }
.page h2 { font-size: 15px; font-weight: 700; color: var(--amber); margin: 26px 0 8px; }
.page h2::before { content: "# "; color: var(--muted); font-weight: 400; }
.page p { margin-bottom: 13px; max-width: 68ch; }
.page ul { margin: 0 0 15px; padding: 0; list-style: none; max-width: 68ch; }
.page ul li { padding-left: 20px; position: relative; margin-bottom: 9px; color: var(--muted); }
.page ul li::before { content: "-"; position: absolute; left: 4px; color: var(--green); }
.page ul li b { color: var(--fg); font-weight: 600; }
.page dl { margin: 0 0 15px; max-width: 68ch; }
.page dt { color: var(--amber); margin-top: 13px; }
.page dd { margin: 2px 0 0; color: var(--muted); }
.page address { font-style: normal; display: inline-block; color: var(--muted);
                border-left: 2px solid var(--line); padding-left: 14px; margin: 2px 0 4px; }
/* the prompt waits for the front page session to finish typing; here there is nothing to wait for */
.shrow { animation-delay: 0s; }
