/* ==========================================================================
   MADWORKS — Design System
   Cinematic, minimal, dark, image-led editorial portfolio.
   ========================================================================== */

:root {
  /* ---- Color ---- */
  --bg:        #0A0A0A;
  --bg-raised: #121212;
  --line:      #232323;
  --ink:       #F4F2EF;
  --ink-dim:   #9A9892;
  --ink-faint: #5C5A56;
  --accent:    #FF402C;
  --accent-ink: #0A0A0A;

  /* ---- Type ---- */
  --f-display: 'Fraunces', 'Iowan Old Style', 'Times New Roman', serif;
  --f-body:    'Inter', 'Helvetica Neue', Arial, sans-serif;

  /* ---- Scale ---- */
  --container: 1480px;
  --gutter: clamp(24px, 5vw, 72px);
  --section-y: clamp(80px, 12vw, 160px);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 280ms;
  --t-med: 560ms;
  --t-slow: 900ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; background: none; border: none; color: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------------
   Grain overlay — subtle animated film texture, ambient only.
   Fixed, full-viewport, sits above content but never intercepts clicks.
   ------------------------------------------------------------------- */

.grain-overlay {
  position: fixed;
  inset: -10%;
  width: 120%;
  height: 120%;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-repeat: repeat;
  background-size: 160px 160px;
  animation: grainShift 9s steps(8) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  12%  { transform: translate(-4%, 3%); }
  25%  { transform: translate(3%, -5%); }
  37%  { transform: translate(-6%, 2%); }
  50%  { transform: translate(5%, 4%); }
  62%  { transform: translate(-2%, -4%); }
  75%  { transform: translate(4%, -2%); }
  87%  { transform: translate(-3%, 5%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .grain-overlay { animation: none; }
}

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 4px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

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

.eyebrow {
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.eyebrow .dot { color: var(--accent); }

h1, .h1 {
  font-family: var(--f-display);
  font-weight: 480;
  font-optical-sizing: auto;
  letter-spacing: -0.012em;
  line-height: 1.02;
  font-size: clamp(40px, 7.4vw, 108px);
}

h2, .h2 {
  font-family: var(--f-display);
  font-weight: 480;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  line-height: 1.06;
  font-size: clamp(32px, 4.6vw, 64px);
}

h3, .h3 {
  font-family: var(--f-display);
  font-weight: 500;
  font-optical-sizing: auto;
  letter-spacing: -0.005em;
  line-height: 1.16;
  font-size: clamp(22px, 2.6vw, 32px);
}

.lede {
  font-family: var(--f-body);
  font-weight: 400;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 640px;
}

.body-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 580px;
}

.mono-label {
  font-family: var(--f-body);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

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

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px var(--gutter);
  mix-blend-mode: normal;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 26px;
  width: auto;
}

.brand-word {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 44px;
}

.main-nav a:not(.btn) {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  position: relative;
  padding-bottom: 4px;
  transition: color var(--t-fast) var(--ease);
}

.main-nav a:not(.btn)::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width var(--t-fast) var(--ease);
}

.main-nav a:not(.btn):hover,
.main-nav a:not(.btn).is-active {
  color: var(--ink);
}

.main-nav a:not(.btn):hover::after,
.main-nav a:not(.btn).is-active::after {
  width: 100%;
}

.nav-links {
  display: flex;
  gap: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 13px 26px;
  border-radius: 2px;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  white-space: nowrap;
}

.btn-accent {
  background: var(--accent);
  color: #0A0A0A;
}

.btn-accent:hover {
  background: #ff5d4b;
}

.btn-outline {
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-arrow {
  transition: transform var(--t-fast) var(--ease);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

.nav-toggle {
  display: none;
  width: 26px;
  height: 18px;
  position: relative;
  z-index: 110;
}

.nav-toggle span {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: var(--ink);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 50%; margin-top: -0.5px; }
.nav-toggle span:nth-child(3) { top: 100%; margin-top: -1px; }

.nav-toggle.is-open span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ---------------------------------------------------------------------
   Mobile nav drawer
   ------------------------------------------------------------------- */

.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
  transform: translateY(-100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform var(--t-med) var(--ease), visibility var(--t-med) var(--ease);
}

.mobile-nav.is-open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

@media (min-width: 901px) {
  .mobile-nav {
    display: none !important;
  }
}

.mobile-nav a:not(.btn) {
  display: block;
  font-family: var(--f-display);
  font-size: 13vw;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.mobile-nav-footer {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------------------------------------------------------------------
   Section scaffolding
   ------------------------------------------------------------------- */

section { position: relative; }

.section-y {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: clamp(40px, 6vw, 80px);
}

.section-head .h2 { max-width: 640px; }

.section-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.section-tag .rule {
  width: 28px;
  height: 1px;
  background: var(--accent);
}

.divider {
  height: 1px;
  background: var(--line);
  width: 100%;
}

/* ---------------------------------------------------------------------
   Reveal-on-scroll utility
   ------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  transition-delay: calc(var(--i, 0) * 90ms);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-top: clamp(56px, 8vw, 96px);
  padding-bottom: 32px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 60px;
  padding-bottom: clamp(48px, 7vw, 88px);
  flex-wrap: wrap;
}

.footer-brand {
  max-width: 380px;
}

.footer-brand .brand { margin-bottom: 22px; }

.footer-statement {
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.65;
}

.footer-cols {
  display: flex;
  gap: 72px;
  flex-wrap: wrap;
}

.footer-col h4 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 18px;
  font-weight: 500;
}

.footer-col a, .footer-col span {
  display: block;
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 12px;
  transition: color var(--t-fast) var(--ease);
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 16px;
}

.footer-bottom span {
  font-size: 12px;
  color: var(--ink-faint);
}

.footer-bottom .footer-bottom-links {
  display: flex;
  gap: 24px;
}

.footer-bottom .footer-bottom-links a {
  font-size: 12px;
  color: var(--ink-faint);
  transition: color var(--t-fast) var(--ease);
}

.footer-bottom .footer-bottom-links a:hover { color: var(--ink); }

/* ---------------------------------------------------------------------
   Buttons / links / CTA row used in several pages
   ------------------------------------------------------------------- */

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), gap var(--t-fast) var(--ease);
}

.text-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  gap: 12px;
}

/* ---------------------------------------------------------------------
   CTA band (used at the base of every page)
   ------------------------------------------------------------------- */

.cta-band {
  border-top: 1px solid var(--line);
  padding: clamp(80px, 12vw, 160px) 0;
  text-align: center;
}

.cta-band h2 {
  max-width: 900px;
  margin: 0 auto 36px;
}

.cta-band .btn {
  padding: 18px 40px;
  font-size: 14px;
}

/* ---------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------- */

@media (max-width: 900px) {
  .main-nav .nav-links { display: none; }
  .main-nav .btn-accent.header-cta { display: none; }
  .nav-toggle { display: block; }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .footer-top { flex-direction: column; gap: 40px; }
  .footer-cols { gap: 48px; }
}
