/* Brand display fonts (local files, see assets/fonts) */
@font-face {
  font-family: "Aero";
  src: url("assets/fonts/Aero.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Aeroblade DEMO";
  src: url("assets/fonts/AerobladeDEMO.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Values taken from Figma frames "Landing Page - section" and
   "Featured Work - section" (each 1920 × 1080). */
:root {
  --ink: #151515;
  --text: #000000;
  --white: #ffffff;
  --green-light: #c7efcd;
  --green-lime: #b1e710;
  --cream: #fffdee;
  --placeholder: #cecece;
  --title-grey: #6b6966;
  --desc-grey: #767470;
  --line-grey: #55534f;

  --frame-w: 1920;
  --header-top: 36px;
  --header-h: 74px;
  --nav-gap: clamp(32px, calc(124 / var(--frame-w) * 100vw), 124px);

  /* Space reserved for the landing animation above Featured Work. */
  --landing-h: 900px;
}

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

html,
body {
  margin: 0;
  background: var(--white);
  /* Stop horizontal trackpad swipes from triggering browser back/forward. */
  overscroll-behavior-x: none;
}

body {
  font-family: "Sora", system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Page background ---------- */
/* One continuous gradient behind both sections, so there is no seam:
   lime (Figma landing top) -> soft green -> cream -> white. */
.page {
  background:
    linear-gradient(180deg,
      var(--green-lime) 0%,
      #bdeb6a 14%,
      var(--green-light) 38%,
      #e6f6de 58%,
      var(--cream) 78%,
      var(--white) 100%),
    var(--white);
}

/* ---------- Landing section ---------- */
.landing {
  position: relative;
  z-index: 2;
  min-height: var(--landing-h);
}

/* Hero image, centred across the page, 48px below the navigation bar
   (measured from the bottom of the menu circle, the bar's lowest point:
   header top + 1px + 13px inset + 48px circle) and at least 80px from
   the sides. */
.landing__hero {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: var(--landing-h);
  padding: calc(var(--header-top) + 62px + 48px) 80px 80px;
}

/* "scroll down for more" cue: pinned to the bottom of the window, gently
   bobbing, and fading away once you start scrolling. */
.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-family: "Sora", system-ui, sans-serif;
  font-size: 14px;
  font-variant-caps: all-small-caps;
  letter-spacing: 1.44px;
  white-space: nowrap;
  opacity: 0.45;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.5s ease;
  animation: scroll-cue-float 2.6s ease-in-out infinite;
}

.scroll-cue.is-hidden {
  opacity: 0;
}

.scroll-cue svg {
  width: 44px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes scroll-cue-float {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -8px); }
}

.landing__hero img {
  display: block;
  width: 650px; /* 70% of 928 */
  max-width: 100%;
  height: auto;
}

/* Phones: 112px each side would leave the image tiny, so it keeps
   clear of the header and uses the normal 16px page margin. */
@media (max-width: 767px) {
  .landing__hero {
    align-items: center;
    padding: calc(var(--header-top) + var(--header-h) + 24px) 16px 48px;
  }
}

.site-header {
  position: absolute;
  inset: var(--header-top) 0 auto 0;
  height: var(--header-h);
}

/* Page side margin: the logo's left edge and the circle's right edge
   both sit this far from the window edge. */
:root {
  --side-margin: 100px;
}

/* Shifted up so the "Femdoc" wordmark's vertical centre lines up with
   the nav text. */
.logo {
  position: absolute;
  top: -15px;
  left: var(--side-margin);
  display: block;
  width: 212px;
  height: 74px;
}

/* Home page logo at 70%, the same size as the Merch page. The "Femdoc"
   wordmark (centre 51.34 of 74 in the artwork) stays level with the nav
   text, 36.34px below the header top. */
.landing .logo,
.commission-page .logo {
  width: calc(212px * 0.7);
  height: calc(74px * 0.7);
  top: calc(36.34px - 51.34px * 0.7);
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
}

/* The logo is drawn as a colour through its own shape (a mask), so it
   can turn purple on hover to show it's clickable. The <img> stays
   for its alt text but is invisible. */
.logo {
  background-color: #151515;
  -webkit-mask: url("assets/femdoc-logo.svg") center / 100% 100% no-repeat;
  mask: url("assets/femdoc-logo.svg") center / 100% 100% no-repeat;
  transition: background-color 0.08s ease-out;
}

.logo img {
  opacity: 0;
}

.logo:hover,
.logo:focus-visible {
  background-color: #6e0cf5;
}

/* Nav container: 1140 wide, centred in the frame */
.top-nav {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--nav-gap);
  white-space: nowrap;
}

.top-nav a,
.menu-panel a {
  font-size: 18px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 1.08px;
  color: var(--text);
  text-decoration: none;
}

.top-nav a {
  position: relative;
}

.top-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.top-nav a:hover::after,
.top-nav a:focus-visible::after {
  transform: scaleX(1);
}

/* Hamburger: 74 × 74 box with a 48px white circle centred inside it.
   Nudged down 1px so it sits on the optical centre of the nav text.
   Fixed to the window, so it stays put while the page scrolls (it starts
   exactly where the header puts it). Once scrolled it fades back until
   hovered, focused or opened. */
.menu-button {
  position: fixed;
  top: calc(var(--header-top) + 1px);
  right: calc(var(--side-margin) - 13px); /* the 48px circle sits 13px inside this 74px button */
  width: 74px;
  height: 74px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 50;
  transition: opacity 0.35s ease;
}

.menu-button.is-scrolled {
  opacity: 0.4;
}

.menu-button.is-scrolled:hover,
.menu-button.is-scrolled:focus-visible,
.menu-button[aria-expanded="true"] {
  opacity: 1;
}

.menu-button__icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.25s ease;
}

/* Three black lines; they fold into an × while the menu is open. */
.menu-button__bar {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 2.5px;
  margin: -1.25px 0 0 -10px;
  background: var(--text);
  transition:
    transform 0.35s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.2s ease;
}

.menu-button__bar:nth-child(1) { transform: translateY(-6px); }
.menu-button__bar:nth-child(3) { transform: translateY(6px); }

.menu-button[aria-expanded="true"] .menu-button__bar:nth-child(1) {
  transform: rotate(45deg);
}

.menu-button[aria-expanded="true"] .menu-button__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.2);
}

.menu-button[aria-expanded="true"] .menu-button__bar:nth-child(3) {
  transform: rotate(-45deg);
}

.menu-button:hover .menu-button__icon,
.menu-button[aria-expanded="true"] .menu-button__icon {
  transform: scale(1.08);
}

.menu-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 50%;
}

/* ---------- Menu panel (opened by the hamburger) ---------- */
.menu-panel {
  position: fixed;
  top: calc(var(--header-top) + var(--header-h) + 16px);
  right: calc(var(--side-margin) - 13px);
  z-index: 49;
  min-width: 240px;
  padding: 26px 30px 26px 20px;
  border-radius: 4px;
  background: var(--white);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-panel.is-open {
  opacity: 1;
  transform: none;
}

.menu-panel nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

/* Items slide down into place one after another as the menu opens.
   Each is an icon column then the label. */
.menu-panel a {
  --menu-purple: #9864ee;
  position: relative;
  display: grid;
  grid-template-columns: 26px auto;
  align-items: center;
  column-gap: 48px;
  width: 100%;
  opacity: 0;
  transform: translateY(-14px);
  transition:
    opacity 0.3s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  /* Only the slide-in animates; hover changes (colour, bold, icon) are
     instant, so the stagger delays below never hold them back. */
}

.menu-icon {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  overflow: visible;
}

/* Bold text is wider; an invisible bold copy holds the space so the
   label doesn't nudge sideways when it turns bold on hover. */
.menu-label {
  display: inline-grid;
}

.menu-label::after {
  content: attr(data-label);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 700;
}

/* Hover: same colour, but the label turns bold and the icon's lines thicken. */
.menu-panel a:hover {
  font-weight: 700;
}

.menu-panel a:hover .menu-icon {
  stroke-width: 1.35;
}

.menu-panel.is-open a {
  opacity: 1;
  transform: none;
}

.menu-panel.is-open a:nth-child(1) { transition-delay: 0.05s; }
.menu-panel.is-open a:nth-child(2) { transition-delay: 0.11s; }
.menu-panel.is-open a:nth-child(3) { transition-delay: 0.17s; }
.menu-panel.is-open a:nth-child(4) { transition-delay: 0.23s; }
.menu-panel.is-open a:nth-child(5) { transition-delay: 0.29s; }
.menu-panel.is-open a:nth-child(6) { transition-delay: 0.35s; }

/* The page you're on: purple and bold, with a light rule beneath. */
.menu-panel a[aria-current="page"] {
  font-weight: 700;
  color: var(--menu-purple);
}

.menu-panel a[aria-current="page"]:hover {
  color: #6e0cf5;
}

.menu-panel a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 2px;
  right: -10px;
  bottom: -7px; /* 10px gap below the icon, the item's lowest part */
  height: 1px;
  background: #d9d9d9;
}

/* ---------- Featured Work section ---------- */
/* Background comes from .page so the two sections blend seamlessly. */
.featured {
  /* The cards are the focus: the centred card fills the screen height
     left over after the heading and the project title (--chrome), but
     stays narrow enough for all three cards plus two 120px gaps to fit
     the width (centre + 2 × 0.88 side cards, ~2.55 card widths once
     the curve draws the side cards inward). */
  --chrome: 257px;
  --card-w: max(240px, min(
    calc((100vh - var(--chrome)) * 510 / 660),
    calc((100vw - 240px) / 2.55)
  ));
  --card-gap: 120px;

  position: relative;
  padding: 11px 0 48px;
  overflow: hidden;
}

.featured__heading {
  text-align: center;
  color: var(--text);
}

.featured__title {
  margin: 0;
  font-family: "Aero", "Sora", sans-serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 28px;
  letter-spacing: 1.92px;
  text-transform: uppercase;
}

.featured__subtitle {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0.96px;
}

/* 510 × 660 cards, 120px gaps, centre card centred (Figma spacing). */
.carousel {
  position: relative;
  margin-top: 40px;
  outline: none;
}

/* Fallback (no WebGL): a flat, swipeable strip that snaps to centre. */
.carousel:not(.is-3d) {
  display: flex;
  align-items: center;
  gap: var(--card-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-inline: calc((100% - var(--card-w)) / 2);
  scrollbar-width: none;
}

.carousel:not(.is-3d)::-webkit-scrollbar {
  display: none;
}

.carousel:not(.is-3d) .work-card {
  scroll-snap-align: center;
}

/* 3D mode: the figures stay in the DOM for screen readers only;
   the visible cards are drawn by carousel.js on the canvas. */
.carousel.is-3d {
  height: calc(var(--card-w) * 660 / 510);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.carousel.is-3d.is-dragging {
  cursor: grabbing;
}

.carousel.is-3d.is-hovering-card {
  cursor: pointer;
}

.carousel.is-3d .work-card {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Canvas is taller than the card band so bending paper never clips. */
.carousel__canvas {
  position: absolute;
  left: 0;
  top: -20%;
  width: 100%;
  height: 140%;
  pointer-events: none;
  display: block;
}

.carousel:focus-visible::after {
  content: "";
  position: absolute;
  inset: -12px calc(50% - var(--card-w) / 2 - 12px);
  border: 2px solid var(--ink);
  border-radius: 8px;
  pointer-events: none;
}

.work-card {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  aspect-ratio: 510 / 660;
  margin: 0;
  overflow: hidden;
  container-type: inline-size;
}

.work-card--placeholder {
  background: var(--placeholder);
}

/* Artwork fills the width and is anchored to the top (Figma: h 117.24%, top 0) */
.work-card__img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* Number label at x 200, y 282 inside a 510 × 660 card */
.work-card__number {
  position: absolute;
  left: calc(200 / 510 * 100cqw);
  top: calc(282 / 510 * 100cqw);
  font-family: "Aeroblade DEMO", "Aero", sans-serif;
  font-size: calc(64 / 510 * 100cqw);
  line-height: normal;
  letter-spacing: calc(3.84 / 510 * 100cqw);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--white);
  pointer-events: none;
}

.work-card--placeholder .work-card__number {
  color: var(--text);
}

.project-title {
  --name-h: 30px;
  --title-gap: 10px;
  position: relative;
  width: min(600px, calc(100% - 32px));
  margin: 32px auto 0;
  display: flex;
  flex-direction: column;
  gap: var(--title-gap);
  text-align: center;
}

.project-title p {
  margin: 0;
}

.project-title__name {
  font-weight: 700;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: 0.96px;
  text-transform: uppercase;
  color: var(--title-grey);
}

.project-title__desc {
  font-weight: 400;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.84px;
  text-transform: lowercase;
  color: var(--desc-grey);
}

/* Title text is split into letters by carousel.js so it can animate:
   letters drop away while the carousel moves and rise back in when it
   settles. Hovering the centre card or the text parts the two lines
   and draws an underline between them. */
.project-title {
  cursor: default;
}

.project-title__name,
.project-title__desc {
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-title.is-underlined .project-title__name {
  transform: translateY(-6px);
}

.project-title.is-underlined .project-title__desc {
  transform: translateY(6px);
}

/* Underline position for the project title. */
.project-title__line {
  position: absolute;
  left: 50%;
  top: calc(var(--name-h) + var(--title-gap) / 2);
  width: var(--line-w, 100%);
  margin-top: -3.5px;
  transform: translateX(-50%);
}

/* ---------- Kink line (shared) ----------
   Thin rule with a small lightning kink just left of centre, used under
   the carousel title and the selected Merch category. It is hidden until
   drawn, then grows outward from the kink. Colour: --kink-color. */
.kink-line {
  display: flex;
  align-items: flex-start;
  height: 7px;
  pointer-events: none;
}

.kink-line__seg {
  height: 1px;
  background: var(--kink-color, var(--line-grey));
  transform: scaleX(0);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.kink-line__seg--left {
  flex: 0 0 47%;
  margin-top: 2px;
  transform-origin: right center;
}

.kink-line__seg--right {
  flex: 1 1 auto;
  margin-top: 4px;
  transform-origin: left center;
}

.kink-line__bolt {
  flex: 0 0 auto;
  width: 9px;
  height: 7px;
  overflow: visible;
  fill: none;
  stroke: var(--kink-color, var(--line-grey));
  stroke-width: 1.1;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Drawn state */
.project-title.is-underlined .kink-line__seg,
.shop-categories a[aria-current="page"] .kink-line__seg {
  transform: scaleX(1);
  transition-delay: 0.08s;
}

.project-title.is-underlined .kink-line__bolt,
.shop-categories a[aria-current="page"] .kink-line__bolt {
  opacity: 1;
  transform: none;
}

.project-title .word {
  display: inline-block;
  white-space: nowrap;
}

.project-title .char {
  display: inline-block;
  transition:
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.45s ease;
  transition-delay: calc(var(--i) * 18ms);
  will-change: transform;
}

.project-title.is-hidden .char {
  opacity: 0;
  transform: translateY(0.6em) rotate(4deg);
  transition-duration: 0.22s, 0.18s;
  transition-delay: calc(var(--i) * 4ms);
}


/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .top-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --header-top: 20px;
  }

  .logo {
    left: 16px;
    width: 160px;
    height: 56px;
    top: 9px;
  }

  .menu-button,
  .menu-panel {
    right: 16px;
  }

  .menu-panel {
    left: 16px;
  }
}

/* Narrow screens: three cards side by side get too small, so the
   carousel becomes a swipeable strip that snaps each card to centre. */
@media (max-width: 767px) {
  :root {
    --landing-h: 100vh;
    --landing-h: 100svh;
  }

  .featured {
    --card-w: min(510px, 72vw);
    --card-gap: 24px;
    padding-bottom: 96px;
  }

  .carousel {
    margin-top: 48px;
  }

  .project-title {
    --name-h: 28px;
    margin-top: 32px;
  }

  .project-title__name {
    font-size: 22px;
    line-height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Home page on small screens: same logo size as the Merch page, with the
   wordmark level with the circle's centre (38px below the header top). */
@media (max-width: 767px) {
  .landing .logo,
  .commission-page .logo {
    width: 133.6px;
    height: 46.6px;
    top: calc(38px - 51.34px * 46.6 / 74);
  }
}

@media (max-width: 380px) {
  .landing .logo,
  .commission-page .logo {
    width: 115px;
    height: 40px;
    top: calc(38px - 51.34px * 40 / 74);
  }
}
