/* ============ Tokens ============ */
:root {
  --bg: #0d0d0f;
  --bg-2: #141417;
  --surface: #1a1a1e;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eeeef0;
  --muted: #9b9ca3;
  --grey: #c9ccd1;
  --accent: #5b3cf5;
  --accent-2: #7d64ff;
  --radius: 22px;
  --radius-sm: 12px;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --display: "Syne", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; letter-spacing: -0.02em; }
em { font-style: normal; color: var(--grey); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }
/* no grey/blue tap rectangle on touch screens (keyboard focus ring is kept via :focus-visible) */
a, button, [role="button"] { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(80px, 12vw, 150px); }
.section__head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section__head--row { max-width: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 18px; font-size: 13px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.h2 { font-size: clamp(34px, 5vw, 60px); font-weight: 700; }

.dot {
  display: inline-block; width: .2em; height: .2em; margin-left: .06em;
  border-radius: 50%; background: var(--accent); vertical-align: baseline;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; transition: transform .25s var(--ease), background .25s, border-color .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { border-color: var(--line); background: rgba(255,255,255,.03); }
.btn--ghost:hover { border-color: var(--grey); }
.btn--block { width: 100%; }

/* ============ Nav ============ */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { background: rgba(13,13,15,.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 32px; height: 76px; }
.nav__logo img { width: 128px; height: auto; }
.nav__links { display: flex; gap: 30px; margin-left: auto; font-size: 15px; font-weight: 500; }
.nav__links a { color: var(--muted); transition: color .2s; }
.nav__links a:hover { color: var(--text); }
.nav__cta { padding: 10px 20px; }
.nav__toggle { display: none; background: none; border: 0; width: 44px; height: 44px; position: relative; margin-left: auto; }
.nav__toggle span { position: absolute; left: 11px; right: 11px; height: 2px; background: var(--text); transition: transform .3s var(--ease); }
.nav__toggle span:first-child { top: 17px; }
.nav__toggle span:last-child { top: 25px; }
.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ============ Hero ============ */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding: 130px 0 80px; overflow: hidden;
  background:
    radial-gradient(min(60%, 1100px) 50% at calc(50% + min(35%, 480px)) 20%, rgba(91,60,245,.22), transparent 70%),
    radial-gradient(min(40%, 760px) 40% at calc(50% - min(40%, 560px)) 90%, rgba(201,204,209,.06), transparent 70%);
}
.hero__inner { position: relative; z-index: 2; }
.hero__title { font-size: clamp(44px, 6.6vw, 112px); max-width: 60%; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.hero__bottom { display: grid; gap: 28px; margin-top: clamp(32px, 4vw, 52px); max-width: 560px; }
.hero__lead { max-width: 460px; margin: 0; color: var(--muted); font-size: 18px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero__stack { --stack: min(29vw, 420px); position: absolute; right: calc(max(16px, (100vw - var(--wrap)) / 2) + var(--stack) * .11); top: 50%; width: var(--stack); aspect-ratio: 1; transform: translateY(-50%); z-index: 1; pointer-events: none; }
.hs { position: absolute; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.55); object-fit: cover; will-change: transform; }
.hs--1 { width: 52%; aspect-ratio: 2/3; right: 4%; top: 0; transform: rotate(6deg); }
.hs--2 { width: 44%; aspect-ratio: 4/5; left: 6%; top: 18%; transform: rotate(-7deg); }
.hs--3 { width: 42%; aspect-ratio: 1; right: 16%; bottom: -4%; transform: rotate(-2deg); }

/* Hero door: drawn in ithildin — silver lines that appear as if under moonlight */
.hero__door {
  --door: min(25vw, 360px);
  position: absolute; z-index: 3; top: 50%; translate: 0 -46%;
  right: calc(max(16px, (100vw - var(--wrap)) / 2) + var(--gutter) + 20px);
  width: var(--door); text-align: center;
}
.hero__door::before { /* moonlight behind the stone */
  content: ""; position: absolute; left: 50%; top: 42%; width: 150%; aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(closest-side, rgba(150,140,255,.16), transparent 70%); pointer-events: none;
}
.door {
  all: unset; position: relative; display: block; width: 100%; cursor: pointer; color: #dfe2f6; border-radius: 12px;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.door:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 8px; }
.door svg { display: block; width: 100%; height: auto; overflow: visible;
  filter: drop-shadow(0 0 3px rgba(205,210,255,.55)) drop-shadow(0 0 14px rgba(125,100,255,.45)); transition: filter .5s; }
.door:hover svg { filter: drop-shadow(0 0 4px rgba(225,228,255,.8)) drop-shadow(0 0 22px rgba(125,100,255,.7)); }
.door__lines path, .door__pillars path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.door__pillars path { stroke-width: 1.9; stroke-linecap: square; stroke-linejoin: miter; }
.door__pillars path.sep { stroke-linecap: round; stroke-width: 3; stroke-dasharray: none !important; }
.door__inscription { font-family: "Alcarin Tengwar", serif; font-size: 19px; fill: currentColor; opacity: 0; transition: opacity 1.4s ease 1.6s; }
.door.font-ready .door__inscription { opacity: 1; }
.door__dot { fill: var(--accent); filter: drop-shadow(0 0 8px rgba(125,100,255,.9)); }
.door__pulse { fill: none; stroke: var(--accent-2); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: dot-pulse 2.8s ease-out infinite; }
.door__light { fill: url(#doorLight); opacity: 0; transition: opacity .6s ease; }
.door__hint { margin: 14px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.hero__door:hover .door__hint { color: var(--grey); }

/* the door reveals itself stroke by stroke */
.door__lines path, .door__pillars path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .door__lines path, .js .door__pillars path { animation: rune-draw 1.3s var(--ease) both, rune-flash 2.2s ease-out both; animation-delay: calc(var(--i) * 140ms + 300ms); }

/* opening: the door gives onto a night sky and a constellation born from the dot */
.door__sky { opacity: 0; transition: opacity .5s ease; }
.door.is-open .door__sky { opacity: 1; }
.door.is-open .door__light { opacity: 1; }
#doorStars circle { fill: #e6e8ff; opacity: 0; }
.door.is-open #doorStars circle {
  animation: star-in .5s ease-out both, star-twinkle 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 12ms), calc(var(--tw) + .5s);
}
@keyframes star-in { from { opacity: 0; } to { opacity: .85; } }
@keyframes star-twinkle { 0%, 100% { opacity: .85; } 50% { opacity: .3; } }
#doorConstellation polyline { fill: none; stroke: #b9adff; stroke-width: 1; stroke-linejoin: round; opacity: .7; stroke-dasharray: 1; stroke-dashoffset: 1; }
#doorConstellation .node { fill: #f1eeff; opacity: 0; filter: drop-shadow(0 0 3px rgba(185,173,255,.9)); }
.door.is-open #doorConstellation polyline { animation: rune-draw .9s var(--ease) both; animation-delay: calc(.25s + var(--i) * 90ms); }
.door.is-open #doorConstellation .node { animation: star-in .4s ease-out .7s both; }
.door.is-open .door__seam { opacity: 0; transition: opacity .3s; }
.door.is-open .door__dot { transform-box: fill-box; transform-origin: center; transform: scale(1.5); transition: transform .6s var(--ease); }

/* ============ Marquee ============ */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 12px 0; background: var(--bg-2); }
.marquee__track { display: flex; align-items: center; gap: 36px; width: max-content; animation: marquee 32s linear infinite; }
.marquee span { font-family: var(--display); font-weight: 700; font-size: clamp(18px, 2.1vw, 26px); line-height: 1.2; color: var(--grey); white-space: nowrap; }
.marquee i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ About ============ */
.about__grid { display: grid; grid-template-columns: 240px 1fr; gap: 40px; align-items: start; }
.section__head--row .eyebrow, .section__head .eyebrow { display: flex; width: fit-content; }
.about__statement { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3.4vw, 42px); line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
.hl { color: var(--grey); background: linear-gradient(transparent 62%, rgba(91,60,245,.55) 62%); padding-inline: .05em; }
.stats { list-style: none; padding: 0; margin: 56px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; border-top: 1px solid var(--line); padding-top: 32px; }
.stats strong { display: block; font-family: var(--display); font-size: clamp(38px, 5vw, 56px); line-height: 1; margin-bottom: 8px; }
.stats span { color: var(--muted); font-size: 15px; }

/* ============ Name meaning ============ */
.name { margin-top: clamp(72px, 10vw, 120px); padding-top: clamp(40px, 5vw, 56px); border-top: 1px solid var(--line); }
.name__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.name__part {
  position: relative; overflow: hidden; padding: clamp(28px, 4vw, 48px);
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.name__part { transition: border-color .4s; }
.name__part:first-child:hover { border-color: rgba(125,100,255,.45); }
.name__part:last-child:hover { border-color: rgba(201,204,209,.35); }

/* Illustration area on each card */
.name__art { position: relative; height: 150px; margin-bottom: 28px; }
.name__caption {
  position: absolute; left: 0; bottom: -6px; font-size: 12px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* Punto: the dot becomes a road, drawn like a route on a Middle-earth map */
.name__art--route svg { width: 100%; height: 130px; overflow: visible; }
.route__path { fill: none; stroke: var(--grey); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 9; opacity: .75; }
.route__reveal { fill: none; stroke: #fff; stroke-width: 10; stroke-dasharray: 1; }
.route__end path { fill: none; stroke: var(--accent-2); stroke-width: 2.4; stroke-linecap: round; }
.js .name:not(.is-in) .route__reveal { stroke-dashoffset: 1; }
.js .name:not(.is-in) .route__end { opacity: 0; }
.js .name.is-in .route__reveal { animation: rune-draw 2.4s var(--ease) .5s both; }
.js .name.is-in .route__end { animation: rune-fade .6s ease-out 2.5s both; }
.route__dot { fill: var(--accent); filter: drop-shadow(0 0 10px rgba(125,100,255,.8)); }
.route__pulse { fill: none; stroke: var(--accent-2); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: dot-pulse 2.8s ease-out infinite; }
@keyframes dot-pulse { from { transform: scale(1); opacity: .8; } to { transform: scale(3.2); opacity: 0; } }
.name__part:first-child:hover .route__path { opacity: 1; stroke: #fff; transition: stroke .3s, opacity .3s; }

/* Gris: the wizard's mark — a glowing G rune inside a slow ring of runes */
.mark { position: relative; width: 130px; height: 130px; }
.mark__ring { position: absolute; inset: 0; color: var(--grey); opacity: .4; animation: ring-spin 60s linear infinite; }
.mark__ring svg { width: 100%; height: 100%; }
.mark__ring path { stroke-width: 1.6; }
.mark__ring path.sep { stroke-width: 2.6; }
.mark__rune { position: absolute; left: 50%; top: 50%; translate: -50% -50%; height: 58px; color: #e6e8fa; --step: 260ms; }
.mark__rune svg { height: 100%; width: auto; }
.mark__rune path { stroke-width: 2.2; }
.name__part:last-child:hover .mark__rune path { stroke: #fff; transition: stroke .3s; }
.name__part:last-child:hover .mark__ring { opacity: .7; transition: opacity .4s; }
.name__word { font-size: clamp(48px, 6vw, 84px); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 20px; }
.name__word--grey { color: var(--grey); }
.name__part p { position: relative; z-index: 1; color: var(--muted); margin: 0; max-width: 460px; }

/* ============ Services ============ */
.services { background: var(--bg-2); border-block: 1px solid var(--line); }
.services__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.service {
  position: relative; padding: 32px 28px 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; transition: transform .35s var(--ease), border-color .35s;
}
.service::after { content: ""; position: absolute; top: 28px; right: 28px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--grey); transition: background .35s, border-color .35s; }
.service:hover { transform: translateY(-6px); border-color: rgba(125,100,255,.5); }
.service:hover::after { background: var(--accent); border-color: var(--accent); }
.service__num { font-family: var(--display); color: var(--muted); font-size: 14px; margin-bottom: 64px; }
.service h3 { font-size: 24px; margin-bottom: 14px; }
.service p { color: var(--muted); font-size: 15px; margin: 0 0 22px; }
.service ul { list-style: none; padding: 18px 0 0; margin: auto 0 0; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 6px; }
.service li::before { content: "·"; color: var(--accent-2); font-weight: 800; margin-right: 8px; }

/* ============ Work ============ */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { padding: 9px 18px; border-radius: 999px; background: transparent; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); transition: all .2s; }
.filter:hover { color: var(--text); border-color: var(--grey); }
.filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.work__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; grid-auto-flow: dense; }
.card {
  grid-column: span var(--span, 6); text-align: left; padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; gap: 14px;
}
.card--w4 { --span: 4; } .card--w5 { --span: 5; } .card--w6 { --span: 6; }
.card--w7 { --span: 7; } .card--w8 { --span: 8; } .card--w12 { --span: 12; }
.work__grid.is-filtered .card { --span: 6; }
.work__grid.is-filtered .card--w12 { --span: 12; }
.card[hidden] { display: none; }

.card__media {
  position: relative; overflow: hidden; border-radius: var(--radius);
  height: clamp(320px, 38vw, 480px); background: var(--panel, var(--surface));
  border: 1px solid var(--line);
}
.card__media > img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card__media > img { transform: scale(1.04); }
.card__media::after {
  content: "Ver proyecto →"; position: absolute; left: 20px; bottom: 20px;
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 700; opacity: 0; transform: translateY(10px);
  transition: opacity .3s, transform .3s var(--ease);
}
.card:hover .card__media::after, .card:focus-visible .card__media::after { opacity: 1; transform: none; }

.card__meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-inline: 4px; }
.card__meta h3 { font-size: 22px; }
.card__meta span { color: var(--muted); font-size: 14px; }

.card__media--panel { display: grid; place-items: center; }
.card__media--panel .card__logo { width: 62%; height: auto; object-fit: contain; }
.card__media--lisa { display: flex; align-items: center; justify-content: center; gap: 4%; padding: 24px; }
.card__media--lisa img { height: auto; width: 30%; object-fit: contain; filter: drop-shadow(0 12px 20px rgba(60,40,90,.18)); }
.card__media--lisa img:nth-child(1) { transform: rotate(-6deg); }
.card__media--lisa img:nth-child(2) { width: 34%; }
.card__media--lisa img:nth-child(3) { transform: rotate(6deg); }

/* browser mock with scroll-on-hover screenshot */
.card__media--browser { background: var(--panel, #2a1f5c); padding: 28px 28px 0; }
.card__media--browser:not([style]) { background: linear-gradient(140deg, #6a4cf5, #3b1fb8); }
.browser { height: 100%; border-radius: 12px 12px 0 0; overflow: hidden; background: #fff; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.browser__bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: #ececef; }
.browser__bar i { width: 9px; height: 9px; border-radius: 50%; background: #c8c8cc; }
.browser__bar span { margin-left: 10px; padding: 3px 12px; border-radius: 6px; background: #fff; color: #777; font-size: 11px; }
.scrollshot {
  width: 100%; flex: 1; min-height: 0; object-fit: cover; object-position: 50% 0;
  transition: object-position 7s cubic-bezier(.45,.05,.55,.95);
}
.card:hover .scrollshot, .card:focus-visible .scrollshot { object-position: 50% 100%; }

.card__media--photo > img { object-position: 100% 50%; }.card__media--posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 28px; align-items: center; background: linear-gradient(135deg, #c7d7f5, #e3d4f2 60%, #cdf7ec); }
.card__media--posts > img { width: 100%; height: auto; aspect-ratio: 4/5; object-fit: cover; border-radius: 12px; box-shadow: 0 16px 30px rgba(40,20,100,.22); transition: transform .5s var(--ease); }
.card:hover .card__media--posts img:nth-child(1) { transform: rotate(-4deg) translateY(-6px); }
.card:hover .card__media--posts img:nth-child(2) { transform: translateY(-14px); }
.card:hover .card__media--posts img:nth-child(3) { transform: rotate(4deg) translateY(-6px); }

.card--split { flex-direction: row; align-items: stretch; gap: 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.card__split-text { flex: 1; padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.card__split-text h3 { font-size: clamp(26px, 3vw, 38px); }
.card__split-text p { color: var(--muted); margin: 0; max-width: 460px; }
.card__link { font-weight: 700; margin-top: 8px; }
.card__link b { display: inline-block; transition: transform .3s var(--ease); color: var(--accent-2); }
.card:hover .card__link b { transform: translateX(6px); }
.card--split .card__media { flex: 1; border: 0; border-radius: 0; background: linear-gradient(160deg, #1ff0d0, #6a4cf5); display: grid; place-items: end center; padding: 36px 36px 0; }
.card--split .card__media::after { display: none; }
.mail { width: min(360px, 100%); height: 100%; border-radius: 14px 14px 0 0; overflow: hidden; background: #fff; display: flex; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.tag { display: inline-block; width: fit-content; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); }

/* ============ Process ============ */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); }
.step { padding: 32px 28px 0 0; position: relative; }
.step::before { content: ""; position: absolute; top: -6px; left: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--grey); }
.step:first-child::before { background: var(--accent); border-color: var(--accent); }
.step span { font-family: var(--display); color: var(--muted); font-size: 14px; letter-spacing: .02em; }
.section__lead { color: var(--muted); font-size: 18px; max-width: 520px; margin: 20px 0 0; }
.contact__friend { color: var(--text); font-weight: 600; }

/* ============ Dwarvish inscriptions (Angerthas Moria) ============ */
[data-runes] svg { display: block; overflow: visible; }
[data-runes] path { fill: none; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; }
[data-runes] path.sep { stroke-linecap: round; }

/* Inscriptions that draw themselves and flash, like ithildin under moonlight.
   The glow lives on the whole <svg> (one filter, cheap to animate). */
.glow svg { filter: drop-shadow(0 0 3px rgba(190,196,255,.5)) drop-shadow(0 0 12px rgba(125,100,255,.35)); }
[data-draw] path { stroke-dasharray: 1; }
[data-draw] path.sep { stroke-dasharray: none; }
.js [data-draw]:not(.is-in) path { stroke-dashoffset: 1; }
.js [data-draw]:not(.is-in) path.sep { opacity: 0; }
.js [data-draw].is-in path {
  animation: rune-draw 1.1s var(--ease) both, rune-flash 2.2s ease-out both;
  animation-delay: calc(var(--i) * var(--step, 90ms) + 200ms);
}
.js [data-draw].is-in path.sep { animation-name: rune-fade, rune-flash; }
@keyframes rune-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rune-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rune-flash { 0% { stroke: #fff; } 100% { stroke: currentColor; } }

/* Hero: a slow, glowing ring of runes around the project stack */
.rune-ring {
  position: absolute; left: 50%; top: 50%; width: 122%; aspect-ratio: 1;
  translate: -50% -50%; color: #dcdff5; opacity: .78;
  animation: ring-spin 180s linear infinite; will-change: rotate;
}
.rune-ring svg { width: 100%; height: 100%; filter: drop-shadow(0 0 3px rgba(205,210,255,.6)) drop-shadow(0 0 14px rgba(125,100,255,.5)); }
.rune-ring path { stroke-width: 1.15; }
.rune-ring path.sep { stroke-width: 2; }
@keyframes ring-spin { to { rotate: 360deg; } }

/* Tengwar rings ("Mithrandir"): text on a circular path, shown once the font is ready */
.tengwar-ring text { font-family: "Alcarin Tengwar", serif; fill: currentColor; }
.tengwar-ring { transition: opacity 1.2s ease; }
.tengwar-ring:not(.is-ready) { opacity: 0 !important; }

/* Marquee: the brand names travel between two bands of runes going the other way */
.marquee__runes { display: flex; width: max-content; color: var(--grey); opacity: .38; animation: marquee 70s linear infinite reverse; }
.marquee__runes--top { margin-bottom: 9px; animation-duration: 90s; }
.marquee__track + .marquee__runes { margin-top: 9px; }
.marquee__runes svg { height: 12px; width: auto; }
.marquee__runes > div { padding-right: 6px; }
.marquee__runes path { stroke-width: 1.5; }
.marquee__runes path.sep { stroke-width: 2.6; }

/* Footer: the Ring inscription, one band travelling right to left */
.ring-band { overflow: hidden; padding: 22px 0; border-bottom: 1px solid var(--line); color: #d9dcf0; --step: 14ms; }
.ring-band__track { display: flex; width: max-content; animation: marquee 80s linear infinite; }
.ring-band__track > div { padding-right: 6px; }
.ring-band svg { height: 18px; width: auto; }
.ring-band path { stroke-width: 1.6; }
.ring-band path.sep { stroke-width: 2.6; }
.js .ring-band [data-draw].is-in path { animation-delay: calc(var(--d, 0s) + 200ms); }

/* Tengwar version: the inscription as it appears on the One Ring, in the same silver glow as the runes.
   Font: Alcarin Tengwar by Toshi Omagari (SIL Open Font License 1.1). */
@font-face {
  font-family: "Alcarin Tengwar";
  src: url("https://cdn.jsdelivr.net/gh/Tosche/Alcarin-Tengwar@main/Fonts%20Static/AlcarinTengwar-Regular.woff2") format("woff2"),
       url("https://cdn.jsdelivr.net/gh/Tosche/Alcarin-Tengwar@main/Fonts%20Static/AlcarinTengwar-Regular.woff") format("woff");
  font-display: block;
}
.ring-band--tengwar { padding: 12px 0 10px; }
.ring-band--tengwar .ring-band__track { animation-duration: 110s; }
.ring-band--tengwar .ring-band__track > span {
  font-family: "Alcarin Tengwar", serif; font-size: 30px; line-height: 1.5; white-space: pre;
  color: #d9dcf0; padding-right: 0;
  text-shadow: 0 0 3px rgba(190,196,255,.5), 0 0 12px rgba(125,100,255,.35);
}
.ring-band--tengwar:not(.is-ready) .ring-band__reveal { opacity: 0; }
/* Reveal: a screen-anchored sweep from left to right, then a flare that settles into an ember glow */
.ring-band__reveal {
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%); mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%;
  -webkit-mask-position: 0 0; mask-position: 0 0;
}
.js .ring-band--tengwar:not(.is-in) .ring-band__reveal { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
.js .ring-band--tengwar.is-ready.is-in .ring-band__reveal { animation: ring-sweep 2.2s cubic-bezier(.4,0,.2,1) .2s both; }
.js .ring-band--tengwar.is-ready.is-in .ring-band__track > span { animation: ring-flare 3.2s ease-out .2s both; }
@keyframes ring-sweep {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
@keyframes ring-flare {
  0%, 35% { color: #fff; text-shadow: 0 0 6px rgba(255,255,255,.9), 0 0 18px rgba(160,140,255,.8); }
  100% { color: #d9dcf0; text-shadow: 0 0 3px rgba(190,196,255,.5), 0 0 12px rgba(125,100,255,.35); }
}

/* Process: a large inscription carved faintly into the background */
.process { position: relative; overflow: hidden; }
.process > .wrap { position: relative; z-index: 1; }
.rune-watermark { position: absolute; top: clamp(70px, 9vw, 120px); left: 50%; translate: -50% 0; height: clamp(28px, 7.6vw, 116px); color: #fff; opacity: .055; pointer-events: none; }
.rune-watermark svg { height: 100%; width: auto; }
.rune-watermark path { stroke-width: 2.2; }
.rune-watermark path.sep { stroke-width: 3.4; }

/* Page background: columns of runes in the side margins that travel with the scroll */
.rune-column {
  position: fixed; top: 0; z-index: 4; width: 11px; color: var(--grey);
  opacity: .045; pointer-events: none; transition: opacity .6s; will-change: transform;
}
.rune-column svg { width: 100%; height: auto; }
.rune-column path { stroke-width: 1.8; }
.rune-column path.sep { stroke-width: 3; }
.rune-column--left { left: max(14px, calc((100vw - var(--wrap)) / 2 - 70px)); }
.rune-column--right { right: max(14px, calc((100vw - var(--wrap)) / 2 - 70px)); }
body.is-scrolling .rune-column { opacity: .16; }
body.modal-open .rune-column { opacity: 0; }
@media (max-width: 1279px) { .rune-column { display: none; } }

/* Contact: "habla amigo y entra" */
.runes { margin: 28px 0 -8px; height: 30px; width: fit-content; cursor: help; color: #d9dcf0; }
.runes svg { height: 100%; width: auto; }
.runes path { stroke-width: 1.7; }
.runes path.sep { stroke-width: 2.6; }
.runes:hover path { stroke: #fff; transition: stroke .3s; }

/* Footer: a closing line and a call to action */
.footer__hero { padding-block: clamp(36px, 4.5vw, 60px); }
.footer__cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer__tag { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -0.02em; line-height: 1.1; }
.step h3 { font-size: 26px; margin: 10px 0 12px; }
.step p { color: var(--muted); margin: 0; font-size: 15px; }

/* ============ Team ("La compañía") ============ */
.team { background: var(--bg-2); border-top: 1px solid var(--line); }
.team__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.member {
  display: flex; flex-direction: column; gap: 20px; padding: clamp(24px, 3.5vw, 40px);
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  transition: border-color .4s;
}
.member:hover { border-color: rgba(125,100,255,.4); }
.member__head { display: flex; align-items: center; gap: 22px; }
.member__photo { position: relative; flex: none; width: 104px; height: 104px; }
.member__photo { margin: 22px; }
.member__photo img { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
/* each name, in Tengwar, circling the portrait */
.member__ring {
  position: absolute; inset: -25%; color: #d9dcf0; opacity: .55;
  animation: ring-spin 240s linear infinite; will-change: rotate;
}
.member__ring svg { width: 100%; height: 100%; filter: drop-shadow(0 0 3px rgba(190,196,255,.55)) drop-shadow(0 0 10px rgba(125,100,255,.35)); }
.member:hover .member__ring { opacity: .85; transition: opacity .4s; }
.member__photo::after {
  content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px rgba(125,100,255,.8);
  top: 4px; right: 4px; transition: transform .6s var(--ease);
}
.member:hover .member__photo::after { transform: rotate(0) translate(-3px, -3px) scale(1.2); }
.member__name { font-size: clamp(24px, 2.4vw, 30px); font-weight: 700; }
.member__role { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.member__runes { height: 11px; margin-top: 12px; color: #d9dcf0; opacity: .6; }
.member__runes svg { height: 100%; width: auto; filter: drop-shadow(0 0 3px rgba(190,196,255,.5)); }
.member__runes path { stroke-width: 2.2; }
.member__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.member__tags li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--grey); }
.member__bio { margin: 0; color: var(--muted); font-size: 15.5px; }
.member__quote { margin: auto 0 0; padding-left: 14px; border-left: 2px solid var(--accent); color: var(--grey); font-size: 15px; font-style: italic; }
.member__note { margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ============ Contact ============ */
.contact { background: radial-gradient(min(50%, 900px) 60% at calc(50% - min(50%, 720px)) 100%, rgba(91,60,245,.2), transparent 70%), var(--bg-2); border-top: 1px solid var(--line); }
.contact__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 90px); align-items: start; }
.contact__title em { white-space: nowrap; }
.contact__title { font-size: clamp(34px, 4.4vw, 68px); font-weight: 700; line-height: 1.02; letter-spacing: -0.03em; }
.contact__lead { color: var(--muted); font-size: 18px; max-width: 420px; margin: 24px 0 36px; }
.contact__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.contact__list li { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.contact__list li:first-child { border-top: 1px solid var(--line); }
.contact__list span { color: var(--muted); }
.contact__list a { font-weight: 600; transition: color .2s; word-break: break-all; }
.contact__list a:hover { color: var(--accent-2); }

.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 3.5vw, 40px); display: grid; gap: 20px; }
.field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-size: 14px; font-weight: 600; color: var(--grey); padding: 0; margin-bottom: 8px; }
.field > label { margin-bottom: 0; }
.field input[type="text"], .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--text); font: inherit; font-size: 16px; resize: vertical; transition: border-color .2s;
}
.field input::placeholder, .field textarea::placeholder { color: #5f6068; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { margin: 0; cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); transition: all .2s; }
.chips input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.form__error { margin: 0; color: #ff8a8a; font-size: 14px; min-height: 1em; }
.form__error:empty { display: none; }
.form__note { margin: -6px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ============ Footer ============ */
.footer { border-top: 1px solid var(--line); padding: 0 0 36px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.footer p { margin: 0; }
.footer__hero + .footer__inner { border-top: 1px solid var(--line); padding-top: 28px; }
.footer__top:hover { color: var(--text); }
.footer__legal { margin: 18px auto 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); opacity: .6; }

.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: transform .25s var(--ease);
}
.wa-float:hover { transform: scale(1.08); }

/* ============ Modal ============ */
.modal { width: min(1080px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); color: var(--text); overflow: auto; overscroll-behavior: contain; }
.modal::backdrop { background: rgba(5,5,7,.9); } /* solid dim: a live blur over an animated page is very costly */
.modal[open] { animation: modalIn .45s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.modal__inner { position: relative; }
.modal__close { position: sticky; top: 14px; float: right; margin: 14px 14px 0 0; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20,20,23,.92); font-size: 16px; }
.modal__close:hover { background: var(--surface); }
.modal__head { padding: clamp(28px, 5vw, 56px) clamp(20px, 5vw, 56px) 32px; }
.modal__head h2 { font-size: clamp(34px, 5vw, 58px); margin: 16px 0; }
.modal__head p { color: var(--muted); max-width: 640px; margin: 0; font-size: 18px; }
.modal__facts { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 28px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.modal__facts div { display: grid; gap: 2px; }
.modal__facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.modal__facts dd { margin: 0; font-weight: 600; }
.modal__gallery { padding: 0 clamp(12px, 3vw, 32px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.modal__gallery figure { margin: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--g-bg, var(--surface)); grid-column: span var(--g-span, 1); }
.modal__gallery figure.is-contain { display: grid; place-items: center; padding: clamp(24px, 5vw, 60px); }
.modal__gallery figure.is-contain img { max-height: 420px; width: auto; }
.modal__gallery figure.is-narrow img { max-width: 720px; margin-inline: auto; }
.modal__gallery img { width: 100%; height: auto; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 32px clamp(20px, 5vw, 56px) 40px; }
.modal__foot p { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; }
body.modal-open { overflow: hidden; }

/* Before / after comparison */
.card__badge {
  position: absolute; z-index: 2; top: 12px; right: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(13,13,15,.85); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.compare { --pos: 50%; position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; user-select: none; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; pointer-events: none; }
/* Reveal with transforms only (GPU-composited, no repaint): the wrapper slides in from the left
   while its image slides back the same amount, so the picture stays in place. */
.compare__before { position: absolute; inset: 0; overflow: hidden; transform: translateX(calc(var(--pos) - 100%)); will-change: transform; }
.compare__before img { transform: translateX(calc(100% - var(--pos))); will-change: transform; }
.compare__line { position: absolute; inset: 0; transform: translateX(var(--pos)); will-change: transform; pointer-events: none; }
.compare__line::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 12px rgba(0,0,0,.35); }
.compare__line span {
  position: absolute; top: 50%; left: 0; translate: -50% -50%; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 8px 24px rgba(0,0,0,.35);
}
.compare__label {
  position: absolute; bottom: 14px; padding: 6px 12px; border-radius: 999px; background: rgba(13,13,15,.8);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; pointer-events: none;
}
.compare__label--before { left: 14px; }
.compare__label--after { right: 14px; background: var(--accent); }
.compare { cursor: ew-resize; touch-action: pan-y; }
.compare__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.compare:has(.compare__range:focus-visible) .compare__line span { outline: 2px solid #fff; outline-offset: 3px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; background: var(--surface); align-items: start; }
.pair > div { position: relative; border-radius: 8px; overflow: hidden; background: #fff; }
.pair img { width: 100%; height: auto; }
.pair__label {
  position: absolute; top: 10px; left: 10px; padding: 5px 10px; border-radius: 999px; background: rgba(13,13,15,.8);
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.pair__label--after { background: var(--accent); }

/* ============ Reveal ============ */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 1080px) {
  .services__grid { grid-template-columns: repeat(2, 1fr); }
  .hero__stack { opacity: .35; }
}
@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: 76px 0 auto; flex-direction: column; gap: 0; margin: 0;
    background: rgba(13,13,15,.97); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px; transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: all .3s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav__links a { padding: 14px 0; font-size: 20px; color: var(--text); border-bottom: 1px solid var(--line); }
  .nav__cta { display: none; }
  .nav__toggle { display: block; }
  .nav.menu-open { background: rgba(13,13,15,.97); }

  .hero__title { max-width: none; font-size: clamp(38px, 11.5vw, 84px); }
  .hero { flex-direction: column; align-items: stretch; gap: 40px; padding-top: 110px; min-height: 0; }
  .hero__stack { position: relative; right: auto; top: auto; transform: none; width: 86%; max-width: 420px; margin: 0 auto; opacity: 1; }
  .hero__door { position: relative; right: auto; top: auto; translate: none; width: min(66%, 280px); margin: 0 auto; }

  .about__grid { grid-template-columns: 1fr; gap: 0; }
  .name__grid { grid-template-columns: 1fr; }
  .team__grid { grid-template-columns: 1fr; }
  .member__photo { width: 84px; height: 84px; }
  .rune-watermark { top: 36px; opacity: .06; }
  .work__grid .card, .work__grid.is-filtered .card { --span: 12; }
  .card--split { flex-direction: column; }
  .card--split .card__split-text { flex: none; justify-content: flex-start; gap: 12px; padding: 28px 24px 24px; }
  .card--split .card__media { flex: none; height: 380px; min-height: 0; padding: 28px 28px 0; }
  .steps { grid-template-columns: 1fr 1fr; row-gap: 40px; border-top: 0; }
  .step { border-top: 1px solid var(--line); }
  .card__media--photo > img { object-position: 78% 50%; }
  .contact__grid { grid-template-columns: 1fr; }
  .modal__gallery { grid-template-columns: 1fr; }
  .modal__gallery figure { grid-column: auto; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .services__grid { grid-template-columns: 1fr; }
  .service__num { margin-bottom: 36px; }
  .stats { grid-template-columns: 1fr; gap: 20px; }
  .steps { grid-template-columns: 1fr; }
  .card__media { height: 360px; }
  .card__media--posts { gap: 8px; padding: 20px 16px; height: auto; }
  .card__meta { flex-direction: column; gap: 2px; }
  .hero__actions .btn { flex: 1 1 100%; white-space: nowrap; }
  .footer { padding-bottom: 88px; } /* keep the last line clear of the WhatsApp button */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* While a project is open, freeze everything animating behind it (bands, rings, door, glows)
   so the browser only works on the modal. */
body.modal-open main *, body.modal-open main *::before, body.modal-open main *::after,
body.modal-open footer *, body.modal-open .nav * { animation-play-state: paused !important; }
body.modal-open .rune-column { display: none; }
body.modal-open .nav.is-scrolled { backdrop-filter: none; -webkit-backdrop-filter: none; }
