/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --color-bg: #eef1fa;
  --color-bg-elevated: rgba(255, 255, 255, 0.72);
  --color-bg-solid: #ffffff;
  --color-border: rgba(26, 29, 35, 0.08);
  --color-text: #1a1d23;
  --color-text-muted: #5b6270;
  --color-placeholder-pattern: #d1d5db;

  /* Primary accent: links, CTAs, focus states */
  --color-accent: #4f46e5;
  --color-accent-2: #7c3aed;
  --color-accent-muted: rgba(79, 70, 229, 0.1);

  /* Category accents: focus areas, project tags, skill groups */
  --color-cat-soc: #2563eb;
  --color-cat-offsec: #e11d48;
  --color-cat-cloud: #d97706;
  --color-cat-general: #0d9488;

  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Geist Mono", ui-monospace, monospace;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  --max-width: 64rem;
  --radius: 1rem;
  --shadow-sm: 0 1px 2px rgba(23, 24, 45, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(23, 24, 45, 0.08), 0 2px 6px rgba(23, 24, 45, 0.04);
  --shadow-lg: 0 20px 40px -8px rgba(23, 24, 45, 0.14), 0 4px 10px rgba(23, 24, 45, 0.05);

  /* Body background color washes (overridden per theme) */
  --wash-1: rgba(8, 145, 178, 0.12);
  --wash-2: rgba(124, 58, 237, 0.10);
  --wash-3: rgba(22, 163, 74, 0.07);

  /* Interactive dot background color, as an r,g,b triplet (read by JS) */
  --color-dot-rgb: 91, 98, 112;
}

/* ==========================================================================
   Dark theme
   ========================================================================== */
:root[data-theme="dark"] {
  --color-bg: #101218;
  --color-bg-elevated: rgba(30, 33, 42, 0.72);
  --color-bg-solid: #1a1d26;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-text: #e8eaf0;
  --color-text-muted: #9aa1b0;
  --color-placeholder-pattern: #363a48;

  --color-accent: #818cf8;
  --color-accent-2: #a78bfa;
  --color-accent-muted: rgba(129, 140, 248, 0.16);

  --color-cat-soc: #60a5fa;
  --color-cat-offsec: #fb7185;
  --color-cat-cloud: #fbbf24;
  --color-cat-general: #2dd4bf;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);

  --wash-1: rgba(95, 215, 255, 0.09);
  --wash-2: rgba(179, 140, 255, 0.11);
  --wash-3: rgba(135, 232, 160, 0.06);

  --color-dot-rgb: 138, 145, 165;
}

/* ==========================================================================
   Base
   ========================================================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(ellipse 900px 600px at 8% -5%, var(--wash-1), transparent 60%),
    radial-gradient(ellipse 800px 600px at 95% 10%, var(--wash-2), transparent 60%),
    radial-gradient(ellipse 900px 700px at 50% 100%, var(--wash-3), transparent 60%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

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

p {
  margin: 0;
}

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

img {
  max-width: 100%;
  display: block;
}

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

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

.main {
  flex: 1;
  width: 100%;
}

.main:not(.contained) {
  display: flex;
  flex-direction: column;
}

.main.contained {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 3rem 1rem;
  width: 100%;
}

.mono {
  font-family: var(--font-mono);
}

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

.max-prose {
  max-width: 68ch;
}

.mx-auto {
  margin-inline: auto;
}

.section {
  padding: 4rem 0;
}

.section-sm {
  padding: 2rem 0;
}

/* ==========================================================================
   Interactive dot background
   ========================================================================== */
#dot-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-footer .container {
  padding-block: 1.5rem;
  text-align: center;
}

.site-footer p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   Scroll to top
   ========================================================================== */
#scroll-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 0.75rem;
  z-index: 50;
  height: 3.5rem;
  width: 3.5rem;
  display: none;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-solid);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-accent);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

#scroll-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero .container {
  padding-block: 5rem;
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .hero .container {
    grid-template-columns: 1fr 1fr;
  }
}

.hero-eyebrow {
  color: var(--color-accent);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
  background: linear-gradient(135deg, var(--color-text) 40%, var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 3.25rem;
  }
}

.hero-role {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  height: 1.75rem;
}

.cursor {
  color: var(--color-accent);
}

.cursor.hidden {
  visibility: hidden;
}

.hero-lede {
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-bottom: 2rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-photo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-photo {
  width: 100%;
  max-width: 20rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--color-bg-solid);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Focus areas / cards grid
   ========================================================================== */
.grid-3 {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-icon {
  height: 2rem;
  width: 2rem;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Project cards
   ========================================================================== */
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.projects-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.project-card {
  display: block;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

a.project-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

a.project-card:hover .project-card-img {
  transform: scale(1.05);
}

.project-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--color-bg);
}

.project-card-img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.project-card-placeholder {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: repeating-linear-gradient(
    135deg,
    var(--color-placeholder-pattern) 0px,
    var(--color-placeholder-pattern) 1px,
    transparent 1px,
    transparent 12px
  );
}

.project-card-placeholder svg {
  height: 2.5rem;
  width: 2.5rem;
  opacity: 0.6;
  stroke: var(--color-text-muted);
}

.project-card-year {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--color-bg-solid) 90%, transparent);
  padding: 0.125rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-accent);
  backdrop-filter: blur(4px);
}

.project-card-body {
  padding: 1.25rem;
}

.project-card-body h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.project-card-body p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

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

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
}

.tag-soc { color: var(--color-cat-soc); background: color-mix(in srgb, var(--color-cat-soc) 12%, transparent); }
.tag-offsec { color: var(--color-cat-offsec); background: color-mix(in srgb, var(--color-cat-offsec) 12%, transparent); }
.tag-cloud { color: var(--color-cat-cloud); background: color-mix(in srgb, var(--color-cat-cloud) 12%, transparent); }
.tag-general { color: var(--color-cat-general); background: color-mix(in srgb, var(--color-cat-general) 12%, transparent); }

/* ==========================================================================
   Tech marquee
   ========================================================================== */
.marquee-section {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-block: 1.1rem;
  overflow: hidden;
}

.marquee-track {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

.marquee-track span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-inline: 0.85rem;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ==========================================================================
   CTA band
   ========================================================================== */
.cta-band {
  text-align: center;
  padding-block: 5rem;
}

.cta-band h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .cta-band h2 {
    font-size: 2rem;
  }
}

.cta-band p {
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-inline: auto;
  margin-bottom: 2rem;
}

/* ==========================================================================
   About page
   ========================================================================== */
.about-header {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .about-header {
    flex-direction: row;
  }
}

.about-photo {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-bg-solid);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.about-section {
  margin-bottom: 3rem;
}

.about-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.about-section p {
  margin-bottom: 1rem;
}

.timeline-card,
.job-card,
.skill-card {
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.job-card + .job-card,
.timeline-card + .timeline-card {
  margin-top: 1rem;
}

.job-card-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.job-card-row p {
  font-weight: 600;
  margin: 0;
}

.job-card-period {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.job-card-location {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.job-card ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.job-card li + li {
  margin-top: 0.25rem;
}

.skills-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skill-card {
  border-left-width: 4px;
  border-left-style: solid;
}

.skill-card .skill-category {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.skill-card .skill-level {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.skill-card .skill-items {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Contact page
   ========================================================================== */
.contact-list {
  display: grid;
  gap: 1rem;
  max-width: 24rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.contact-list li {
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.contact-list li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Article content (project / blog detail pages)
   ========================================================================== */
.article {
  max-width: 44rem;
  margin-inline: auto;
}

.article h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.article h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article h4 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article p {
  margin-bottom: 1rem;
}

.article ul,
.article ol {
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

.article li {
  margin-bottom: 0.5rem;
}

.article img {
  border-radius: 0.5rem;
  margin-block: 1.5rem;
}

.article blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.article a {
  text-decoration: underline;
}

.article-meta {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Terminal ("homelab TUI") look
   The tmux-style nav bar (.tui-bar) is used on every page and is always dark,
   regardless of theme. The rest of this section is the home page dashboard,
   scoped to <html class="tui">; the home page is dark-only with no toggle.
   ========================================================================== */
:root {
  --tui-bg: #0a0e13;
  --tui-panel: rgba(13, 18, 25, 0.88);
  --tui-panel-solid: #0d1219;
  --tui-bar: #131b25;
  --tui-line: #2b3a4a;
  --tui-text: #cfd8e3;
  --tui-text-bright: #f2f6fa;
  --tui-muted: #7d8da0;
  --tui-cyan: #5fd7ff;
  --tui-violet: #b38cff;
  --tui-orange: #ffaf5f;
  --tui-green: #87e8a0;
  --tui-pink: #ff7fa8;

  --tui-font: var(--font-mono);
  --tui-font-prose: var(--font-sans);
}

:root.tui {
  --color-dot-rgb: 95, 215, 255;
  --color-accent: var(--tui-cyan);
  color-scheme: dark;
}

.tui body {
  background-color: var(--tui-bg);
  color: var(--tui-text);
  font-family: var(--tui-font);
  font-size: 0.875rem;
}

.tui-container {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* tmux-style window bar (site-wide nav) */
.tui-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--tui-bar);
  border-bottom: 1px solid var(--tui-line);
}

.tui-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  padding-block: 0.5rem;
  font-family: var(--tui-font);
  font-size: 0.875rem;
  line-height: 1.6;
}

.tui-session {
  color: var(--tui-green);
  text-decoration: none;
  font-weight: 500;
}

.tui-windows {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tui-windows a {
  display: block;
  padding: 0.125rem 0.5rem;
  color: var(--tui-muted);
  text-decoration: none;
}

.tui-windows a:hover {
  color: var(--tui-text-bright);
  background: rgba(95, 215, 255, 0.1);
}

.tui-windows a[aria-current="page"] {
  color: var(--tui-bg);
  background: var(--tui-green);
}

.tui-win-num {
  color: var(--tui-orange);
}

.tui-windows a[aria-current="page"] .tui-win-num {
  color: inherit;
}

.tui-clock {
  margin-left: auto;
  color: var(--tui-muted);
  font-variant-numeric: tabular-nums;
}

.tui-theme {
  font: inherit;
  color: var(--tui-muted);
  background: none;
  border: 0;
  padding: 0.125rem 0.25rem;
  cursor: pointer;
}

.tui-theme:hover {
  color: var(--tui-text-bright);
}

.tui-theme-name {
  color: var(--tui-orange);
}

.tui-theme-name::after {
  content: "light";
}

:root[data-theme="dark"] .tui-theme-name::after {
  content: "dark";
}

.tui-bar :focus-visible {
  outline: 2px solid var(--tui-cyan);
  outline-offset: 1px;
}

/* Phones: session + theme on row one, windows on one scrollable row, no clock */
@media (max-width: 640px) {
  .tui-clock {
    display: none;
  }

  .tui-theme {
    margin-left: auto;
  }

  .tui-windows {
    order: 1;
    flex-basis: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tui-bar-inner {
    font-size: 0.8125rem;
  }

  .tui-windows {
    gap: 0;
  }

  .tui-windows a {
    padding-inline: 0.3rem;
    white-space: nowrap;
  }
}

/* Narrow phones (e.g. 360px Androids): one size down so all 5 windows fit */
@media (max-width: 380px) {
  .tui-bar-inner {
    font-size: 0.75rem;
  }
}

/* Panes */
.tui-grid {
  width: 100%;
  display: grid;
  gap: 1.25rem;
  padding-block: 2rem 2.5rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "who" "fetch" "svc" "proj";
}

@media (min-width: 900px) {
  .tui-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto;
    grid-template-areas: "who fetch" "svc fetch" "proj proj";
    padding-block: 3rem 3.5rem;
  }
}

.pane {
  position: relative;
  border: 1px solid var(--tui-line);
  border-radius: 3px;
  background: var(--tui-panel);
  padding: 1.375rem 1.25rem 1.125rem;
}

.pane-label,
.pane-meta {
  position: absolute;
  top: -0.6rem;
  padding-inline: 0.375rem;
  /* Transparent above the pane border so the page's color wash shows through;
     opaque below it to cut the border line behind the label text */
  background: linear-gradient(transparent calc(50% - 1px), var(--tui-panel-solid) calc(50% - 1px));
  font-size: 0.75rem;
  line-height: 1.1rem;
  color: var(--tui-muted);
}

.pane-label { left: 0.75rem; }
.pane-meta { right: 0.75rem; }
.pane-label b { font-weight: 500; }

.pane-who {
  grid-area: who;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pane-who .pane-label b { color: var(--tui-cyan); }
.pane-fetch { grid-area: fetch; }
.pane-fetch .pane-label b { color: var(--tui-violet); }
.pane-svc {
  grid-area: svc;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pane-svc .pane-label b { color: var(--tui-green); }
.pane-proj { grid-area: proj; }
.pane-proj .pane-label b { color: var(--tui-pink); }

.tui-u { color: var(--tui-green); }
.tui-h { color: var(--tui-violet); }
.tui-p { color: var(--tui-cyan); }
.tui-ok { color: var(--tui-green); }

/* whoami pane */
.tui-prompt {
  color: var(--tui-muted);
  margin-bottom: 0.875rem;
  overflow-wrap: anywhere;
}

.tui .cursor {
  color: var(--tui-cyan);
}

.tui h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.75rem, 7.5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  /* A monospace space is a full character wide; tighten the gap between words */
  word-spacing: -0.3em;
  color: var(--tui-text-bright);
  min-height: 1.02em;
}

.tui-role {
  margin: 0.75rem 0 1.125rem;
  color: var(--tui-cyan);
  font-size: 1rem;
  min-height: 1.6em;
}

.tui-block-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -3px;
  background: var(--tui-cyan);
  animation: tui-blink 1s steps(1) infinite;
}

.tui-bio {
  font-family: var(--tui-font-prose);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 56ch;
}

.tui kbd {
  font: inherit;
  color: var(--tui-bg);
  background: var(--tui-orange);
  padding: 0.0625rem 0.375rem;
  border-radius: 2px;
}

/* neofetch pane */
#ascii-photo {
  display: block;
  width: 100%;
  max-width: 19rem;
  aspect-ratio: 796 / 825;
  margin-inline: auto;
}

/* Two-column layout: a smaller portrait keeps the neofetch pane from
   stretching the whoami pane with empty space */
@media (min-width: 900px) {
  #ascii-photo {
    max-width: 15rem;
  }
}

#ascii-photo {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hint-tap {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .hint-hover { display: none; }
  .hint-tap { display: inline; }
}

.tui-fetch {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.125rem 1rem;
  margin: 1rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.tui-fetch dt {
  color: var(--tui-cyan);
}

.tui-fetch dd {
  margin: 0;
}

/* services pane */
.tui-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 0.375rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.tui-services {
  /* Fixed to the tallest group (3 rows at 2 columns) so switching tabs doesn't shift the layout */
  min-height: calc(3 * 1.3rem + 2 * 0.375rem);
  align-content: start;
}

.tui-services[hidden] {
  display: none;
}

.pane-tabs {
  display: flex;
  gap: 0.25rem;
  padding-inline: 0.25rem;
}

.pane-tabs button {
  font: inherit;
  color: var(--tui-muted);
  background: none;
  border: 0;
  padding: 0 0.125rem;
  cursor: pointer;
}

.pane-tabs button::before { content: "["; visibility: hidden; }
.pane-tabs button::after { content: "]"; visibility: hidden; }

.pane-tabs button:hover {
  color: var(--tui-text-bright);
}

.pane-tabs button[aria-selected="true"] {
  color: var(--tui-green);
}

.pane-tabs button[aria-selected="true"]::before,
.pane-tabs button[aria-selected="true"]::after {
  visibility: visible;
}

.pane-tabs button:focus-visible {
  outline: 1px solid var(--tui-cyan);
  outline-offset: 1px;
}

/* Phones: not enough border for label + tabs, so the tabs become the pane's first row */
@media (max-width: 640px) {
  .pane-tabs {
    position: static;
    background: none;
    padding: 0;
    margin: 0 0 0.75rem -0.125rem;
  }
}

.tui-services li {
  display: grid;
  grid-template-columns: 0.75rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.tui-services i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--tui-green);
}

.tui-services span:last-child {
  color: var(--tui-muted);
  font-size: 0.8125rem;
}

.tui-services .is-learning i {
  background: var(--tui-orange);
}

.tui-services .is-learning span:last-child {
  color: var(--tui-orange);
}

.pane-sub {
  color: var(--tui-orange);
}

/* projects pane */
.tui-table-wrap {
  overflow-x: auto;
}

/* Set by js/home.js when there are more than 5 projects: the wrapper gets a
   max-height of exactly 5 rows and scrolls, with the header row pinned */
.tui-table-wrap.is-scrollable {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tui-line) transparent;
}

.tui-table-wrap.is-scrollable::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.tui-table-wrap.is-scrollable::-webkit-scrollbar-thumb {
  background: var(--tui-line);
  border-radius: 3px;
}

.tui-table-wrap.is-scrollable:hover {
  scrollbar-color: var(--tui-cyan) transparent;
}

.tui-table-wrap.is-scrollable:hover::-webkit-scrollbar-thumb {
  background: var(--tui-cyan);
}

.tui-table-wrap.is-scrollable:focus-visible {
  outline: 1px solid var(--tui-cyan);
  outline-offset: 2px;
}

.tui-table-wrap.is-scrollable th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.tui-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.tui-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--tui-bg);
  background: var(--tui-cyan);
  padding: 0.1875rem 0.75rem;
}

.tui-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--tui-muted);
}

/* One line per row, like real `ps` output: on phones the table scrolls
   sideways instead of breaking a command mid-flag or wrapping tags */
.tui-table td {
  white-space: nowrap;
}

.tui-table tbody tr:hover {
  background: rgba(179, 140, 255, 0.14);
}

.tui-table a {
  color: var(--tui-text-bright);
  text-decoration: none;
}

.tui-table a:hover,
.tui-table a:focus-visible {
  color: var(--tui-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tui-more {
  margin: 0.75rem 0 0 0.75rem;
  color: var(--tui-muted);
  font-size: 0.875rem;
}

.tui-more #proj-more-count {
  color: var(--tui-orange);
}

.tui-more a {
  color: var(--tui-muted);
  text-decoration: none;
}

.tui-more a:hover,
.tui-more a:focus-visible {
  color: var(--tui-text-bright);
}

.tui-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.tui-status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--tui-muted);
}

.tui-status.is-running {
  color: var(--tui-green);
}

.tui-status.is-running::before {
  border-color: var(--tui-green);
  background: var(--tui-green);
}

/* footer + scroll-to-top */
.tui-footer {
  border-top: 1px solid var(--tui-line);
  background: var(--tui-bar);
}

.tui-footer p {
  padding-block: 0.75rem;
  font-size: 0.75rem;
  color: var(--tui-muted);
}

.tui #scroll-to-top {
  border-radius: 3px;
  border-color: var(--tui-line);
  background: var(--tui-bar);
  color: var(--tui-cyan);
  box-shadow: none;
}

@keyframes tui-blink {
  50% { opacity: 0; }
}

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

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee-track,
  .tui-block-cursor {
    animation: none;
  }
}
