:root {
  --bg-start: #0b1220;
  --bg-end: #111827;
  --text: #cbd5e1;
  --heading: #f8fafc;
  --highlight: #38bdf8;
  --accent: #334155;
  --surface: rgb(8 22 42 / 35%);
  --button-text: #0b1220;
  --danger: #fda4af;

  --page-scrollbar-radius: 32;
  --page-scrollbar-stroke: 7;
  --page-scrollbar-inset: 4;
  --page-scrollbar-thumb: 80;
  --page-scrollbar-finish: 5;
  --page-scrollbar-scroll-padding: 100;
  --page-scrollbar-trail: 0;
  --page-scrollbar-thumb-size: 80;
  --page-scrollbar-track-length: 0;
  --page-scrollbar-offset: 0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  isolation: isolate;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-start), var(--bg-end));
  min-height: 100vh;
  line-height: 1.6;
}

.water-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
}

.water-background--ready {
  opacity: 1;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
  background: var(--surface);
  border-bottom: 1px solid var(--accent);
}

.nav {
  width: calc(100% - 2rem);
  max-width: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  gap: 1rem;
}

.nav-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--text);
  border-radius: 0.4rem;
}

.social-links a:hover,
.social-links a:focus-visible {
  color: var(--highlight);
  background: var(--surface);
}

.social-links a:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

.social-links svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.brand {
  text-decoration: none;
  color: var(--heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: border-color 180ms ease, color 180ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  border-color: var(--highlight);
  color: var(--heading);
}

.section {
  padding: 4rem 0 3rem;
}

.hero {
  padding-top: 5rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--heading);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 1rem;
}

p {
  margin: 0 0 1rem;
}

.intro {
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.button {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgb(56 189 248 / 45%);
  background: rgb(56 189 248 / 22%);
  backdrop-filter: blur(8px);
  color: var(--heading);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -10px #000000;
}

.button:disabled,
.button--cooldown {
  cursor: not-allowed;
  opacity: 0.8;
  transform: none;
  box-shadow: none;
}

.button--pressed {
  animation: button-press-feedback 220ms ease;
}

.button--blocked {
  animation: button-block-feedback 320ms ease;
}

@keyframes button-press-feedback {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes button-block-feedback {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }

  100% {
    transform: translateX(0);
  }
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0;
}

.control--search {
  grid-column: 1 / -1;
}

.controls-toggles {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.controls-toggles .toggle {
  flex: 0 0 auto;
}

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

.control,
.toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  border-radius: 0.7rem;
  padding: 0.7rem;
}

.control {
  flex-direction: column;
  align-items: flex-start;
}

.control input,
.control select {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.6rem;
}

.control input::placeholder {
  color: var(--text);
}

.status {
  min-height: 1.4rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.status.error {
  color: var(--danger);
}

.status.loading {
  color: var(--heading);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.project-card {
  border: 1px solid var(--accent);
  border-radius: 0.9rem;
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.project-card--skeleton {
  pointer-events: none;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 0.9rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #334155 20%, #475569 50%, #334155 80%);
  background-size: 200% 100%;

}

.skeleton-title {
  width: 68%;
  height: 1.1rem;
}

.skeleton-description.short {
  width: 84%;
}

.skeleton-spacer {
  flex: 1;
}

.skeleton-meta {
  width: 56%;
}

.skeleton-stats-line {
  width: 74%;
}

.skeleton-updated-line {
  width: 64%;
}

.skeleton-button {
  width: 9.5rem;
  height: 2.2rem;
}


.project-card:hover,
.project-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -20px #000000;
}

.project-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--heading);
}

.project-meta {
  margin: 0;
  margin-top: auto;
  font-size: 0.95rem;
}

.project-stats {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
  opacity: 0.92;
}

.project-stats-line,
.project-updated {
  margin: 0;
}

.project-card .button {
  align-self: flex-start;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.contact-form {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.9rem;
  max-width: 680px;
}

.contact-form .control {
  margin: 0;
}

.contact-form-status {
  margin: 0;
  min-height: 1.4rem;
  font-weight: 600;
}

.contact-form-status--warning {
  color: var(--danger);
}

.control textarea {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  resize: vertical;
  min-height: 8rem;
}

.contact-honeypot {
  position: absolute;
  left: -9999px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .button:hover,
  .button:focus-visible,
  .project-card:hover,
  .project-card:focus-within {
    transform: none;
    box-shadow: none;
  }
}

@media (max-width: 950px) {
  .nav-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

@media (max-width: 800px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    flex-wrap: wrap;
  }
}

html[data-page-scrollbar] {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html[data-page-scrollbar]::-webkit-scrollbar,
html[data-page-scrollbar] body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.page-scrollbar {
  position: fixed;
  top: 0;
  right: 8px;
  height: 100vh;
  width: calc(var(--page-scrollbar-radius) * 2px);
  pointer-events: none;
  z-index: 2000;
  overflow: visible !important;
  opacity: 0;
  transition: opacity 220ms ease;
}

html[data-page-scrollbar] .page-scrollbar {
  opacity: 1;
}

.page-scrollbar path {
  stroke-width: calc(var(--page-scrollbar-stroke) * 1px);
  vector-effect: non-scaling-stroke;
}

.page-scrollbar__track {
  stroke: transparent;
}

.page-scrollbar__thumb {
  pointer-events: visibleStroke;
  cursor: grab;
  touch-action: none;
  stroke: rgb(100 156 184 / 50%);
  filter: drop-shadow(0 0 1px rgb(203 213 225 / 45%));
  stroke-dasharray: var(--page-scrollbar-thumb-size) var(--page-scrollbar-track-length);
  stroke-dashoffset: var(--page-scrollbar-offset);
}

html[data-scrollbar-dragging],
html[data-scrollbar-dragging] * {
  cursor: grabbing !important;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .page-scrollbar {
    transition: none;
  }
}

section[id] {
  scroll-margin-top: 5.5rem;
}

.hero {
  min-height: calc(100dvh - var(--header-height, 64px));
  display: flex;
  align-items: center;
  padding: 5rem 0;
}

.hero .container {
  width: min(880px, 92vw);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.6rem, 5.8vw, 4.8rem);
  max-width: 15ch;
  letter-spacing: -0.045em;
  margin-inline: auto;
}

.hero-actions {
  justify-content: center;
}

#about > .container,
#projects > .container:first-child,
#bad-apple > .container:first-child {
  text-align: center;
}

.eyebrow {
  color: var(--highlight);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.intro {
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 2rem;
  margin-inline: auto;
}

.button--secondary {
  background: var(--surface);
  border-color: var(--accent);
}

.section-subtitle, .tech-line {
  color: var(--text);
}

#projects .container {
  width: min(1280px, 92vw);
}

:is(#projects, #bad-apple) {
  padding-top: 1rem;
  scroll-margin-top: calc(var(--header-height, 64px) + 8px);
}

:is(#projects, #bad-apple) h2 { margin-bottom: .4rem; }
:is(#projects, #bad-apple) .section-subtitle { margin-bottom: 0; }
:is(#projects, #bad-apple) .project-carousel { margin-block: 1rem; }

@media (min-height: 700px) {
  :is(#projects, #bad-apple) .featured-card {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--header-height, 64px) - 190px);
  }
  #projects .featured-image {
    flex: 1;
    min-height: 0;
    height: 0;
  }
  #bad-apple .video-stage {
    flex: 1;
    min-height: 0;
    aspect-ratio: auto;
  }
  :is(#projects, #bad-apple) .featured-copy { flex-shrink: 0; }
  #projects .terminal-project { height: 100%; }
}

@media (max-width: 600px) and (min-height: 700px) {
  #bad-apple .featured-card {
    height: calc(100dvh - var(--header-height, 64px) - 220px);
  }
}

#bad-apple .container {
  width: min(1200px, 92vw);
}

#about .container {
  width: min(780px, 92vw);
}

#contact .container {
  width: min(860px, 92vw);
}

#repositories .container {
  width: min(1160px, 92vw);
}

.repository-intro {
  text-align: center;
}

.about-meta {
  margin-top: 1.5rem;
  color: var(--highlight);
  font-size: 0.95rem;
}

.nav-menu {
  display: none;
}

.project-carousel {
  max-width: 3048px;
  overflow: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  margin: 2rem auto 1.5rem;
}

.project-carousel::-webkit-scrollbar {
  display: none;
}

.carousel-track {
  display: flex;
  width: max-content;
  gap: 1.5rem;
  padding: 0 calc((100% - min(80vw, 1000px)) / 2);
}

.featured-card {
  flex: 0 0 min(80vw, 1000px);
  scroll-snap-align: center;
  overflow: hidden;
  border-radius: 1.1rem;
  border: 1px solid var(--accent);
  background: var(--surface);
}

.featured-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  background: #0b1220;
}

.featured-copy {
  padding: 1.6rem 2rem;
}

[data-project="browser-linux"] { background: rgb(8 22 42 / 50%); }

.terminal-project {
  display: block;
  width: 100%;
  height: 700px;
  border: 0;
  background: transparent;
}

.terminal-project[hidden] { display: none; }

@media (max-width: 1100px) {
  .terminal-project { height: 760px; }
}

@media (max-width: 600px) {
  .terminal-project { height: 860px; }
}

.featured-copy h3 {
  font-size: 1.8rem;
  margin-bottom: 0.6rem;
}

.featured-copy > p {
  margin-bottom: 0.7rem;
}

.tech-line {
  font-size: 0.88rem;
}

.featured-stats {
  color: var(--highlight);
  font-size: 0.9rem;
}

.project-links {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.carousel-dots {
  display: flex;
  gap: 0.75rem;
}

.carousel-dots button {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.carousel-dots button::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 180ms ease, transform 180ms ease;
}

.carousel-dots button[aria-current="true"]::after {
  background: var(--highlight);
  transform: scale(1.4);
}

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05080d;
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: white;
}

.video-play span {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid rgb(203 213 225 / 50%);
  border-radius: 50%;
  background: rgb(8 22 42 / 75%);
  font-size: 1.2rem;
}

.video-play[hidden] {
  display: none;
}

.video-status {
  color: var(--danger);
  margin: 0;
}

.expand-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 350ms ease, visibility 350ms;
}

.expand-panel.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
}

.expand-panel__inner {
  overflow: hidden;
  min-height: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 3rem 0 2rem;
  font-size: 0.85rem;
  border-top: 1px solid var(--accent);
}

.site-footer a {
  color: var(--text);
}

.footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.effects-toggle {
  border: 0;
  padding: 0.5rem 0;
  background: none;
  color: #98abc2;
  font: inherit;
  cursor: pointer;
}

.effects-toggle:hover,
.effects-toggle:focus-visible {
  color: var(--highlight);
}

.profile-stats {
  padding-bottom: 2rem;
  border-top: 1px solid var(--accent);
}

.profile-stats > summary {
  padding: 1rem 0;
  color: var(--text);
  cursor: pointer;
}

.profile-stats > summary:hover,
.profile-stats > summary:focus-visible {
  color: var(--highlight);
}

.profile-stats > summary:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 4px;
}

.profile-stats__cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.profile-stats__cards img {
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

@media (max-width: 950px) {
  .nav-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

@media (max-width: 800px) {
  .nav {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .nav-menu {
    display: inline-block;
    padding: 0.35rem 0.8rem;
  }
  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
  }
  .nav-links.is-open {
    display: flex;
  }
  .nav-links a {
    display: block;
    padding: 0.65rem 0;
  }
  .carousel-track {
    gap: 0.8rem;
    padding-inline: 5vw;
  }
  .featured-card {
    flex-basis: 90vw;
  }
  .featured-copy {
    padding: 1.2rem;
  }
  .featured-copy h3 {
    font-size: 1.5rem;
  }
  }

.featured-stats {
  min-height: 1.5em;
}

.featured-stats[hidden] {
  display: block;
  visibility: hidden;
}

[data-project="fling"] .featured-image {
  object-fit: contain;
  background: #0b1220;
}

#contact {
  text-align: center;
}

#contact .contact-links {
  justify-content: center;
}

#contact .contact-form {
  margin-inline: auto;
  text-align: left;
}

.effects-off *, .effects-off *::before, .effects-off *::after {
  scroll-behavior: auto !important;
  animation: none !important;
  transition: none !important;
}
.effects-off .water-background { display: none; }
