:root {
  color-scheme: light dark;
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --bg-sunken: #f4f4f5;
  --fg: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  /* Michal's own signature color (sampled from his LinkedIn banner,
     2026-08-29) - same hex in both themes, deliberately not shifted per
     theme like the old teal was, since it's meant to be recognizable as
     HIS orange rather than "the site's algorithmically-tinted accent". */
  --accent: #fe3c00;
  --accent-fg: #ffffff;
  --accent-soft: #fff1ea;
  /* Kept clearly apart in hue from --accent (yellow, not another red/orange)
     now that the accent itself is a red-orange - the old --error red
     (#dc2626) sat only ~14deg away on the color wheel and risked reading as
     "the same color" as the brand accent at a glance. */
  --error: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --bg-card: #131316;
    --bg-sunken: #1a1a1e;
    --fg: #ededf0;
    --muted: #93939c;
    --border: #29292f;
    --accent: #fe3c00;
    --accent-fg: #ffffff;
    --accent-soft: #2a1206;
    --error: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 28px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* --- brand / chrome ---------------------------------------------------- */

.topbar {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.topbar-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.1rem 1.5rem;
}
.topbar-row .brand { grid-column: 1; justify-self: start; min-width: 0; }
/* .quicknav (when present, e.g. dashboard) sits in the middle column,
   truly centered since the brand/nav columns are equal 1fr tracks either
   side of it. .topbar-nav (Sign in / Sign out / Home) stays pinned right,
   always in column 3 - explicit grid-column on all three, because with
   no third grid item (pages that don't fill topbar_center) CSS grid's
   auto-placement drops .topbar-nav into the empty middle column instead
   of column 3, centering it on the screen instead of pinning it right. */
.topbar-row .quicknav { grid-column: 2; justify-self: center; min-width: 0; margin: 0; padding: 0; }
.topbar-row .topbar-nav { grid-column: 3; justify-self: end; min-width: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.brand svg { flex-shrink: 0; color: var(--accent); }
.brand .cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--accent);
  margin-left: 0.05em;
  animation: blink 1.1s steps(1) infinite;
  vertical-align: -0.15em;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .brand .cursor { animation: none; opacity: 0.6; }
}
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 500; font-family: var(--font-mono); }
.topbar nav a:hover { color: var(--fg); }
.topbar nav a.cta {
  color: var(--accent-fg);
  background: var(--accent);
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  font-weight: 700;
}
.topbar nav a.cta:hover { opacity: 0.88; }

main { max-width: 720px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
main.wide { max-width: 900px; }
main.narrow { max-width: 620px; }

h1 {
  font-size: 2.1rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
}
h2 {
  font-size: 0.78rem;
  font-weight: 700;
  margin: 3rem 0 1.1rem;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--muted);
}
h2::before { content: "// "; color: var(--accent); opacity: 0.7; }
h3 { font-family: var(--font-mono); }
.lede { color: var(--muted); font-size: 1.08rem; margin: 0; }
.lede-main { margin-bottom: 0.4rem; }
.lede-sub { margin-bottom: 2.75rem; font-size: 0.95rem; }
.lede .rotator {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--fg);
  font-family: var(--font-mono);
  font-weight: 600;
  border-bottom: 1px dashed var(--accent);
  transition: opacity 0.25s ease, width 0.3s ease;
}

/* --- content layout ------------------------------------------------------ */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.card h3 .kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.card p { color: var(--muted); font-size: 0.92rem; margin: 0 0 1rem; }
.card .spacer { flex: 1; }

/* --- terminal-flavoured code blocks -------------------------------------- */

.termcard {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  margin: 0.5rem 0 0;
}
.termcard .termbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.termcard .termbar span {
  width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--border);
}
.termcard pre {
  border: none;
  border-radius: 0;
  margin: 0;
  background: transparent;
}

/* /respond: the setup command is genuinely hidden (blurred + unselectable +
   unclickable), not just Copy-disabled, until the consent checkbox above
   it is checked - see respond.html. */
.termcard-wrap { position: relative; margin: 0.5rem 0 0; }
.termcard-wrap .termcard { margin: 0; transition: filter 0.15s ease; }
.termcard.locked {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
}
.termcard-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--fg);
  font-weight: 500;
}
/* Same [hidden]-vs-class-display specificity trap as .check-row above -
   without this, toggling `.hidden = true` in JS silently does nothing. */
.termcard-lock[hidden] { display: none; }

pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  margin: 0.5rem 0 0;
  font-family: var(--font-mono);
}
code { font-family: var(--font-mono); }
p code, li code {
  background: var(--bg-sunken);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.87em;
}

.box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin: 1.25rem 0;
  scroll-margin-top: 5rem;
}
.box h2 { margin-top: 0; }

/* --- flow diagram ("how it works") --------------------------------------- */

.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 0 0 2.5rem;
}
@media (max-width: 720px) {
  .flow { grid-template-columns: 1fr; gap: 0; }
  .flow .flow-step::after { content: none; }
}
.flow-step {
  position: relative;
  min-width: 0;
}
.flow-step .flow-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.5rem;
}
.flow-step h4 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-family: var(--font-mono);
}
.flow-step p { color: var(--muted); font-size: 0.84rem; margin: 0; line-height: 1.45; }
.flow-step::after {
  content: "\2192";
  position: absolute;
  top: 1.9rem;
  right: -1.15rem;
  color: var(--border);
  font-size: 1rem;
  line-height: 1;
}
.flow-step:last-child::after { content: none; }
@media (max-width: 720px) {
  .flow-step { padding: 0 0 1.25rem 1rem; border-left: 2px solid var(--border); margin-left: 0.3rem; }
  .flow-step:last-child { padding-bottom: 0; border-left: none; }
}

/* --- forms / stats / buttons --------------------------------------------- */

.stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1.25rem; flex-wrap: wrap; }
.stat { min-width: 140px; }
.stat .stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-family: var(--font-mono); }
.stat .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-mono); }
.stat .stat-value.negative { color: var(--error); }

label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
input, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--fg);
  font: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 1.1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
/* The class-level `display: flex` above has the same specificity as the
   browser default `[hidden] { display: none }` rule, and author styles
   win that tie - so without this, toggling the `hidden` attribute (e.g.
   the ToS/Privacy consent row that should only show in "Create account"
   mode on the login form) silently does nothing and the row stays
   visible. */
.check-row[hidden] { display: none; }
.check-row input[type="checkbox"] {
  width: auto;
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

/* Sign in / Create account submit button: `button` is inline-flex by
   default so it hugs the left edge under the form fields instead of
   sitting centered in the box like the Google button below it. */
#auth-form button[type="submit"] {
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.5; cursor: default; }
button.secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
button.ghost {
  background: var(--bg-sunken);
  color: var(--fg);
  border-color: var(--border);
  font-weight: 500;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  margin-top: 0;
}
button.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--border);
  font-family: var(--font-sans);
  font-weight: 500;
}
button.google-btn svg { flex-shrink: 0; }
button.linkedin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--border);
  font-family: var(--font-sans);
  font-weight: 500;
}
button.linkedin-btn svg { flex-shrink: 0; }

.harness-tabs .tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
/* Fixed floor so switching tabs (a one-line CLI command vs a multi-line
   JSON/TOML block) doesn't reflow the page under the reader - min-height
   only sets a floor, a snippet taller than this (e.g. wrapped on a very
   narrow screen) still grows the box normally. */
.harness-tabs .code-row pre { min-height: 15rem; }
@media (max-width: 640px) {
  /* Narrower width wraps the URL/header onto more lines, so the tallest
     snippet needs noticeably more room here than on desktop. */
  .harness-tabs .code-row pre { min-height: 21rem; }
}
.harness-tabs .tab-btn {
  margin-top: 0;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.76rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.harness-tabs .tab-btn:hover { opacity: 0.8; }
.harness-tabs .tab-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.code-row { position: relative; }
/* Reserve room on the right so the absolutely-positioned Copy button never
   overlaps the first line of code - matters once long commands wrap onto
   multiple lines on narrow/mobile widths instead of scrolling horizontally. */
.code-row pre { padding-right: 4.5rem; }
.code-row button.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  margin-top: 0;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--error); font-size: 0.88rem; }
.token-box { word-break: break-all; }
.divider { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 1.1rem 0 0.2rem; }

/* --- in-page quick nav (dashboard) ---------------------------------------- */

/* Lives in the center column of .topbar-row (block topbar_center in
   base.html), inline with the brand and the right-side nav - one row,
   truly centered, instead of a second stacked bar under the topbar. */
.quicknav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.quicknav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  transition: opacity 0.15s ease;
}
.quicknav a:hover { color: var(--fg); border-color: var(--accent); }
.quicknav a.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* --- simple prose pages (terms/privacy/faq/docs) --------------------------- */

.prose h2 { margin: 2.5rem 0 0.75rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--fg); font-size: 0.95rem; line-height: 1.65; }
.prose p.muted { color: var(--muted); }
.prose ul { padding-left: 1.2rem; }
.prose .updated { color: var(--muted); font-size: 0.85rem; font-family: var(--font-mono); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 2.5rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--fg); }
footer .links { display: flex; justify-content: center; gap: 1rem; margin-top: 0.6rem; flex-wrap: wrap; }
