/* =========================================================
   Midland CrossFit — base y componentes
   Concepto: la forja. Negro hierro, oro del logo (#BE940B)
   como acento contado, hueso para respirar. Runas sobrias,
   marcas de esquina en botones, corte largo tendido en paneles.
   Las secciones claras invierten los tokens (ver sections.css).
   ========================================================= */

:root {
  --ink: #0A0907;
  --ink-2: #110F0C;
  --iron: #1A1814;
  --iron-2: #24211C;
  --line: rgba(237, 230, 214, .14);
  --line-strong: rgba(237, 230, 214, .3);
  --bone: #EDE6D6;
  --muted: #A69E8D;
  --gold: #BE940B;
  --gold-hi: #D9BD6A;
  --gold-deep: #6B520A;
  --gold-text: var(--gold-hi);
  /* valores fijos: no cambian en secciones claras */
  --ink-fixed: #0A0907;
  --bone-fixed: #EDE6D6;

  --f-display: "Anybody", "Arial Narrow", Impact, sans-serif;
  --f-body: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;

  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1440px;
  --hdr-h: 72px;
  --dock-h: 58px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --slash-w: clamp(60px, 11vw, 120px);
  --slash-h: clamp(14px, 2.4vw, 28px);
  --slash: polygon(0 0, 100% 0, 100% calc(100% - var(--slash-h)), calc(100% - var(--slash-w)) 100%, 0 100%);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--hdr-h);
  background: var(--ink);
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--dock-h);
}
@supports (overflow: clip) { body { overflow-x: clip; } }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: 800; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
em { font-style: normal; }
::selection { background: var(--gold); color: var(--ink-fixed); }

:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--gold); color: var(--ink-fixed);
  padding: 12px 16px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* grano fino sobre toda la página */
body::after {
  content: "";
  position: fixed; inset: -50%;
  z-index: 150; pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- tipografía ---------- */
.eyebrow {
  display: flex; align-items: flex-start; gap: .7em;
  font-family: var(--f-body);
  font-size: .76rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.eyebrow .rune { color: var(--gold); margin-top: .08em; }
.hero__eyebrow { font-size: .7rem; letter-spacing: .18em; line-height: 1.5; }
.rune {
  width: .7em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: square; stroke-linejoin: miter;
}

.h2 {
  font-family: var(--f-display);
  font-weight: 800;
  font-variation-settings: "wdth" 72;
  font-size: clamp(2.5rem, 1.3rem + 5vw, 6.2rem);
  line-height: .9;
  letter-spacing: -.01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.h2 em, .contact__title em, .values__statement em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  color: inherit;
  letter-spacing: 0;
  font-size: 1.08em;
}
.lead {
  font-size: clamp(1.2rem, 1rem + .8vw, 1.55rem);
  line-height: 1.35;
  color: var(--bone);
}

/* palabras enmascaradas (las crea el JS) */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: .14em 0 .22em; margin: -.14em 0 -.22em; }
.wi { display: inline-block; }

/* ---------- botones: rectos, marcas de esquina, relleno que sube ---------- */
.btn {
  --bg: transparent; --fg: var(--bone); --bd: var(--line-strong); --tick: var(--gold); --fill: var(--bone);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  min-height: 52px;
  padding: .9em 1.6em;
  background-color: var(--bg);
  background-image: linear-gradient(var(--fill), var(--fill));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 0%;
  color: var(--fg);
  border: 1px solid var(--bd);
  border-radius: 0;
  font-family: var(--f-body); font-weight: 700;
  font-size: .92rem; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none;
  transition: background-size .5s var(--ease-out), color .35s var(--ease-out), border-color .35s;
}
.btn::after {
  content: ""; position: absolute; inset: -6px; pointer-events: none;
  background:
    linear-gradient(var(--tick), var(--tick)) 0 0 / 14px 2px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 0 0 / 2px 14px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 100% / 14px 2px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 100% / 2px 14px no-repeat;
  transition: inset .4s var(--ease-out);
}
.btn:hover { background-size: 100% 100%; color: var(--ink); border-color: var(--fill); }
.btn:hover::after { inset: -10px; }
.btn__arrow { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .4s var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn--gold { --bg: var(--gold); --fg: var(--ink-fixed); --bd: var(--gold); --fill: var(--bone); }
.btn--ghost { --bd: var(--line-strong); --fill: var(--bone); }
.btn--ink { --bg: var(--ink-fixed); --fg: var(--bone-fixed); --bd: var(--ink-fixed); --fill: var(--gold); --tick: var(--ink-fixed); }
.btn--ink:hover { color: var(--ink-fixed); border-color: var(--gold); }
.btn--sm { min-height: 44px; padding: .6em 1.1em; font-size: .78rem; }
.btn--block { width: 100%; }

/* ---------- cabecera ---------- */
.hdr {
  position: fixed; inset: 0 0 auto; z-index: 120;
  height: var(--hdr-h);
  color: var(--bone-fixed);
  transition: transform .5s var(--ease-out), background .4s, border-color .4s, color .4s;
  border-bottom: 1px solid transparent;
}
.hdr.is-solid {
  background: rgba(10, 9, 7, .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-color: var(--line);
}
.hdr.is-light { color: var(--ink-fixed); }
.hdr.is-light.is-solid { background: rgba(237, 230, 214, .9); border-color: rgba(10, 9, 7, .12); }
.hdr.is-light .hdr__logo img { filter: brightness(0); }
.hdr.is-hidden { transform: translateY(-100%); }
.hdr__in {
  height: 100%;
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex; align-items: center; gap: 20px;
}
.hdr__logo { display: block; margin-right: auto; padding: 6px 0; }
.hdr__logo img { height: 44px; width: auto; transition: filter .4s; }
.nav { display: none; }
.nav ul { display: flex; gap: clamp(10px, 1.4vw, 24px); }
.nav a {
  position: relative; display: inline-block; padding: 10px 0;
  font-size: .76rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: inherit;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.nav a:hover::after, .nav a.is-current::after { transform: scaleX(1); transform-origin: left; }
.hdr__cta { display: none; }

/* selector de idioma */
.lang ul { display: flex; align-items: center; }
.lang li { display: flex; align-items: center; }
.lang li + li::before { content: ""; width: 1px; height: 10px; background: currentColor; opacity: .3; }
.lang a {
  display: inline-block; padding: 10px 7px;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em;
  text-decoration: none; color: inherit; opacity: .55;
  transition: opacity .3s;
}
.lang a:hover, .lang a[aria-current] { opacity: 1; }
.lang a[aria-current] { position: relative; }
.lang a[aria-current]::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: 6px; height: 1px; background: var(--gold);
}
.lang--hdr { display: none; }
.lang--menu a { padding: 12px 10px; font-size: .8rem; }
.lang--menu li:first-child a { padding-left: 0; }

.burger {
  position: relative; z-index: 120;
  width: 48px; height: 48px;
  background: none; border: 1px solid currentColor; color: inherit;
  cursor: pointer; opacity: .9;
}
.burger span {
  position: absolute; left: 13px; right: 13px; height: 2px; background: currentColor;
  transition: transform .45s var(--ease-out), top .45s var(--ease-out), right .45s var(--ease-out);
}
.burger span:first-child { top: 18px; }
.burger span:last-child { top: 27px; right: 19px; }
.burger[aria-expanded="true"] span:first-child { top: 22px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { top: 22px; right: 13px; transform: rotate(-45deg); }

/* menú móvil */
.menu {
  position: fixed; inset: 0; z-index: 110;
  background: var(--ink-2);
  padding: calc(var(--hdr-h) + 24px) var(--gutter) 32px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow-y: auto;
}
.menu[hidden] { display: none; }
.menu::before {
  content: ""; position: absolute; inset: auto -20% -30% -20%; height: 60%;
  background: radial-gradient(closest-side, rgba(190, 120, 20, .18), transparent);
  pointer-events: none;
}
.menu__list a {
  display: flex; align-items: baseline; gap: 14px;
  padding: 6px 0;
  font-family: var(--f-display); font-weight: 800;
  font-variation-settings: "wdth" 70;
  font-size: clamp(1.9rem, 8.5vw, 3.1rem); line-height: 1.05;
  text-transform: uppercase; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.menu__n { font-family: var(--f-body); font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .1em; }
.menu__foot { position: relative; display: grid; gap: 4px; margin-top: 28px; }
.menu__foot > a { display: inline-block; padding: 10px 0; color: var(--muted); text-decoration: none; }
.menu.is-open .menu__list li { animation: menuIn .6s var(--ease-out) both; }
.menu.is-open .menu__list li:nth-child(2) { animation-delay: .04s; }
.menu.is-open .menu__list li:nth-child(3) { animation-delay: .08s; }
.menu.is-open .menu__list li:nth-child(4) { animation-delay: .12s; }
.menu.is-open .menu__list li:nth-child(5) { animation-delay: .16s; }
.menu.is-open .menu__list li:nth-child(6) { animation-delay: .2s; }
.menu.is-open .menu__list li:nth-child(7) { animation-delay: .24s; }
.menu.is-open .menu__list li:nth-child(8) { animation-delay: .28s; }
@keyframes menuIn { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
body.menu-open { overflow: hidden; }
body.menu-open .hdr { background: var(--ink-2); border-color: var(--line); color: var(--bone-fixed); transform: none; }
body.menu-open .hdr .hdr__logo img { filter: none; }

/* ---------- hero (vídeo + anillo-lente) ---------- */
.hero {
  position: relative; isolation: isolate;
  min-height: 100svh;
  padding-top: calc(var(--hdr-h) + 28px);
  padding-bottom: 28px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hero__media {
  position: absolute; inset: 0; z-index: -2;
  background: var(--ink-fixed) url("assets/video/poster1.jpg") center / cover no-repeat;
}
.hero__video, .values__video {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  opacity: 0; transition: opacity 1.6s ease;
  filter: saturate(.55) contrast(1.04);
}
.hero__video.is-playing, .values__video.is-playing { opacity: 1; }
.hero__veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 9, 7, .78) 0%, rgba(10, 9, 7, .62) 45%, rgba(10, 9, 7, .9) 100%),
    linear-gradient(0deg, var(--ink-fixed) 0%, rgba(10, 9, 7, 0) 22%);
}
.hero__grid {
  position: relative;
  flex: 1;
  display: grid;
  gap: 36px;
  align-content: center;
}
.hero__copy { position: relative; z-index: 2; }
.hero__title {
  --wdth: 74;
  font-family: var(--f-display);
  font-weight: 900;
  font-variation-settings: "wdth" var(--wdth);
  font-size: clamp(2.5rem, 13vw, 9.2rem);
  line-height: .86;
  letter-spacing: -.015em;
  text-transform: uppercase;
  margin-bottom: 1.6rem;
}
.line { display: block; overflow: hidden; padding-top: .16em; margin-top: -.16em; padding-bottom: .04em; }
.line__in { display: inline-block; white-space: nowrap; }
.line--indent { padding-left: .9em; }
/* titulares más largos en catalán y francés: un punto menos para que la línea no se parta */
html[lang="ca"] .hero__title { font-size: clamp(2.2rem, 10.5vw, 8.4rem); }
html[lang="fr"] .hero__title { font-size: clamp(2.2rem, 10.5vw, 8rem); }
.line--last em {
  font-family: var(--f-serif); font-style: italic; font-weight: 400;
  text-transform: lowercase; color: var(--gold-hi);
  font-size: .95em; letter-spacing: 0;
}
.hero__lead { max-width: 30em; color: var(--muted); font-size: 1.08rem; }
.hero__lead strong { color: var(--bone); font-weight: 600; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }

.hero__emblem { position: relative; z-index: 1; display: flex; justify-content: center; }
.emblem { position: relative; width: min(62vw, 380px); aspect-ratio: 1; }
.emblem__lens {
  position: absolute; inset: 13%;
  border-radius: 50%;
  -webkit-backdrop-filter: brightness(1.35) contrast(1.08) saturate(.8);
  backdrop-filter: brightness(1.35) contrast(1.08) saturate(.8);
  box-shadow: inset 0 0 0 1px rgba(190, 148, 11, .3), 0 40px 120px -30px rgba(0, 0, 0, .9);
}
.emblem__lens::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(10, 9, 7, .7));
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: spin 90s linear infinite; }
.ring__line { fill: none; stroke: rgba(190, 148, 11, .4); stroke-width: 1; }
.ring__runes use { fill: none; stroke: var(--gold); stroke-width: 1.3; stroke-linecap: square; }
.ring__dot { fill: var(--gold); }
@keyframes spin { to { transform: rotate(360deg); } }

.hero__meta {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 28px;
  font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.hero__scroll {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  text-decoration: none; color: var(--bone);
}
.hero__scroll svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 2; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: var(--ink-2);
  padding: 18px 0;
}
.marquee__track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__set { display: flex; align-items: center; gap: 36px; padding-right: 36px; }
.marquee__set span {
  font-family: var(--f-display); font-weight: 800;
  font-variation-settings: "wdth" 120;
  font-size: clamp(1.4rem, 1rem + 2vw, 2.6rem);
  text-transform: uppercase; white-space: nowrap; line-height: 1;
}
.marquee__set span:nth-of-type(odd) { color: transparent; -webkit-text-stroke: 1px rgba(237, 230, 214, .5); }
.marquee .rune { width: 18px; height: 28px; color: var(--gold); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- pilares ---------- */
.pillars { padding-block: clamp(56px, 8vw, 110px); }
.pillars__grid {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.pillar {
  position: relative;
  background: var(--ink);
  padding: 28px 24px 26px;
  transition: background .5s var(--ease-out);
}
.pillar:hover { background: var(--iron); }
.pillar__n {
  display: block; margin-bottom: 26px;
  font-family: var(--f-serif); font-style: italic; font-size: 1.6rem; color: var(--gold-text); line-height: 1;
}
.pillar__t {
  font-family: var(--f-display); font-weight: 800;
  font-variation-settings: "wdth" 80;
  font-size: clamp(1.5rem, 1.2rem + .9vw, 2rem); line-height: .95; text-transform: uppercase;
  margin-bottom: 14px;
}
.pillar__t span { display: block; color: var(--muted); font-weight: 500; }
.pillar p { margin: 0; color: var(--muted); font-size: .98rem; }

/* ---------- dock (barra inferior móvil) ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: grid; grid-template-columns: 1fr 1fr 1.4fr;
  background: rgba(17, 15, 12, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.dock a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 58px; padding: 0 8px;
  font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; color: var(--bone-fixed);
  border-right: 1px solid var(--line);
}
.dock svg { width: 18px; height: 18px; fill: none; stroke: var(--gold-hi); stroke-width: 1.8; stroke-linejoin: round; }
.dock .dock__main { background: var(--gold); color: var(--ink-fixed); border: 0; }

/* ---------- cursor (escritorio, lo activa el JS) ---------- */
.cursor { display: none; }
.has-cursor .cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor summary { cursor: none; }
.cursor__dot, .cursor__ring {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
  border-radius: 50%;
  mix-blend-mode: difference;
  transform: translate3d(-100px, -100px, 0);
}
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--bone-fixed); }
.cursor__ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(237, 230, 214, .8);
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), background .35s, border-color .35s, opacity .3s;
}
.cursor.is-link .cursor__ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(237, 230, 214, .18); }
.cursor.is-down .cursor__ring { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.cursor.is-out { opacity: 0; }
