/* =========================================================
   EMERGE FITNESS — Design System
   ========================================================= */

:root {
  /* Palette */
  --ink: #08080A;
  --surface-1: #0F0F12;
  --surface-2: #16161B;
  --surface-3: #1D1D24;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #F4F2EE;
  --text-dim: #A5A3A0;
  --muted: #6B6B71;
  --ember: #FF5722;
  --ember-warm: #FF7A45;
  --ember-soft: rgba(255, 87, 34, 0.10);

  /* Type */
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-italic: 'Instrument Serif', Georgia, serif;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.3, 1);
  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --max: 1400px;
  --gutter: clamp(20px, 4vw, 56px);
  --section-y: clamp(80px, 12vw, 160px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--ember); color: #fff; }

/* Grain overlay (subtle film noise) */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* =========================================================
   Typography
   ========================================================= */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text);
}

.display-xl {
  font-size: clamp(3.5rem, 11vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.92;
}
.display-l {
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.96;
}
.display-m {
  font-size: clamp(2rem, 4.5vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  display: inline-block;
}

.serif { font-family: var(--font-italic); font-style: italic; font-weight: 400; }

/* =========================================================
   Container & Section
   ========================================================= */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

section {
  position: relative;
}

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

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  --bg: var(--ember);
  --fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform 0.4s var(--ease-out), background-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -12px rgba(255, 87, 34, 0.5);
}
.btn--ghost {
  --bg: transparent;
  --fg: var(--text);
  border-color: var(--line-strong);
}
.btn--ghost:hover {
  background: var(--text);
  color: var(--ink);
  box-shadow: none;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Underline link */
.link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  padding-bottom: 4px;
}
.link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(1);
  transition: transform 0.6s var(--ease-out);
}
.link:hover::after { transform-origin: left; transform: scaleX(0.4); }

/* =========================================================
   Reveal Animation Base
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(56px);
  transition: opacity 1.6s var(--ease-out), transform 1.6s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Stronger variant for hero CTAs / important moments */
.reveal-strong {
  opacity: 0;
  transform: translateY(90px);
  transition: opacity 1.9s var(--ease-out), transform 1.9s var(--ease-out);
  will-change: opacity, transform;
}
.reveal-strong.in { opacity: 1; transform: translateY(0); }

/* Image mask reveal (clip-path slide) */
.reveal-mask {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.6s var(--ease-out);
}
.reveal-mask.in { clip-path: inset(0 0 0 0); }

.split-line {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: inherit;
}
.split-line > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.5s var(--ease-out);
}
.in .split-line > span,
.split-line.in > span { transform: translateY(0); }

/* =========================================================
   Top Bar (homepage)
   ========================================================= */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  background: linear-gradient(to bottom, rgba(8,8,10,0.85), rgba(8,8,10,0));
  backdrop-filter: blur(6px);
}
.topbar .wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.topbar nav {
  display: flex;
  gap: 28px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.topbar nav a {
  position: relative;
  transition: color 0.3s ease;
}
.topbar nav a:hover { color: var(--text); }
.topbar .loc {
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}
@media (max-width: 768px) {
  .topbar nav { display: none; }
}

/* =========================================================
   Landing — Hero & Branches Grid
   ========================================================= */
.landing-hero {
  position: relative;
  padding-top: 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-intro {
  padding: clamp(40px, 8vw, 90px) var(--gutter) clamp(30px, 5vw, 50px);
  max-width: 1100px;
}
.landing-intro .eyebrow { margin-bottom: 18px; }
.landing-intro h1 {
  font-size: clamp(2.6rem, 7.5vw, 6.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.96;
  margin-bottom: 28px;
}
.landing-intro h1 em {
  font-family: var(--font-italic);
  font-style: italic;
  font-weight: 400;
  color: var(--ember-warm);
}
.landing-intro p {
  max-width: 560px;
  color: var(--text-dim);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.65;
}

.branches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(48vh, 1fr);
  gap: 0;
  width: 100%;
  border-top: 1px solid var(--line);
}
.branches-grid > .branch-tile {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.branches-grid > .branch-tile:nth-child(2n) { border-right: none; }
.branches-grid > .branch-tile:nth-last-child(-n+2) { border-bottom: none; }

.branch-tile {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  background: var(--surface-1);
  min-height: 56vh;
  color: var(--text);
  transition: background 0.5s ease;
  animation: tile-in 1.5s var(--ease-out) both;
}
.branches-grid .branch-tile:nth-child(1) { animation-delay: 0.55s; }
.branches-grid .branch-tile:nth-child(2) { animation-delay: 0.70s; }
.branches-grid .branch-tile:nth-child(3) { animation-delay: 0.85s; }
.branches-grid .branch-tile:nth-child(4) { animation-delay: 1.00s; }
@keyframes tile-in {
  from { opacity: 0; transform: translateY(48px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Branch tile inner content cascades after the tile arrives */
.branch-tile__inner > * {
  opacity: 0;
  transform: translateY(20px);
  animation: tile-content-in 1.2s var(--ease-out) both;
}
.branch-tile__inner > *:nth-child(1) { animation-delay: 1.1s; }
.branch-tile__inner > *:nth-child(2) { animation-delay: 1.25s; }
.branches-grid .branch-tile:nth-child(2) .branch-tile__inner > *:nth-child(1) { animation-delay: 1.25s; }
.branches-grid .branch-tile:nth-child(2) .branch-tile__inner > *:nth-child(2) { animation-delay: 1.4s; }
.branches-grid .branch-tile:nth-child(3) .branch-tile__inner > *:nth-child(1) { animation-delay: 1.4s; }
.branches-grid .branch-tile:nth-child(3) .branch-tile__inner > *:nth-child(2) { animation-delay: 1.55s; }
.branches-grid .branch-tile:nth-child(4) .branch-tile__inner > *:nth-child(1) { animation-delay: 1.55s; }
.branches-grid .branch-tile:nth-child(4) .branch-tile__inner > *:nth-child(2) { animation-delay: 1.7s; }
@keyframes tile-content-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.branch-tile__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.branch-tile__media img,
.branch-tile__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.15) brightness(0.7);
  transform: scale(1.04);
  transition: transform 2s var(--ease-out), filter 1.2s ease;
}
.branch-tile__media video {
  opacity: 0;
  transition: opacity 1.2s var(--ease-out), transform 2s var(--ease-out), filter 1.2s ease;
}
.branch-tile__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(8,8,10,0.85) 0%, rgba(8,8,10,0.2) 50%, rgba(8,8,10,0.55) 100%);
  transition: background 0.6s ease;
}
.branch-tile__inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 48px);
  min-height: 56vh;
}
.branch-tile__top {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}
.branch-tile__loc {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.branch-tile__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.branch-tile__name {
  font-size: clamp(2rem, 4.6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.95;
  margin-bottom: 6px;
}
.branch-tile__sub {
  font-size: 0.95rem;
  color: var(--text-dim);
}
.branch-tile__cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text);
  position: relative;
}
.branch-tile__cta .arrow {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--ink);
  transition: transform 0.5s var(--ease-out), background 0.3s ease;
}
.branch-tile__cta .arrow svg { width: 14px; height: 14px; fill: currentColor; }

/* Hover state */
.branch-tile:hover .branch-tile__media img,
.branch-tile:hover .branch-tile__media video {
  transform: scale(1.08);
  filter: grayscale(0) brightness(0.65);
}
.branch-tile:hover .branch-tile__media video { opacity: 1; }
.branch-tile:hover .branch-tile__overlay {
  background: linear-gradient(to top, rgba(8,8,10,0.92) 0%, rgba(8,8,10,0.35) 60%, rgba(8,8,10,0.7) 100%);
}
.branch-tile:hover .branch-tile__cta .arrow {
  transform: translateX(6px) rotate(-45deg);
  background: var(--ember);
  color: #fff;
}

@media (max-width: 880px) {
  .branches-grid { grid-template-columns: 1fr; }
  .branches-grid > .branch-tile { border-right: none; }
  .branches-grid > .branch-tile:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .branch-tile { min-height: 60vh; }
  .branch-tile__inner { min-height: 60vh; }
}

/* =========================================================
   Brand statement / about strip (homepage)
   ========================================================= */
.statement {
  padding: var(--section-y) var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.statement-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 80px;
  align-items: start;
}
.statement .eyebrow { margin-bottom: 24px; }
.statement h2 {
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.statement h2 em {
  font-family: var(--font-italic);
  font-style: italic;
  font-weight: 400;
  color: var(--ember-warm);
}
.statement-body { color: var(--text-dim); font-size: 1.05rem; line-height: 1.7; }
.statement-body p + p { margin-top: 1.2em; }
@media (max-width: 880px) { .statement-inner { grid-template-columns: 1fr; gap: 40px; } }

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 60px var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--ink);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}
.stat__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}
.stat__num .unit {
  color: var(--ember);
  margin-left: 4px;
  font-size: 0.55em;
  vertical-align: super;
}
.stat__label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--text-dim);
}
@media (max-width: 768px) { .stats-row { grid-template-columns: 1fr 1fr; gap: 32px; } }

/* Marquee — static by default, slow drift on hover */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  overflow: hidden;
  padding: 28px 0;
}
.marquee__track {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  width: max-content;
  animation: marquee 180s linear infinite;
  animation-play-state: paused;
}
.marquee:hover .marquee__track { animation-play-state: running; }
.marquee span {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 48px;
  transition: color 0.5s ease;
}
.marquee:hover span { color: var(--text); }
.marquee span::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--ember);
  border-radius: 50%;
  flex-shrink: 0;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Editorial list block */
.things-section {
  border-top: 1px solid var(--line);
  background: var(--ink);
  padding: clamp(70px, 10vw, 130px) var(--gutter);
}
.things-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 80px;
  align-items: start;
}
.things-aside {
  font-family: var(--font-italic);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: var(--text-dim);
  line-height: 1.45;
}
.things-aside small {
  display: block;
  margin-top: 18px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.things-list {
  list-style: none;
  border-top: 1px solid var(--line);
}
.things-list li {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.2vw, 2.4rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.025em;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  position: relative;
  transition: color 0.5s var(--ease-out), padding-left 0.5s var(--ease-out);
}
.things-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--ember);
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out);
}
.things-list li:hover { padding-left: 28px; color: var(--ember-warm); }
.things-list li:hover::before { opacity: 1; transform: translateX(0); }
@media (max-width: 768px) {
  .things-inner { grid-template-columns: 1fr; gap: 32px; }
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  background: var(--surface-1);
  border-top: 1px solid var(--line);
  padding: clamp(60px, 8vw, 100px) var(--gutter) 32px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 60px;
  margin-bottom: 60px;
}
.footer-brand h3 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.footer-brand p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 320px;
}
.footer-col h5 {
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 20px;
  font-weight: 600;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.footer-col a {
  font-size: 0.95rem;
  color: var(--text-dim);
  transition: color 0.3s ease;
}
.footer-col a:hover { color: var(--text); }
.footer-col a.active { color: var(--ember); }

.footer-bottom {
  max-width: var(--max);
  margin: 0 auto;
  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 .copyright {
  font-size: 0.8rem;
  color: var(--muted);
}
.social-icons {
  display: flex;
  gap: 14px;
}
.social-icons a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  transition: background 0.3s ease, transform 0.4s var(--ease-out), border-color 0.3s ease;
}
.social-icons a:hover {
  background: var(--ember);
  border-color: var(--ember);
  transform: translateY(-2px);
}
.social-icons svg { width: 18px; height: 18px; fill: var(--text); }

@media (max-width: 880px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-brand { grid-column: span 2; }
}
@media (max-width: 540px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-brand { grid-column: span 1; }
}

/* =========================================================
   Utility
   ========================================================= */
.text-orange { color: var(--ember); }
.no-scroll { overflow: hidden; }

/* Respect reduced motion only for entrance/reveal animations,
   not the marquee (which is user-triggered via hover) or hover transitions. */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-strong, .reveal-mask, .split-line > span {
    transition-duration: 0.01ms !important;
  }
  .branch-tile, .branch-tile__inner > * {
    animation-duration: 0.01ms !important;
  }
}
