:root {
  --bg: #06110e;
  --bg-soft: #0b1915;
  --panel: rgba(8, 23, 18, 0.84);
  --panel-strong: rgba(10, 28, 22, 0.96);
  --line: rgba(111, 247, 176, 0.18);
  --line-strong: rgba(111, 247, 176, 0.42);
  --text: #ecfff4;
  --muted: #8eae9e;
  --accent: #6ff7b0;
  --accent-strong: #35d6ff;
  --accent-warm: #ff8f5a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 1180px;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", "Courier New", monospace;
  --sans: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

body.theme-demonic {
  --bg: #120605;
  --bg-soft: #190907;
  --panel: rgba(26, 10, 10, 0.84);
  --panel-strong: rgba(34, 11, 11, 0.96);
  --line: rgba(255, 93, 80, 0.2);
  --line-strong: rgba(255, 108, 92, 0.42);
  --text: #fff1ed;
  --muted: #cda59b;
  --accent: #ff6b57;
  --accent-strong: #ff9a5f;
  --accent-warm: #ffcf66;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(53, 214, 255, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(111, 247, 176, 0.08), transparent 30%),
    linear-gradient(180deg, #081613 0%, #050b09 100%);
  overflow-x: hidden;
}

body.theme-demonic {
  background:
    radial-gradient(circle at top left, rgba(255, 92, 67, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 169, 110, 0.08), transparent 26%),
    linear-gradient(180deg, #140707 0%, #090303 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(111, 247, 176, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 247, 176, 0.025) 1px, transparent 1px);
  background-size: 100% 30px, 30px 100%;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(111, 247, 176, 0.06) 50%, transparent 100%);
  animation: scan 12s linear infinite;
  pointer-events: none;
  z-index: -1;
}

.page-noise {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 0.6px, transparent 0.6px);
  background-size: 10px 10px;
  opacity: 0.04;
  pointer-events: none;
  z-index: -1;
}

#symbol-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.78;
}

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

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: calc(var(--max-width) + 48px);
  margin: 0 auto;
  padding: 18px 24px;
  background: rgba(6, 17, 14, 0.76);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(111, 247, 176, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav a,
.nav-toggle {
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  transition: 0.25s ease;
}

.nav a:hover,
.nav a:focus-visible,
.nav-toggle:hover,
.nav-toggle:focus-visible {
  color: var(--text);
  border-color: var(--line);
  background: rgba(111, 247, 176, 0.06);
}

.nav-toggle {
  display: none;
  background: transparent;
  cursor: pointer;
}

.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 120px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr;
  gap: 28px;
  align-items: stretch;
  padding: 48px 0 32px;
}

.hero-copy,
.terminal-card,
.panel,
.project-card,
.info-card,
.contact-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 38px;
  border-radius: var(--radius-lg);
}

.eyebrow,
.section-kicker,
.modal-kicker {
  margin-bottom: 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.5rem, 4vw, 4.6rem);
  line-height: 0.97;
  letter-spacing: -0.04em;
}

.hero-text,
.section-heading p,
.focus-card p,
.project-description,
.info-card li,
.modal-content,
.contact-list a,
.discord-button {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 62ch;
  margin-top: 22px;
  font-size: 1.05rem;
}

.typing-shell {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin-top: 30px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 15, 12, 0.75);
  font-family: var(--mono);
  color: var(--text);
}

.shell-prefix,
.terminal-prompt {
  color: var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  transition: 0.22s ease;
}

.button-primary {
  color: #04100c;
  background: linear-gradient(135deg, var(--accent) 0%, #9dffd0 100%);
}

.button-primary:hover,
.button-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(111, 247, 176, 0.18);
}

.button-secondary {
  border: 1px solid var(--line-strong);
  background: rgba(111, 247, 176, 0.05);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: rgba(111, 247, 176, 0.11);
  transform: translateY(-2px);
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.point-card,
.metric-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(111, 247, 176, 0.04);
  border: 1px solid rgba(111, 247, 176, 0.08);
}

.point-label,
.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.point-card strong,
.metric-card strong {
  font-size: 0.98rem;
  line-height: 1.4;
}

.hero-terminal {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.hero-portrait-shell {
  position: relative;
  padding: 22px 22px 0;
}

.portrait-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(53, 214, 255, 0.08), transparent 50%),
    rgba(6, 16, 13, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body.theme-demonic .portrait-frame {
  background:
    radial-gradient(circle at top, rgba(255, 214, 170, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 107, 87, 0.12), transparent 50%),
    rgba(18, 7, 7, 0.92);
}

.hero-portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  filter: saturate(1.08) contrast(1.05);
}

.portrait-badge {
  position: absolute;
  left: 38px;
  bottom: 16px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(4, 12, 10, 0.78);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.83rem;
}

.terminal-lights {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.terminal-lights span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.terminal-lights span:nth-child(1) {
  background: #ff6b6b;
}

.terminal-lights span:nth-child(2) {
  background: #ffd166;
}

.terminal-lights span:nth-child(3) {
  background: #6ff7b0;
}

.terminal-body {
  display: grid;
  gap: 12px;
  padding: 22px 20px 12px;
  font-family: var(--mono);
}

.terminal-row {
  display: grid;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(111, 247, 176, 0.08);
}

.accent-line {
  color: var(--accent-strong);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
}

.panel {
  margin-top: 28px;
  padding: 34px;
  border-radius: var(--radius-lg);
}

.section-heading {
  max-width: 760px;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  margin-bottom: 16px;
}

.focus-grid,
.projects-grid {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

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

.focus-card,
.stack-card,
.project-card,
.info-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
}

.focus-card {
  padding: 24px;
  background: rgba(9, 24, 19, 0.72);
  border: 1px solid rgba(111, 247, 176, 0.12);
}

.focus-index {
  display: inline-flex;
  margin-bottom: 22px;
  color: var(--accent-warm);
  font-family: var(--mono);
  font-size: 0.86rem;
  letter-spacing: 0.12em;
}

.focus-card h3,
.stack-card h3,
.project-card h3,
.info-card h3 {
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.stack-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.stack-card {
  padding: 24px;
  background: rgba(9, 24, 19, 0.68);
  border: 1px solid rgba(53, 214, 255, 0.12);
}

.chip-group,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.project-tags span {
  padding: 8px 12px;
  border: 1px solid rgba(111, 247, 176, 0.12);
  border-radius: 999px;
  background: rgba(111, 247, 176, 0.05);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(53, 214, 255, 0.05), transparent 28%),
    rgba(8, 24, 19, 0.84);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(111, 247, 176, 0.22);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.project-kind {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.project-actions a,
.link-button {
  color: var(--accent-strong);
}

.link-button {
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.split-panel .two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.info-card {
  padding: 24px;
  background: rgba(9, 24, 19, 0.7);
}

.clean-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.clean-list li::before {
  content: "> ";
  color: var(--accent);
  font-family: var(--mono);
}

.contact-card {
  margin-top: 24px;
}

.contact-shell {
  border-radius: 24px;
  overflow: hidden;
}

.contact-list {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.contact-list a,
.discord-button {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  background: rgba(111, 247, 176, 0.05);
  border: 1px solid rgba(111, 247, 176, 0.08);
}

.discord-button {
  justify-content: flex-start;
}

.footer {
  padding: 28px 24px 42px;
  color: var(--muted);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.84rem;
}

.terminal-toggle-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(7, 18, 15, 0.9);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  cursor: pointer;
}

.theme-toggle-btn {
  position: fixed;
  right: 24px;
  bottom: 84px;
  z-index: 120;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(7, 18, 15, 0.9);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
  transform: translateY(-2px);
}

.theme-toggle-btn[aria-pressed="true"] {
  background: rgba(54, 14, 12, 0.95);
  border-color: rgba(255, 107, 87, 0.48);
}

.terminal-window {
  position: fixed;
  right: 24px;
  bottom: 86px;
  z-index: 130;
  width: min(560px, calc(100vw - 32px));
  display: none;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(4, 12, 10, 0.98);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.48);
}

.terminal-window.open {
  display: flex;
}

.terminal-close,
.modal-close {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(111, 247, 176, 0.08);
  color: var(--text);
  font-family: var(--mono);
  cursor: pointer;
}

.terminal-output {
  display: grid;
  gap: 10px;
  min-height: 280px;
  max-height: 360px;
  padding: 20px;
  overflow-y: auto;
  font-family: var(--mono);
  color: var(--text);
}

.terminal-line.is-accent {
  color: var(--accent);
}

.terminal-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid rgba(111, 247, 176, 0.08);
  background: rgba(8, 20, 16, 0.9);
  font-family: var(--mono);
}

#terminal-input {
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-family: var(--mono);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 8, 6, 0.84);
  backdrop-filter: blur(10px);
}

.modal.open {
  display: flex;
}

.modal-dialog {
  width: min(760px, 100%);
  padding: 28px;
  border-radius: 28px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 19, 15, 0.96);
  box-shadow: var(--shadow);
}

.modal-close {
  margin-left: auto;
  display: block;
}

.modal-dialog h2 {
  margin-top: 18px;
  margin-bottom: 16px;
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
}

.modal-content p + p {
  margin-top: 12px;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

[data-reveal].visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

@media (max-width: 1040px) {
  .hero,
  .projects-grid,
  .stack-layout,
  .focus-grid,
  .split-panel .two-column {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }

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

  .hero h1 {
    max-width: 100%;
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 16px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(8, 22, 18, 0.98);
    box-shadow: var(--shadow);
  }

  .nav.open {
    display: flex;
  }

  .layout {
    padding: 20px 16px 110px;
  }

  .hero-copy,
  .panel,
  .modal-dialog {
    padding: 24px;
  }

  .hero-points,
  .metrics-grid,
  .focus-grid,
  .stack-layout,
  .projects-grid,
  .split-panel .two-column {
    grid-template-columns: 1fr;
  }

  .typing-shell {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .terminal-window {
    right: 16px;
    bottom: 82px;
    width: calc(100vw - 32px);
  }

  .terminal-toggle-btn {
    right: 16px;
    bottom: 16px;
  }

  .theme-toggle-btn {
    right: 16px;
    bottom: 76px;
  }
}

@media (max-width: 520px) {
  .hero {
    padding-top: 18px;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .button {
    width: 100%;
  }

  .hero-actions {
    flex-direction: column;
  }
}
