:root {
  color-scheme: light;
  --page: light-dark(#f6f8f5, #101612);
  --surface: light-dark(#fff, #1b1e27);
  --ink: light-dark(#141a29, #f4f6fc);
  --muted: light-dark(#4e586b, #b9c2d5);
  --line: light-dark(#dce1eb, #353c4c);
  --accent: light-dark(#175f3c, #a9e5ba);
  --chrome: light-dark(rgb(247 250 246 / 82%), rgb(17 25 20 / 83%));
  --control: light-dark(#e9f1e9, #26362d);
  --control-hover: light-dark(#deeadf, #34483b);
  --music-accent: light-dark(#13764b, #69d29f);
  --court-marking: light-dark(rgb(175 75 75 / 22%), rgb(255 166 166 / 20%));
  --court-fill: light-dark(rgb(245 155 155 / 18%), rgb(245 155 155 / 12%));
  --shadow: 0 10px 28px light-dark(rgb(30 49 94 / 6%), rgb(0 0 0 / 16%));
  --project-glow: 0 0 0 1px light-dark(rgb(36 128 76 / 41%), rgb(141 226 179 / 48%)),
    0 0 27px light-dark(rgb(51 153 95 / 27%), rgb(94 211 144 / 32%));
  --shell: 72rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --radius: 1.5rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  line-height: 1.55;
  scroll-padding-top: 6rem;
}

:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  isolation: isolate;
  color: var(--ink);
  background-color: var(--page);
  background-image: radial-gradient(ellipse at 85% 0, light-dark(#e3f1e6, #1b3024), transparent 46rem);
  min-height: 100vh;
  transition: background-color 180ms ease, color 180ms ease;
}

body::before {
  position: fixed;
  z-index: -1;
  top: clamp(10rem, 33vh, 22rem);
  left: 50%;
  width: min(88rem, 144vw);
  aspect-ratio: 2.15;
  transform: translateX(-50%) rotate(-11deg);
  border: 2px solid var(--court-marking);
  background:
    linear-gradient(var(--court-marking), var(--court-marking)) center / 1px 100%,
    linear-gradient(var(--court-marking), var(--court-marking)) center / 57% 1px,
    linear-gradient(var(--court-marking), var(--court-marking)) 21.5% center / 1px 70%,
    linear-gradient(var(--court-marking), var(--court-marking)) 78.5% center / 1px 70%,
    linear-gradient(var(--court-marking), var(--court-marking)) center 15% / 100% 1px,
    linear-gradient(var(--court-marking), var(--court-marking)) center 85% / 100% 1px;
  background-repeat: no-repeat;
  background-color: var(--court-fill);
  pointer-events: none;
  content: "";
}

a {
  color: inherit;
  text-underline-offset: 0.24em;
}

button { font: inherit; }
a, button { touch-action: manipulation; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.shell {
  width: min(calc(100% - 2 * var(--gutter)), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 3;
  top: 0.5rem;
  left: var(--gutter);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--surface);
  translate: 0 -150%;
}

.skip-link:focus { translate: none; }

.site-header {
  position: sticky;
  z-index: 2;
  top: 0;
  isolation: isolate;
}

.site-header::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 -1.1rem;
  background-color: var(--chrome);
  -webkit-backdrop-filter: blur(19px) saturate(160%);
  backdrop-filter: blur(19px) saturate(160%);
  mask-image: linear-gradient(#000 0 calc(100% - 1.1rem), transparent);
  pointer-events: none;
  content: "";
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  min-height: 4rem;
}

.nav-links {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.1rem, 1.25vw, 1rem);
}

.nav-links a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: 999px;
  text-decoration: none;
}

.nav-links a {
  padding: 0.25rem 0.7rem;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: 0.005em;
  transition: background-color 160ms ease, color 160ms ease;
}

.theme-toggle {
  grid-column: 3;
  justify-self: end;
  width: 2.75rem;
  padding: 0;
  border: 0;
  color: var(--ink);
  background-color: var(--control);
  cursor: pointer;
  transition: background-color 160ms ease, transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

.theme-toggle[aria-pressed="true"] .moon-icon,
.theme-toggle[aria-pressed="false"] .sun-icon { display: none; }

.home-shell { --shell: 80rem; }

.hero {
  --court-shade: #102b21;
  --court-accent: #e2f87f;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 19rem);
  align-items: center;
  gap: clamp(1.5rem, 7vw, 6rem);
  min-height: clamp(30rem, calc(100svh - 12rem), 45rem);
  margin-block: clamp(1rem, 3vw, 2.75rem) 2rem;
  padding: clamp(1.5rem, 5.3vw, 4.5rem);
  overflow: hidden;
  border-radius: clamp(1.35rem, 3vw, 2.25rem);
  color: #f6fcf5;
  background-color: var(--court-shade);
  box-shadow: 0 1.5rem 3.4rem rgb(14 48 33 / 18%);
}

.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, var(--court-shade) 6%, rgb(16 43 33 / 96%) 34%, rgb(16 43 33 / 83%) 56%, rgb(16 43 33 / 20%) 79%, transparent),
    url("assets/tennis-court.jpg") right center / cover;
  content: "";
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 7.15vw, 6.5rem);
  font-weight: 730;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  @supports (background-clip: text) or (-webkit-background-clip: text) {
    #hero-title {
      width: fit-content;
      margin-block: -0.08em;
      padding-block: 0.08em;
      background: linear-gradient(
        100deg,
        #f6fcf5 41%,
        #188056 46%,
        #439e70 49%,
        #efffca 50%,
        #439e70 51%,
        #188056 54%,
        #f6fcf5 59%
      );
      background-size: 280% 100%;
      background-position: 100% 50%;
      -webkit-background-clip: text;
      background-clip: text;
      animation: name-glow 1.35s ease-in-out 160ms;
    }
  }
}

@keyframes name-glow {
  from { color: transparent; background-position: 100% 50%; }
  to { color: transparent; background-position: 0% 50%; }
}

.hero-exploring {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.37em;
  margin: 1.2rem 0 1.55rem;
  color: #e0eee2;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  letter-spacing: -0.015em;
  line-height: 1.45;
}

.exploring-topics {
  display: inline-grid;
  color: var(--court-accent);
  font-weight: 650;
}

.exploring-topics span {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 210ms ease;
}

.exploring-topics [data-active] { opacity: 1; }

.about-section h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.hero .about-copy {
  max-width: 54ch;
  color: #e0eee2;
}

.hero .spotify-card {
  align-self: end;
  color: var(--ink);
}

.hero-content a:focus-visible { outline-color: var(--court-accent); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 160ms ease, transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

.button-secondary {
  color: var(--ink);
  background-color: var(--control);
}

.page-content { padding-block: clamp(2.5rem, 6vw, 5.5rem) 3rem; }

.page-content h1 {
  margin: 0;
  font-size: clamp(2.15rem, 5vw, 3.65rem);
  font-weight: 710;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.text-link {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 2.75rem;
  color: var(--accent);
  font-size: 0.93rem;
  font-weight: 650;
  text-decoration-color: transparent;
  transition: text-decoration-color 150ms ease;
}

.project-grid,
.skills-grid { margin-top: clamp(1.25rem, 2.8vw, 2rem); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.project-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  box-shadow: var(--project-card-shadow, var(--shadow));
  transition: box-shadow 180ms ease;
}

.project-card:focus-within { --project-card-shadow: var(--project-glow); }

.project-media {
  display: grid;
  place-items: center;
  aspect-ratio: 2.06;
  overflow: hidden;
}

.project-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-media-stock {
  padding: clamp(0.7rem, 2vw, 1.4rem);
  background-color: #dce7fe;
}

.project-media-stock img {
  max-height: 100%;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 6px 20px rgb(29 61 133 / 14%);
  object-fit: contain;
}

.project-media-bayes { background-color: #dcefeb; }

.project-media-court {
  background: radial-gradient(ellipse at center, #142823, #070c14 78%);
}

.project-media-court img { object-fit: contain; }

.project-media-structures {
  background:
    radial-gradient(ellipse at center, rgb(255 255 255 / 88%), transparent 68%),
    linear-gradient(145deg, #c8d0fc, #e3dffc 68%, #c2cdfb);
}

.project-media-structures img {
  width: clamp(4.5rem, 10vw, 7rem);
  height: auto;
  border-radius: 23%;
  box-shadow: 0 12px 30px rgb(40 50 164 / 32%);
}

.project-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 0.3rem;
  padding: clamp(1.15rem, 2.6vw, 2rem);
  padding-bottom: clamp(0.65rem, 1.65vw, 1.35rem);
}

.project-category {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.012em;
}

.project-body h3 {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.034em;
  line-height: 1.16;
}

.project-description {
  max-width: 42ch;
  margin: 0.35rem 0;
  color: var(--muted);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin-top: 0.2rem;
}

.about-copy {
  max-width: 61ch;
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  letter-spacing: -0.012em;
}

.spotify-card {
  min-width: 0;
  padding: clamp(1.05rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.spotify-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.95rem;
}

.spotify-heading svg {
  flex: none;
  color: var(--music-accent);
}

.spotify-heading h2 {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.3;
}

.spotify-track {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 4rem;
}

.spotify-cover {
  flex: none;
  border-radius: 0.65rem;
  background: var(--control);
  object-fit: cover;
}

.spotify-details { min-width: 0; overflow-wrap: anywhere; }
.spotify-title { font-size: 1.05rem; font-weight: 700; }
.spotify-artist,
.spotify-status { display: block; color: var(--muted); font-size: 0.9rem; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.7rem, 2vw, 1.5rem);
}

.skill-group {
  padding: clamp(1rem, 2.3vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--surface);
}

.skill-group h3 {
  margin: 0 0 0.75rem;
  font-size: 1.13rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.skill-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  font-size: 0.875rem;
  font-weight: 550;
}

.skill-list img {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
}

.nav-links [aria-current="page"] {
  color: var(--accent);
  background: var(--control);
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.profile-link {
  width: 2.8rem;
  padding: 0;
  border: 1px solid rgb(239 255 239 / 32%);
  color: #f6fcf5;
  background-color: #284638;
}

.contact-section { max-width: 42rem; }

.contact-form {
  display: grid;
  gap: 1rem;
  margin-top: clamp(1.25rem, 3vw, 2rem);
  padding: clamp(1rem, 3.5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.contact-form label {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  font-weight: 650;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.contact-form textarea { resize: vertical; }
.contact-form p { margin: 0; color: var(--muted); }

.button-send {
  justify-self: start;
  border: 0;
  color: light-dark(#fff, #101612);
  background: var(--accent);
  cursor: pointer;
}

.button-send:disabled { opacity: 0.65; cursor: progress; }

@media (hover: hover) {
  .project-card:hover { --project-card-shadow: var(--project-glow); }

  .nav-links a:hover,
  .theme-toggle:hover,
  .button-secondary:hover { background-color: var(--control-hover); }

  .profile-link:hover { background-color: #3a5948; }
  .text-link:hover { text-decoration-color: currentColor; }
}

.theme-toggle:active,
.button:active {
  transform: scale(0.97);
  transition-duration: 65ms;
}

.nav-links a:active { background-color: var(--control-hover); }
.text-link:active { text-decoration-color: currentColor; }

@media (max-width: 45rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: clamp(9rem, 40vw, 13rem);
    min-height: auto;
  }

  .hero::before {
    inset: auto 0 0;
    height: clamp(19rem, 78vw, 26rem);
    background:
      linear-gradient(180deg, var(--court-shade), transparent 31%, rgb(16 43 33 / 65%)),
      url("assets/tennis-court.jpg") 85% center / cover;
  }

  .hero .spotify-card { width: min(100%, 22rem); }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  .header-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .nav-links {
    grid-column: 1;
    justify-content: flex-start;
    gap: 0.1rem;
  }

  .nav-links a { padding-inline: 0.3rem; }
  .theme-toggle { grid-column: 2; }
  .contact-identity { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 23rem) {
  .skills-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
  }

  .theme-toggle:active,
  .button:active { transform: none; }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .site-header::before {
    inset: 0;
    background-color: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    mask-image: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: var(--muted);
    --court-marking: light-dark(rgb(175 75 75 / 8%), rgb(255 166 166 / 8%));
    --court-fill: transparent;
  }
  .site-header { border-bottom: 1px solid var(--line); }
  .text-link { text-decoration-color: currentColor; }
  .hero::before { opacity: 0.35; }
}

@media (forced-colors: active) {
  body::before { display: none; }
}
