:root {
  /* core palette  */
  --color-bg: #f8f5f2;
  --color-unfold: #8b7e6e;
  --color-accent: var(--color-unfold);
  --color-accent-dark: #7a452c;
  --color-btn-bg: var(--color-accent);
  --color-btn-color: var(--color-accent);
  --color-surface: #ffffff;
  --color-surface-muted: #e4e1df;
  --color-surface-about: #ebe6e0;
  --color-surface-accent: #e6d9cc;
  --color-border: #d9cbb9;
  --color-border-soft: #e7dccd;
  --color-shadow: rgba(46, 38, 32, 0.07);
  --color-shadow-strong: rgba(46, 38, 32, 0.12);
  --color-text: color-mix(in oklab, #2e2a24, transparent 30%);
  --color-text-soft: #5d5046;

  /* layout */
  --btn-border: 1px solid hsl(from var(--color-unfold) calc(100deg * h) calc(1.5 * s) calc(l * 1.5));
  --component-padding: 1.5rem;
  --container: 1120px;
  --container-narrow: 780px;
  --header-height: 72px;
  --radius: 10px;
  --radius-sm: 2px;
  --section-shadow: 0 0px 30px 10px rgb(30 30 30 / 0.15);

  /* motion. */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 220ms;

  /* fragrances */
  --color-serenity: #d0c1b4;
  --color-elegance: #9b9e8d;
  --color-valour: #f1e8dc;
  --color-opulence: #3e3b35;
}

/* import the montserrat ttf from the fonts folder */
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
}

/* base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Offset for sticky header when following anchor links */
}

body {
  margin: 0;
  font-family:
    "Montserrat",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

a {
  color: var(--color-accent-dark);

  &:hover,
  &:focus-visible {
    text-decoration: none;
  }
}

/* Utility: hide content visually while remaining accessible to assistive tech */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout primitives ---------- */

.container {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
}

.section {
  padding: 4.5rem 0;
}

.section-muted {
}

.section-about {
  background: var(--color-surface-about);
}

.section-accent {
  background: var(--color-surface-accent);
}

.prose-flow {
  display: grid;
  gap: 1.75rem;
  max-width: var(--container-narrow);
  margin: 0 auto;
}

/* ---------- Header / navigation ---------- */

body {
  > header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    /* Border fades in once scrolled past --min-height; JS toggles .is-scrolled */
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease);
    backdrop-filter: blur(10px);

    > div {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: var(--header-height);
      gap: 1rem;

      > a {
        font-size: 1.15rem;
        font-weight: 200;
        letter-spacing: 0.02em;
        color: #808080;
        text-decoration: none;
        aspect-ratio: 246 / 169;
        background: 0% / 60% no-repeat url(../img/logo.webp);
        height: 100%;
        min-height: var(--header-height);
        width: auto;
        display: block;
        filter: brightness(0);

        > span {
          display: none;
        }
      }

      nav {
        /* on  mobile: hidden by default, revealed via the .is-open class toggled by JS */
        display: none;
        position: absolute;
        top: 72px;
        right: 0.5rem;
        min-width: 220px;
        padding: 1rem;
        border-radius: 0 0 var(--radius) var(--radius);
        background: var(--color-surface);
        box-shadow: 0 20px 30px var(--color-shadow-strong);

        &.is-open {
          display: grid;
          gap: 0.75rem;
        }

        a {
          --hpadding: 0.2rem;
          --border-width: 0%;
          position: relative;
          text-decoration: none;
          color: var(--color-text);
          padding: 0.4rem var(--hpadding);

          &::before {
            content: "";
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: var(--border-width);
            height: 2px;
            background: var(--color-text);
            transition: width var(--dur-fast) var(--ease);
            will-change: width;
            pointer-events: none;
          }

          &:hover,
          &.current {
            --border-width: calc(100% - calc(2 * var(--hpadding)));
          }
        }
      }
    }
  }

  &.scrolled {
    > header {
      border-bottom-color: var(--color-border-soft);
    }
  }
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);

  &:hover,
  &:focus-visible {
    border-color: var(--color-accent);
  }
}

/* ---------- Typography ---------- */

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text);
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
  color: var(--color-text);
  font-weight: 400;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.6rem);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

p {
  margin-top: 0;

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

em {
  font-style: normal;
  color: var(--color-unfold);
  font-weight: 500;
}

.lede,
.section-copy {
  max-width: 60ch;
  font-size: 1.05rem;
  color: var(--color-text-soft);

  & + & {
    margin-top: 1rem;
  }
}

.icons {
  display: flex;
  gap: 3rem;
  margin: 3rem 0 0;
  justify-content: center;

  img {
    height: 100%;
    width: auto;
    aspect-ratio: 1;
    max-height: 100px;
    filter: sepia(1) hue-rotate(-7deg) saturate(0.6);
  }
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.button {
  background: transparent;
  color: var(--color-btn-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  border: 0;

  > span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.35rem;
    border: var(--btn-border);
    border-radius: 2rem 4px 2rem;
    transition: transform var(--dur);
  }

  &:hover,
  &:focus-visible {
    span {
      transform: translateY(-5px);
    }
  }

  &:active {
    span {
      transform: translateY(0);
    }
  }

  &[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
  }
}

.button-secondary {
  --color-btn-bg: transparent;
  --color-btn-color: var(--color-accent-dark);

  &:hover,
  &:focus-visible {
    --color-btn-bg: color-mix(in srgb, var(--color-accent) 10%, transparent);
  }
}

/* ---------- Cards / panels / grids ---------- */

.panel {
  padding: var(--component-padding);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.card-grid,
.details-grid {
  display: grid;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card-grid {
  .card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 5px 10px rgb(0 0 0 / 0.15);
    padding: 1rem;
  }
}

ol {
  counter-reset: counter;
  /* counter-increment: counter; */

  > li {
    position: relative;

    &::before {
      content: counter(counter);
      counter-increment: counter;
      font-size: 1.5rem;
      font-weight: 200;
      position: absolute;
      left: 50%;
      background: #fff;
      border-radius: 50%;
      width: 2.5rem;
      height: 2.5rem;
      display: flex;
      transform: translate(-50%, -2.3rem);
      justify-content: center;
      align-items: center;
      border-top: 1px solid hsl(from var(--color-text) h s calc(5.1 * l));
      border-bottom: 1px solid hsl(from var(--color-text) h s calc(5.1 * l));
      color: var(--color-unfold);
    }
  }
}

.hero {
  --color-background: var(--color-opulence);
  padding: 4.5rem 0 5rem;
  position: relative;
  z-index: 20;
  background: var(--color-bg);
  box-shadow: var(--section-shadow);

  .hero-grid {
    display: flex;
    /* gap: 2.5rem; */
    align-items: center;
  }

  .hero-copy {
    max-width: 52ch;

    h1 {
      color: var(--color-unfold);

      > span {
        color: var(--color-text);
        font-weight: 200;
        font-size: 0.7em;
        display: block;

        span {
          margin: 0 -0.2em;
          opacity: 0.5;
        }
      }
    }
  }

  figure {
    margin: 0;
    position: relative;
    aspect-ratio: 4 / 5;
    width: 100%;
    max-width: 480px;

    img {
      aspect-ratio: 4 / 5;
      width: 100%;
      max-width: 480px;
      margin: 0 auto;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;

      &[data-background] {
        z-index: 1;
        opacity: 0;
        transition: opacity 650ms var(--ease);
        will-change: opacity;

        &.is-active {
          opacity: 1;
          z-index: 2;
        }
      }
    }
  }

  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-background);
    clip-path: polygon(calc(50% + 220px) 0px, 100% 0px, 100% 100%, calc(50% + 40px) 100%);
    transition: background var(--dur-fast) var(--ease);
  }
}

#what,
#formula {
  position: relative;

  &::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 4rem;
    background: 50% 100% / 1642px no-repeat url(../img/divider.svg);
    opacity: 0.5;
    pointer-events: none;
  }
}

#what {
  ul {
    margin: 0;
    padding: 0;
    color: var(--color-text-soft);
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-direction: column;

    > li {
      background: #fff;
      padding: 1rem;
      border-radius: var(--radius);
    }

    h4 {
      font-size: 1.2rem;
      font-weight: 300;
      line-height: 1.2;
      margin: 0 0 0.5rem;
    }

    p {
      margin: 0;
      opacity: 0.6;
      color: #000;
    }
  }
}

/* ==========================================================================
   FRAGRANCES — simple horizontal scroller + native scroll-snap.
   ----------------------------------------------------------------------------
   Architecture (KISS / no fanciness):
     .fragrances          → outer wrapper; holds palette vars, padding, bg fade
     .fragrances__scroller → the HORIZONTAL scroll element itself:
                            overflow-x: auto, scroll-snap-type: x mandatory
     .fragrances__slide   → ×5 flex children; each is min-width:100%,
                            scroll-snap-align: start, carries palette via
                            data-color-bg / data-color-surface / data-color-accent* attrs
                            background-color + text colour crossfade via CSS when
                            the JS IntersectionObserver marks one [data-active].
     .fragrances__inner   → copy (left) + visual (right) grid per-slide
     .fragrances__dots    → simple horizontal row of 5 dots BELOW the scroller
                            JS syncs aria-current to active slide; click scrolls
   ========================================================================== */

.fragrances {
  position: relative;
  z-index: 17;
  background: var(--color-bg);
  box-shadow: var(--section-shadow);
  /* Default palette = intro slide. Overridden per-slide by JS copying
     data-color-* dataset attrs → these CSS custom properties. */
  --f-bg: var(--color-surface-muted);
  --f-accent: var(--color-accent);
  --f-accent-soft: var(--color-accent-dark);
  --f-text: var(--color-text);
  --f-text-soft: var(--color-text-soft);
  padding: 4.5rem 0;
  /* Crossfade palette vars whenever the active slide changes. */
  background-color: var(--f-bg);
  transition:
    background-color 500ms var(--ease),
    color 500ms var(--ease);
  color: var(--f-text);

  > div {
    overflow: hidden;
  }

  .scroller {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* No visible scrollbars — users swipe / drag / mouse-wheel-horiz / dot-nav.
     scrollbar-width = Firefox; ::-webkit-scrollbar = Chromium / Safari */
    scrollbar-width: none;
    &::-webkit-scrollbar {
      display: none;
    }
    /* Right & left breathing room for first/last slide content
     (equal to inline padding inside .container). */
    padding: 0 0 2.5rem;
    margin: 0;
    width: 100%;

    > article {
      /* Each slide exactly fills the scroller viewport → snap is page-per-page. */
      flex: 0 0 100%;
      min-width: 0;
      scroll-snap-align: start;
      scroll-snap-stop: always;

      > div {
        display: grid;
        grid-template-columns: 1.1fr 1fr;
        gap: 3rem;
        align-items: center;
        /* width: 100%; */
        min-height: clamp(420px, 70vh, 640px);
        padding: 1rem 0;

        > div {
          color: var(--f-text);
          max-width: 52ch;

          h2 {
            color: var(--f-text);

            + div {
              font-size: 0.86rem;
              font-weight: 600;
              text-transform: uppercase;
              letter-spacing: 0.12em;
              color: var(--f-accent);
              margin: 0 0 0.75rem;
            }
          }

          p {
            margin: 0;
            font-size: 1.05rem;
            line-height: 1.7;
            color: var(--f-text-soft);
          }
        }

        > figure {
          margin: 0;
          justify-self: end;
          width: 100%;
          max-width: 420px;
          aspect-ratio: 3 / 4;

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

      &[data-fragrance="intro"] figure {
        aspect-ratio: 1;
      }
    }
  }
}

/* ---------- Dot nav (horizontal row, below the scroller) ---------- */
.fragrances__dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 0;
}

.fragrances__dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1.5px solid var(--f-text-soft);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition:
    background 240ms var(--ease),
    border-color 240ms var(--ease),
    transform 240ms var(--ease);
}

.fragrances__dots button[aria-current="true"] {
  background: var(--f-accent);
  border-color: var(--f-accent);
  transform: scale(1.35);
}

/* -------------------- Responsive tweaks -------------------- */
@media (max-width: 767px) {
  .hero {
    .hero-grid {
      flex-direction: column-reverse;
    }

    &::before {
      clip-path: polygon(0% 0%, 100% 0%, 100% calc(50% + -10px), 0% calc(50% - 130px));
    }
  }

  .actions,
  .icons {
    justify-content: center;
  }

  #what ul {
    grid-template-columns: repeat(1, 1fr);
  }

  .fragrances {
    padding: 3.5rem 0;

    .scroller {
      > article {
        > div {
          grid-template-columns: 1fr;
          grid-template-rows: auto auto;
          gap: 1.75rem;
          align-content: center;
          min-height: clamp(520px, 80vh, 680px);
          padding: 0.5rem 0;

          figure {
            justify-self: center;
            max-width: 300px;
            order: -1; /* image on top on mobile for this section */
          }
        }
      }
    }
  }

  .fragrances__dots {
    gap: 0.5rem;
    padding-top: 0.5rem;
  }

  .fragrances__dots button {
    width: 8px;
    height: 8px;
  }
}

/* -------------------- Reduced motion: disable smooth snap scroll -------------------- */
@media (prefers-reduced-motion: reduce) {
  .fragrances__scroller {
    scroll-behavior: auto;
  }
}

/* ---------- FAQ — native <details> accordion ---------- */

#faq {
  background: var(--color-bg);
  position: relative;
  z-index: 15;

  .faq-list {
    display: grid;
    gap: 0.75rem;
  }

  .faq-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    padding: 0 1.25rem;
    overflow: hidden;
    transition:
      border-color var(--dur-fast) var(--ease),
      box-shadow var(--dur-fast) var(--ease);

    &[open] {
      border-color: var(--color-accent);
      box-shadow: 0 10px 28px var(--color-shadow);
    }

    > summary {
      list-style: none;
      padding: 1.15rem 0;
      font-weight: 600;
      color: var(--color-text);
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;

      &::-webkit-details-marker {
        display: none;
      }

      &::after {
        content: "+";
        font-size: 1.4rem;
        color: var(--color-accent);
        line-height: 1;
        transition: transform var(--dur) var(--ease);
      }
    }

    &[open] > summary::after {
      transform: rotate(45deg);
    }

    & > p {
      margin: 0 0 1.25rem;
      color: var(--color-text-soft);
    }
  }
}

[data-platform="apple"] #faq .faq-item {
  > summary {
    flex-direction: row-reverse;
    justify-content: left;
  }
}

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

form {
  --color-error: #f22c13;
  display: grid;
  gap: 1.1rem;

  div:has(label, input, textarea) {
    position: relative;

    & label {
      position: absolute;
      margin: -0.4rem 0 0;
      font-size: 0.8rem;
      line-height: 1rem;
      background: #fff;
      opacity: 0;
      padding: 0 0.5rem;
      transition: opacity var(--dur);

      &:has(+ input:not(:placeholder-shown)),
      &:has(+ textarea:not(:placeholder-shown)) {
        opacity: 1;
      }
    }

    &::after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 2px;
      opacity: 0;
      background: var(--color-accent);
      transition: opacity var(--dur) var(--ease);
    }

    &:has(input:focus),
    &:has(textarea:focus) {
      &::after {
        opacity: 1;
      }
    }

    &:has([aria-invalid="true"])::after {
      background: var(--color-error);
      opacity: 1;
    }

    & input,
    & textarea {
      display: block;
      width: 100%;
      padding: 0.75rem 0.5rem 0.25rem;
      border: 0;
      border-bottom: 1px solid var(--color-border);
      border-radius: 0;
      background: #fff;
      font: inherit;
      line-height: 1.5;
      transition:
        border-color var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease);

      &:focus {
        outline: none;
      }
    }

    & textarea {
      resize: vertical;
      min-height: 120px;
    }
  }

  .actions {
    display: flex;
    justify-content: center;
  }

  .form-status {
    margin: 0.25rem 0 0;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .form-status--error {
    color: var(--color-error);
  }

  .form-status--success {
    color: #2f5d35;
  }
}

/* ---------- Footer ---------- */

body > footer {
  padding: 2.25rem 0;
  background: #3e3b35;

  > div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: #fff;
    font-size: 0.92rem;
  }
}

/* ==========================================================================
   Responsive layout — single mobile-first breakpoint, 768px.
   ========================================================================== */

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  body > header > div > nav {
    position: static;
    display: flex;
    min-width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 1.5rem;

    & a {
      padding: 0.25rem 0.35rem;
    }
  }

  .hero {
    padding: 0;
    display: flex;
    min-height: calc(100dvh - var(--header-height));
  }

  .hero-grid {
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
  }

  .card-grid,
  .details-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-grid .card {
    &:nth-child(1) {
      transform: rotate(-2deg);
    }
    &:nth-child(2) {
      transform: translate(0, -4px);
    }
    &:nth-child(3) {
      transform: rotate(2deg);
    }
  }

  /* Fragrances get a 2-up layout so each card has room to breathe */
  .fragrance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: 1fr 1.1fr;
    gap: 3rem;
  }

  /* Extra breathing room on larger viewports */
  .section {
    padding: 5.5rem 0;
  }
}

/* Honour user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
