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

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

html {
  scroll-behavior: smooth;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Inter", sans-serif;
}

/* === Tokens === */

:root {
  --bg: #edecfb;
  --text: #16171f;
  --surface: #ffffff;
  --text-muted: #5f6172;
  --accent: #5a4bff;
  --accent-soft: #e6e3ff;
  --border: #dcdaf3;
  --footer-bg: #16171f;
  --footer-text: #f5f3f0;
}

[data-theme="dark"] {
  --bg: #17172a;
  --surface: #232338;
  --text: #f0f0f0;
  --text-muted: #9a9ab5;
  --accent: #8b7dff;
  --border: #33334d;
  --footer-bg: #0d0d18;
  --footer-text: #f0f0f0;
}

[data-theme="dark"] #intro {
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--accent) 26%, transparent) 0%,
    color-mix(in srgb, var(--accent) 10%, transparent) 40%,
    transparent 80%
  );
}

body {
  background: var(--bg);
  color: var(--text);
  transition:
    background-color 0.2s,
    color 0.2s;
}

a {
  text-decoration: none;
  display: inline-flex;
}

/* === Header / Nav === */

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

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

.nav__right ul {
  display: flex;
  list-style: none;
  gap: 16px;
  align-items: center;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 0%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); /* Safari */
}

#theme-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
}

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

.logo svg {
  height: 36px;
  width: auto;
  display: block;
  color: var(--text);
}

.highlight {
  color: var(--accent);
  font-weight: bold;
}

.section {
  max-width: 1000px;
  margin-inline: auto;
  padding: 96px 24px;
  margin-top: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

section[id] {
  scroll-margin-top: 80px; /* ≈ your nav height */
}

/* === Intro === */

#intro {
  min-height: calc(100vh - 72px);
  margin-top: 0;
  padding-block: 24px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 48px;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--accent) 20%, transparent) 0%,
    color-mix(in srgb, var(--accent) 8%, transparent) 40%,
    transparent 80%
  );
}

.intro__content {
  display: flex;
  flex-direction: column;
}

.intro__art {
  flex-shrink: 0;
}

.intro__art svg {
  width: min(340px, 38vw);
  height: auto;
  color: var(--text);
}

#intro h1 {
  font-size: clamp(2rem, 9vw, 8rem);
  line-height: 1.1;
  margin-bottom: 16px;
}
#intro p {
  max-width: 60ch;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.intro__links {
  list-style: none;
  display: flex;
  gap: 10px;
}

.intro__links a {
  align-items: center;
  padding: 8px;
  color: var(--text);
  display: inline-flex;
  border-radius: 8px;
  transition:
    color 0.15s,
    background-color 0.15s;
}

.intro__links a:hover {
  color: var(--accent);
  background-color: var(--surface);
}

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

.intro__links svg {
  width: 32px;
  height: 32px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro__content h1,
.intro__content p,
.intro__links,
.intro__art {
  opacity: 0; /* hidden until animated */
  animation: rise 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.intro__content h1 {
  animation-delay: 0.1s;
}
.intro__content p {
  animation-delay: 0.3s;
}
.intro__links {
  animation-delay: 0.5s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

.intro__art {
  animation:
    rise 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both,
    float 4s ease-in-out infinite;
}

.intro__art svg {
  transition: transform 0.3s ease;
}

.intro__art svg:hover {
  transform: rotate(-4deg) scale(1.05);
}

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

  .intro__art {
    animation: none;
  }
  .intro__art svg {
    transition: none;
  }

  .intro__content h1,
  .intro__content p,
  .intro__links,
  .intro__art {
    animation: none;
    opacity: 1; /* make sure nothing stays hidden */
  }
}

/* === Projects === */

.project-section__title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: 132px;
  font-size: 3.25rem;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 100px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .project-card {
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .project-card:hover {
  box-shadow: 0 20px 44px rgba(255, 255, 255, 0.16);
}

.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__overlay {
  position: absolute;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  inset: 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 48px;
  margin: 0 auto;
}

.project-card__summary {
  max-width: 60ch;
}

.project-card-title,
.project-card__summary {
  width: min(85%, 460px);
}

.project-card:hover .project-card__overlay,
.project-card:focus-within .project-card__overlay {
  opacity: 1;
  transform: translateY(0);
}

.project-card__links {
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  align-items: start;
}

.project-card__links svg {
  width: 32px;
  height: 32px;
}

.project-card__links a {
  color: #fff;
  display: inline-flex;
  padding: 8px;
  border-radius: 8px;
  transition:
    color 0.15s,
    background-color 0.15s;
}

.project-card-title {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: 1.4em;
}

.project-card-title h4 {
  font-size: 0.7em;
}

/* === Footer === */

footer {
  padding: 20px 24px;
  background: var(--footer-bg);
  color: var(--footer-text);
}

.footer__top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.footer__copyright {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 12px;
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

footer .logo svg,
footer .intro__links a {
  color: var(--footer-text);
}

/* === Contact overlay === */

#contact-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#contact-fab svg {
  width: 36px;
  height: 36px;
}

#contact-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

#contact-open {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.contact-overlay {
  width: 90%;
  height: 600px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border-radius: 50px;
}

.contact-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.contact-overlay__panel {
  width: 50%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  transition: transform 0.4s ease;
}

.contact-overlay__info {
  background: var(--surface);
  border-radius: 50px 0 0 50px;
  transform: translateX(-40%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 100px;
  gap: 24px;
}

.contact-overlay__info h2,
.contact-overlay__info p,
.contact__info {
  align-self: stretch;
  text-align: left;
}

.contact-overlay__info h2 {
  font-size: 2rem;
}

.contact-overlay__info h3 {
  font-size: 1.17rem;
}

.contact-overlay__info p {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 20px;
}

.form-status {
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--accent);
}
.form-status.is-error {
  color: #e5484d; /* red for the failure case */
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  justify-items: center;
}

.language {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.language__icon {
  width: 52px;
  height: 52px;
  transition: transform 0.2s ease;
}

.language:hover .language__icon {
  transform: scale(0.9);
}

.language__name {
  font-size: 14px;
  color: var(--text-muted);
  opacity: 0;
  transform: scale(0);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.language:hover .language__name {
  opacity: 1;
  transform: scale(1);
}

.contact-overlay__form {
  background: var(--footer-bg);
  border-radius: 0 50px 50px 0;
  color: var(--footer-text);
  transform: translateX(40%);
  text-align: left;
  justify-content: center;
  padding: 48px;
}

.contact-overlay.is-open .contact-overlay__info,
.contact-overlay.is-open .contact-overlay__form {
  transform: translateX(0);
}

#contact-close {
  position: absolute;
  top: 16px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.7rem;
  z-index: 10;
}

.contact-overlay__form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  text-align: left;
}

.contact-overlay__form form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  padding: 0;
}

.contact-overlay__form input,
.contact-overlay__form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.contact-overlay__form h2 {
  font-size: 2rem;
  text-align: left;
}

.contact-overlay__form h5 {
  font-size: 1.17rem;
}

.contact-overlay__form textarea {
  resize: vertical;
  min-height: 140px;
}

.contact-overlay__form button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  min-width: 120px;
  max-width: 180px;
  align-self: flex-start;
}

.contact-overlay__form input:focus,
.contact-overlay__form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* === Responsive === */

@media (max-width: 1200px) {
  .contact-overlay__info h2,
  .contact-overlay__form h2 {
    font-size: 1.5rem;
  }

  .contact-overlay__info h3,
  .contact-overlay__form h5 {
    font-size: 1rem;
  }

  .contact-overlay__info p {
    font-size: 16px;
  }
}

@media (max-width: 1000px) {
  .contact-overlay__info {
    display: none;
  }

  .contact-overlay__form {
    width: 100%;
    border-radius: 50px;
  }
}

@media (max-width: 720px) {
  #intro {
    flex-direction: column;
    text-align: center;
  }
  .intro__links {
    justify-content: center;
  }
  .intro__art svg {
    width: 220px;
  }
}
