/* Tokyo Night defaults; the theme script in <head> overrides these. */
:root {
  --accent: #7aa2f7;
  --selection: #292e42;
  --muted: #414868;
  --background: #1a1b26;
  --dark-background: #13141c;
  --darker-background: #0e0e14;
  --lighter-background: #24283b;
  --foreground: #a9b1d6;
  --dark-foreground: #565f89;
  --bright-foreground: #c0caf5;
  /* Secondary text: dark_foreground is too faint in some themes, so lean it toward foreground. */
  --dim: color-mix(in srgb, var(--dark-foreground) 55%, var(--foreground));
  --red: #f7768e;
  --yellow: #e0af68;
  --orange: #eb927b;
  --green: #9ece6a;
  --cyan: #449dab;
  --blue: #7aa2f7;
  --magenta: #ad8ee6;

  /* Hyprland-ish geometry: gaps_in 5, gaps_out 10, border 2. */
  --gap-in: 10px;
  --gap-out: 10px;
  --border: 2px;
  --bar-h: 30px;
  --font: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-mode="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  font: 14px/1.6 var(--font);
  color: var(--foreground);
  background-color: var(--darker-background);
  /* A quiet "wallpaper" drawn from the theme's own colors. */
  background-image:
    radial-gradient(60vw 50vh at 85% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(50vw 60vh at 5% 95%, color-mix(in srgb, var(--magenta) 14%, transparent), transparent 70%),
    linear-gradient(160deg, var(--background), var(--darker-background));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
b { color: var(--bright-foreground); font-weight: 600; }
em { color: var(--bright-foreground); font-style: italic; }
p { margin: 0 0 .8em; }
pre { margin: 0 0 .8em; font: inherit; white-space: pre; overflow-x: auto; }
h1, h2, h3 { margin: 0; font-size: inherit; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 4px; z-index: 50; background: var(--accent); color: var(--background); padding: 4px 10px; }
.skip:focus { left: 10px; }

.c-accent { color: var(--accent); } .c-muted { color: var(--dim); }
.c-red { color: var(--red); } .c-green { color: var(--green); } .c-yellow { color: var(--yellow); }
.c-orange { color: var(--orange); } .c-blue { color: var(--blue); } .c-cyan { color: var(--cyan); }
.c-magenta { color: var(--magenta); }
.small { font-size: 12.5px; }

/* ── Waybar ─────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 12px;
  background: color-mix(in srgb, var(--darker-background) 92%, transparent);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  color: var(--foreground);
}
.bar button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0 6px; height: var(--bar-h); cursor: pointer;
}
.bar button:hover { color: var(--accent); }
.bar-left, .bar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar-right { justify-content: flex-end; }
.bar-logo { font-weight: 800; color: var(--accent) !important; letter-spacing: -.02em; }
.workspaces { display: flex; }
.workspaces a {
  display: grid; place-items: center; min-width: 24px; height: var(--bar-h);
  color: var(--dim); text-decoration: none; position: relative;
}
.workspaces a:hover { color: var(--foreground); }
.workspaces a[aria-current="page"] { color: var(--bright-foreground); font-weight: 800; }
.workspaces a[aria-current="page"]::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 4px; height: 2px; background: var(--accent);
}
.ws-name { color: var(--dim); padding-left: 6px; }
.clock { color: var(--bright-foreground); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--green); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.bar-theme { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.swatch {
  width: 12px; height: 12px; border: 1px solid var(--muted);
  background: conic-gradient(var(--accent) 0 25%, var(--magenta) 0 50%, var(--green) 0 75%, var(--yellow) 0);
}

/* ── Desktop & workspaces ───────────────────────────── */
.desktop { position: relative; }
.ws { padding: var(--gap-out); }
.tile { display: grid; gap: var(--gap-in); }

.js .desktop { height: calc(100dvh - var(--bar-h)); overflow: hidden; }
.js .ws {
  position: absolute; inset: 0;
  transform: translateX(var(--from, 100%)); visibility: hidden;
  transition: transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s .45s;
}
.js .ws.active { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.22, 1, .36, 1); }
.js .ws.before { --from: -100%; }
.js .tile { height: 100%; }

/* Window */
.win {
  min-width: 0; min-height: 0; overflow: auto;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--background) 94%, transparent);
  border: var(--border) solid var(--muted);
  transition: border-color .15s;
  scrollbar-width: thin; scrollbar-color: var(--muted) transparent;
}
.win:hover, .win:focus-within, .win.focused { border-color: var(--accent); }
.prompt { color: var(--foreground); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-path { color: var(--cyan); font-weight: 600; }
.p-arrow { color: var(--green); }

/* Layouts (dwindle-like on wide screens) */
.layout-home { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.layout-home .win-fetch { grid-row: 1 / 3; }
.layout-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.layout-work { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); }
.layout-work .win-log { grid-row: 1 / 3; }
.layout-stack { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.layout-contact { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: minmax(0, 1fr) auto; }
.layout-contact .win-compose { grid-column: 2; grid-row: 1 / 3; }

/* fastfetch */
.fetch { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.avatar {
  width: 210px; height: auto; aspect-ratio: 1; object-fit: cover;
  border: var(--border) solid var(--accent);
  filter: saturate(.95);
}
.fetch-info { margin: 0; flex: 1 1 260px; min-width: 0; }
.fetch-info > div { display: flex; gap: 10px; }
.fetch-info dt { color: var(--accent); font-weight: 600; min-width: 84px; }
.fetch-info dt::after { content: ":"; color: var(--dim); }
.fetch-info dd { margin: 0; color: var(--bright-foreground); min-width: 0; }
.fetch-head { font-weight: 800; color: var(--bright-foreground); }
.fetch-rule { height: 1px; margin: 4px 0 8px; background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 10px); }
.fetch-swatches { margin-top: 14px; gap: 0 !important; }
.fetch-swatches span { width: 26px; height: 14px; }

/* about */
.md-h { color: var(--bright-foreground); font-size: 20px; font-weight: 800; margin-bottom: 10px; letter-spacing: -.01em; }

/* keybindings */
.keys { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 18px; }
.keys li { display: flex; align-items: center; gap: 4px; }
.keys span { color: var(--dim); margin-left: 8px; }
kbd {
  font: inherit; font-size: 12px; min-width: 22px; text-align: center; padding: 0 6px;
  color: var(--bright-foreground); background: var(--lighter-background); border: 1px solid var(--muted); border-bottom-width: 2px;
}

/* projects */
.proj { display: flex; flex-direction: column; }
.proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.proj-head img, .proj-ico { width: 40px; height: 40px; flex: none; }
.proj-ico {
  display: grid; place-items: center; font-size: 22px;
  background: var(--lighter-background); border: 1px solid var(--muted);
}
.proj-ico svg { width: 26px; height: 26px; }
.proj h3 { font-size: 17px; color: var(--bright-foreground); font-weight: 800; }
.proj-meta { margin-top: auto; margin-bottom: 0; padding-top: 8px; display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: var(--dim); }
.proj-meta a { margin-left: auto; }
.lang::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lc); margin-right: 6px; }
.stars { display: inline-flex; align-items: center; gap: 4px; }
.stars svg, .links svg { width: 13px; height: 13px; color: var(--yellow); }

/* git log */
.log { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.log::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--muted); }
.log > li { position: relative; margin-bottom: 18px; }
.log-head { margin: 0 0 2px -18px; }
.ref { color: var(--orange); }
.log h3 { color: var(--bright-foreground); font-size: 15px; font-weight: 800; }
.log-date { color: var(--dim); font-size: 12.5px; margin-bottom: 6px; }
.log ul { margin: 0; padding-left: 0; list-style: none; }
.log ul li { position: relative; padding-left: 16px; margin-bottom: 5px; }
.log ul li::before { content: "+"; position: absolute; left: 0; color: var(--green); }

/* btop highlights */
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.stats li { display: grid; gap: 2px; }
.stat-n { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-l { color: var(--dim); font-size: 12.5px; }
.meter {
  height: 6px; margin-top: 4px;
  background: repeating-linear-gradient(90deg, var(--lighter-background) 0 5px, transparent 5px 7px);
  position: relative;
}
.meter::after {
  content: ""; position: absolute; inset: 0; width: var(--v);
  background: repeating-linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 7px);
}

/* packages */
.pkgs { display: grid; gap: 12px; }
.pkg h3 { color: var(--dim); font-weight: 600; }
.pkg p { margin: 0; color: var(--bright-foreground); word-spacing: .4em; }

/* contact */
.links { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
.links a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; color: var(--foreground); border: 1px solid transparent; }
.links a:hover { text-decoration: none; border-color: var(--muted); background: var(--lighter-background); }
.links svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.links .k { color: var(--blue); }
.links .v { color: var(--green); overflow-wrap: anywhere; }
.copy {
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 12px;
  color: var(--background); background: var(--accent); border: 0;
}
.copy:hover { filter: brightness(1.1); }

/* ── Launcher (Walker) ─────────────────────────────── */
.launcher { position: fixed; inset: 0; z-index: 40; display: grid; justify-items: center; align-items: start; padding-top: 18vh; background: color-mix(in srgb, var(--darker-background) 45%, transparent); }
.launcher[hidden] { display: none; }
.launcher-box { width: min(560px, calc(100vw - 32px)); background: var(--background); border: var(--border) solid var(--accent); box-shadow: 0 20px 60px rgb(0 0 0 / .35); }
.launcher-input {
  width: 100%; font: inherit; font-size: 15px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--muted);
  color: var(--bright-foreground); background: transparent; outline: none;
}
.launcher-input::placeholder { color: var(--dim); }
.launcher-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.launcher-list li { display: flex; gap: 12px; align-items: center; padding: 7px 10px; cursor: pointer; }
.launcher-list li[aria-selected="true"] { background: var(--selection); color: var(--bright-foreground); }
.launcher-list .kind { color: var(--dim); font-size: 12px; margin-left: auto; }
.launcher-list .sw { width: 12px; height: 12px; flex: none; border: 1px solid var(--muted); }

/* ── Notifications (mako) ──────────────────────────── */
.notify { position: fixed; top: calc(var(--bar-h) + 10px); right: 10px; z-index: 30; display: grid; gap: 8px; width: min(340px, calc(100vw - 20px)); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 10px 14px; font-size: 13px;
  background: var(--background); color: var(--foreground); border: var(--border) solid var(--accent);
  animation: toast-in .25s ease-out;
}
.toast b { display: block; }
.toast.out { opacity: 0; transform: translateX(20px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }

/* ── Smaller screens: windows stack and the page scrolls ── */
@media (max-width: 900px), (max-height: 560px) {
  .ws-name, .status { display: none; }
  .js .desktop { height: auto; overflow: visible; }
  .js .ws { position: static; transform: none; transition: none; display: none; }
  .js .ws.active { display: block; }
  .js .tile { height: auto; }
  .tile { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; grid-auto-rows: auto !important; }
  .tile > .win { grid-row: auto !important; overflow: visible; }
  .bar { grid-template-columns: 1fr auto; }
  .bar-center { display: none; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  .layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  body { font-size: 13.5px; }
  .avatar { width: 140px; }
  .fetch { gap: 16px; }
  .fetch-info dt { min-width: 74px; }
  .theme-name { display: none; }
  .win { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Project screenshots fill the space under the description. */
.shot {
  flex: 1 1 0; min-height: 90px; width: 100%; object-fit: cover; object-position: top center;
  border: 1px solid var(--muted); background: var(--darker-background); margin-top: 4px;
}
.shot.contain { object-fit: contain; object-position: center; }

/* Short windows keep the prompt on top and center the output below it. */
.win.center { display: flex; flex-direction: column; }
.win.center > .prompt + * { margin-top: auto; }
.win.center > :last-child { margin-bottom: auto; }

@media (min-width: 901px) and (min-height: 561px) {
  body { font-size: clamp(14px, .5vw + 7.5px, 16px); }
  .avatar { width: clamp(210px, 17vw, 300px); }
}
@media (max-width: 900px) {
  .notify { top: auto; bottom: 10px; }
  .shot { flex: none; aspect-ratio: 16 / 9; height: auto; }
}

.copy { align-self: flex-start; }
.win-fetch .avatar { width: clamp(210px, 36vh, 340px); }

/* aerc-style compose */
.win-compose { display: flex; flex-direction: column; }
.compose { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.field { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--muted); padding: 4px 0; }
.field span { color: var(--accent); font-weight: 600; min-width: 64px; }
.compose input, .compose textarea {
  font: inherit; color: var(--bright-foreground); background: transparent; border: 0; outline: none; flex: 1; min-width: 0; padding: 4px 0;
}
.compose input::placeholder, .compose textarea::placeholder { color: var(--dim); }
.compose input[readonly] { color: var(--dim); }
.compose .body { flex: 1; display: flex; margin-top: 8px; min-height: 160px; }
.compose textarea { resize: none; padding: 8px 10px; background: color-mix(in srgb, var(--darker-background) 50%, transparent); border: 1px solid var(--muted); }
.compose textarea:focus, .field:focus-within { border-color: var(--accent); }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }

pre.tree, pre.toml, pre.curl { line-height: 1.4; }
