/* ============================================================
   STYLES.CSS — Dark terminal / builder aesthetic
   Personal website for Akshat Garg

   Design system:
   - Spacing scale: 4, 8, 12, 16, 24, 32, 48, 64, 80, 120px
   - Fluid typography via clamp()
   - Three breakpoints: 1024px (tablet), 768px (mobile), 480px (small)
   - Accent color: cyan (#00D4B8) via data-accent
   - Fonts: Bricolage Grotesque (body), IBM Plex Mono (mono)
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg: #0a0a0a;
  --bg-subtle: #111111;
  --bg-elevated: #161616;
  --text-primary: #e0e0e0;
  --text-secondary: #8a8a8a;
  --border-subtle: #1a1a1a;
  --border-medium: #252525;
  --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
  --font-body: 'Bricolage Grotesque', Georgia, serif;

  /* Fluid spacing */
  --space-section: clamp(48px, 8vw, 100px);
  --space-hero-pad-top: clamp(64px, 10vw, 80px);
  --space-hero-pad-bottom: clamp(40px, 6vw, 60px);
  --space-content-pad: clamp(20px, 4vw, 40px);
}

[data-accent="cyan"] {
  --accent: #00D4B8;
  --accent-dim: rgba(0, 212, 184, 0.15);
  --accent-glow: rgba(0, 212, 184, 0.06);
  --accent-border: rgba(0, 212, 184, 0.3);
  --accent-strong: rgba(0, 212, 184, 0.9);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(
    ellipse 80% 60% at 50% 40%,
    rgba(255, 255, 255, 0.015) 0%,
    transparent 70%
  );
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: max(14px, 0.4vw + 10px);
  line-height: 1.7;
  overflow-x: hidden;
  cursor: default;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* --- Noise/grain texture overlay --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Cursor overrides for interactive elements --- */
#ascii-container { cursor: pointer; }
#bg-canvas { cursor: crosshair; }
a, button, [role="button"], input { cursor: pointer; }
#terminal-input { cursor: text; }

::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

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

ul {
  list-style: none;
}

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

/* ============================================================
   BACKGROUND CANVAS (#2)
   ============================================================ */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Ensure all content sits above the canvas */
#scroll-progress,
#crt-overlay,
main {
  position: relative;
  z-index: 1;
}

/* ============================================================
   SCREEN READER ONLY (skip link)
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only:focus-visible {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  padding: 8px 16px;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  z-index: 10001;
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  z-index: 10000;
  pointer-events: none;
  transition: width 0.05s linear;
}

/* ============================================================
   GLOBAL FLOATING SCROLL HINT (fixed at bottom of viewport)
   Visible when there's more to scroll, fades near page bottom.
   Pulse animation mimics headlight dipper reflection.
   ============================================================ */
#scroll-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.6s ease;
}

#scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.scroll-chevron {
  display: block;
  width: 16px;
  height: 16px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: rotate(45deg);
  animation: scrollDipper 2.5s ease-in-out infinite;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

/* Expand touch target to 44px minimum for accessibility */
#scroll-hint::before {
  content: '';
  position: absolute;
  top: -14px;
  left: -14px;
  right: -14px;
  bottom: -14px;
}

@media (hover: hover) {
  #scroll-hint:hover .scroll-chevron {
    border-color: var(--accent);
    transform: rotate(45deg) scale(1.15);
  }
}

@keyframes scrollDipper {
  0% {
    opacity: 0.3;
    border-color: var(--text-secondary);
    box-shadow: none;
  }
  50% {
    opacity: 0.85;
    border-color: var(--accent);
    box-shadow: 2px 2px 8px var(--accent-glow), 0 0 2px var(--accent-dim);
  }
  100% {
    opacity: 0.3;
    border-color: var(--text-secondary);
    box-shadow: none;
  }
}

/* ============================================================
   CRT SCAN-LINE OVERLAY
   ============================================================ */
#crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
}


/* ============================================================
   MAIN CONTAINER
   ============================================================ */
main {
  max-width: clamp(800px, 65vw, 1400px);
  margin: 0 auto;
  padding: 0 var(--space-content-pad);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
#hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-hero-pad-top) 0 var(--space-hero-pad-bottom);
  gap: clamp(32px, 5vw, 48px);
  position: relative;
}

/* Asymmetric hero: text column wider (60%), ASCII narrower */
#hero-text {
  flex: 0 1 60%;
}

#name {
  font-family: var(--font-mono);
  font-size: max(24px, 1.5vw + 26px);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
  animation: fadeIn 0.6s cubic-bezier(0.33, 1, 0.68, 1) 0.3s both;
}

#tagline {
  font-family: var(--font-mono);
  font-size: max(14px, 0.4vw + 12px);
  font-weight: 400;
  color: var(--accent);
  min-height: 1.7em;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
  white-space: pre-wrap;
}

/* Blinking cursor for typing effect */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  transition: background-color 0.3s ease;
}

/* --- Social Links (terminal chip style) --- */
#social-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

#social-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
}

#social-links a:hover {
  background-color: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

#social-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.link-arrow {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-left: 0;
}

#social-links a:hover .link-arrow {
  max-width: 20px;
  opacity: 1;
  margin-left: 8px;
}

/* Social links staggered entrance (JS adds .visible to #social-links) */
#social-links.visible a {
  animation: fadeIn 0.4s cubic-bezier(0.33, 1, 0.68, 1) both;
}

#social-links.visible a:nth-child(1) { animation-delay: 0s; }
#social-links.visible a:nth-child(2) { animation-delay: 0.1s; }
#social-links.visible a:nth-child(3) { animation-delay: 0.15s; }

/* ============================================================
   ASCII CONTAINER — Hover to Photo Reveal
   ============================================================ */
#ascii-container {
  flex: 0 1 35%;
  position: relative;
  overflow: hidden;
  text-align: center;
  animation: fadeIn 0.8s ease 0.5s both;
}

/* Hero scrolled — force-complete animations to prevent frame contention with snap */
#hero.scrolled #name,
#hero.scrolled #ascii-container {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

#hero.scrolled #social-links a {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

#ascii-art {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--accent);
  white-space: pre;
  display: inline-block;
  text-align: left;
  position: relative;
  z-index: 2;
  transition: opacity 0.6s ease, color 0.3s ease;
  user-select: none;
  text-shadow: 0 0 8px var(--accent-dim);
}

#photo-reveal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.6s ease;
  filter: grayscale(50%) contrast(1.2);
  border-radius: 2px;
}

/* Desktop hover reveal — guarded so touch devices don't get sticky :hover */
@media (hover: hover) {
  #ascii-container:hover #ascii-art {
    opacity: 0;
  }

  #ascii-container:hover #photo-reveal {
    opacity: 1;
  }
}

/* Touch device tap toggle (JS adds .photo-active) */
#ascii-container.photo-active #ascii-art {
  opacity: 0;
}

#ascii-container.photo-active #photo-reveal {
  opacity: 1;
}

/* Guard: hide photo reveal when no source is set */
#photo-reveal[src=""],
#photo-reveal:not([src]) {
  display: none;
}

/* Line glow effect during ASCII scan-line render */
#ascii-art.line-glow {
  text-shadow: 0 0 16px var(--accent-dim), 0 0 4px var(--accent);
}

/* ============================================================
   CONTENT SECTIONS — Scroll-in Animations
   ============================================================ */
.content-section {
  padding: var(--space-section) 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.content-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Subtle section dividers */
.content-section + .content-section {
  border-top: 1px solid transparent;
  border-image: linear-gradient(
    to right,
    transparent 0%,
    var(--border-medium) 20%,
    var(--accent-dim) 50%,
    var(--border-medium) 80%,
    transparent 100%
  ) 1;
}

/* --- Section Headers --- */
.section-header {
  font-family: var(--font-mono);
  font-size: max(15px, 0.4vw + 12px);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 32px;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 20px;
}

.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent-dim), transparent 80%);
}

.section-intro {
  color: var(--text-secondary);
  font-size: max(13px, 0.3vw + 10px);
  font-weight: 400;
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ============================================================
   NOW SECTION — Asymmetric Layout (#5)
   section-header as left sidebar label, items in right column
   ============================================================ */
#now {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0 clamp(24px, 4vw, 48px);
  align-items: start;
}

#now .section-header {
  grid-column: 1;
  grid-row: 1 / -1;
  writing-mode: horizontal-tb;
  position: sticky;
  top: 80px;
  padding-top: 12px;
  margin-bottom: 0;
  font-size: max(14px, 0.35vw + 12px);
  opacity: 0.7;
  white-space: nowrap;
  display: block;
}

#now .section-header::after {
  display: none;
}

#now-items {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#now-items li {
  padding: 16px 20px;
  border-radius: 4px;
  border-left: 2px solid var(--border-subtle);
  background: transparent;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease,
              border-color 0.3s ease, background-color 0.3s ease;
  position: relative;
}

#now-items li:hover {
  background-color: var(--accent-glow);
  border-left-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 0 1px var(--accent-border);
  cursor: pointer;
}

/* Hover arrow indicator (CSS pseudo-element) */
#now-items li::after {
  content: '\2192';
  position: absolute;
  right: 16px;
  top: 16px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#now-items li:hover::after {
  opacity: 0.5;
  transform: translateX(0);
}

.now-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: max(11px, 0.2vw + 9px);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.now-status {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-dim); }
  50% { opacity: 0.5; box-shadow: 0 0 0 4px transparent; }
}

/* Ongoing status: solid dot, no pulse (for passive activities) */
.now-status.ongoing {
  animation: none;
  opacity: 0.4;
}

/* Metric numbers highlighted in accent */
.now-metric {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
}

.now-title {
  display: block;
  font-family: var(--font-body);
  font-size: max(15px, 0.45vw + 10px);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.now-desc {
  display: block;
  font-size: max(13px, 0.4vw + 10px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
}

#now-items li.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered delays for now items */
#now-items li:nth-child(1) { transition-delay: 0.1s; }
#now-items li:nth-child(2) { transition-delay: 0.2s; }
#now-items li:nth-child(3) { transition-delay: 0.3s; }
#now-items li:nth-child(4) { transition-delay: 0.4s; }
#now-items li:nth-child(5) { transition-delay: 0.5s; }

/* ============================================================
   ABOUT SECTION — Three-layer structure
   Hook (quote) → Story (paragraph) → Stats (numbers)
   ============================================================ */
#about {
  position: relative;
}

#about-content {
  max-width: 720px;
}

.about-hook {
  font-size: max(17px, 0.6vw + 12px);
  line-height: 1.8;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: 0.005em;
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin-bottom: 24px;
}

.about-story {
  font-size: max(14px, 0.4vw + 10px);
  line-height: 1.8;
  color: var(--text-secondary);
  font-weight: 400;
  padding-left: 22px;
  margin-bottom: 32px;
}

.about-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 22px;
  flex-wrap: wrap;
}

.about-stats .stat {
  font-family: var(--font-mono);
  font-size: max(13px, 0.25vw + 10px);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.about-stats .stat-sep {
  color: var(--border-medium);
  font-size: 14px;
}

/* About staggered entrance (hook → story → stats) */
.about-hook,
.about-story,
.about-stats {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#about.visible .about-hook {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

#about.visible .about-story {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

#about.visible .about-stats {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.2s;
}

/* Stat number visual hierarchy */
.stat-number {
  font-size: max(15px, 0.3vw + 10px);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ============================================================
   TERMINAL SECTION (#1)
   ============================================================ */
#terminal {
  background: #080808;
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px var(--accent-border);
  margin-left: -48px;
  margin-right: -48px;
}

#terminal-titlebar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #161616;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  -webkit-user-select: none;
}

.terminal-dots {
  display: flex;
  gap: 8px;
}

.terminal-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  position: relative;
}

.terminal-dots span::after {
  position: absolute;
  left: 50%;
  font-weight: 700;
  font-family: -apple-system, system-ui, sans-serif;
  opacity: 0;
  transition: opacity 0.15s ease-out;
  pointer-events: none;
}

.terminal-dots:hover span::after {
  opacity: 1;
}

.dot-close {
  background: #FF5F57;
}
.dot-close::after {
  content: '\00D7';
  color: #4a0002;
  font-size: 10px;
  top: 50%;
  transform: translate(-50%, -51%);
  line-height: 1;
}

.dot-minimize {
  background: #FEBC2E;
}
.dot-minimize::after {
  content: '\2013';
  color: #5a3e00;
  font-size: 10px;
  top: 50%;
  transform: translate(-50%, -55%);
  line-height: 1;
}

.dot-maximize {
  background: #28C840;
}
.dot-maximize::after {
  content: '\2197';
  color: #0a4a12;
  font-size: 8px;
  top: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  margin-right: 44px;
}

#terminal-body {
  padding: 20px;
}

#terminal-output {
  overflow-y: auto;
  max-height: 340px;
  scroll-behavior: smooth;
}

/* Terminal scrollbar */
#terminal-output::-webkit-scrollbar {
  width: 4px;
}

#terminal-output::-webkit-scrollbar-track {
  background: transparent;
}

#terminal-output::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 2px;
}

#terminal-output::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* Terminal output lines */
#terminal-output div {
  font-size: max(13px, 0.2vw + 10px);
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 4px;
}

.terminal-prompt {
  color: var(--accent);
  margin-right: 8px;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.terminal-prompt.flash {
  color: var(--accent-strong);
  text-shadow: 0 0 8px var(--accent-dim);
  transition: none;
}

.terminal-response {
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal-command {
  color: var(--text-primary);
}

#terminal-input-line {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: 12px;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: max(13px, 0.2vw + 10px);
  font-weight: 400;
  caret-color: var(--accent);
  outline: none;
}

#terminal-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
}

/* ============================================================
   SOURCE CODE OVERLAY (#4)
   ============================================================ */
#source-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 5, 0.97);
  z-index: 10001;
  overflow-y: auto;
  padding: 40px;
  display: none;
}

#source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  background: rgba(5, 5, 5, 0.97);
  padding-bottom: 16px;
  z-index: 1;
}

#source-filename {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  color: var(--accent);
}

#source-close {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--accent);
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease;
}

#source-close:hover {
  background-color: var(--accent);
  color: var(--bg);
}

#source-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#source-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-primary);
  tab-size: 2;
}

/* Syntax highlighting classes */
.hl-tag {
  color: var(--accent);
}

.hl-attr {
  color: #98c379;
}

.hl-string {
  color: #e5c07b;
}

.hl-comment {
  color: #5c6370;
  font-style: italic;
}

/* ============================================================
   FOOTER SIGN-OFF
   ============================================================ */
.footer-signoff {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.footer-prompt {
  color: var(--accent);
  opacity: 0.6;
  margin-right: 6px;
}

/* ============================================================
   NEWSLETTER SECTION — Alternating indent (#5)
   ============================================================ */
#newsletter-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 40px;
}

.newsletter-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 14px 12px;
  border-radius: 2px;
  border-left: 2px solid transparent;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease,
              background-color 0.15s ease-out, border-color 0.15s ease-out;
}

/* Asymmetric zigzag: even items indented */
.newsletter-item:nth-child(even) {
  margin-left: 40px;
}

.newsletter-item.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered delays for newsletter items */
.newsletter-item:nth-child(1) { transition-delay: 0.1s; }
.newsletter-item:nth-child(2) { transition-delay: 0.2s; }
.newsletter-item:nth-child(3) { transition-delay: 0.3s; }
.newsletter-item:nth-child(4) { transition-delay: 0.4s; }
.newsletter-item:nth-child(5) { transition-delay: 0.5s; }

.newsletter-item:hover {
  background-color: var(--accent-glow);
  border-left-color: var(--accent-border);
}

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

/* Hover arrow indicator (consistent with now section) */
.newsletter-item::after {
  content: '\2192';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateX(-4px) translateY(-50%);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.newsletter-item:hover::after {
  opacity: 0.5;
  transform: translateX(0) translateY(-50%);
}

.newsletter-issue {
  font-family: var(--font-mono);
  font-size: max(11px, 0.25vw + 8px);
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 36px;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.newsletter-item:hover .newsletter-issue {
  opacity: 1;
}

.newsletter-date {
  font-family: var(--font-mono);
  font-size: max(12px, 0.25vw + 9px);
  font-weight: 400;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 90px;
  letter-spacing: 0.03em;
}

.newsletter-read-time {
  font-family: var(--font-mono);
  font-size: max(11px, 0.25vw + 8px);
  font-weight: 400;
  color: var(--text-muted, var(--text-secondary));
  flex-shrink: 0;
  opacity: 0.5;
  letter-spacing: 0.02em;
}

.newsletter-title {
  font-size: max(14px, 0.4vw + 10px);
  font-weight: 400;
  color: var(--text-primary);
  transition: color 0.15s ease-out;
}

.newsletter-item:hover .newsletter-title {
  color: var(--accent);
}

/* --- Subscribe Button --- */
#subscribe-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 12px 28px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

#subscribe-btn:hover {
  background-color: var(--accent);
  color: var(--bg);
}

#subscribe-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#subscribe-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

#subscribe-btn.subscribed {
  border-color: var(--accent);
  color: var(--accent);
  pointer-events: none;
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  text-align: center;
  padding: clamp(32px, 5vw, 48px) 0;
  border-top: 1px solid transparent;
  border-image: linear-gradient(
    to right,
    transparent 0%,
    var(--border-medium) 20%,
    var(--accent-dim) 50%,
    var(--border-medium) 80%,
    transparent 100%
  ) 1;
  margin-top: clamp(24px, 4vw, 40px);
}

#footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.footer-meta {
  margin-top: 8px;
  opacity: 0.5;
}

/* ============================================================
   UTILITY / ANIMATION KEYFRAMES
   ============================================================ */

/* Gentle fade-in for the hero on page load */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ============================================================
   FOCUS-VISIBLE — Global fallback for any interactive element
   ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   SNAP SCROLL — Hero + Terminal as full-viewport pages
   Desktop only — mobile uses regular scrolling
   ============================================================ */
@media (min-width: 769px) and (min-height: 500px) {
  html {
    scroll-snap-type: y mandatory;
  }

  #hero {
    scroll-snap-align: start;
    will-change: transform;
  }

  #terminal-section {
    scroll-snap-align: start;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 40px 0 60px;
    box-sizing: border-box;
    /* Override content-section fade — snap targets appear instantly */
    opacity: 1;
    transform: none;
    will-change: transform;
  }

  #terminal-section .section-header,
  #terminal-section .section-intro {
    flex-shrink: 0;
  }

  #terminal-section #terminal {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #terminal-section #terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #terminal-section #terminal-output {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    min-height: 0;
  }

  #terminal-section #terminal-input-line {
    flex-shrink: 0;
  }

  /* GPU cleanup: drop will-change after scroll settles to free VRAM */
  html.scroll-settled #hero,
  html.scroll-settled #terminal-section {
    will-change: auto;
  }
}


/* ============================================================
   RESPONSIVE — Tablet (max-width: 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  #hero {
    gap: clamp(24px, 3vw, 36px);
  }

  #hero-text {
    flex: 0 1 58%;
  }

  #ascii-container {
    flex: 0 1 38%;
  }

  .content-section {
    padding: clamp(40px, 6vw, 64px) 0;
  }

  /* Reduce now section grid gap on tablet */
  #now {
    grid-template-columns: 120px 1fr;
    gap: 0 clamp(16px, 3vw, 32px);
  }

  #terminal {
    margin-left: -24px;
    margin-right: -24px;
  }
}

/* ============================================================
   RESPONSIVE — Mobile (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  body {
    min-height: 100dvh;
  }

  main {
    padding: 0 24px;
  }

  #hero {
    flex-direction: column;
    text-align: left;
    padding: clamp(60px, 12vw, 100px) 0 40px;
    gap: 40px;
    min-height: auto;
  }

  #hero-text {
    flex: none;
    width: 100%;
  }

  #ascii-container {
    flex: none;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  #ascii-art {
    text-align: left;
  }

  .content-section {
    padding: clamp(36px, 6vw, 48px) 0;
  }

  .section-header {
    margin-bottom: 24px;
  }

  /* Revert #now to single-column on mobile */
  #now {
    display: block;
  }

  #now-items li::after {
    display: none;
  }

  #now .section-header {
    position: static;
    writing-mode: horizontal-tb;
    margin-bottom: 24px;
    opacity: 1;
  }

  /* About: full width on mobile */
  #about-content {
    max-width: 100%;
  }

  .about-hook {
    /* font-size handled by max() formula — no mobile override needed */
  }

  .about-story,
  .about-stats {
    padding-left: 22px;
  }

  /* Revert newsletter zigzag on mobile */
  .newsletter-item:nth-child(even) {
    margin-left: 0;
  }

  .newsletter-item {
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 8px;
    border-left-width: 2px;
  }

  .newsletter-date {
    min-width: auto;
  }

  .newsletter-issue {
    min-width: auto;
  }

  .newsletter-title {
    flex-basis: 100%;
  }

  .newsletter-item::after {
    display: none;
  }

  #subscribe-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 24px;
  }

  /* Terminal: prominent on mobile — 70vh with flex layout */
  #terminal-section {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
  }

  #terminal-section #terminal {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #terminal-section #terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #terminal-section #terminal-output {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    min-height: 0;
  }

  #terminal-section #terminal-input-line {
    flex-shrink: 0;
  }

  #terminal {
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 6px;
  }

  #terminal-titlebar {
    padding: 10px 12px;
  }

  .terminal-dots span {
    width: 10px;
    height: 10px;
  }

  .terminal-title {
    font-size: 11px;
    margin-right: 38px;
  }

  #terminal-body {
    padding: 16px;
  }

  /* Source overlay: less padding on mobile */
  #source-overlay {
    padding: 20px;
  }

  #source-code {
    font-size: 11px;
  }

  /* Terminal features: mobile adjustments */
  .neofetch-output {
    flex-direction: column;
    gap: 12px;
  }

  .cmatrix-container {
    font-size: 11px;
  }
}

/* --- Small screens (max-width: 480px) --- */
@media (max-width: 480px) {
  main {
    padding: 0 16px;
  }

  #now-items li {
    padding: 10px 0 10px 12px;
  }

  .newsletter-item {
    padding: 10px 6px;
  }

  #terminal {
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 4px;
  }

  #terminal-body {
    padding: 12px;
  }

  #terminal-output {
    /* Inherits flex:1 + max-height:none from 768px breakpoint */
  }

  #terminal-output div {
    font-size: max(12px, 0.2vw + 10px);
  }

  #terminal-input {
    font-size: max(12px, 0.2vw + 10px);
  }
}

/* ============================================================
   TERMINAL FEATURES — Styles for extended terminal commands
   ============================================================ */

/* cmatrix: Matrix rain animation container */
.cmatrix-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.2;
  color: var(--accent);
  z-index: 10;
  background: var(--bg);
}

.cmatrix-container .cmatrix-col {
  position: absolute;
  top: 0;
  white-space: pre;
  writing-mode: vertical-lr;
  text-orientation: upright;
  opacity: 0.8;
  animation: cmatrix-fall linear infinite;
}

@keyframes cmatrix-fall {
  from { transform: translateY(-100%); }
  to { transform: translateY(100vh); }
}

.cmatrix-exit-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 11;
  opacity: 0.6;
}

/* neofetch: system info display */
.neofetch-output {
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

.neofetch-ascii {
  color: var(--accent);
  white-space: pre;
  flex-shrink: 0;
}

.neofetch-info {
  white-space: pre;
  min-width: 0;
}

.neofetch-color-strip {
  display: flex;
  gap: 2px;
  margin-top: 8px;
}

.neofetch-color-strip span {
  width: 24px;
  height: 12px;
  display: inline-block;
  border-radius: 2px;
}

/* achievements: badge display */
.achievement-earned {
  color: var(--text-primary);
}

.achievement-locked {
  color: var(--text-secondary);
  opacity: 0.5;
}

.achievement-notification {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin-top: 4px;
  font-size: 13px;
}

/* ping: progress bar animation */
.ping-bar {
  display: inline-block;
  color: var(--accent);
  letter-spacing: -1px;
}

/* ssh: connection animation */
.ssh-connecting {
  color: var(--text-secondary);
}

.ssh-connected {
  color: var(--accent);
}

/* banner: large ASCII text */
.banner-output {
  color: var(--accent);
  font-family: var(--font-mono);
  white-space: pre;
  line-height: 1.1;
  font-size: 12px;
}

/* tree: directory tree display */
.tree-output {
  font-family: var(--font-mono);
  white-space: pre;
  line-height: 1.4;
}

.tree-dir {
  color: var(--accent);
  font-weight: 600;
}

/* Tab completion matches display */
.tab-matches {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

/* ============================================================
   REDUCED MOTION — Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
  }

  html {
    scroll-behavior: auto;
  }

  .content-section {
    opacity: 1;
    transform: none;
  }

  #now-items li {
    opacity: 1;
    transform: none;
  }

  .newsletter-item {
    opacity: 1;
    transform: none;
  }

  #hero-text,
  #name,
  #ascii-container {
    animation: none;
    opacity: 1;
    transform: none;
  }

  #social-links,
  #social-links a {
    opacity: 1;
    transform: none;
    animation: none;
  }

  #scroll-hint .scroll-chevron {
    animation: none;
    opacity: 0.4;
  }

  .now-status {
    animation: none;
  }

  .about-hook,
  .about-story,
  .about-stats {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    cursor: auto;
  }

  #crt-overlay,
  #scroll-progress,
  #scroll-hint,
  #bg-canvas,
  #terminal-section,
  #source-overlay {
    display: none !important;
  }

  .content-section {
    opacity: 1 !important;
    transform: none !important;
    break-inside: avoid;
  }

  .newsletter-item {
    opacity: 1 !important;
    transform: none !important;
  }

  #now-items li {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Revert asymmetric layout for print */
  #now {
    display: block;
  }

  #about-content {
    max-width: 100%;
  }

  .newsletter-item:nth-child(even) {
    margin-left: 0;
  }

  #hero {
    min-height: auto;
    page-break-after: avoid;
  }

  #ascii-container {
    display: none;
  }

  a {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #555;
  }

  #social-links a[href]::after,
  #subscribe-btn::after {
    content: '';
  }

  #footer {
    border-top: 1px solid #ccc;
  }

  .content-section + .content-section {
    border-top: 1px solid #ccc;
    border-image: none;
  }
}
