:root {
  /* Matched to portfoliohome painting */
  --white: #f5f2ea;
  --white-soft: #ede9d5;
  --lavender-pale: #d4c8e4;
  --lavender: #a89bb8;
  --lavender-dusty: #9381a8;
  --purple-mid: #6d5a87;
  --purple-deep: #4b2a8e;
  --purple-dark: #3a206e;
  --purple-ink: #24143f;
  --cave-red: #c62828;
  --cave-red-hover: #e53935;
  --shadow: rgba(36, 20, 63, 0.38);
  font-family: "DM Sans", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--purple-ink);
  background: var(--lavender-dusty);
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
}

/* —— Home / Cave entrance —— */
.home {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2rem 1.5rem 12vh;
  overflow: hidden;
}

.home__bg {
  position: absolute;
  inset: 0;
  background: url("../images/portfoliohome.png") center / cover no-repeat;
  z-index: 0;
}

.home__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(58, 32, 110, 0.65) 0%,
    rgba(75, 42, 142, 0.2) 45%,
    transparent 70%
  );
  pointer-events: none;
}

.home__content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.home__social {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 1rem;
  transform: translateX(-50%);
}

.home__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  color: var(--white);
  background: rgba(245, 242, 234, 0.12);
  border: 1px solid rgba(245, 242, 234, 0.45);
  border-radius: 50%;
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.home__social a:hover {
  background: var(--white);
  color: var(--purple-deep);
  border-color: var(--white);
  transform: translateY(-2px);
}

@media (min-width: 768px) {
  .home__social {
    top: 2rem;
  }
}

.home__social a:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

.home__social svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.btn-cave {
  display: inline-block;
  margin: 0;
  padding: 1rem 2.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  background: var(--cave-red);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(198, 40, 40, 0.45),
    0 2px 8px var(--shadow);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-cave:hover {
  background: var(--cave-red-hover);
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(198, 40, 40, 0.5),
    0 4px 12px var(--shadow);
}

.btn-cave:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 4px;
}

.home__about-link {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 2;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--white);
  padding: 0.5rem 1rem;
  border: 1px solid rgba(245, 242, 234, 0.45);
  border-radius: 4px;
  background: rgba(245, 242, 234, 0.12);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.home__about-link:hover {
  background: var(--white);
  color: var(--purple-deep);
  border-color: var(--white);
}

.home__about-link:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

@media (min-width: 768px) {
  .home__about-link {
    top: 2rem;
    left: 2rem;
  }
}

/* —— About —— */
.about-page {
  min-height: 100dvh;
  background: radial-gradient(
      ellipse 120% 90% at 50% 20%,
      var(--white) 0%,
      var(--white-soft) 25%,
      var(--lavender-pale) 50%,
      var(--lavender-dusty) 75%,
      var(--purple-mid) 100%
    );
}

.about-header {
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) auto minmax(5rem, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 2rem 0.5rem;
}

.about-header h1 {
  margin: 0;
  grid-column: 2;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--purple-dark);
  text-align: center;
}

.about-header .back-link {
  color: var(--purple-dark);
}

.about-header__left {
  grid-column: 1;
  justify-self: start;
}

.about-header__right {
  grid-column: 3;
  justify-self: end;
}

.about-body {
  max-width: 40rem;
  margin: 1.5rem auto 3rem;
  padding: 2rem 1.75rem 2.5rem;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 40px var(--shadow);
}

.about-intro {
  margin: 0 0 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--purple-ink);
}

.about-photo {
  margin: 0 auto 2.5rem;
  max-width: 280px;
  text-align: center;
}

.about-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 28px var(--shadow);
  border: 2px solid var(--lavender-pale);
}

.about-photo figcaption {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--purple-mid);
  line-height: 1.4;
}

.about-skills-section h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  color: var(--purple-deep);
  text-align: center;
}

.about-skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.about-skills li {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.85rem;
  background: var(--purple-deep);
  color: var(--white);
  border-radius: 999px;
}

.contact-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--lavender-pale);
}

.contact-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--purple-deep);
  text-align: center;
}

.contact-note {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--purple-mid);
  text-align: center;
}

.contact-success {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  color: var(--purple-dark);
  background: var(--lavender-pale);
  border-radius: 8px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form__honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-form__field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple-dark);
}

.contact-form__field input,
.contact-form__field textarea {
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  color: var(--purple-ink);
  background: var(--white-soft);
  border: 1px solid var(--lavender);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.contact-form__field input:focus,
.contact-form__field textarea:focus {
  outline: none;
  border-color: var(--purple-deep);
}

.contact-form__field textarea {
  resize: vertical;
  min-height: 120px;
}

.btn-contact {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  background: var(--purple-deep);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.btn-contact:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.btn-contact:focus-visible {
  outline: 3px solid var(--lavender-pale);
  outline-offset: 3px;
}

.projects-header__left {
  grid-column: 1;
  justify-self: start;
}

/* —— Projects carousel —— */
.projects-page {
  min-height: 100dvh;
  background: radial-gradient(
      ellipse 120% 90% at 50% 25%,
      var(--white) 0%,
      var(--white-soft) 22%,
      var(--lavender-pale) 45%,
      var(--lavender-dusty) 72%,
      var(--purple-mid) 100%
    );
  display: flex;
  flex-direction: column;
}

.projects-header {
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) auto minmax(5rem, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 2rem 0.5rem;
}

.projects-header h1 {
  margin: 0;
  grid-column: 2;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--purple-dark);
  text-align: center;
}

.projects-header .back-link {
  color: var(--purple-dark);
}

.projects-header .back-link:last-of-type {
  grid-column: 3;
  justify-self: end;
}

.projects-page .back-link {
  color: var(--purple-dark);
}

.back-link {
  color: var(--white);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.back-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.carousel-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 0 2rem;
  position: relative;
}

.carousel-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--purple-dark);
  opacity: 0.75;
  margin: 0 0 0.75rem;
}

.carousel {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 1.5rem;
  padding: 1rem 1.5rem 2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-deep) transparent;
}

.carousel::-webkit-scrollbar {
  height: 6px;
}

.carousel::-webkit-scrollbar-thumb {
  background: var(--purple-deep);
  border-radius: 3px;
}

.carousel__card {
  flex: 0 0 min(85vw, 380px);
  scroll-snap-align: center;
  background: var(--white);
  border: 1px solid var(--lavender-pale);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px var(--shadow);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.carousel__card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px var(--shadow);
}

.carousel__card:focus-visible {
  outline: 3px solid var(--cave-red);
  outline-offset: 4px;
}

.carousel__card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.carousel__card-body {
  padding: 1.25rem 1.35rem 1.5rem;
}

.carousel__card-body h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: var(--purple-deep);
}

.carousel__card-body p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--purple-mid);
  line-height: 1.45;
}

.carousel__card-link {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--purple-deep);
  opacity: 0.85;
  text-decoration: none;
}

.carousel__card:hover .carousel__card-link {
  opacity: 1;
  color: var(--cave-red);
}

.btn-github {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--white);
  background: var(--purple-deep);
  border-radius: 6px;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.btn-github:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.btn-github:focus-visible {
  outline: 3px solid var(--lavender-pale);
  outline-offset: 3px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.carousel-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--purple-mid);
  opacity: 0.55;
  transition:
    opacity 0.2s,
    transform 0.2s,
    background 0.2s;
}

.carousel-dots span.active {
  opacity: 1;
  background: var(--purple-deep);
  border-color: var(--purple-deep);
  transform: scale(1.2);
}

/* —— Project detail —— */
.detail-page {
  min-height: 100dvh;
  background: linear-gradient(
    180deg,
    var(--lavender-dusty) 0%,
    var(--purple-mid) 40%,
    var(--purple-dark) 100%
  );
}

.detail-hero {
  position: relative;
  height: min(42vh, 320px);
  overflow: hidden;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--lavender-dusty) 0%,
    transparent 65%
  );
}

.detail-body {
  max-width: 42rem;
  margin: -3rem auto 0;
  padding: 2rem 1.75rem 2.5rem;
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 40px var(--shadow);
}

.detail-body h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  color: var(--purple-deep);
}

.detail-tagline {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: var(--lavender);
  font-style: italic;
  font-family: "Cormorant Garamond", Georgia, serif;
}

.detail-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.detail-stack span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  background: var(--purple-deep);
  color: var(--white);
  border-radius: 999px;
}

.detail-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  color: var(--purple-deep);
}

.detail-section p {
  margin: 0 0 1.5rem;
  line-height: 1.65;
  color: var(--purple-ink);
  opacity: 0.88;
}

.detail-nav {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-not-found {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--white);
}

.detail-not-found h1 {
  color: var(--white);
}

.detail-not-found a {
  color: var(--white-soft);
}

/* Fade-in on load */
.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

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

@media (min-width: 768px) {
  .home {
    padding-bottom: 14vh;
  }

  .carousel__card {
    flex: 0 0 400px;
  }
}
