:root {
  --bg-0: #060b17;
  --bg-1: #0d1424;
  --panel: rgba(10, 18, 35, 0.75);
  --panel-strong: rgba(13, 25, 47, 0.88);
  --line: rgba(90, 187, 255, 0.28);
  --text: #d8e6ff;
  --muted: #84a4c7;
  --brand: #3de0ff;
  --brand-2: #4effb2;
  --danger: #ff5ec9;
  --shadow: 0 14px 50px rgba(0, 0, 0, 0.45);
  --grid-shift-x: 0px;
  --grid-shift-y: 0px;
  --glow-shift-x: 0px;
  --glow-shift-y: 0px;
  --glow-b-shift-x: 0px;
  --glow-b-shift-y: 0px;
  --grid-spot-x: 50%;
  --grid-spot-y: 35%;
}

[data-theme="light"] {
  --bg-0: #ebf2ff;
  --bg-1: #f6fbff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --line: rgba(32, 109, 190, 0.3);
  --text: #0f2244;
  --muted: #355987;
  --brand: #0066ff;
  --brand-2: #0ea16d;
  --danger: #c32182;
  --shadow: 0 14px 35px rgba(15, 40, 80, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background-color: var(--bg-0);
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, rgba(79, 181, 255, 0.2), transparent 30%),
    radial-gradient(circle at 80% 90%, rgba(78, 255, 178, 0.16), transparent 28%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1));
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.mono {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.02em;
}

.site-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 35%, black 45%, transparent 100%);
  transform: translate3d(var(--grid-shift-x), var(--grid-shift-y), 0);
  transition: transform 160ms ease-out;
}

.home-page.grid-hover-enabled .bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--grid-spot-x) var(--grid-spot-y), rgba(78, 233, 255, 0.24), transparent 28%);
  opacity: 0;
  transition: opacity 200ms ease;
}

.home-page.grid-hover-enabled.grid-hover-active .bg-grid::after {
  opacity: 1;
}

.bg-glow {
  position: absolute;
  width: min(34vw, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(70px);
}

.bg-glow-a {
  top: 6%;
  left: 4%;
  background: rgba(62, 152, 255, 0.35);
  transform: translate3d(var(--glow-shift-x), var(--glow-shift-y), 0);
  transition: transform 190ms ease-out;
}

.bg-glow-b {
  right: 3%;
  bottom: 8%;
  background: rgba(78, 255, 178, 0.2);
  transform: translate3d(var(--glow-b-shift-x), var(--glow-b-shift-y), 0);
  transition: transform 220ms ease-out;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
  background: rgba(7, 16, 32, 0.45);
  border-bottom: 1px solid var(--line);
  transition: transform 0.35s ease;
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.navbar-themed .navbar-brand {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
}

.tiny {
  font-size: 0.7rem;
  color: var(--muted);
}

.nav-link {
  color: var(--muted);
  position: relative;
  margin-left: 0.25rem;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.2rem;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

.navbar-toggler {
  border-color: var(--line);
  color: var(--brand);
}

.navbar-toggler:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(61, 224, 255, 0.2);
}

#theme-toggler {
  border-color: var(--line);
  color: var(--brand);
  min-width: 8.75rem;
}

.site-main {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.hero-shell {
  min-height: calc(100vh - 140px);
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: center;
}

.hero-panel,
.hero-card,
.page-shell,
.post.card,
.project.card,
.timeline-body,
.search-box,
.input-group-text,
.list-group-item,
.card,
.fs-form {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 14px;
}

.hero-panel {
  padding: clamp(1.3rem, 3vw, 2.2rem);
}

.hero-kicker {
  color: var(--brand-2);
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}

.hero-title {
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 0.95;
  margin-bottom: 1rem;
}

.hero-title .hero-line {
  display: block;
  font-size: clamp(1rem, 2.1vw, 1.5rem);
  color: var(--muted);
  margin-top: 1rem;
  line-height: 1.3;
}

.hero-subtitle {
  color: var(--muted);
  max-width: 52ch;
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.hero-card {
  padding: 1.2rem;
}

.hero-card h2 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--brand);
  text-transform: uppercase;
}

.hero-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hero-card li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--line);
}

.hero-card li:last-child {
  border-bottom: 0;
}

.hero-card span {
  color: var(--muted);
}

.page-shell {
  padding: clamp(1rem, 2.5vw, 2rem);
}

.page-title {
  margin-bottom: 1.2rem;
  font-size: clamp(1.7rem, 4.5vw, 2.8rem);
  letter-spacing: -0.02em;
}

.markdown-body p,
.markdown-body li,
.markdown-body label {
  color: var(--text);
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.8rem;
}

.markdown-body a {
  color: var(--brand);
}

.markdown-body a:hover {
  color: var(--brand-2);
}

.markdown-body code.highlighter-rouge,
.markdown-body pre {
  color: #d8f0ff;
  background: rgba(0, 8, 20, 0.92);
  border: 1px solid rgba(108, 190, 255, 0.3);
}

.markdown-body {
  overflow-wrap: anywhere;
}

.markdown-body img:not(.emoji),
.markdown-body figure img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 1rem auto;
  border-radius: 10px;
}

.markdown-body figure {
  max-width: 100%;
}

.markdown-body pre,
.markdown-body .highlight {
  overflow-x: auto;
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.markdown-body .highlight pre {
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}

.markdown-body .highlight .c,
.markdown-body .highlight .cm,
.markdown-body .highlight .c1,
.markdown-body .highlight .cs {
  color: #7f9bb7;
  font-style: italic;
}

.markdown-body .highlight .k,
.markdown-body .highlight .kc,
.markdown-body .highlight .kd,
.markdown-body .highlight .kn,
.markdown-body .highlight .kp,
.markdown-body .highlight .kr,
.markdown-body .highlight .kt {
  color: #64d8ff;
}

.markdown-body .highlight .na,
.markdown-body .highlight .nb,
.markdown-body .highlight .nc,
.markdown-body .highlight .nf,
.markdown-body .highlight .nn {
  color: #7effba;
}

.markdown-body .highlight .s,
.markdown-body .highlight .s1,
.markdown-body .highlight .s2,
.markdown-body .highlight .se,
.markdown-body .highlight .si,
.markdown-body .highlight .sr {
  color: #ffd379;
}

.markdown-body .highlight .m,
.markdown-body .highlight .mi,
.markdown-body .highlight .mf,
.markdown-body .highlight .il {
  color: #ff9ccf;
}

.markdown-body .highlight .o,
.markdown-body .highlight .ow {
  color: #b9d8ff;
}

.post.card,
.project.card,
.card {
  text-decoration: none;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.post.card:hover,
.project.card:hover,
.card:hover {
  transform: translateY(-6px);
  border-color: rgba(94, 240, 255, 0.45);
}

.card-footer,
.card-body,
.card-title,
.card-text,
.text-themed,
.text-muted,
.small {
  color: var(--text) !important;
}

.badge,
.badge-info,
.badge-primary,
.badge-success,
.badge-secondary,
.badge-danger,
.badge-pill {
  background: rgba(58, 128, 214, 0.2) !important;
  color: var(--brand) !important;
  border: 1px solid rgba(65, 194, 255, 0.38) !important;
}

.search-box,
.form-control,
.fs-input,
.fs-textarea {
  background: var(--panel-strong) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
}

.search-box::placeholder,
.fs-input::placeholder,
.fs-textarea::placeholder {
  color: var(--muted);
}

.fs-form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.fs-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.fs-input,
.fs-textarea {
  width: 100%;
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
}

.fs-button-group {
  display: flex;
  justify-content: flex-end;
}

.fs-description {
  margin-top: 0.35rem;
  color: var(--muted);
}

.btn-info,
.fs-button {
  color: #041423;
  border: none;
  background-image: linear-gradient(100deg, var(--brand), var(--brand-2));
  font-weight: 700;
}

.btn-outline-info {
  border-color: var(--line);
  color: var(--brand);
}

.timeline-body {
  border-radius: 12px;
}

.timeline-body:after {
  background-color: var(--brand);
}

.timeline-body .timeline-item:after {
  border-color: var(--brand);
  background: var(--bg-0);
}

.timeline-body .timeline-item .content {
  border-bottom: 1px dashed var(--line);
}

.social {
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.social:hover {
  color: var(--brand);
  transform: translateY(-2px);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(7, 15, 31, 0.5);
}

.reveal-up {
  opacity: 0;
  transform: translateY(14px);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

@media (max-width: 991px) {
  .hero-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 1rem;
  }

  .hero-panel,
  .hero-card {
    width: 100%;
  }

  .hero-title {
    line-height: 1.02;
  }

  .hero-title .hero-line {
    margin-top: 0.75rem;
  }

  .navbar-nav {
    margin-top: 0.8rem;
  }

  .nav-link {
    margin-left: 0;
    padding: 0.55rem 0.25rem;
  }

  .nav-link::after {
    left: 0.25rem;
    right: 0.25rem;
    bottom: 0.1rem;
  }

  .site-main {
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
  }

  .page-shell {
    padding: 1rem;
  }
}

@media (max-width: 767px) {
  .hero-actions {
    gap: 0.55rem;
  }

  .hero-actions .btn {
    width: 100%;
    min-height: 2.8rem;
  }

  .hero-card li {
    gap: 0.45rem;
    align-items: flex-start;
  }

  .site-footer {
    padding-top: 1.1rem !important;
    padding-bottom: 1.1rem !important;
  }

  .social {
    margin-inline: 0.65rem;
  }

  .fs-button-group {
    justify-content: stretch;
  }

  .fs-button-group .fs-button,
  .fs-button-group .btn {
    width: 100%;
  }
}

@media (max-width: 575px) {
  .hero-panel,
  .hero-card,
  .page-shell,
  .post.card,
  .project.card,
  .timeline-body,
  .search-box,
  .card,
  .fs-form {
    border-radius: 10px;
  }

  .hero-kicker {
    font-size: 0.8rem;
    margin-bottom: 0.55rem;
  }

  .hero-title {
    font-size: clamp(1.7rem, 11vw, 2.4rem);
  }

  .hero-title .hero-line {
    font-size: clamp(0.92rem, 4.3vw, 1.1rem);
  }

  .hero-subtitle {
    font-size: 0.96rem;
  }

  .hero-card li {
    flex-direction: column;
    padding: 0.6rem 0;
  }

  .site-main {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .page-title {
    margin-bottom: 1rem;
  }

  .timeline-body .timeline-item .content {
    padding-right: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
