:root {
  color-scheme: dark;
  --page: #0a0d0c;
  --surface: rgba(15, 19, 18, 0.88);
  --text: #e8ebe8;
  --muted: #9aa19d;
  --subtle: #737b76;
  --line: rgba(215, 225, 218, 0.12);
  --line-strong: rgba(215, 225, 218, 0.2);
  --accent: #c4e6d0;
  --contour: #78818a;
  --contour-accent: #a0b7cc;
  --contour-opacity: 0.68;
  --dock-shadow: 0 16px 55px rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f6f2;
  --surface: rgba(250, 251, 248, 0.9);
  --text: #222925;
  --muted: #626d66;
  --subtle: #858e88;
  --line: rgba(38, 57, 45, 0.12);
  --line-strong: rgba(38, 57, 45, 0.2);
  --accent: #315d43;
  --contour: #9aa2ac;
  --contour-accent: #7d9dc3;
  --contour-opacity: 0.58;
  --dock-shadow: 0 16px 45px rgba(36, 54, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 40px;
  scrollbar-color: var(--line-strong) var(--page);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  transition: background-color 300ms ease, color 300ms ease;
}

body.font-sans {
  font-family: "DM Sans", sans-serif;
}

::selection {
  background: var(--accent);
  color: var(--page);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

.page-noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
}

.contour-bg {
  position: fixed;
  z-index: -2;
  inset: -20%;
  display: block;
  width: 140%;
  height: 140%;
  opacity: var(--contour-opacity);
  pointer-events: none;
  transform-origin: center;
  animation: topography-drift var(--topography-duration, 45s) ease-in-out infinite alternate;
}

.custom-cursor {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background-color 180ms ease;
}

.custom-cursor::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text);
  content: "";
  transform: translate(
    calc(-50% + var(--cursor-dot-x, 0px)),
    calc(-50% + var(--cursor-dot-y, 0px))
  );
  transition: transform 120ms ease-out;
}

.custom-cursor.is-visible {
  opacity: 0.7;
}

@keyframes topography-drift {
  from {
    transform: translate3d(-1.5%, 0.5%, 0) scale(1.04);
  }

  to {
    transform: translate3d(1.5%, -0.5%, 0) scale(1.08);
  }
}

.section-anchor {
  scroll-margin-top: 42px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-wrap {
  position: relative;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background-color: var(--surface);
  object-fit: cover;
  object-position: 58% 36%;
}

.avatar-presence {
  position: absolute;
  right: 2px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--page);
  border-radius: 50%;
  background: #8bc6a0;
  box-shadow: 0 0 12px rgba(139, 198, 160, 0.65);
}

.meta-line,
.section-index,
.project-number,
.project-type,
.tech-list,
.intro-links,
.footer,
.dock-label {
  font-family: "DM Mono", monospace;
}

.meta-line {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
  letter-spacing: -0.02em;
}

.intro-statement {
  max-width: 700px;
  margin: 34px 0 0;
  font-size: clamp(26px, 4.4vw, 36px);
  font-weight: 500;
  line-height: 1.36;
  letter-spacing: -0.055em;
}

.text-muted {
  color: var(--muted);
}

.intro-copy {
  max-width: 665px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: -0.015em;
}

.intro-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 21px;
  color: var(--subtle);
  font-size: 11px;
}

.link-separator {
  color: var(--line-strong);
}

.intro-links a {
  color: var(--text);
  transition: color 180ms ease;
}

.intro-links a:hover,
.contact-link:hover {
  color: var(--accent);
}

.intro-links i,
.contact-link i,
.contact-submit i {
  margin-left: 3px;
  font-size: 11px;
}

.skills-section,
.projects-section {
  margin-top: 64px;
}

.skills-list {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.skill-row {
  display: grid;
  grid-template-columns: minmax(125px, 0.32fr) minmax(0, 1fr);
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.skill-row h3 {
  margin: 0;
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.8;
  text-transform: uppercase;
}

.skill-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.skill-row-learning p {
  color: var(--accent);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.section-heading h2 {
  flex: none;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.section-index {
  flex: none;
  color: var(--subtle);
  font-size: 10px;
}

.heading-rule {
  width: 100%;
  height: 1px;
  background: var(--line);
}

.project-list {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.project-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  gap: 12px;
  padding: 20px 2px 21px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  transition:
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 260ms ease,
    box-shadow 360ms ease;
}

.project-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  z-index: 1;
  transform: translateY(-2px);
  border-color: var(--line-strong);
  outline: none;
}

.project-card:hover::before,
.project-card:focus-visible::before {
  opacity: 1;
}

.project-card:focus-visible {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.project-card:hover .project-title-row h3,
.project-card:focus-visible .project-title-row h3 {
  color: var(--accent);
}

.project-number {
  padding-top: 3px;
  color: var(--subtle);
  font-size: 11px;
}

.project-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 9px;
}

.project-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.04em;
  transition: color 360ms ease;
}

.project-type {
  color: var(--subtle);
  font-size: 10px;
}

.project-content > p {
  max-width: 570px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tech-list li {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--subtle);
  font-size: 10px;
  line-height: 1;
}

.project-arrow {
  align-self: start;
  padding-top: 2px;
  color: var(--subtle);
  font-size: 11px;
  transition: color 360ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-arrow,
.project-card:focus-visible .project-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

.contact-section {
  margin-top: 64px;
}

.contact-copy {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

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

.contact-field {
  display: grid;
  gap: 7px;
}

.contact-field label {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.field-optional {
  color: var(--subtle);
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.contact-field input {
  min-height: 42px;
  padding: 10px 12px;
}

.contact-field textarea {
  min-height: 126px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.65;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--subtle);
  opacity: 0.75;
}

.contact-field input:focus,
.contact-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.contact-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.contact-submit {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 15px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.contact-submit:hover,
.contact-submit:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  outline: none;
}

.contact-submit:active {
  transform: translateY(0);
}

.contact-note,
.contact-status {
  margin: 0;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.6;
}

.contact-status:not(:empty) {
  color: var(--accent);
}

.footer {
  display: flex;
  justify-content: space-between;
  margin-top: 76px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10px;
}

.spotify-page {
  position: relative;
  width: min(100% - 48px, 620px);
  margin: 0 auto;
  padding: clamp(72px, 15vh, 140px) 0 80px;
  font-family: "DM Sans", sans-serif;
}

.spotify-back-link,
.spotify-open-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  transition: color 180ms ease;
}

.spotify-back-link:hover,
.spotify-back-link:focus-visible,
.spotify-open-link:hover,
.spotify-open-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.spotify-page section {
  margin-top: 40px;
}

.spotify-page .section-heading h1 {
  flex: none;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.spotify-description {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.spotify-embed {
  display: block;
  width: 100%;
  min-height: 352px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
}

.spotify-open-link {
  margin-top: 16px;
}

.bottom-dock {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 54px;
  padding: 7px 10px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--dock-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dock-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.dock-icon:hover,
.dock-icon:focus-visible {
  transform: translateY(-1px);
  background: var(--line);
  color: var(--text);
  outline: none;
}

.dock-icon[aria-current="location"] {
  background: var(--line);
  color: var(--accent);
}

.dock-label {
  padding: 0 13px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  transition: color 180ms ease;
}

.dock-label:hover {
  color: var(--text);
}

.dock-label[aria-current="location"] {
  color: var(--accent);
}

.dock-divider {
  width: 1px;
  height: 22px;
  margin: 0 5px;
  background: var(--line);
}

.theme-toggle i {
  transition: transform 300ms ease;
}

.theme-toggle:hover i {
  transform: rotate(-15deg);
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.project-card.reveal {
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 360ms ease,
    box-shadow 360ms ease;
}

.project-card.reveal.is-visible:hover,
.project-card.reveal.is-visible:focus-visible {
  transform: translateY(-2px);
}

@media (max-width: 520px) {
  main {
    padding-top: 64px !important;
  }

  .meta-line {
    max-width: 230px;
    font-size: 10px;
  }

  .spotify-page {
    width: calc(100% - 36px);
  }

  .spotify-page .section-heading h1 {
    font-size: 16px;
  }

  .intro-statement {
    margin-top: 29px;
    font-size: clamp(26px, 7vw, 33px);
  }

  .intro-copy {
    font-size: 14px;
  }

  .skills-section,
  .projects-section {
    margin-top: 54px;
  }

  .skill-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }

  .project-card {
    grid-template-columns: 28px minmax(0, 1fr) 15px;
    gap: 8px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .project-card.reveal.is-visible:hover,
  .project-card.reveal.is-visible:focus-visible {
    transform: translateY(-1px);
  }

  .project-type {
    width: 100%;
    margin-top: -5px;
  }

  .contact-fields {
    grid-template-columns: 1fr;
  }

  .bottom-dock {
    bottom: max(13px, env(safe-area-inset-bottom));
    gap: 1px;
    min-height: 50px;
    padding: 6px 7px;
  }

  .dock-icon {
    width: 32px;
    height: 34px;
    font-size: 13px;
  }

  .dock-label {
    padding: 0 9px;
    font-size: 9px;
  }

  .dock-divider {
    margin: 0 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .contour-bg {
    animation: none !important;
    transform: none;
  }

  .project-card,
  .project-arrow,
  .dock-icon {
    transition: none;
  }
}

body.has-custom-cursor,
body.has-custom-cursor a[href],
body.has-custom-cursor button[class] {
  cursor: none;
}
