/* ==========================================================================
   timofejevs.dev
   Every component reads the tokens below. Each theme only redefines tokens.
   Themes marked (Auto) switch between a light and a dark variant with the OS.
   ========================================================================== */

:root {
  --font-heading: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --measure: 46rem;
  --gutter: 1rem;
  --radius: 8px;
  --glow: none;
  --glow-strong: none;
}

/* --- Kanagawa (Auto): Lotus light / Wave dark --------------------------- */
:root,
:root[data-theme="kanagawa"] {
  color-scheme: light;
  --bg: #f2ecbc;
  --band: #e5ddb0;
  --surface: #ebe4b6;
  --fg: #545464;
  --muted: #6d6a5c;
  --heading: #8a3f5f;
  --accent: #4d699b;
  --accent-2: #c84053;
  --border: #d5cea3;
  --chip-bg: #e4d794;
  --chip-fg: #545464;
  --on-accent: #f2ecbc;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme="kanagawa"] {
    color-scheme: dark;
    --bg: #1f1f28;
    --band: #2a2a37;
    --surface: #252531;
    --fg: #dcd7ba;
    --muted: #a6a08a;
    --heading: #957fb8;
    --accent: #7e9cd8;
    --accent-2: #d27e99;
    --border: #3c3c50;
    --chip-bg: #363646;
    --chip-fg: #98bb6c;
    --on-accent: #1f1f28;
  }
}

/* --- Catppuccin (Auto): Latte / Mocha ----------------------------------- */
:root[data-theme="catppuccin"] {
  color-scheme: light;
  --bg: #eff1f5;
  --band: #e6e9ef;
  --surface: #e6e9ef;
  --fg: #4c4f69;
  --muted: #5c5f77;
  --heading: #8839ef;
  --accent: #1e66f5;
  --accent-2: #ea76cb;
  --border: #ccd0da;
  --chip-bg: #dce0e8;
  --chip-fg: #1e66f5;
  --on-accent: #eff1f5;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="catppuccin"] {
    color-scheme: dark;
    --bg: #1e1e2e;
    --band: #181825;
    --surface: #242436;
    --fg: #cdd6f4;
    --muted: #a6adc8;
    --heading: #cba6f7;
    --accent: #89b4fa;
    --accent-2: #f5c2e7;
    --border: #313244;
    --chip-bg: #313244;
    --chip-fg: #a6e3a1;
    --on-accent: #1e1e2e;
  }
}

/* --- Gruvbox (Auto) ----------------------------------------------------- */
:root[data-theme="gruvbox"] {
  color-scheme: light;
  --bg: #fbf1c7;
  --band: #ebdbb2;
  --surface: #f2e5bc;
  --fg: #3c3836;
  --muted: #665c54;
  --heading: #9d0006;
  --accent: #076678;
  --accent-2: #af3a03;
  --border: #d5c4a1;
  --chip-bg: #ebdbb2;
  --chip-fg: #79740e;
  --on-accent: #fbf1c7;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="gruvbox"] {
    color-scheme: dark;
    --bg: #282828;
    --band: #1d2021;
    --surface: #32302f;
    --fg: #ebdbb2;
    --muted: #a89984;
    --heading: #fe8019;
    --accent: #83a598;
    --accent-2: #fabd2f;
    --border: #504945;
    --chip-bg: #3c3836;
    --chip-fg: #b8bb26;
    --on-accent: #282828;
  }
}

/* --- Rosé Pine (Auto): Dawn / Main -------------------------------------- */
:root[data-theme="rose-pine"] {
  color-scheme: light;
  --bg: #faf4ed;
  --band: #f2e9e1;
  --surface: #fffaf3;
  --fg: #575279;
  --muted: #797593;
  --heading: #b4637a;
  --accent: #286983;
  --accent-2: #d7827e;
  --border: #dfdad9;
  --chip-bg: #f2e9e1;
  --chip-fg: #b4637a;
  --on-accent: #faf4ed;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="rose-pine"] {
    color-scheme: dark;
    --bg: #191724;
    --band: #1f1d2e;
    --surface: #1f1d2e;
    --fg: #e0def4;
    --muted: #908caa;
    --heading: #ebbcba;
    --accent: #9ccfd8;
    --accent-2: #c4a7e7;
    --border: #403d52;
    --chip-bg: #26233a;
    --chip-fg: #f6c177;
    --on-accent: #191724;
  }
}

/* --- Tokyo Night -------------------------------------------------------- */
:root[data-theme="tokyo-night"] {
  color-scheme: dark;
  --bg: #1a1b26;
  --band: #16161e;
  --surface: #1f2335;
  --fg: #c0caf5;
  --muted: #9aa5ce;
  --heading: #bb9af7;
  --accent: #7aa2f7;
  --accent-2: #7dcfff;
  --border: #2f334d;
  --chip-bg: #292e42;
  --chip-fg: #9ece6a;
  --on-accent: #1a1b26;
}

/* --- Nord --------------------------------------------------------------- */
:root[data-theme="nord"] {
  color-scheme: dark;
  --bg: #2e3440;
  --band: #3b4252;
  --surface: #353c4a;
  --fg: #eceff4;
  --muted: #b8c0cf;
  --heading: #8fbcbb;
  --accent: #88c0d0;
  --accent-2: #b48ead;
  --border: #4c566a;
  --chip-bg: #434c5e;
  --chip-fg: #a3be8c;
  --on-accent: #2e3440;
}

/* --- Amber CRT ---------------------------------------------------------- */
:root[data-theme="amber"] {
  color-scheme: dark;
  --font-heading: var(--font-mono);
  --bg: #100800;
  --band: #1a0f02;
  --surface: #170d01;
  --fg: #ffc86b;
  --muted: #c99347;
  --heading: #ffd58a;
  --accent: #ffb000;
  --accent-2: #ffd27a;
  --border: #5a3a0d;
  --chip-bg: #2a1905;
  --chip-fg: #ffb000;
  --on-accent: #120900;
  --glow: 0 0 0.35rem rgb(255 176 0 / 0.35);
  --glow-strong: 0 0 0.25rem rgb(255 210 130 / 0.7), 0 0 0.9rem rgb(255 176 0 / 0.45);
}

/* --- Paper -------------------------------------------------------------- */
:root[data-theme="paper"] {
  color-scheme: light;
  --bg: #fbfbf8;
  --band: #efefea;
  --surface: #f4f4f0;
  --fg: #1a1a1a;
  --muted: #555550;
  --heading: #000000;
  --accent: #1a1a1a;
  --accent-2: #555550;
  --border: #d4d4cc;
  --chip-bg: #e8e8e2;
  --chip-fg: #1a1a1a;
  --on-accent: #fbfbf8;
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  text-shadow: var(--glow);
}

.wrap {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--accent-2);
  text-decoration-color: currentColor;
  text-shadow: var(--glow-strong);
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.25;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.1rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--chip-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent-2);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: var(--gutter);
}

/* ==========================================================================
   Header band
   ========================================================================== */

.site-header {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--band)), var(--band));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0.4rem 1.5rem color-mix(in srgb, var(--fg) 7%, transparent);
  margin-bottom: 2.5rem;
}

.header-inner {
  padding-block: 1.25rem 1rem;
}

.identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
  width: fit-content;
}

.identity:hover {
  color: inherit;
  text-shadow: none;
}

.identity-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-name {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.2;
  margin: 0;
  text-shadow: var(--glow-strong);
}

.identity:hover .site-name {
  color: var(--accent);
}

.tagline {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 0.15rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.site-nav a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  padding: 0.25rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.site-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  text-shadow: none;
  box-shadow: var(--glow);
}

/* ==========================================================================
   Desktop shell: the header becomes a sticky left rail beside the content
   ========================================================================== */

/* The rail's copy of the contact links and theme picker only shows on desktop. */
.rail-tools {
  display: none;
}

@media (min-width: 64rem) {
  :root {
    --rail-w: 17rem;
    --rail-gap: 2rem;
    --content-w: calc(var(--measure) + 2 * var(--gutter));
  }

  .site-shell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, var(--content-w));
    justify-content: center;
    align-items: start;
    column-gap: var(--rail-gap);
    padding-inline: var(--gutter);
  }

  /* Footer text lines up with the content column. */
  .site-footer .wrap {
    max-width: calc(var(--rail-w) + var(--rail-gap) + var(--content-w) + 2 * var(--gutter));
    padding-left: calc(2 * var(--gutter) + var(--rail-w) + var(--rail-gap));
  }

  .site-header {
    position: sticky;
    top: 1.25rem;
    margin: 1.25rem 0 0;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
    border-radius: 12px;
    box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, var(--fg) 8%, transparent);
  }

  .header-inner {
    max-width: none;
    margin: 0;
    padding: 1.5rem 1.25rem;
  }

  .identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .avatar-sm {
    width: 4.5rem;
    height: 4.5rem;
  }

  .site-name {
    font-size: 1.3rem;
  }

  .site-nav {
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1.5rem;
  }

  .site-nav a {
    padding: 0.35rem 0.9rem;
  }

  /* No auto margins: in the grid they would shrink the column to its content. */
  .site-main {
    margin-inline: 0;
    padding-top: 1.25rem;
  }

  .rail-tools {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
  }

  .rail-tools .tools {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .rail-tools .badge-btn {
    font-size: 0.72rem;
    padding: 0.35rem 0.7rem;
  }

  .js .rail-tools .theme-picker {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
  }

  .site-footer .tools {
    display: none;
  }
}

/* Wide screens: a wider content column so cards can sit two-up, while running
   text stays at a comfortable reading width. */
@media (min-width: 80rem) {
  :root {
    --content-w: calc(58rem + 2 * var(--gutter));
  }

  /* Faintly shaded margins so the space around the layout reads as framing. */
  body {
    --edge: color-mix(in srgb, var(--band) 65%, var(--bg));
    background: linear-gradient(90deg, var(--edge), var(--bg) calc(50% - 44rem),
      var(--bg) calc(50% + 44rem), var(--edge));
  }

  .site-main {
    max-width: none;
  }

  .about-text,
  .page-header .lede,
  .page-body {
    max-width: var(--measure);
  }

  .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Odd number of cards (more than one): centre the last one under the pair. */
  .project-list > li:last-child:nth-child(odd):not(:first-child) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc((100% - 0.9rem) / 2);
  }

  .oss-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
  }

  /* Two rows per line: the second row also starts the list, and the
     second-last (left column of the last line) also ends it. */
  .oss-row:nth-child(2) {
    padding-top: 0;
    border-top: 0;
  }

  .oss-row:nth-last-child(2):nth-child(odd) {
    padding-bottom: 0;
  }

  /* Odd number of rows (more than one): the last row spans the card so its
     divider runs full width, and its content is centred at one column's width. */
  .oss-row:last-child:nth-child(odd):not(:first-child) {
    grid-column: 1 / -1;
    padding-inline: calc(25% + 0.5rem);
  }
}

@media (min-width: 100rem) {
  html {
    font-size: 106.25%;
  }
}

/* ==========================================================================
   Avatar
   ========================================================================== */

.avatar {
  display: block;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--chip-bg);
  color: var(--accent);
}

.avatar-sm {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 10px;
  border: 2px solid var(--accent);
  box-shadow: var(--glow);
}

.portrait {
  position: relative;
  margin: 0;
  padding: 0.35rem;
  width: 10rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    inset 0 0 1rem color-mix(in srgb, var(--accent) 8%, transparent),
    0 0.5rem 1.5rem color-mix(in srgb, var(--fg) 10%, transparent);
}

.avatar-lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
}

/* ==========================================================================
   Home sections
   ========================================================================== */

.section {
  margin-bottom: 3rem;
}

.section > h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.section > h2::before {
  content: "#";
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent-2);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.75rem;
  align-items: start;
}

.about-text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 38rem) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    order: -1;
    width: 8rem;
  }
}

/* Cards (projects, open source, expertise) */
.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.9rem;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card > :last-child {
  margin-bottom: 0;
}

.card-project:hover,
.card-project:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  border-left-color: var(--accent-2);
  box-shadow: 0 0.5rem 1.25rem color-mix(in srgb, var(--fg) 10%, transparent), var(--glow);
}

.card-oss {
  border-left-color: var(--accent-2);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
}

.card-title a {
  color: var(--heading);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--accent);
}

/* Makes the whole project card clickable while keeping one real link. */
.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

/* Open source: "Other contributions" heading and the single card listing them */
.subsection-title {
  margin: 2rem 0 0.75rem;
  font-size: 1rem;
}

.card-oss-list {
  padding: 0.85rem 1.15rem;
}

.oss-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.oss-row {
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.oss-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.oss-row:last-child {
  padding-bottom: 0;
}

.oss-row .card-head {
  margin-bottom: 0.2rem;
}

.oss-row .card-title {
  font-size: 0.98rem;
}

.oss-row .pill {
  font-size: 0.62rem;
}

.oss-row .tags {
  margin-top: 0.15rem;
}

.oss-row .tags li {
  font-size: 0.7rem;
}

.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  white-space: nowrap;
}

.pill-accent {
  color: var(--on-accent);
  background: var(--accent-2);
  border-color: var(--accent-2);
  text-shadow: none;
}

.tags {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tags li {
  font-size: 0.75rem;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: 4px;
  padding: 0.05rem 0.5rem;
}

/* External links in open-source cards: title and stat chip */
.ext-arrow {
  display: inline-block;
  margin-left: 0.3em;
  font-size: 0.8em;
  transition: transform 0.15s ease;
}

.card-title a.ext {
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.25em;
}

.card-title a.ext .ext-arrow {
  color: var(--accent);
}

.card-title a.ext:hover {
  color: var(--accent);
  text-decoration-style: solid;
  text-decoration-color: currentColor;
}

.card-title a.ext:hover .ext-arrow,
.pill-link:hover .ext-arrow,
.pill-link:focus-visible .ext-arrow {
  transform: translate(2px, -2px);
}

.pill-link {
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--fg) 25%, transparent);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.pill-link .ext-arrow {
  margin-left: 0.35em;
}

.pill-link:hover,
.pill-link:focus-visible {
  color: var(--on-accent);
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2), var(--glow);
  text-shadow: none;
}

/* ==========================================================================
   Pages
   ========================================================================== */

.page-header {
  margin-bottom: 2rem;
}

.back-link {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.back-link:hover {
  color: var(--accent);
}

.page-header h1 {
  text-shadow: var(--glow-strong);
}

.page-header .lede {
  color: var(--muted);
  margin-top: 0.25rem;
}

.project-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.88rem;
}

.project-meta div {
  display: contents;
}

.project-meta dt {
  color: var(--muted);
}

.project-meta dd {
  margin: 0;
}

.page-body h2 {
  margin-top: 2.25rem;
}

.page-body h3 {
  margin-top: 1.5rem;
}

.page-body ul {
  padding-left: 1.25rem;
}

.page-body li {
  margin-bottom: 0.45rem;
}

.page-body li::marker {
  color: var(--accent-2);
}

/* Experience: expertise card + timeline */
.expertise {
  margin-bottom: 2.5rem;
}

.expertise h2 {
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

.skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0;
  font-size: 0.88rem;
}

.skills .skill {
  display: contents;
}

.skills dt {
  font-weight: 600;
  color: var(--heading);
}

.skills dd {
  margin: 0;
}

@media (max-width: 34rem) {
  .skills {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .skills dd {
    margin-bottom: 0.6rem;
  }
}

/* Wide screens: groups side by side, label above its items. */
@media (min-width: 80rem) {
  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 2.5rem;
  }

  .skills .skill {
    display: block;
  }

  .skills dt {
    margin-bottom: 0.15rem;
  }
}

.timeline {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
  margin-left: 0.4rem;
}

.timeline h2 {
  position: relative;
  margin-top: 2.5rem;
  margin-bottom: 0.25rem;
}

.timeline h2:first-child {
  margin-top: 0;
}

.timeline h2::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 1px - 0.45rem);
  top: 0.35em;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: var(--glow);
}

.role {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 4rem;
  padding-block: 1.5rem 2rem;
  background: var(--band);
  border-top: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  font-size: 0.85rem;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.contact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--border);
  transition: transform 0.12s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.badge-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 0 var(--accent), var(--glow);
  transform: translateY(-1px);
}

.icon {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  color: var(--muted);
}

.theme-picker {
  display: none;
  align-items: center;
  gap: 0.6rem;
}

.js .theme-picker {
  display: inline-flex;
}

.theme-picker select {
  font: inherit;
  font-size: 0.8rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.theme-picker select:hover {
  border-color: var(--accent);
}

.copyright {
  margin: 0;
}

/* ==========================================================================
   Amber CRT extras: scanlines and vignette over the whole page
   ========================================================================== */

:root[data-theme="amber"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 0.45) 100%);
}

:root[data-theme="amber"] .avatar {
  filter: sepia(0.6) saturate(1.3) hue-rotate(-8deg) brightness(0.95);
}

:root[data-theme="amber"] .avatar-placeholder {
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .card-project:hover,
  .card-project:focus-within,
  .badge-btn:hover {
    transform: none;
  }
}
