main {
  position: relative;
  z-index: 1;
}

html:not(.js) :is(#s5, #work, #services, #contact) {
  background: #c9293f;
}

:is(#s1, #s2, #s3, #s4) {
  height: 100svh;
  pointer-events: none;
}

#s4 {
  height: 200svh;
}

@media (prefers-reduced-motion: no-preference) {
  #s5 > h2,
  #s5 > dl,
  #work > p,
  #work > h2,
  #services > p,
  #services > h2,
  #contact > p,
  #contact > h2,
  #contact > address {
    opacity: 0;
    animation: fade-up linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

section {
  &:nth-of-type(1) {
  }
}

#s5 {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3rem;
  padding: 4rem 2rem;

  dl {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;

    @media (min-width: 450px) {
      display: grid;
      grid-template-columns: repeat(3, auto);
      grid-auto-flow: column;
      row-gap: 0.3rem;
      column-gap: 2rem;
      justify-content: start;
    }
  }

  dd {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--color-light);
    line-height: 1;
  }

  dt {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--color-light);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;

    &:last-child {
      margin-bottom: 0;
    }

    @media (min-width: 450px) {
      margin-bottom: 0;
    }
  }
}

/* ── Work ── */

#work {
  min-height: 100svh;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
  position: relative;
  background: rgba(0, 0, 0, 0.12);

  p {
    font-size: 1rem;
    color: var(--color-light);
    line-height: 1.6;
    max-width: 48rem;
  }

  h2 {
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.6rem);
    color: var(--color-light);
    letter-spacing: -0.03em;
  }
}

#work-carousel {
  position: relative;
}

#work-track {
  display: grid;
  gap: 1rem;
  list-style: none;

  @media (min-width: 600px) {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 1rem;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  li {
    flex: 0 0 min(85%, 42rem);
    scroll-snap-align: start;
  }

  article {
    border-radius: 0.8rem;
    height: 24rem;
    background: #fff;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.4rem;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    overflow: hidden;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.72) 0%,
        transparent 65%
      );
      pointer-events: none;
    }

    span {
      font-size: 0.7rem;
      font-weight: 800;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #fff;
      position: relative;
      z-index: 1;
    }

    h3 {
      font-size: 1.4rem;
      font-weight: 800;
      color: #fff;
      position: relative;
      z-index: 1;
    }

    p {
      font-size: 1rem;
      color: rgba(255, 255, 255, 0.75);
      line-height: 1.5;
      position: relative;
      z-index: 1;
    }
  }

  .project-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
  }

  .project-link:hover article {
    transform: translateY(-0.25rem);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
  }

  li:first-child article {
    background-image: url(lux.png);
  }

  li:nth-of-type(2) article {
    background-image: url(strakplannew.png);
  }

  li:nth-of-type(3) article {
    background-image: url(artquake.png);
  }
}

:is(#work-prev, #work-next) {
  display: none;

  @media (min-width: 600px) {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 3.2rem;
    height: 3.2rem;
    background: var(--color-primary);
    color: #fff;
    border: var(--border);
    box-shadow: 4px 4px 0 var(--color-ink);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;

    &:hover {
      transform: translateY(calc(-50% - 2px)) translateX(-2px);
      box-shadow: 6px 6px 0 var(--color-ink);
    }
  }
}

#work-prev {
  left: 1.5rem;
}
#work-next {
  right: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  #work-track article {
    opacity: 0;
    animation: fade-up linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

/* ── Services ── */

#services {
  padding: 6rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;

  & > p {
    font-size: 1rem;
    color: var(--color-light);
    line-height: 1.6;
    max-width: 48rem;
  }

  h2 {
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.6rem);
    color: var(--color-light);
    letter-spacing: -0.03em;
  }

  ul {
    list-style: none;
    display: flex;
    flex-direction: column;
  }

  li {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "num  text"
      "title text";
    grid-template-rows: auto 1fr;
    column-gap: 3rem;
    padding: 2.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);

    &:last-child {
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    @media (max-width: 599px) {
      grid-template-columns: 1fr;
      grid-template-areas: "num" "title" "text";
      grid-template-rows: auto;
      gap: 0.6rem;
    }
  }

  span {
    grid-area: num;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--color-light);
    opacity: 0.6;
  }

  h3 {
    grid-area: title;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--color-light);
    align-self: end;
  }

  li p {
    grid-area: text;
    font-size: 1rem;
    color: var(--color-light);
    line-height: 1.6;
    align-self: center;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #services li p {
    opacity: 0;
    animation: fade-in-right linear both;
    animation-timeline: view();
    animation-range: entry 15% entry 55%;
  }
}

/* ── Contact ── */

#contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100svh;

  @media (max-width: 699px) {
    grid-template-columns: 1fr;
  }

  h2 {
    background: rgba(0, 0, 0, 0.12);
    color: var(--color-light);
    padding: 6rem 3rem;
    font-weight: 800;
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    display: flex;
    align-items: center;
  }

  form {
    background: #f7f5f3;
    padding: 6rem 3rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-content: center;

    @media (max-width: 699px) {
      padding: 3rem 2rem;
      grid-template-columns: 1fr;
    }
  }

  form > p:nth-child(4),
  form > p:nth-child(5),
  form > button,
  form > output {
    grid-column: 1 / -1;
  }

  .form-honeypot {
    display: none;
  }

  #contact-status {
    color: green;
  }

  label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
  }

  :is(input, textarea) {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 0.0625rem solid rgba(0, 0, 0, 0.2);
    padding: 0.6rem 0;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--color-ink);
    transition: border-color 0.2s;

    &:focus {
      outline: none;
      border-bottom-color: var(--color-ink);
    }
  }

  textarea {
    resize: vertical;
    min-height: 6rem;
  }

  output {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--color-primary);
    min-height: 1.4rem;
  }
}

/* ── Footer ── */

footer {
  position: absolute;
  top: 2.25rem;
  right: 10%;
  z-index: 2;
  background: #fff;
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 0.375rem 0.875rem;
  color: var(--color-ink);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.0625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

/* ── Contact success state ── */

#contact form.contact-success {
  align-content: center;
  justify-items: center;
  text-align: center;
}

.success-title {
  grid-column: 1 / -1;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.03em;
  line-height: 1;
}

.success-sub {
  grid-column: 1 / -1;
  font-size: 1rem;
  color: var(--color-muted);
}

/* ── Confetti ── */

.confetti-piece {
  position: fixed;
  top: -2rem;
  z-index: 1000;
  pointer-events: none;
  border-radius: 0.1rem;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) translateX(var(--drift)) rotate(720deg);
    opacity: 0;
  }
}

/* ── Animation ── */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(2rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
