:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bg: #171513;
  --bg-elevated: #1f1c19;
  --surface: #211e1a;
  --surface-lighter: #2a2520;
  --surface-highlight: #332c25;
  --primary: #c96a32;
  --primary-dim: #a85728;
  --secondary: #b58a45;
  --accent: #d99558;
  --accent-dim: #c4824a;
  --text: #e8ded0;
  --text-muted: #9c9185;
  --text-dim: #7a7268;
  --border: #4a4036;
  --border-light: #5a4e42;
  --focus: #d99558;
  --error: #c94a32;
  --success: #6a9c5a;
  --warning: #d9a845;

  --font-ui: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;

  --max-width: 1100px;
  --header-height: 64px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(201, 106, 50, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 0.5rem);
  font-size: 16px;
}

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

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(201,106,50,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(181,138,69,0.03) 0%, transparent 50%),
    linear-gradient(180deg, transparent 60%, rgba(23,21,19,0.8) 100%);
  pointer-events: none;
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  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");
  opacity: 0.02;
  pointer-events: none;
  z-index: -1;
}

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

a:hover {
  color: var(--primary);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

p {
  color: var(--text-muted);
  max-width: 65ch;
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  line-height: 1.5;
}

code:not(pre code) {
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.85em;
}

pre code {
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}

kbd {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  font-size: 0.75em;
  box-shadow: 0 1px 0 var(--border-light);
}

::selection {
  background: var(--primary);
  color: var(--bg);
}

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

.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;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dim);
  border-color: var(--primary-dim);
  color: var(--bg);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.8125rem;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-primary {
  background: rgba(201, 106, 50, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.tag-accent {
  background: rgba(217, 149, 88, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.tag-vibe {
  background: rgba(201, 106, 50, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  font-style: italic;
}

.tag-vibe-partial {
  background: rgba(181, 138, 69, 0.15);
  border-color: var(--secondary);
  color: var(--secondary);
  font-style: italic;
}

.background-list,
.opensource-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.background-list li,
.opensource-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.background-list li:hover,
.opensource-list li:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

@media (max-width: 480px) {
  .background-list li,
  .opensource-list li {
    padding: var(--space-md);
  }
}

@media (max-width: 640px) {
  .article-tech {
    gap: var(--space-xs);
  }
  
  .article-tech .tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
  
  .project-card-tech {
    gap: var(--space-xs);
  }
  
  .project-card-tech .tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
  
  .sidebar-info {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }
  
  .sidebar-label::after {
    content: ':';
  }
}

@media (max-width: 768px) {
  .identity-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-side {
    display: block;
    margin-top: var(--space-xl);
  }
}

.about-hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.section {
  padding: var(--space-3xl) 0;
}

.section-header {
  margin-bottom: var(--space-xl);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.section-label::before {
  content: '>';
  color: var(--text-dim);
}

.section-title {
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(217, 149, 88, 0.15);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(23, 21, 19, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-brand:hover {
  color: var(--primary);
}

.site-brand::before {
  content: 'svd@portfolio';
  color: var(--text-dim);
}

.site-brand::after {
  content: ':~$';
  color: var(--primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link::before {
  content: '>';
  color: var(--text-dim);
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
}

.nav-link:hover::before,
.nav-link[aria-current="page"]::before {
  opacity: 1;
  transform: translateX(0);
  color: var(--primary);
}

.nav-link[aria-current="page"] {
  color: var(--accent);
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
}

.nav-link.pdf-download-btn {
  background: none;
  border: none;
  cursor: pointer;
}

.nav-link.pdf-download-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.mobile-menu-btn:hover {
  background: var(--surface);
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-xl) 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.footer-links a {
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
}

.hero {
  position: relative;
  padding: var(--space-3xl) 0;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,106,50,0.06) 0%, transparent 60%),
    linear-gradient(180deg, transparent 40%, var(--bg) 100%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  align-items: start;
  position: relative;
  z-index: 1;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.hero-terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

@media (max-width: 900px) {
  .hero-terminal {
    display: none;
  }
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-lighter);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

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

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-highlight);
  border: 1px solid var(--border);
}

.terminal-dot:nth-child(1) { background: #c94a32; }
.terminal-dot:nth-child(2) { background: #d9a845; }
.terminal-dot:nth-child(3) { background: #6a9c5a; }

.terminal-title {
  margin-left: var(--space-md);
  color: var(--text-muted);
}

.terminal-body {
  padding: var(--space-xl);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
}

.terminal-line {
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.terminal-line:last-child {
  margin-bottom: 0;
}

.prompt {
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.prompt::before {
  content: 'svd@portfolio:~$ ';
}

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

.output {
  color: var(--text-muted);
  margin-left: calc(14ch + var(--space-sm));
}

.output-highlight {
  color: var(--accent);
}

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

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

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

.hero-intro {
  margin-top: var(--space-xl);
}

.hero-tagline {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--text);
  max-width: 50ch;
  line-height: 1.5;
}

.hero-tagline strong {
  color: var(--accent);
  font-weight: 600;
}

.hero-cta {
  margin-top: var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.hero-side {
  display: block;
  margin-top: var(--space-xl);
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
  .hero-side {
    margin-top: 0;
  }
}

.sysinfo-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.sysinfo-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

.sysinfo-title::before {
  content: 'sysinfo';
  color: var(--primary);
}

.sysinfo-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-sm) var(--space-md);
}

.sysinfo-label {
  color: var(--text-dim);
}

.sysinfo-value {
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 500;
}

.sysinfo-value.code {
  font-family: var(--font-mono);
  color: var(--accent);
}

.featured-projects {
  padding: var(--space-3xl) 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@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 {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  text-decoration: none;
  color: inherit;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.project-card:hover::before,
.project-card:focus-visible::before {
  transform: scaleX(1);
}

.project-card:hover,
.project-card:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.project-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.project-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.project-card:hover .project-card-title,
.project-card:focus-visible .project-card-title {
  color: var(--primary);
}

.project-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.project-card-tech::-webkit-scrollbar {
  height: 4px;
}

.project-card-tech::-webkit-scrollbar-track {
  background: transparent;
}

.project-card-tech::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 2px;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.project-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.project-card-link:hover {
  color: var(--primary);
}

.project-card-link svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.project-card-link:hover svg {
  transform: translateX(3px);
}

.dev-identity {
  padding: var(--space-3xl) 0;
}

.identity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

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

.identity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.identity-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.identity-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  color: var(--primary);
}

.identity-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.identity-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.section-nav {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border);
}

.section-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .section-nav-grid {
    grid-template-columns: 1fr;
  }
}

.nav-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-base);
}

.nav-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateX(4px);
}

.nav-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--primary);
  flex-shrink: 0;
}

.nav-card-content {
  flex: 1;
}

.nav-card-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: var(--space-xs);
}

.nav-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.about-hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.about-name {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.about-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: var(--space-md);
}

.about-bio {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 60ch;
  line-height: 1.7;
}

.about-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.about-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.about-meta-label {
  color: var(--primary);
}

.about-section {
  margin-bottom: var(--space-3xl);
}

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

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.tech-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.tech-category:hover {
  border-color: var(--border-light);
}

.tech-category-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.timeline {
  position: relative;
  padding-left: 36px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -36px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-marker::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: var(--space-xs);
}

.timeline-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.ai-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.ai-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.ai-notice-icon {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.manifesto-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: 0;
}

.manifesto-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.manifesto-list li:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.manifesto-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: 0.2rem;
}

@media (max-width: 480px) {
  .manifesto-list li {
    padding: var(--space-md);
  }
}

.projects-hero {
  padding: var(--space-2xl) 0;
  text-align: center;
}

.projects-hero-title {
  margin-bottom: var(--space-sm);
}

.projects-hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0 auto;
}

.projects-list {
  padding: var(--space-xl) 0 var(--space-3xl);
}

.projects-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  justify-content: center;
}

.filter-btn {
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg);
}

.projects-grid.all-projects {
  grid-template-columns: 1fr;
}

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

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

.project-article {
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.article-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: var(--space-lg);
}

.article-title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--space-md);
}

.article-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 65ch;
}

.article-main {
  counter-reset: article-sec;
  min-width: 0;
}

.article-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 900px) {
  .article-content {
    grid-template-columns: 2fr 1fr;
  }
}

.article-section {
  counter-increment: article-sec;
  margin-bottom: var(--space-2xl);
}

.article-section:last-child {
  margin-bottom: 0;
}

.article-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.article-section-title::before {
  content: counter(article-sec, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--primary);
  background: var(--surface);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.article-section p {
  margin-bottom: var(--space-md);
}

.article-section ul {
  margin-left: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--text-muted);
}

.article-section li {
  margin-bottom: var(--space-xs);
}

.article-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.article-repo-btn {
  width: 100%;
  justify-content: center;
  margin-top: var(--space-lg);
}

.article-sidebar {
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.sidebar-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
}

.sidebar-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.sidebar-value {
  color: var(--text);
}

.sidebar-value.code {
  font-family: var(--font-mono);
  color: var(--accent);
}

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.error-panel {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border: 2px solid var(--error);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(201, 74, 50, 0.2);
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

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

.error-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--error);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.error-code {
  font-size: 1.5rem;
  font-weight: 700;
}

.error-body {
  padding: var(--space-2xl) var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-align: center;
}

.error-title {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--error);
  margin-bottom: var(--space-md);
}

.error-message {
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.error-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  text-align: left;
}

.error-detail-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border);
}

.error-detail-line:last-child {
  border-bottom: none;
}

.error-detail-key {
  color: var(--text-dim);
}

.error-detail-value {
  color: var(--accent);
  font-family: var(--font-ui);
  font-weight: 500;
}

.error-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

/* ---- Downloads dock (js/main.js initDownloads) ---- */
.dl-dock {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs);
  background: rgba(33, 30, 26, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeSlideUp 0.6s var(--ease-out) 0.6s both;
}

.dl-dock a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 40px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.dl-dock a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dl-main {
  padding: 0 var(--space-lg);
  font-size: 0.875rem;
  color: var(--bg);
  background: var(--primary);
}

.dl-main:hover {
  color: var(--bg);
  background: var(--accent);
  transform: translateY(-1px);
}

.dl-main .dl-ext {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.75;
}

.dl-cv {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: var(--space-sm);
}

.dl-cv-label {
  padding-right: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dl-cv a {
  min-width: 40px;
  padding: 0 var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  border: 1px solid var(--border);
}

.dl-cv a:hover {
  color: var(--bg);
  background: var(--primary);
  border-color: var(--primary);
}

/* Mobile: full-width bottom bar, every label visible */
@media (max-width: 640px) {
  .dl-dock {
    left: var(--space-sm);
    right: var(--space-sm);
    bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius-lg);
  }
  .dl-main {
    flex: 1;
    min-height: 44px;
    border-radius: var(--radius-md);
  }
  .dl-cv a {
    min-height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
  }
  html.has-dl-dock body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

@media print {
  .dl-dock { display: none; }
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--primary);
  color: var(--bg);
  font-weight: 600;
  border-radius: var(--radius-md);
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-lg);
}

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* =========================================================
   Motion system (hero, reveal, globe) + mobile nav
   ========================================================= */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Home hero ---- */
.hero-ascii { display: none; position: relative; }

@media (min-width: 900px) {
  .hero-ascii {
    display: block;
    animation: fadeSlideUp 0.7s var(--ease-out) both;
  }
}

.hero-ascii::before {
  content: '';
  position: absolute;
  left: -60px; top: -50px;
  width: 380px; height: 320px;
  background: radial-gradient(closest-side, rgba(201,106,50,0.20), transparent 72%);
  pointer-events: none;
  animation: glowBreath 5s ease-in-out infinite;
}

@keyframes glowBreath {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50%      { opacity: 1;    transform: scale(1.06); }
}

.arch-logo {
  position: relative;
  display: inline-block;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.15;
  min-height: calc(19 * 1.15em);
  color: var(--primary);
  white-space: pre;
  overflow: visible;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  user-select: none;
  filter: drop-shadow(0 0 8px rgba(201, 106, 50, 0.4));
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .arch-logo.animated {
    background-image: linear-gradient(100deg, #a85728 0%, #c96a32 30%, #ffdcb8 48%, #c96a32 66%, #a85728 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: archShine 5s linear infinite, archPulse 2.5s ease-in-out infinite;
  }
}

@keyframes archShine {
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}

@keyframes archPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(201,106,50,0.35)); }
  50%      { filter: drop-shadow(0 0 16px rgba(201,106,50,0.7)); }
}

@media (max-width: 1200px) { .arch-logo { font-size: 0.55rem; } }

html.js .arch-logo:not(.is-ready),
html.js .earth-logo:not(.is-ready) {
  visibility: hidden;
  animation: showFailsafe 0s 3s forwards;
}
@keyframes showFailsafe { to { visibility: visible; } }

/* Terminal: pure-CSS typewriter (no JS, no layout shift) */
.hero-terminal { animation: fadeSlideUp 0.6s var(--ease-out) 0.1s both; }
.hero-intro    { animation: fadeSlideUp 0.6s var(--ease-out) 0.2s both; }
.hero-cta      { animation: fadeSlideUp 0.6s var(--ease-out) 0.35s both; }
.hero-side     { animation: fadeSlideUp 0.6s var(--ease-out) 0.25s both; }

.hero-terminal .terminal-line {
  animation: lineIn 0.01s linear var(--d, 0s) both;
}
@keyframes lineIn { from { opacity: 0; } to { opacity: 1; } }

.hero-terminal .command.typed {
  display: inline-block;
  box-sizing: content-box;
  overflow: hidden;
  white-space: pre;
  width: calc(var(--n) * 1ch);
  border-right: 2px solid transparent;
  animation:
    typing var(--t, 0.5s) steps(var(--n)) calc(var(--d, 0s) + 0.25s) both,
    caret  var(--t, 0.5s) linear calc(var(--d, 0s) + 0.25s) both;
}
@keyframes typing { from { width: 0; } to { width: calc(var(--n) * 1ch); } }
@keyframes caret {
  0%, 99% { border-right-color: var(--primary); }
  100%    { border-right-color: transparent; }
}

.sysinfo-grid > * {
  animation: fadeSlideUp 0.5s var(--ease-out) calc(0.55s + var(--i, 0) * 70ms) both;
}
.sysinfo-title::after {
  content: '';
  margin-left: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: ping 2s ease-out infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(106,156,90,0.6); }
  80%, 100% { box-shadow: 0 0 0 7px rgba(106,156,90,0); }
}

/* ---- About hero ---- */
.about-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg) var(--space-2xl);
  align-items: start;
  margin-bottom: var(--space-2xl);
}

.about-intro { min-width: 0; }

@media (min-width: 768px) {
  .about-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "intro globe" "meta globe";
    align-items: center;
  }
  .about-intro { grid-area: intro; }
  .about-meta  { grid-area: meta; }
  .about-header .about-ascii { grid-area: globe; display: block; }
}

.about-ascii { display: none; position: relative; }

.about-ascii::before {
  content: '';
  position: absolute;
  inset: -10%;
  background: radial-gradient(closest-side, rgba(106,156,90,0.16), transparent 75%);
  pointer-events: none;
  animation: glowBreath 6s ease-in-out infinite;
}

.earth-logo {
  position: relative;
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  line-height: 1.2;
  color: #5f564c;
  text-align: left;
  white-space: pre;
  overflow: visible;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  user-select: none;
  cursor: grab;
  touch-action: pan-y;
  filter: drop-shadow(0 0 12px rgba(106,156,90,0.28));
}
.earth-logo.is-dragging { cursor: grabbing; }
.earth-logo .go  { color: #5f564c; }
.earth-logo .gl1 { color: #4f7d41; }
.earth-logo .gl2 { color: #6a9c5a; }
.earth-logo .gl3 { color: #a4d48f; }
.earth-logo .gs  { color: #6d6357; }
.earth-logo .gm  { color: #ffb26b; text-shadow: 0 0 8px rgba(255,178,107,0.9); font-weight: 700; }

@media (min-width: 768px) and (max-width: 1000px) { .earth-logo { font-size: 0.45rem; } }

.about-intro > *, .about-meta-item {
  animation: fadeSlideUp 0.7s var(--ease-out) calc(0.1s + var(--i, 0) * 90ms) both;
}
.about-intro > :nth-child(2) { --i: 1; }
.about-intro > :nth-child(3) { --i: 2; }
.about-intro > :nth-child(4) { --i: 3; }
.about-meta-item:nth-child(1) { --i: 4; }
.about-meta-item:nth-child(2) { --i: 5; }
.about-meta-item:nth-child(3) { --i: 6; }
.about-meta-item:nth-child(4) { --i: 7; }
.about-ascii { animation: fadeSlideUp 0.9s var(--ease-out) 0.25s both; }
@media (max-width: 767px) { .about-ascii { animation: none; } }

/* ---- Article pages: header entrance ---- */
.article-header > * { animation: fadeSlideUp 0.7s var(--ease-out) calc(var(--i, 0) * 90ms) both; }
.article-header > :nth-child(2) { --i: 1; }
.article-header > :nth-child(3) { --i: 2; }

/* ---- Scroll reveal ----
   Elements are hidden only while JS is armed (html.js). The animation uses
   fill-mode "both", so there is never a visible frame before it starts, and
   the class is released on animationend so hover transforms work again. */
@media (prefers-reduced-motion: no-preference) {
  html.js .stagger-in > *,
  html.js .article-section,
  html.js .sidebar-card,
  html.js .section-header { opacity: 0; }

  html.js .stagger-in > .is-in,
  html.js .article-section.is-in,
  html.js .sidebar-card.is-in,
  html.js .section-header.is-in {
    animation: rise 0.7s var(--ease-out) var(--rd, 0s) both;
  }

  html.js .stagger-in > .is-done,
  html.js .article-section.is-done,
  html.js .sidebar-card.is-done,
  html.js .section-header.is-done {
    opacity: 1;
    animation: none;
  }
}

@media print {
  html.js .stagger-in > *, html.js .article-section,
  html.js .sidebar-card, html.js .section-header { opacity: 1 !important; animation: none !important; }
}

/* ---- Mobile nav (button lives inside .site-nav, so hide only the list) ---- */
@media (max-width: 640px) {
  .mobile-menu-btn { display: flex; }

  .nav-list {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility 0s linear 200ms;
  }

  .site-nav.is-open .nav-list {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .nav-link { width: 100%; justify-content: flex-start; }
}
