/* plusplus.fit. The site is one editor pane: each page is a file, with tabs
   and a breadcrumb above it and a status bar below. Colors and faces are the
   app's (DesignSystem's tokens), dark only, as the app is. */

:root {
  --bg: #201f1d;
  --well: #181715;
  --border: #4e4b43;
  --text: #f0ede6;
  --text-2: #9d9b96;
  --accent: #46d17c;   /* the ++ mark, and operators */
  --keyword: #b08cf0;  /* the app's "done" purple */
  --type: #8cc4fa;
  /* SF Pro for the chrome, SF Mono for the file; each falls back to the platform's own. */
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Read by screen readers and search engines, not shown. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The tabs and breadcrumb stay at the top as the file scrolls under them. */
.top { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); }
.tabs { display: flex; background: var(--well); border-bottom: 1px solid var(--border); }
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px 9px 14px;
  font: 400 13px var(--sans);
  color: var(--text-2);
  text-decoration: none;
  box-shadow: inset -1px 0 0 var(--border);
}
.tab.on { background: var(--bg); color: var(--text); margin-bottom: -1px; }
.tab b { font: 700 12px var(--mono); color: var(--accent); }
a.tab:hover { color: var(--text); }
a.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.crumbs { padding: 7px 14px; font: 400 12.5px var(--sans); color: var(--text-2); }
.crumbs i { font-style: normal; margin: 0 6px; opacity: 0.6; }

/* The file: numbered lines, one per row. */
/* A line too long for the window scrolls sideways inside the pane, never off the page. */
main { position: relative; flex: 1; padding: 10px 12px 32px 4px; overflow-x: auto; }
.code {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
  list-style: none;
  counter-reset: n;
  /* In rem, so the reader's own text size applies. */
  font: 500 clamp(0.8125rem, 3.55vw, 1.125rem)/1.75 var(--mono);
  font-variant-ligatures: none;
}
.code li {
  counter-increment: n;
  display: grid;
  grid-template-columns: 2.6em 1fr;
  white-space: pre;
  cursor: text;
  scroll-margin: 84px 0 48px;
}
/* Line numbers are drawn, not read: the second content line gives them empty alt text. */
.code li::before {
  content: counter(n);
  content: counter(n) / "";
  padding-right: 1em;
  text-align: right;
  color: color-mix(in srgb, var(--text-2) 72%, transparent);
}
.code .c { color: var(--text-2); }
.code .k { color: var(--keyword); }
.code .t { color: var(--type); }
.code .g { color: var(--accent); }

/* The caret's line: a faint band the width of the pane, and its number lit. */
.code li.cur {
  --band: color-mix(in srgb, var(--text) 4.5%, transparent);
  background: var(--band);
  box-shadow: 0 0 0 100vmax var(--band);
  clip-path: inset(0 -100vmax);
}
.code li.cur::before { color: var(--text); }
/* An indent guide down the first column of an indented line. */
.code li.in > .line { background: linear-gradient(var(--border), var(--border)) 0 0 / 1px 100% no-repeat; }

/* Prose wraps; its line number stays on the first row. */
.code.md li { white-space: pre-wrap; }
.code.md .h { font-weight: 700; }
.code.md .h i { font-style: normal; color: var(--keyword); }

/* The caret is the app's title cursor: a "_" in the text's own color, set a
   little below the font's underscore, in the cell after the insertion point.
   editor.js adds it and moves it. */
.caret { position: absolute; left: 0; top: 0; color: var(--text); font-weight: 700; pointer-events: none; animation: blink 1.1s steps(1) infinite; }
.caret::before { content: "_"; display: block; transform: translateY(0.17em); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }

/* The status bar stays at the bottom of the screen, clear of a phone's home indicator. */
.status {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; justify-content: flex-end; gap: 18px;
  padding: 6px 14px calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--bg);
  font: 400 12px var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
