:root {
  color-scheme: dark;
  --bg: transparent;
  --panel: rgba(16, 16, 16, 0.2);
  --panel-2: rgba(18, 18, 18, 0.08);
  --border: #29313a;
  --text: #d7dde5;
  --muted: #a6b5c4;
  --accent: #98e6a5;
  --accent-2: #8cc8ff;
  --warning: #ffd580;
  --shadow: rgba(0, 0, 0, 0.45);
  --glass-blur: 6px;
  --control-blur: 4px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Cascadia Code",
    "JetBrains Mono",
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
  line-height: 1.6;
}

/* Identical terminal-output sheets keep the upward scroll seamless. */
.code-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #050a07;
}

.code-stream {
  will-change: transform;
  animation: scroll-code 16s linear infinite;
}

.code-sheet {
  display: grid;
  grid-template-rows: repeat(48, minmax(0, 1fr));
  height: max(100vh, 1152px);
  padding: 0 16px;
  font-size: clamp(10px, 0.9vw, 13px);
  line-height: 1.4;
  color: rgba(70, 235, 120, 0.28);
  text-shadow: 0 0 6px rgba(22, 196, 81, 0.1);
}

.code-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(480px, 1fr));
  gap: 32px;
  align-items: center;
  white-space: pre;
}

.code-row:nth-child(3n) { opacity: 0.6; }
.code-row:nth-child(5n) { color: rgba(165, 255, 197, 0.42); }

.background-paused .code-stream { animation-play-state: paused; }

@keyframes scroll-code {
  to { transform: translateY(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .code-stream {
    animation: none;
  }
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: #c5e4ff;
  text-decoration: underline;
}

.terminal-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100% - 28px));
  margin: 42px auto;
  border: 1px solid rgba(215, 235, 255, 0.24);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 35%, rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow:
    0 22px 70px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(140, 200, 255, 0.1);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .terminal-shell {
    --panel: rgba(16, 16, 16, 0.12);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
  }
}


.topbar {
  position: relative;
  z-index: 6;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(215, 235, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent),
    var(--panel-2);
  font-size: 0.9rem;
}

.window-controls {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0;
}

.window-controls button {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

#reset-display { --light-color: #ff5f57; }
#toggle-background { --light-color: #febc2e; }
#toggle-glass { --light-color: #28c840; }

.traffic-light {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--light-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  color: transparent;
}

.traffic-light svg {
  display: block;
  width: 10px;
  height: 10px;
}

.traffic-light .icon-play,
#toggle-background[aria-pressed="true"] .icon-pause { display: none; }
#toggle-background[aria-pressed="true"] .icon-play { display: block; }

.window-controls:hover .traffic-light,
.window-controls button:focus-visible .traffic-light,
.window-controls button[aria-pressed="true"] .traffic-light {
  color: rgba(0, 0, 0, 0.65);
}

.window-controls button[aria-pressed="true"] .traffic-light {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.window-controls button::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  padding: 7px 10px;
  border: 1px solid rgba(215, 235, 255, 0.25);
  border-radius: 6px;
  background: #171b20;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font: 0.78rem/1.4 "Liberation Mono", monospace;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.window-controls button:hover::after,
.window-controls button:focus-visible::after {
  visibility: visible;
  opacity: 1;
}

.overlay-retry {
  min-width: 32px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(215, 235, 255, 0.3);
  border-radius: 6px;
  background: rgba(16, 16, 16, 0.3);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
}

.overlay-retry:hover {
  border-color: var(--accent-2);
  color: #c5e4ff;
}


:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}


.title { color: var(--muted); text-align: center; }
.status { justify-self: end; color: var(--accent); }

.terminal {
  position: relative;
  min-width: 0;
  padding: 28px;
  overflow-wrap: anywhere;
}

.terminal > p,
.cursor-line { margin: 0 0 14px; }

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

.sep,
.symbol {
  color: var(--muted);
  margin-right: 0.45rem;
}

.path { color: var(--accent-2); }
.output { margin: 0 0 30px 18px; }

.hero h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: #b9c2cc;
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.socials a {
  display: inline-block;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #0b1014;
}

.socials a:hover,
.socials a:focus-visible {
  border-color: var(--accent-2);
  text-decoration: none;
}

.private-access {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.private-button {
  display: inline-block;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(152, 230, 165, 0.035);
}

.private-button:hover,
.private-button:focus-visible {
  color: #c9ffd2;
  border-color: #c9ffd2;
  text-decoration: none;
}

.private-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.section-heading { margin-bottom: 18px; }

.section-heading h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--warning);
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* Gallery categories */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Container units keep the image frame and its arrow midpoint in sync. */
.gallery-category {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  --gallery-image-height: clamp(220px, 56.25cqi, 340px);
  min-width: 0;
  border: 1px solid rgba(215, 235, 255, 0.24);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(16, 16, 16, 0.12);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.gallery-grid > .gallery-category:first-child { grid-column: 1 / -1; }

.gallery-art,
.gallery-grid > .gallery-category:nth-child(3) {
  --gallery-image-height: clamp(280px, 125cqi, 340px);
}


.gallery-category-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--warning);
  font-size: 0.84rem;
}

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

.carousel-stage {
  position: relative;
  min-height: var(--gallery-image-height);
}

.carousel-slides { height: 100%; }

.gallery-slide {
  display: none;
  margin: 0;
}

.gallery-slide.active { display: block; }

.gallery-slide img {
  display: block;
  width: 100%;
  height: var(--gallery-image-height);
  object-fit: contain;
  background: transparent;
  cursor: zoom-in;
}

.gallery-slide img:hover,
.gallery-slide img:focus-visible {
  opacity: 0.9;
  outline: 2px solid var(--accent-2);
  outline-offset: -3px;
}

.gallery-slide figcaption {
  min-height: 66px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: #c3ccd6;
  font-size: 0.9rem;
}

.carousel-arrow,
.overlay-arrow {
  position: absolute;
  isolation: isolate;
  overflow: hidden;
  z-index: 5;
  top: calc(var(--gallery-image-height) / 2);
  transform: translateY(-50%);
  width: 44px;
  height: 54px;
  border: 1px solid rgba(215, 235, 255, 0.3);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.18);
  -webkit-backdrop-filter: blur(var(--control-blur));
  backdrop-filter: blur(var(--control-blur));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}


.carousel-arrow:hover,
.carousel-arrow:focus-visible,
.overlay-arrow:hover,
.overlay-arrow:focus-visible {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.carousel-arrow.prev { left: 6px; }
.carousel-arrow.next { right: 6px; }

/* Compact rig overview and the optional full Fastfetch snapshot. */
.rig-summary {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.12);
}

.rig-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 0;
}

.rig-summary dl > div { min-width: 0; }
.rig-summary dt { color: var(--muted); font-size: 0.84rem; }
.rig-summary dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* Also support definition lists with unwrapped dt/dd pairs. */
.rig-summary dl:has(> dt) {
  grid-template-columns: minmax(80px, 0.35fr) minmax(0, 1fr);
}

.rig-details { margin-top: 16px; }

.rig-details > summary {
  width: fit-content;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent-2);
  cursor: pointer;
}

.rig-details > summary:hover {
  border-color: var(--accent-2);
  background: rgba(140, 200, 255, 0.06);
}

.rig-details[open] > summary { margin-bottom: 12px; }

/* Fastfetch block */
.fastfetch-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(420px, 1.6fr);
  gap: 28px;
  align-items: center;
  overflow-x: auto;
  padding: 22px;
  border: 1px solid var(--border);
  background: #080b0d;
}

.fastfetch-logo {
  margin: 0;
  color: #c8d0d9;
  font-family: "DejaVu Sans Mono", "Noto Sans Mono", "Liberation Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.05;
  white-space: pre;
  justify-self: center;
}

.fastfetch-specs {
  min-width: 0;
  border: 1px solid #89939d;
  border-radius: 4px;
  overflow: hidden;
}

.ff-group + .ff-group {
  border-top: 1px solid #89939d;
}

.ff-group {
  padding: 7px 10px;
}

.ff-row {
  display: grid;
  grid-template-columns: 74px 12px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  font-size: 0.82rem;
  line-height: 1.45;
}

.ff-key {
  color: #bfc8d2;
  text-align: left;
}

.ff-sep {
  color: #7f8b98;
  text-align: center;
}

.ff-value {
  color: #d7dde5;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .fastfetch-card {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .fastfetch-logo {
    font-size: 0.66rem;
  }
}

/* Full-screen lightbox */
.image-overlay {
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 94vh;
  margin: auto;
  padding: 50px 18px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  isolation: isolate;
  background: rgba(16, 16, 16, 0.12);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.7);
}

.image-overlay::backdrop {
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}


.image-overlay > img,
.image-overlay > .overlay-caption,
.image-overlay > .overlay-status,
.image-overlay > .overlay-retry {
  position: relative;
  z-index: 1;
}

.image-overlay img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 125px);
  margin: 0 auto;
  object-fit: contain;
}

.overlay-caption {
  margin: 12px auto 0;
  max-width: 900px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.overlay-caption:empty { display: none; }

.image-overlay[data-image-state="loading"],
.image-overlay[data-image-state="error"] {
  min-height: 240px;
}

.image-overlay[data-image-state="loading"] > img,
.image-overlay[data-image-state="error"] > img {
  visibility: hidden;
  height: 0;
}

.overlay-status {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0 48px 12px;
  color: var(--text);
  text-align: center;
  overflow-wrap: anywhere;
}

.image-overlay[data-image-state="error"] .overlay-status {
  color: var(--warning);
}

.overlay-retry {
  display: block;
  min-height: 44px;
  margin: 0 auto 12px;
}

/* Author display rules must never reveal inactive viewer controls or status. */
.image-overlay [hidden],
.window-controls [hidden] { display: none; }

.overlay-arrow {
  top: 50%;
  width: 44px;
  height: 52px;
}

.overlay-prev { left: 8px; }
.overlay-next { right: 8px; }

.overlay-counter {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 2;
  color: var(--muted);
  font-size: 0.84rem;
}

.overlay-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 14px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 5px 7px;
  background: transparent;
  color: var(--accent-2);
  font: inherit;
  cursor: pointer;
}

.overlay-close:hover,
.overlay-close:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

body.overlay-open { overflow: hidden; }

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

/* Optional opaque treatment for readability and lower rendering cost. */
body.glass-simplified {
  --panel: #141414;
  --panel-2: #1a1a1a;
  --muted: #b2bdc8;
}

body.glass-simplified :is(.terminal-shell, .gallery-category, .rig-summary,
  .fastfetch-card, .image-overlay, .carousel-arrow, .overlay-arrow) {
  --panel: #141414;
  --panel-2: #1a1a1a;
  --muted: #b2bdc8;
  background: #141414;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.glass-simplified .topbar { background: #1a1a1a; }

body.glass-simplified .overlay-retry {
  background: #222;
}


.cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.1em;
  margin-left: 0.18rem;
  vertical-align: -0.15em;
  background: var(--text);
  animation: blink 1s steps(1) infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

@media (max-width: 760px) {
  .terminal-shell {
    width: min(100% - 14px, 1040px);
    margin: 16px auto;
    border-radius: 8px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .window-controls button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .title { display: none; }
  .terminal { padding: 20px 16px; }
  .output { margin-left: 10px; }

  .gallery-grid { grid-template-columns: 1fr; }
  .rig-summary dl { grid-template-columns: 1fr; }
  .fastfetch-card { padding: 14px; }
  .fastfetch-logo { max-width: 100%; overflow-x: auto; }

  .fastfetch-terminal {
    margin-left: -10px;
    margin-right: 0;
  }
}

/* Boot sequence: hidden steps keep their layout space, so nothing shifts. */
.js-boot .terminal > :not(.boot-log, .is-revealed) { visibility: hidden; }

.js-boot .terminal > .is-revealed:not(p:has(> .prompt)) {
  animation: reveal-output 220ms ease-out both;
}

@keyframes reveal-output {
  from { opacity: 0; transform: translateY(4px); }
}

.boot-log {
  position: absolute;
  inset: 28px 28px auto;
  margin: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  white-space: pre-wrap;
}

/* Untyped characters keep their space; the caret takes none. */
.typed-command > :not(.typed) { color: transparent; }
.typed-command > .caret,
.typed-command > .caret-end { position: relative; }

.typed-command > .caret::before,
.typed-command > .caret-end::after {
  content: "";
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 0.62em;
  height: 1.1em;
  background: var(--text);
}

.typed-command > .caret-end::after { left: calc(100% + 0.18rem); }

.status-state {
  display: inline-block;
  min-width: 7ch;
  text-align: right;
}

.login-line { margin: 0 0 14px; font-size: 0.86rem; }

.status-clock {
  display: inline-block;
  min-width: 8ch;
  margin-left: 0.4rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.uptime-output p { margin: 0; }
.uptime-output [data-live-uptime] { white-space: pre-wrap; }

/* htop-style meters; values are simulated in terminal-effects.js. */
.htop {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.12);
  font-size: 0.86rem;
}

.htop-meter {
  display: grid;
  grid-template-columns: 3.5ch minmax(0, 1fr);
  gap: 1ch;
  line-height: 1.5;
}

.meter-label { color: var(--accent-2); }

.meter-track {
  display: flex;
  min-width: 0;
  color: var(--text);
}

.meter-bar {
  display: flex;
  flex: 1;
  min-width: 0;
}

.meter-gauge {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: var(--accent);
  white-space: nowrap;
  transition: width 900ms ease-in-out;
}

.meter-fill::before {
  content: "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
}

[data-meter="mem"] .meter-fill { color: var(--accent-2); }
[data-meter="gpu"] .meter-fill { color: var(--warning); }

/* Fixed width so bars end in one column and never jitter as digits change. */
.meter-value {
  min-width: 12ch;
  padding-left: 1ch;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.htop-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  margin: 6px 0 0;
}

.htop-footer > span { white-space: nowrap; }

body.glass-simplified .htop { background: #141414; }

@media (prefers-reduced-motion: reduce) {
  .meter-fill { transition: none; }
}

@media (max-width: 760px) {
  .boot-log { inset: 20px 16px auto; }
}
