:root {
  --bg: #0b0b0c;
  --fg: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.65);
  --accent: #ff2d2d;
  --accent-hover: #ff4d4d;
  --hairline: rgba(255, 255, 255, 0.12);
  --maxw: 1100px;
  --line-y: 45vh;
  --line-left: clamp(16px, 5vw, 56px);
  --mouse-x: 50vw;
  --mouse-y: 50vh;
  --grid-spot-x: 50vw;
  --grid-spot-y: 50vh;
  --grid-shift-alpha: 0;
  --halo-size: 570px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    radial-gradient(circle at 5% 0%, rgba(255, 255, 255, 0.035), transparent 40%),
    var(--bg);
  background-size:
    80px 80px,
    80px 80px,
    auto,
    auto;
  color: var(--fg);
  font-family: Inter, sans-serif;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    var(--halo-size) circle at var(--mouse-x) var(--mouse-y),
    rgba(255, 45, 45, 0.06),
    rgba(255, 45, 45, 0.02) 35%,
    transparent 68%
  );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      rgba(255, 255, 255, var(--grid-shift-alpha)) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, var(--grid-shift-alpha)) 1px,
      transparent 1px
    );
  background-size: 80px 80px, 80px 80px;
  -webkit-mask-image: radial-gradient(
    620px circle at var(--grid-spot-x) var(--grid-spot-y),
    rgba(0, 0, 0, 0.95),
    transparent 72%
  );
  mask-image: radial-gradient(
    620px circle at var(--grid-spot-x) var(--grid-spot-y),
    rgba(0, 0, 0, 0.95),
    transparent 72%
  );
}

a {
  color: inherit;
}

.container {
  width: min(calc(100% - 3rem), var(--maxw));
  margin: 0 auto;
}

.container.narrow {
  width: min(calc(100% - 3rem), 850px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem clamp(1rem, 2vw, 2rem);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  gap: 1.25rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  transition: transform 150ms ease, color 150ms ease;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
  color: var(--fg);
  transform: translateY(-2px);
}

.section {
  position: relative;
  z-index: 2;
  padding: clamp(4rem, 8vw, 7rem) 0;
  border-bottom: 1px solid var(--hairline);
}

.section::after {
  content: "";
  position: absolute;
  left: var(--line-left);
  bottom: -1px;
  width: 38px;
  height: 1px;
  background: var(--accent);
  opacity: 0.95;
}

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  padding-top: clamp(5rem, 11vw, 8.5rem);
  padding-bottom: clamp(3.5rem, 8vh, 6rem);
}

.hero .container {
  position: static;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(3.2rem, 12vw, 9.5rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.hero-dot {
  color: var(--accent);
}

.hero-dot-pulse {
  font-size: 0.87em;
  animation: heroDotPulse 3s ease-in-out infinite;
}

@keyframes heroDotPulse {
  0% {
    text-shadow:
      0 0 0 rgba(255, 45, 45, 0),
      0 0 0 rgba(255, 45, 45, 0);
  }
  50% {
    text-shadow:
      0 0 12px rgba(255, 45, 45, 0.75),
      0 0 24px rgba(255, 45, 45, 0.55),
      0 0 40px rgba(255, 45, 45, 0.35);
  }
  100% {
    text-shadow:
      0 0 0 rgba(255, 45, 45, 0),
      0 0 0 rgba(255, 45, 45, 0);
  }
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  margin-bottom: 1.15rem;
}

.hero-lines {
  position: relative;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.25rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.45rem, 3.2vw, 2.5rem);
  line-height: 1.2;
}

.hero-line {
  display: inline-block;
  color: rgba(245, 245, 245, 0.82);
  transition: color 180ms ease;
}

.hero-keyword {
  color: rgba(245, 245, 245, 0.92);
  opacity: 0.82;
  text-shadow: 0 0 0 rgba(255, 45, 45, 0);
  transition:
    color 1500ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 1500ms cubic-bezier(0.22, 1, 0.36, 1),
    text-shadow 1500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-keyword.is-active {
  color: var(--accent);
  opacity: 1;
  text-shadow: 0 0 10px rgba(255, 45, 45, 0.22);
}

.descriptor {
  margin: 1.4rem 0 0;
  color: var(--muted);
}

.hero-cta {
  margin-top: 5.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  padding: 0.8rem 1.3rem;
  font-size: 1.125rem;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.text-link {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease, color 150ms ease;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--fg);
  text-decoration-color: var(--accent);
}

.terminal {
  margin-top: 7.2rem;
  max-width: 28rem;
  border: 1px solid var(--hairline);
  padding: 0.9rem 1rem;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.hero-scroll-hint {
  position: absolute;
  right: max(32px, calc((100vw - var(--maxw)) / 2 + 32px));
  bottom: 0.9rem;
  display: grid;
  gap: 0.2rem;
  justify-items: end;
  text-align: right;
}

.hero-scroll-hint span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hero-scroll-hint strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--accent);
  animation: scrollArrowBob 1.4s ease-in-out infinite;
}

@keyframes scrollArrowBob {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
  100% {
    transform: translateY(0);
  }
}

.cursor {
  display: inline-block;
  width: 0.65ch;
  margin-left: 0.25ch;
  border-bottom: 2px solid var(--accent);
  animation: blink 1s steps(1, end) infinite;
  vertical-align: -0.08em;
}

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

#about p {
  margin: 0.45rem 0;
  max-width: 52ch;
  color: var(--muted);
}

#about p:last-child {
  margin-bottom: 0;
}

#about #about-line-1 {
  color: var(--muted);
  font-weight: 400;
  font-size: 1.02rem;
  line-height: 1.6;
}

.about-title {
  position: relative;
  display: inline-block;
}

.about-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: transform 260ms ease, opacity 260ms ease;
}

.about-title.is-underlined::after {
  transform: scaleX(1);
  opacity: 1;
}

#about .container.narrow {
  transform: translateX(150px);
}

#about.section,
#work.section {
  padding-bottom: clamp(6rem, 10vw, 9rem);
}

.work-list {
  display: grid;
  width: min(100%, 980px);
  margin: 110px auto 0;
  gap: 40px;
}

.work-item {
  padding: 1.75rem 2rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.reveal-card {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(2px);
  transition:
    opacity 520ms ease,
    transform 520ms ease,
    filter 520ms ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
  will-change: opacity, transform, filter;
}

.reveal-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.system-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 60, 60, 0.35);
  box-shadow:
    0 0 18px rgba(255, 60, 60, 0.12),
    0 0 50px rgba(255, 60, 60, 0.05);
}

.systems-subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1.02rem;
}

.systems-subtitle-secondary {
  opacity: 0.65;
  font-size: 0.95em;
  margin-bottom: 0;
}

#about #about-line-2,
#about #about-line-3,
.contact-availability {
  opacity: 0.65;
  font-size: 0.95em;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
}

.system-category {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.system-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.system-label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex: 0 0 6px;
  transition: box-shadow 0.2s ease;
}

.system-card:hover .system-label-dot {
  box-shadow: 0 0 8px rgba(255, 60, 60, 0.8);
}

.system-name {
  margin: 12px 0 0;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  letter-spacing: -0.02em;
}

.system-desc {
  margin: 18px 0 0;
  color: var(--muted);
  max-width: 75ch;
}

.system-stack-title {
  margin: 22px 0 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.system-stack {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86rem;
}

.system-stack .system-stack-tech {
  color: var(--muted);
}

.system-stack .stack-separator {
  color: var(--muted);
  opacity: 0.6;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.system-card:hover .system-stack .system-stack-tech {
  color: var(--muted);
}

.system-card:hover .system-stack .stack-separator {
  color: var(--accent);
  opacity: 0.9;
}

.system-card-active {
  border-color: color-mix(in srgb, var(--accent) 35%, rgba(255, 255, 255, 0.06));
}

.system-active-label {
  margin: 0;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.systems-cta {
  padding: 1.25rem 1.35rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.systems-cta-line {
  margin: 0;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.98rem;
  line-height: 1.6;
}

.systems-cta-link {
  display: inline-block;
  margin-top: 0.15rem;
  color: var(--fg);
  text-decoration: none;
  transition: color 180ms ease;
}

.systems-cta-link:hover,
.systems-cta-link:focus-visible {
  color: var(--accent);
}

.systems-cta-cursor {
  color: var(--accent);
  animation: systemsCtaCursorBlink 1s steps(1, end) infinite;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid var(--hairline);
  padding: 1rem;
}

.card h3 {
  font-size: 1.16rem;
  margin-bottom: 0.7rem;
}

.card ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

.process-list {
  margin: 0;
  padding-left: 1.3rem;
  display: grid;
  gap: 0.9rem;
}

.process-list li {
  padding-left: 0.3rem;
}

.process-list li strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.12rem;
}

.process-list li small {
  display: block;
  color: var(--muted);
  margin-top: 0.1rem;
}

.contact-kicker {
  margin: 0 0 22px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.1;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.contact-content {
  max-width: 52ch;
}

.contact-title {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  font-weight: 400;
  max-width: 520px;
}

.contact-row {
  margin: 28px 0 0;
}

.contact-row a {
  font-size: 1.35rem;
  font-weight: 600;
  text-decoration: none;
}

.contact-row a:hover,
.contact-row a:focus-visible {
  color: var(--accent-hover);
}

.contact-row a:hover .hero-dot,
.contact-row a:focus-visible .hero-dot {
  color: var(--fg);
}

.contact-availability {
  margin: 10px 0 0;
  color: var(--muted);
}

#contact .btn {
  margin-top: 28px;
  padding: 0.7rem 1.15rem;
  font-size: 1rem;
}

.footer {
  position: relative;
  z-index: 2;
  padding: 1.25rem 0 2rem;
}

.footer .container {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.86rem;
}

.footer .container p {
  margin: 0;
  transition: color 180ms ease;
}

.footer .container p:hover {
  color: var(--accent);
}

.footer .container .footer-brand:hover .hero-dot {
  color: var(--fg);
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

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

  #about .container.narrow {
    transform: none;
  }

  .about-title::after {
    transition: none;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-start;
  }
  .hero-scroll-hint {
    right: 20px;
    bottom: 0.75rem;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
  .hero-scroll-hint strong {
    animation: none;
  }

  .reveal-card {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

@media (hover: none), (pointer: coarse) {
  body::before {
    display: none;
  }
  body::after {
    display: none;
  }
}
