/* ==========================================================================
   Moon & Muse Studio: shared styles
   Tokens, reset, typography, layout helpers, header, nav, footer, buttons.
   See ai/DESIGN.md for where each value comes from in the Figma file.
   ========================================================================== */

:root {
  /* Colour */
  --rust: #672C1C;
  --rust-deep: #4B190B;
  --cocoa: #442C19;
  --olive: #72652A;
  --coral: #ED917F;
  --terracotta: #B1643E;
  --cream: #F5EDE3;
  --sky: #DAE0EB;
  --stripe-brown: #8C6A52;
  --stripe-blue: #B7C4D4;

  /* Type */
  --font-serif: 'Averia Serif Libre', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-script: 'Sacramento', 'Brush Script MT', cursive;

  --fs-display: clamp(4rem, 11vw, 10rem);       /* 160px marquee / page titles */
  --fs-xxl: clamp(2.75rem, 6vw, 5.25rem);       /* 84px The Studio, Design meets */
  --fs-xl: clamp(2.25rem, 4.4vw, 4rem);         /* 64px */
  --fs-lg: clamp(1.9rem, 3.2vw, 2.85rem);       /* 45px */
  --fs-md: clamp(1.5rem, 2.4vw, 2.2rem);        /* 35px */
  --fs-lead: clamp(1.2rem, 1.75vw, 1.5625rem);  /* 25px */
  --fs-body-serif: 1.0625rem;                   /* 17-18px */
  --fs-body: 1rem;                              /* 16px */
  --fs-small: 0.875rem;

  /* Layout */
  --container: 1124px;
  --container-narrow: 600px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --section-y: clamp(4.5rem, 10vw, 8.5rem);
  --radius: 5px;

  /* Textures. Relative url()s in custom properties resolve against the stylesheet
     that uses them, so these only work inside base.css; page CSS needs ../../ paths. */
  --tex-linen: url('../assets/img/texture-linen-cream.jpg');
  --tex-stripes-green: url('../assets/img/texture-stripes-green.jpg');
  --tex-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* WebP versions of the textures. The JPGs above are the fallback: a browser that does not
   understand image-set(... type()) skips this block and keeps them. */
@supports (background-image: image-set(url('../assets/img/texture-linen-cream.webp') type('image/webp'))) {
  :root {
    --tex-linen: url('../assets/img/texture-linen-cream.webp');
    --tex-stripes-green: url('../assets/img/texture-stripes-green.webp');
  }
}

/* --- Reset --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--rust);
  background: var(--rust);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
h1, h2, h3, h4 { font-size: inherit; font-weight: inherit; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }

img, svg { display: block; max-width: 100%; height: auto; }
/* <picture> only picks the WebP/PNG/JPG source; it must not affect layout. */
picture { display: contents; }

a { color: inherit; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Utilities ----------------------------------------------------------- */

.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;
}

.skip-link {
  position: absolute;
  top: 0.75rem; left: 0.75rem;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--cream);
  color: var(--rust);
  font-family: var(--font-serif);
  font-weight: 700;
  border-radius: var(--radius);
  transform: translateY(-200%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }

.text-center { text-align: center; }

/* Backgrounds */
.bg-rust { background-color: var(--rust); color: var(--cream); }
.bg-cocoa { background-color: var(--cocoa); color: var(--cream); }
.bg-olive { background-color: var(--olive); color: var(--cream); }
.bg-sky { background-color: var(--sky); color: var(--rust); }
.bg-cream { background-color: var(--cream); color: var(--rust); }
.bg-terracotta { background-color: var(--terracotta); color: var(--cream); }

.bg-linen {
  background: var(--cream) var(--tex-linen) 0 0 / 600px auto repeat;
  color: var(--rust);
}

.bg-plaster {
  background: var(--tex-noise) 0 0 / 240px repeat, var(--cocoa);
  color: var(--cream);
}

/* Stripe bands between sections */
.stripes {
  height: 41px;
  background-color: var(--cream);
}

.stripes--brown {
  background-image: repeating-linear-gradient(90deg,
    transparent 0 25px,
    var(--stripe-brown) 25px 26.5px,
    transparent 26.5px 28.5px,
    var(--stripe-brown) 28.5px 30px);
}

.stripes--blue {
  height: 70px;
  background-image: repeating-linear-gradient(90deg,
    transparent 0 32px,
    var(--stripe-blue) 32px 61px);
}

.stripes--green {
  height: 30px;
  background: var(--cream) var(--tex-stripes-green) left center / 540px auto repeat-x;
}

/* --- Typography ---------------------------------------------------------- */

.serif { font-family: var(--font-serif); }

.h-display,
.h-xxl,
.h-xl,
.h-lg,
.h-md,
.lead {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
  font-weight: 400;
}

.h-display { font-size: var(--fs-display); line-height: 1.1; font-style: italic; font-weight: 300; }
.h-xxl { font-size: var(--fs-xxl); line-height: 1.05; }
.h-xl { font-size: var(--fs-xl); line-height: 1.12; }
.h-lg { font-size: var(--fs-lg); line-height: 1.14; font-weight: 700; }
.h-md { font-size: var(--fs-md); line-height: 1.05; }
.lead { font-size: var(--fs-lead); line-height: 1.3; }

.upper { text-transform: uppercase; }
.italic, em { font-style: italic; }
.light { font-weight: 300; }
.bold { font-weight: 700; }

.body-serif {
  font-family: var(--font-serif);
  font-size: var(--fs-body-serif);
  line-height: 1.7;
}

.body-sans { font-family: var(--font-sans); font-size: var(--fs-body); line-height: 1.7; }

.stack > * + * { margin-top: 1.1em; }

/* "— OUR POV —" style kicker with rules either side */
.kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.kicker::before,
.kicker::after {
  content: '';
  flex: 0 1 72px;
  min-width: 24px;
  height: 1.5px;
  background: currentColor;
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-width: min(321px, 100%);
  min-height: 63px;
  padding: 0.75rem 1.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.15rem, 1.6vw, 1.5625rem);
  line-height: 1.19;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / 0.18); }
.btn:active { transform: none; box-shadow: none; }
.btn__arrow { font-style: normal; }

.btn--rust { background: var(--rust); color: var(--cream); }
.btn--sky { background: var(--sky); color: var(--olive); }
.btn--coral { background: var(--coral); color: var(--cocoa); }
.btn--terracotta { background: var(--terracotta); color: var(--cream); }
.btn--outline { background: transparent; color: var(--cream); border-color: var(--cream); font-style: normal; }
.btn--outline:hover { background: var(--cream); color: var(--rust); }

/* Text-only link with arrow, e.g. "View case study →" */
.link-arrow {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: var(--fs-lead);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1.5px no-repeat;
  transition: background-size 0.25s ease;
}
.link-arrow:hover { background-size: 100% 1.5px; }

/* --- Logo (wordmark PNG recoloured with a mask) -------------------------- */

.wordmark {
  display: block;
  aspect-ratio: 2000 / 204;
  background-color: currentColor;
  -webkit-mask: url('../assets/img/logo-wordmark-cream.png') center / contain no-repeat;
  mask: url('../assets/img/logo-wordmark-cream.png') center / contain no-repeat;
}
@supports (background-image: image-set(url('../assets/img/logo-wordmark-cream.webp') type('image/webp'))) {
  .wordmark {
    -webkit-mask: url('../assets/img/logo-wordmark-cream.webp') center / contain no-repeat;
    mask: url('../assets/img/logo-wordmark-cream.webp') center / contain no-repeat;
  }
  /* Phones never show the wordmark wider than the screen, so they get a 1000px copy instead of 2000px. */
  @media (max-width: 600px) {
    .wordmark {
      -webkit-mask: url('../assets/img/logo-wordmark-cream-1000.webp') center / contain no-repeat;
      mask: url('../assets/img/logo-wordmark-cream-1000.webp') center / contain no-repeat;
    }
  }
}

.logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--header-ink, var(--cream));
}
.logo .wordmark { width: clamp(136px, 17vw, 242px); }
.logo__sub {
  font-family: var(--font-serif);
  font-size: clamp(0.7rem, 1vw, 0.875rem);
  letter-spacing: 0.9em;
  margin-right: -0.9em;
  text-transform: uppercase;
  line-height: 1;
}

/* --- Header -------------------------------------------------------------- */

.site-header {
  position: absolute;
  inset: var(--header-top, 0) 0 auto 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1rem;
  padding: clamp(1.5rem, 4vw, 3.4rem) var(--gutter) 0;
  max-width: 1440px;
  margin-inline: auto;
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.site-header .logo { grid-column: 2; }

.nav-toggle {
  grid-column: 3;
  justify-self: end;
  display: grid;
  gap: 12px;
  width: 51px;
  padding: 8px 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--header-ink, var(--cream));
  margin-right: clamp(0px, 5vw, 80px);
}
.nav-toggle span {
  display: block;
  height: 5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(17px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-17px) rotate(-45deg); }

@media (max-width: 600px) {
  .nav-toggle { width: 38px; gap: 8px; }
  .nav-toggle span { height: 4px; }
  .nav-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(12px) rotate(45deg); }
  .nav-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-12px) rotate(-45deg); }
}

/* When the overlay is open the toggle sits above it in cream */
body.nav-open .site-header { position: fixed; z-index: 120; }
body.nav-open .site-header .logo,
body.nav-open .nav-toggle { color: var(--cream); }

/* --- Overlay navigation -------------------------------------------------- */

.site-nav {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem var(--gutter) 4rem;
  background: var(--tex-noise) 0 0 / 240px repeat, var(--rust);
  color: var(--cream);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
  overflow-y: auto;
}
.site-nav.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

.site-nav__list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  max-width: var(--container);
}
.site-nav__list li { border-bottom: 1.5px solid rgb(237 145 127 / 0.6); }
.site-nav__list li:first-child { border-top: 1.5px solid rgb(237 145 127 / 0.6); }

.site-nav__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.9rem, 2vw, 1.4rem) 0;
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1.05;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateY(12px);
  opacity: 0;
  transition: color 0.2s ease, transform 0.45s ease, opacity 0.45s ease;
}
.site-nav__list a em { font-weight: 300; text-transform: none; }
.site-nav.is-open .site-nav__list a { transform: none; opacity: 1; }
.site-nav.is-open .site-nav__list li:nth-child(2) a { transition-delay: 0.05s; }
.site-nav.is-open .site-nav__list li:nth-child(3) a { transition-delay: 0.1s; }
.site-nav.is-open .site-nav__list li:nth-child(4) a { transition-delay: 0.15s; }
.site-nav.is-open .site-nav__list li:nth-child(5) a { transition-delay: 0.2s; }
.site-nav__list a:hover,
.site-nav__list a[aria-current='page'] { color: var(--coral); }
.site-nav__list a::after {
  content: '→';
  font-size: 0.5em;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s, transform 0.2s;
}
.site-nav__list a:hover::after { opacity: 1; transform: none; }

.site-nav__meta {
  margin: 2.5rem auto 0;
  width: 100%;
  max-width: var(--container);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-serif);
  font-style: italic;
}

/* --- Footer -------------------------------------------------------------- */

.site-footer {
  position: relative;
  overflow: hidden;
  background: var(--rust);
  color: var(--cream);
  padding-top: clamp(4rem, 10vw, 12rem);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    '.    social'
    'copy links';
  align-items: end;
  row-gap: clamp(2.5rem, 6vw, 5.5rem);
  column-gap: 2rem;
}

.footer__social {
  grid-area: social;
  display: flex;
  justify-content: flex-end;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer__social a {
  display: block;
  color: #F5F5F5;
  transition: color 0.2s, transform 0.2s;
}
.footer__social a:hover { color: var(--coral); transform: translateY(-2px); }
.footer__social svg { width: clamp(40px, 4vw, 56px); height: auto; }

.footer__copy {
  grid-area: copy;
  font-weight: 300;
  font-size: var(--fs-body);
}

.footer__nav { grid-area: links; }
.footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 6vw, 5.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer__nav a {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.6vw, 1.4375rem);
  line-height: 1.14;
  text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size 0.25s ease;
}
.footer__nav a:hover,
.footer__nav a[aria-current='page'] { background-size: 100% 1px; }

.footer__wordmark {
  width: 100%;
  margin: clamp(2.5rem, 5vw, 4.5rem) 0 0;
  color: var(--cream);
  /* 5px of breathing room so the letters aren't cropped by the page edges.
     The border is transparent (and masked out), so the footer background is untouched. */
  border: solid transparent;
  border-width: 0 5px 5px;
}

@media (max-width: 760px) {
  .footer__inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      'social'
      'links'
      'copy';
    row-gap: 2rem;
  }
  .footer__social { justify-content: flex-start; }
  .footer__nav ul { column-gap: 1.75rem; row-gap: 1rem; }
}

/* --- Shared section patterns --------------------------------------------- */

/* Centred CTA band: heading, italic line, button */
.cta-band {
  text-align: center;
  padding-block: clamp(5rem, 12vw, 10rem);
}
.cta-band__title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: 1.31;
  text-transform: uppercase;
}
.cta-band__sub {
  margin-top: 0.75rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.125rem;
}
.cta-band .btn { margin-top: clamp(2rem, 4vw, 3.25rem); }

/* Small pill tag, e.g. "Brand Strategy" on the Work page */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag {
  padding: 0.3rem 1.4rem;
  background: var(--rust);
  color: var(--cream);
  border-radius: 2px;
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  line-height: 1.3;
}

/* Fade-up on scroll, enabled only when JS is running */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }
