/* ── Theme tokens ─────────────────────────────────────────── */
:root {
  --bg: #0e1012;
  --fg: #c9d1d9;
  --muted: #6b7380;
  --faint: #2a2f36;
  --accent: #7ee787;   /* prompt / clock */
  --key: #79c0ff;      /* [k] brackets */
  --hl: #e3b341;       /* matches while typing */
  --sel: rgba(121, 192, 255, 0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4ef;
    --fg: #24292f;
    --muted: #868c95;
    --faint: #dcdad2;
    --accent: #1a7f37;
    --key: #0969da;
    --hl: #9a6700;
    --sel: rgba(9, 105, 218, 0.1);
  }
}

:root[data-theme="light"] {
  --bg: #f5f4ef;
  --fg: #24292f;
  --muted: #868c95;
  --faint: #dcdad2;
  --accent: #1a7f37;
  --key: #0969da;
  --hl: #9a6700;
  --sel: rgba(9, 105, 218, 0.1);
}

/* ── Base ─────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.7 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 48px 16px;
}

::selection { background: var(--sel); }

a { color: inherit; text-decoration: none; }

.muted { color: var(--muted); }

/* ── Terminal column ──────────────────────────────────────── */
.term {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ps1 { color: var(--accent); white-space: nowrap; }
.ps1 .path { color: var(--key); }

.cmd { color: var(--fg); }

.out { padding-left: 2ch; }

/* now */
.now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 3ch;
  row-gap: 4px;
  margin-top: 6px;
}

.clock {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.clock .ampm { font-size: 0.4em; font-weight: 400; color: var(--muted); margin-left: 0.4ch; }

.date, .weather { white-space: nowrap; }
.weather .hl { color: var(--fg); }

.greeting { color: var(--muted); }

/* links */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px 24px;
  margin-top: 6px;
}

.group-name { color: var(--muted); margin-bottom: 2px; }

.link {
  display: block;
  width: fit-content;
  padding: 0 1ch 0 0;
  border-radius: 3px;
  transition: color 0.12s, opacity 0.12s, background-color 0.12s;
}
.link .key { color: var(--key); }
.link:hover, .link:focus-visible { background: var(--sel); outline: none; }

.links.filtering .link { opacity: 0.35; }
.links.filtering .link.match { opacity: 1; color: var(--hl); }

/* output (help, messages) */
#output .out { white-space: pre-wrap; }
#output .row { display: flex; gap: 2ch; }
#output .row > :first-child { color: var(--key); min-width: 12ch; }
#output .err { color: var(--hl); }

/* prompt */
.prompt {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  padding-top: 4px;
}

#q {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font: inherit;
  caret-color: var(--accent);
  caret-shape: block;
}
#q::placeholder { color: var(--muted); opacity: 0.8; }

/* corner theme toggle */
.corner {
  position: fixed;
  top: 16px;
  right: 16px;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.corner:hover, .corner:focus-visible { color: var(--fg); outline: none; }

/* small screens */
@media (max-width: 520px) {
  body { font-size: 14px; place-items: start center; padding-top: 64px; }
  .term { gap: 22px; }
  .links { grid-template-columns: repeat(2, 1fr); }
  .prompt { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
