/* The reading pages. Self-contained: these are served without the app, so
   nothing here depends on the palette JavaScript applies. Light and dark
   both come from the reader's own preference. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#ffffff, #14161b);
  --ink: light-dark(#242424, #e6e7ea);
  --ink-soft: light-dark(#5a5f6a, #a7adba);
  --ink-faint: light-dark(#8b909c, #767d8c);
  --edge: light-dark(#e4e4e2, #2a2e37);
  --panel: light-dark(#faf9f7, #1b1e25);
  --accent: light-dark(#1a8917, #3fb950);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  /* the app's radius scale, restated: these pages load no JS and no
     shared stylesheet, so the values live here too */
  --r-sm: 6px;
  --r-lg: 10px;
  --r-pill: 999px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  /* the app's chrome width, so the wordmark holds still across the site
     and the index grid never runs wider than the header above it */
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
}
/* the wordmark, set the way the app sets it */
.wordmark {
  font-family: var(--mono);
  font-size: 1.2rem;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
}
.wm-bold { font-weight: 700; }
.wm-caret {
  display: inline-block;
  width: .5em;
  height: 1em;
  margin-left: .18em;
  vertical-align: text-bottom;
  background: var(--accent);
  /* the same pulse as the app's header: one brand, one heartbeat */
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .wm-caret { animation: none; }
}
.topnav { display: flex; gap: 1.1rem; font-size: .88rem; }
.topnav a { color: var(--ink-soft); text-decoration: none; }
.topnav a:hover { color: var(--ink); }

main {
  flex: 1;
  width: 100%;
  /* one frame for the whole reading surface -- header, footer, and
     the app all run 64rem, and an 80-column code block fits it;
     body copy keeps its own 38rem measure below */
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .7rem;
}
.eyebrow a { color: var(--ink-faint); text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }

h1 {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: .6rem;
}
h2 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 2.4rem 0 .7rem;
}
.tagline {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin-bottom: 1.6rem;
  max-width: 38rem;
}
p { margin-bottom: 1rem; max-width: 38rem; }

/* the quick facts, above the prose */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .9rem 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
}
.facts dt {
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.facts dd { font-size: .95rem; }

/* the global board. These pages load no JavaScript, so every custom
   property here has to be one learn.css declares itself -- applyTheme
   never runs on this side of the site. */
.board {
  list-style: none;
  margin: .8rem 0 .4rem;
  padding: 0;
  max-width: 24rem;
  font-family: var(--sans);
  font-size: .9rem;
  counter-reset: place;
}
.board li {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  padding: .25rem .5rem;
  border-bottom: 1px solid var(--edge);
  counter-increment: place;
}
.board li:last-child { border-bottom: 0; }
.board li::before {
  content: counter(place);
  color: var(--ink-faint);
  min-width: 1.4rem;
}
.board-who { flex: 1; overflow-wrap: anywhere; }
.board-tpm { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.board-note { font-size: .85rem; color: var(--ink-faint); }

.cta { margin: 1.8rem 0 .3rem; }
.cta a {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  color: var(--paper);
  background: var(--accent);
  padding: .65rem 1.25rem;
  /* a pill, matching the app's primary buttons */
  border-radius: var(--r-pill);
}
.cta a:hover { filter: brightness(1.1); }
.cta-note { font-size: .88rem; color: var(--ink-faint); }

.docs, .others { list-style: none; }
.docs li { margin-bottom: .45rem; }
.docs a { color: var(--accent); }

.others {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .5rem;
}
.others a {
  display: inline-block;
  font-size: .85rem;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  padding: .18rem .7rem;
}
.others a:hover { color: var(--ink); border-color: var(--ink-faint); }

.langgrid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(13.5rem, 100%), 1fr));
  gap: .9rem;
  margin-top: 1.6rem;
}
.langcard {
  position: relative;  /* the anchor for .card-go's stretched overlay */
  display: flex;
  flex-direction: column;
  gap: .55rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem .8rem;
  background: var(--panel);
  transition: border-color .15s ease, transform .15s ease,
              box-shadow .15s ease;
}
.langcard:hover {
  border-color: var(--ink-faint);
  transform: translateY(-1px);
  box-shadow: 0 3px 14px light-dark(rgba(0, 0, 0, .07),
                                    rgba(0, 0, 0, .45));
}
@media (prefers-reduced-motion: reduce) {
  .langcard { transition: none; }
  .langcard:hover { transform: none; }
}
/* 1rem, not the heading 1.05rem: the longest name (Visual Basic, in
   the mono face) plus logo and go icon must fit a 13.5rem column's
   ~181px of content */
.langcard h2 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-size: 1rem;
}
/* min-width lets an unforeseen long name shrink and wrap instead of
   pushing past the card edge (flex children refuse to by default) */
.langcard h2 a {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.langcard h2 a:hover { color: var(--accent); }
/* the quiet call to action: brackets in the corner, the practice mirror
   of the app's open-book icon. Its ::after stretches over the whole
   card, so clicking anywhere starts a session; the small links float
   above the overlay and keep their own destinations. */
.card-go {
  display: inline-flex;
  margin-left: auto;
  padding: .15rem;
  color: var(--ink-faint);
}
.card-go svg { width: 18px; height: 18px; }
.card-go::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
}
.langcard:hover .card-go { color: var(--accent); }
.card-go:focus-visible { outline: none; }
.card-go:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.langcard h2 a:not(.card-go), .card-links a {
  position: relative;
  z-index: 1;
}
.lang-logo { width: 22px; height: 22px; flex: none; }
/* rust's mark follows the palette, as it does in the app menu */
.lang-logo .rust-disc { fill: var(--ink); }
.lang-logo .rust-ring { stroke: var(--paper); }
.lang-logo .rust-mark { fill: var(--paper); }
/* the tagline stretches, so links and CTA sit at the card's foot */
.card-tagline {
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}
/* the card's verb reads as the primary action, not a third gray link */
.card-links a.card-practice { color: var(--accent); font-weight: 600; }
/* the version the snippets target: its own line under the name --
   beside a mono name the longest chips (NASM 3 (x86-64)) overflow the
   narrowest column. Mono is explicit: outside the h2 nothing else
   supplies it */
.card-version {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--ink-faint);
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  padding: .05em .5em;
  white-space: nowrap;
  align-self: flex-start;
  margin-top: -.2rem;
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .9rem;
  font-size: .85rem;
  margin: 0;
  padding-top: .55rem;
  border-top: 1px solid var(--edge);
}
/* padding over margin-for-space: the .85rem text alone is too small a
   touch target on phones, so each link earns ~30px without moving */
.card-links a {
  color: var(--accent);
  text-decoration: none;
  padding: .3rem .1rem;
  margin: -.3rem -.1rem;
}
.card-links a:hover { text-decoration: underline; }

.foot {
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
  border-top: 1px solid var(--edge);
  color: var(--ink-faint);
  font-size: .85rem;
}
.foot a { color: var(--ink-faint); font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- the tree below a language ---------------- */

.crumbs {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-faint);
  margin-bottom: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4em;
}
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* a set: an anchored section of the tour page, not a page of its own */
.set { scroll-margin-top: 1.5rem; }
.set h2 { margin-top: 2rem; }
/* the tours list on a language page: same kind of content as the tour
   page's .steps, so it wears the same dress */
.langlist { list-style: none; }
.langlist li { border-top: 1px solid var(--edge); }
.langlist li:last-child { border-bottom: 1px solid var(--edge); }
.langlist a {
  display: block;
  padding: .7rem 0;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}
.langlist a:hover strong { color: var(--accent); }
.langlist a span {
  display: block;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.5;
  max-width: 38rem;
}

.steps { list-style: none; }
.steps li { border-top: 1px solid var(--edge); padding: .7rem 0; }
.steps li:last-child { border-bottom: 1px solid var(--edge); }
.steps a { font-weight: 600; text-decoration: none; color: var(--ink); }
.steps a:hover { color: var(--accent); }
.steps span {
  display: block;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.5;
  max-width: 38rem;
}

.how { margin: 0 0 1rem 1.1rem; }
.how li { margin-bottom: .35rem; max-width: 38rem; }

.vocab {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .4rem;
  margin-bottom: 1rem;
}
.vocab code {
  font-family: var(--mono);
  font-size: .8rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: .1rem .45rem;
}

.nextprev {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.6rem 0;
  font-size: .9rem;
}
.nextprev a { color: var(--accent); text-decoration: none; }
.nextprev a:hover { text-decoration: underline; }

/* the snippet itself, colored from the token runs already on the row */
.code {
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.65;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
  margin-bottom: 1.4rem;
}
.t-keyword, .t-keyword-declaration, .t-keyword-reserved, .t-keyword-namespace,
.t-keyword-constant, .t-operator-word {
  color: light-dark(#8250df, #d2a8ff);
}
.t-keyword-type, .t-name-class, .t-name-builtin, .t-name-builtin-pseudo {
  color: light-dark(#953800, #ffa657);
}
.t-name-function, .t-name-function-magic, .t-name-decorator {
  color: light-dark(#6639ba, #d2a8ff);
}
.t-literal-string, .t-literal-string-single, .t-literal-string-double,
.t-literal-string-doc, .t-literal-string-escape, .t-literal-string-interpol,
.t-literal-string-affix, .t-literal-string-backtick, .t-literal-string-char {
  color: light-dark(#0a3069, #a5d6ff);
}
.t-literal-number, .t-literal-number-integer, .t-literal-number-float,
.t-literal-number-hex, .t-literal-number-oct, .t-literal-number-bin {
  color: light-dark(#0550ae, #79c0ff);
}
.t-comment, .t-comment-single, .t-comment-multiline, .t-comment-hashbang,
.t-comment-preproc, .t-comment-special {
  color: light-dark(#6e7781, #8b949e);
  font-style: italic;
}
.t-name-tag { color: light-dark(#116329, #7ee787); }
.t-name-attribute { color: light-dark(#0550ae, #79c0ff); }
.t-operator, .t-punctuation { color: var(--ink-soft); }

/* the public profile (/u): a career by language, in this shell rather
   than the share card so it reads as a page of the site. The activity
   grid restates the app's calendar in its own class names: this side
   loads no app.css, and the two must stay independently deletable. */
.profile { max-width: 64rem; }
.prof-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.4rem;
}
.prof-avatar {
  width: 72px; height: 72px; flex: none;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--edge);
}
.prof-id h1 { margin: 0; font-size: 1.6rem; }
.prof-since, .prof-career {
  margin: .1rem 0 0;
  color: var(--ink-soft);
  font-size: .92rem;
}
.prof-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .9rem 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
}
/* the app's stat voice: the label whispers under a mono number */
.prof-stats dt, .prof-mini dt {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-faint);
}
.prof-stats dd {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
/* wider columns than the learn index: six numbers and a standings
   list need room, and a card stands at its own height rather than
   stretching to its tallest neighbour's */
.prof-langs {
  margin-top: .4rem;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  align-items: start;
}
.prof-langs .langcard h3 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
}
.prof-langs .langcard h3 a {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}
.prof-langs .langcard h3 a:hover { color: var(--accent); }
.prof-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem .6rem;
}
.prof-mini dd {
  font-family: var(--mono);
  font-size: .98rem;
  font-variant-numeric: tabular-nums;
}
.ranks {
  list-style: none;
  margin: .2rem 0 0;
  padding: 0;
  font-size: .85rem;
  border-top: 1px solid var(--edge);
}
.ranks li {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--edge);
}
.ranks li:last-child { border-bottom: 0; }
.ranks a {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranks a:hover { color: var(--accent); }
.ranks span {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: .8rem;
  white-space: nowrap;
}

.act {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
  padding: .9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  --act-cell: 12px;
  --act-gap: 3px;
}
.act-months, .act-body { display: flex; gap: var(--act-gap); }
.act-corner, .act-days { width: 14px; flex: none; }
.act-months, .act-days {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--ink-faint);
  line-height: 1;
}
.act-mslot { width: var(--act-cell); flex: none; white-space: nowrap; }
.act-days { display: flex; flex-direction: column; gap: var(--act-gap); }
.act-dslot { height: var(--act-cell); display: flex; align-items: center; }
.act-grid { display: flex; gap: var(--act-gap); }
.act-week { display: flex; flex-direction: column; gap: var(--act-gap); }
.act-day, .act-swatch {
  display: block;
  width: var(--act-cell); height: var(--act-cell);
  border-radius: 2px;
  background: light-dark(#ebedf0, #232833);
}
/* the app's four steps of green, restated for the reader's scheme */
.act-l1 { background: light-dark(#bfe8c5, #1f4d2a); }
.act-l2 { background: light-dark(#7fd28c, #2e7d3a); }
.act-l3 { background: light-dark(#3fb950, #3fb950); }
.act-l4 { background: light-dark(#1a8917, #7ee787); }
.act-future { background: transparent; border: 1px dashed var(--edge); }
.act-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: .4rem 0 0;
  justify-content: flex-end;
  font-size: .72rem;
  color: var(--ink-faint);
}
.act-legend span:first-child { margin-right: .2rem; }
.act-legend span:last-child { margin-left: .2rem; }
