:root {
  color-scheme: dark;
  --brand-black: #0d0d0d;
  --brand-surface: #141414;
  --brand-surface-soft: #1f1f1f;
  --brand-light: #f0f0f0;
  --brand-muted: #b5b5b5;
  --brand-accent: #b07a4a;
  --brand-accent-dark: #6f4a2b;
  --brand-highlight: #ffffff;
  --brand-border: rgba(255, 255, 255, 0.08);
  --brand-border-strong: rgba(0, 0, 0, 0.12);
  --brand-glass: rgba(255, 255, 255, 0.04);
  --brand-glass-strong: rgba(255, 255, 255, 0.08);
  --brand-shadow: rgba(0, 0, 0, 0.45);
}

html.light {
  color-scheme: light;
  --brand-black: #f7f8f9;
  --brand-surface: #ffffff;
  --brand-surface-soft: #f0f0f0;
  --brand-light: #0d0d0d;
  --brand-muted: #4a4a4a;
  --brand-accent: #b07a4a;
  --brand-accent-dark: #8b5a31;
  --brand-highlight: #111111;
  --brand-border: rgba(0, 0, 0, 0.08);
  --brand-border-strong: rgba(0, 0, 0, 0.16);
  --brand-glass: rgba(0, 0, 0, 0.04);
  --brand-glass-strong: rgba(0, 0, 0, 0.08);
  --brand-shadow: rgba(0, 0, 0, 0.18);
}

body {
  min-height: 100vh;
  background: var(--brand-black);
  color: var(--brand-light);
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("../images/site-background.jpg") center/cover no-repeat;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.4s ease;
}

html.light body::before {
  opacity: 0.55;
}

html.light body {
  background: var(--brand-black);
}

main {
  position: relative;
  z-index: 1;
}

::selection {
  background: rgba(176, 122, 74, 0.25);
  color: var(--brand-highlight);
}

.hero-gradient {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(28, 19, 12, 0.92), rgba(90, 63, 36, 0.78), rgba(24, 16, 10, 0.95));
}

.hero-gradient::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 30% 30%, rgba(155, 118, 70, 0.42), transparent 55%),
    radial-gradient(circle at 68% 42%, rgba(111, 82, 46, 0.36), transparent 60%),
    radial-gradient(circle at 50% 78%, rgba(67, 48, 28, 0.32), transparent 65%);
  filter: blur(60px);
  animation: gradientOrbit 18s ease-in-out infinite alternate;
  z-index: 0;
}

body.prefers-reduced-motion .hero-gradient::after {
  animation: none;
}

@keyframes gradientOrbit {
  0% {
    transform: translate3d(-4%, -6%, 0) scale(1.05);
  }
  50% {
    transform: translate3d(5%, 4%, 0) scale(1.12);
  }
  100% {
    transform: translate3d(-3%, 6%, 0) scale(1.08);
  }
}

.glass-card {
  background: var(--brand-glass);
  border: 1px solid var(--brand-border);
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px -40px var(--brand-shadow);
}

.glass-card:hover {
  border-color: rgba(176, 122, 74, 0.4);
  box-shadow: 0 24px 80px -50px rgba(176, 122, 74, 0.35);
}

.card-tilt {
  transform-style: preserve-3d;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.card-tilt:hover {
  transform: translateY(-6px) rotate3d(1, -1, 0, 6deg) scale(1.01);
}

body.is-touch .card-tilt,
body.is-touch .card-tilt:hover {
  transform: none;
}

.btn-gradient {
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand-accent), var(--brand-accent-dark));
  opacity: 0.92;
  transition: transform 0.5s ease, opacity 0.4s ease;
  z-index: -1;
}

.btn-gradient:hover::before {
  transform: scale(1.04);
  opacity: 1;
}

.btn-gradient:active::before {
  transform: scale(0.98);
}

.section-heading span {
  display: inline-block;
  background: linear-gradient(135deg, rgba(176, 122, 74, 0.25), transparent);
  padding-inline: 16px;
  border-radius: 999px;
}

.marquee {
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.marquee-track {
  display: flex;
  gap: 48px;
  padding-block: 12px;
  animation: marqueeScroll 32s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

body.prefers-reduced-motion .marquee-track {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transform: translateX(0) !important;
}

@keyframes marqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  font-weight: 500;
}

html.light .tech-item {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

.project-thumbnail {
  border-radius: 32px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background: linear-gradient(135deg, rgba(176, 122, 74, 0.25), rgba(111, 82, 46, 0.45));
}

.project-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 55%),
    radial-gradient(circle at 70% 60%, rgba(176, 122, 74, 0.35), transparent 60%);
  filter: blur(24px);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.project-card:hover .project-thumbnail::after {
  opacity: 1;
}

.project-thumbnail img,
.project-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.project-card:hover .project-thumbnail img,
.project-card:hover .project-thumb-image {
  transform: scale(1.05);
  filter: saturate(1.08);
}

.project-card .project-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  background: linear-gradient(0deg, rgba(13, 13, 13, 0.8), rgba(13, 13, 13, 0.28), transparent 55%);
  color: #fff;
  opacity: 1;
  transform: translateY(0);
  transition: background 0.35s ease;
}

.project-card:hover .project-overlay {
  background: linear-gradient(0deg, rgba(13, 13, 13, 0.92), rgba(13, 13, 13, 0.38), transparent 60%);
}

#project-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(18px);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: clamp(16px, 4vw, 48px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow-y: auto;
}

#project-modal.active {
  opacity: 1;
  pointer-events: auto;
}

#project-modal .modal-content {
  max-width: 940px;
  width: min(940px, 100%);
  background: var(--brand-surface);
  color: var(--brand-light);
  border: 1px solid var(--brand-border);
  border-radius: 32px;
  box-shadow: 0 30px 120px -60px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  max-height: calc(100vh - clamp(48px, 10vh, 120px));
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#project-modal .modal-content > * {
  overflow-y: auto;
  flex: 1 1 auto;
}

#project-modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-gallery {
  display: grid;
  gap: 16px;
}

.modal-gallery > * {
  height: 220px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(176, 122, 74, 0.12), rgba(111, 82, 46, 0.22));
  border: 1px solid var(--brand-border);
}

.modal-gallery img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  #project-modal .modal-content {
    border-radius: 24px;
    max-height: calc(100vh - clamp(32px, 8vh, 96px));
  }

  .modal-gallery > * {
    height: 180px;
  }
}

.page-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(176, 122, 74, 0.08), transparent 45%),
    rgba(5, 5, 5, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}

body.prefers-reduced-motion .page-overlay {
  transition: none;
  opacity: 0 !important;
}

body.page-exit .page-overlay {
  opacity: 1;
  pointer-events: auto;
}

body.page-enter {
  animation: pageFadeIn 0.65s ease forwards;
}

body.prefers-reduced-motion.page-enter {
  animation: none;
}

@keyframes pageFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.cursor-glow {
  position: fixed;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(176, 122, 74, 0.18) 0%, rgba(176, 122, 74, 0) 60%);
  mix-blend-mode: screen;
  filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 50;
}

.cursor-glow.active {
  opacity: 1;
}

.cursor-glow.cursor-hover {
  background: radial-gradient(circle, rgba(176, 122, 74, 0.28) 0%, rgba(176, 122, 74, 0) 60%);
  filter: blur(6px);
}

nav[aria-label="Primary"] {
  backdrop-filter: blur(18px);
  background: linear-gradient(135deg, rgba(13, 13, 13, 0.78), rgba(13, 13, 13, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-wordmark {
  font-family: 'Great Vibes', 'Poppins', cursive;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.05;
  color: inherit;
  display: inline-flex;
  align-items: center;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.brand-wordmark:hover,
nav[aria-label="Primary"] .brand-wordmark:hover {
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

body.menu-open {
  overflow: hidden;
}

[data-menu] {
  display: flex;
}

[data-menu][data-state="open"] {
  animation: menuReveal 0.3s ease forwards;
}

@keyframes menuReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 639px) {
  [data-menu] {
    display: none;
  }

  [data-menu][data-state="open"] {
    display: flex;
  }

  [data-desktop-theme-toggle] {
    display: none !important;
  }
}

@media (min-width: 640px) {
  [data-menu] {
    display: flex;
  }

  [data-menu-toggle] {
    display: none !important;
  }

  [data-mobile-theme-toggle] {
    display: none !important;
  }

  [data-desktop-theme-toggle] {
    display: grid;
  }
}

[data-menu-toggle] [data-menu-icon="close"] {
  display: none;
}

[data-menu-toggle][aria-expanded="true"] [data-menu-icon="open"] {
  display: none;
}

[data-menu-toggle][aria-expanded="true"] [data-menu-icon="close"] {
  display: block;
}

[data-menu-toggle] svg {
  pointer-events: none;
}

.founder-portrait {
  position: relative;
  width: clamp(200px, 28vw, 260px);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 45px -28px rgba(0, 0, 0, 0.65);
}

html.light nav[aria-label="Primary"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58));
  border-color: rgba(15, 15, 15, 0.08);
}

.theme-indicator {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.3s ease;
}

.theme-indicator:hover {
  transform: translateY(-3px);
  background: rgba(176, 122, 74, 0.18);
  border-color: rgba(176, 122, 74, 0.42);
}

html.light .theme-indicator {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

footer {
  border-top: 1px solid var(--brand-border);
  background: linear-gradient(180deg, rgba(13, 13, 13, 0.85), rgba(13, 13, 13, 0.95));
}

html.light footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98));
}

.form-field {
  position: relative;
}

.form-field input,
.form-field textarea,
.form-field select {
  transition: border 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.form-field:has(input:focus,
    textarea:focus,
    select:focus) .field-glow {
  opacity: 1;
  transform: scale(1.02) translateY(-50%);
}

.field-glow {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(176, 122, 74, 0.22), rgba(176, 122, 74, 0));
  filter: blur(18px);
  border-radius: 24px;
  opacity: 0;
  transform: scale(1) translateY(-50%);
  top: 50%;
  z-index: -1;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.split-lines {
  display: inline-block;
  overflow: hidden;
}

[data-scroll-indicator] {
  position: fixed;
  inset-inline-start: 0;
  inset-block-start: 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(176, 122, 74, 0.2), rgba(176, 122, 74, 0.85));
  transform-origin: left;
  z-index: 90;
}

@media (max-width: 640px) {
  nav[aria-label="Primary"] {
    padding: 16px 20px;
    gap: 18px;
  }

  .hero-gradient {
    border-radius: 32px;
  }

  .hero-gradient::after {
    inset: -45%;
    filter: blur(28px);
  }

  .hero-gradient .glass-card {
    padding: clamp(20px, 6vw, 32px);
    min-height: unset;
  }

  .marquee {
    mask-image: none;
  }

  .marquee-track {
    gap: 32px;
    animation-duration: 40s;
  }

  section {
    scroll-margin-top: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  .project-card .project-overlay {
    opacity: 1;
    transform: translateY(0);
    background: linear-gradient(0deg, rgba(13, 13, 13, 0.85), rgba(13, 13, 13, 0.15), transparent 75%);
  }

  .card-tilt:hover {
    transform: none;
  }

  .marquee-track {
    animation-duration: 22s;
  }

  #project-modal .modal-content {
    border-radius: 24px;
  }
}
