/* Ciutadel - MVP (light / Apple-inspired). Vanilla CSS, no external requests.
   Wordmark font self-hosted (IBM Plex Sans). Interactive smart-city background. */

@font-face {
  font-family: "Plex Sans";
  src: url("/fonts/plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: "Plex Sans Fallback";
  src: local("Helvetica Neue"), local("Arial");
  size-adjust: 96%;
  ascent-override: 100%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --ink: #000028;
  --ink-soft: #2b2d42;
  --muted: #555766;
  --muted-soft: #6b6d7e;
  --line: #e6e6ea;
  --line-strong: #d6d7dd;
  --petrol: #009999;
  --petrol-text: #097070;
  --green: #00ffb9; /* highlight on dark surfaces (tooltips, OG) */

  --step--1: clamp(0.83rem, 0.80rem + 0.14vw, 0.92rem);
  --step-0: 1rem;
  --step-1: clamp(1.12rem, 1.03rem + 0.42vw, 1.35rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-h1: clamp(1.95rem, 1.0rem + 4.2vw, 4.4rem);
  --step-h2: clamp(1.7rem, 1.2rem + 2.2vw, 3rem);

  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snappy: cubic-bezier(0.4, 0, 0.2, 1);

  /* the map box (bottom-right anchored) + a mask anchored to IT that dissolves its top/left edges,
     so the map never ends in a hard rectangle regardless of viewport width */
  --map-w: min(1040px, 96vw);
  --map-h: calc(min(1040px, 96vw) * 0.9415);
  /* circular dissolve: a true circle centred on the map's bottom-right anchor (off-screen), so the
     visible map fades along a circular arc instead of straight top/left edges -> the map reads as a disc */
  --edge-mask: radial-gradient(circle farthest-side at 100% 100%, #000 0%, #000 52%, transparent 95%);
  /* steeper version for the hover lens: opaque across the disc body, fading only at the circular edge,
     so the bright clarity reveal stays 100% crisp but never repaints beyond the map's circular boundary */
  --edge-mask-reveal: radial-gradient(circle farthest-side at 100% 100%, #000 0%, #000 82%, transparent 99%);
  /* readability scrim behind loose copy over the map; nulled where the scene is hidden */
  --scrim-bg: rgba(255, 255, 255, 0.92);
}

*,
*::before,
*::after { box-sizing: border-box; }

/* Selección de texto = acento de marca (petrol "Siemens") con texto blanco */
::selection { background: var(--petrol); color: #fff; }
::-moz-selection { background: var(--petrol); color: #fff; }

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* ============ Interactive smart-city scene ============ */
.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.scene__layer {
  position: absolute;
  inset: -6%;
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: min(1040px, 96vw);
  transform-origin: 100% 100%;
  /* pointer parallax (--px/--py) + scroll travel (--sy) + scroll zoom (--sz) */
  transform: translate3d(var(--px, 0px), calc(var(--py, 0px) + var(--sy, 0px)), 0) scale(var(--sz, 1));
  transition: transform 0.5s var(--ease);
  will-change: transform;
}
/* base city - always on; visible enough to read as a map at rest. Circular edge mask (anchored to the
   map's bottom-right corner) dissolves the map along a circular arc so it reads as a disc, not a rectangle. */
.scene__plan {
  background-image: url("/bg-trace.svg");
  opacity: 0.15;
  -webkit-mask-image: var(--edge-mask);
  mask-image: var(--edge-mask);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: right bottom;
  mask-position: right bottom;
  -webkit-mask-size: var(--map-w) var(--map-h);
  mask-size: var(--map-w) var(--map-h);
}
/* the cursor is a flashlight: under the "lens" the streets SHARPEN (clarity).
   The lens lives in VIEWPORT space (inset:0, untransformed) so it stays centered on the
   pointer; the map it reveals is painted by ::before with the SAME transform as .scene__plan
   so it aligns with the base map. The lens is intersected with --edge-mask so hovering near
   the top/left edge never undoes the edge dissolve. */
.scene__reveal {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  -webkit-mask-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), #000 0%, #000 22%, transparent 74%);
  mask-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), #000 0%, #000 22%, transparent 74%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.scene__reveal::before {
  content: "";
  position: absolute;
  inset: -6%;
  background-image: url("/bg-trace.svg");
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: min(1040px, 96vw);
  transform-origin: 100% 100%;
  transform: translate3d(var(--px, 0px), calc(var(--py, 0px) + var(--sy, 0px)), 0) scale(var(--sz, 1));
  transition: transform 0.5s var(--ease);
  will-change: transform;
  /* the map under the lens fades in the SAME circular box as .scene__plan (so it aligns), but with
     the steeper --edge-mask-reveal so the bright clarity reveal stays crisp across the disc and
     dissolves only at the circular boundary. The parent's lens then clips this. */
  -webkit-mask-image: var(--edge-mask-reveal);
  mask-image: var(--edge-mask-reveal);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: right bottom;
  mask-position: right bottom;
  -webkit-mask-size: var(--map-w) var(--map-h);
  mask-size: var(--map-w) var(--map-h);
}
.scene.is-active .scene__reveal { opacity: 1; }
/* soft petrol halo following the cursor - the flashlight glow */
.scene__spot {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 153, 153, 0.14), rgba(0, 153, 153, 0.04) 46%, transparent 72%);
}
.scene.is-active .scene__spot { opacity: 1; }
/* living data network (canvas, injected by bg.js): particles ride the real streets with
   light trails, wake up + glow teal near the cursor, pulse the hub, emit signal rings.
   Placed exactly like the map background, inside .scene so the mask fades it like the map. */
.scene__net,
.scene__data,
.scene__sea {
  position: absolute;
  right: -6%;
  bottom: -6%;
  transform-origin: 100% 100%;
  transform: translate3d(var(--px, 0px), calc(var(--py, 0px) + var(--sy, 0px)), 0) scale(var(--sz, 1));
  transition: transform 0.5s var(--ease);
  will-change: transform;
  -webkit-mask-image: var(--edge-mask);
  mask-image: var(--edge-mask);
}

/* ============ Layout ============ */
.wrap {
  width: 100%;
  min-width: 0;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.75rem);
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-block: clamp(0.9rem, 2.4vw, 1.25rem);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  text-decoration: none;
  transition: opacity 0.2s var(--ease-snappy);
}
.wordmark {
  font-family: "Plex Sans", "Plex Sans Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
}
.brand .wordmark { font-size: 1.28rem; }
.wordmark__dot {
  display: inline-block;
  width: 0.17em;
  height: 0.17em;
  border-radius: 50%;
  background: var(--petrol);
  margin-left: 0.07em;
  vertical-align: baseline;
}
@media (hover: hover) { .brand:hover { opacity: 0.72; } }

.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: var(--step--1);
  font-weight: 500;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.26rem 0.36rem;
  background: var(--bg);
}
.lang a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  transition: color 0.18s var(--ease-snappy), background 0.18s var(--ease-snappy);
}
@media (hover: hover) { .lang a:hover { color: var(--ink); } }
.lang a[aria-current="page"] { color: var(--bg); background: var(--ink); }

/* ---- Hero ---- */
.hero {
  min-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding-block: clamp(3rem, 9vh, 6rem) clamp(3rem, 8vh, 5rem);
}
.hero .inner { max-width: 50rem; margin-inline: auto; }
.hero h1 {
  margin: 0;
  font-size: var(--step-h1);
  line-height: 1.05;
  letter-spacing: clamp(-0.035em, -0.02em - 0.3vw, -0.02em);
  font-weight: 600;
  color: var(--ink);
  max-width: 100%;
  text-wrap: balance;
}
.hero p.lead {
  margin: var(--space-6) auto 0;
  max-width: 42ch;
  font-size: var(--step-1);
  line-height: 1.4;
  letter-spacing: -0.011em;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem 1.4rem;
  margin-top: var(--space-10);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--bg);
  background: var(--ink);
  text-decoration: none;
  padding: 0.82rem 1.6rem;
  border-radius: 980px;
  transition: transform 0.18s var(--ease-snappy), box-shadow 0.18s var(--ease-snappy), background 0.18s var(--ease-snappy);
}
@media (hover: hover) {
  .btn:hover {
    transform: translateY(-1px);
    background: #16163c;
    box-shadow: 0 1px 2px rgba(0, 0, 40, 0.16), 0 6px 16px -8px rgba(0, 0, 40, 0.24);
  }
  .btn:hover svg { transform: translateX(2px); }
}
.btn:active { transform: translateY(0) scale(0.99); background: #16163c; box-shadow: 0 1px 2px rgba(0, 0, 40, 0.18); transition-duration: 80ms; }
.btn svg { transition: transform 0.18s var(--ease-snappy); }
.btn:focus-visible { outline: 2px solid var(--bg); outline-offset: 3px; box-shadow: 0 0 0 5px var(--petrol-text); }
.cta__alt { font-size: 0.92rem; color: var(--muted); }
.cta__alt a {
  color: var(--petrol-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--petrol-text), transparent 55%);
  transition: text-decoration-color 0.18s var(--ease-snappy);
}
@media (hover: hover) { .cta__alt a:hover { text-decoration-color: var(--petrol-text); } }

/* trust strip - the live proof of sovereignty */
.trust {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.9rem;
  margin: var(--space-8) auto 0;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--step--1);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}
.trust b { color: var(--ink); font-weight: 600; }
.trust .sep { color: var(--line-strong); }

/* ---- Generic section ---- */
.section { padding-block: clamp(3.5rem, 10vh, 7rem); border-top: 1px solid var(--line); }
.section__head { max-width: 46rem; margin-inline: auto; text-align: center; }
.eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--petrol-text);
  margin: 0 0 0.8rem;
}
.section h2 {
  margin: 0;
  font-size: var(--step-h2);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 600;
  text-wrap: balance;
}
.section .sub {
  margin: 1rem auto 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.5;
}

/* principles */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: clamp(2rem, 5vw, 3rem);
}
.principle {
  background: var(--bg-soft);   /* fallback: opaque grey surface */
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
}
/* frosted grey glass: a translucent grey card that blurs the map behind it.
   Falls back to the opaque surface above where backdrop-filter is unsupported. */
/* frosted glass only on non-touch devices: on phones/tablets backdrop-filter has to re-blur the
   animated scene every frame (it sits behind the cards), which makes scrolling stutter. Touch
   devices keep the opaque grey fallback above. */
@media (pointer: fine) {
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .principle,
    .residency .diagram {
      background: rgba(245, 245, 247, 0.35);
      -webkit-backdrop-filter: blur(16px);
      backdrop-filter: blur(16px);
    }
  }
}
.principle .pmark { width: 30px; height: 30px; margin-bottom: 14px; color: var(--petrol-text); }
.principle h3 { margin: 0 0 0.4rem; font-size: 1.15rem; letter-spacing: -0.01em; }
.principle p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.principle .tag {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--petrol-text);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}

/* tag that reveals an explanatory tooltip on hover/focus. No icon: the pill itself
   is the affordance (cursor: help). Works with no JS; keyboard-accessible via
   tabindex + aria-describedby on the tag. */
.tag--has-info { position: relative; cursor: help; }
.tag--has-info:focus-visible { outline: 2px solid var(--petrol-text); outline-offset: 2px; }
.tag-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 5;
  width: max-content;
  max-width: 280px;
  padding: 0.65rem 0.75rem;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 40, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s var(--ease);
  pointer-events: none;
}
.tag-tip b { color: var(--green); font-weight: 600; }
.tag-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 14px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.tag--has-info:hover .tag-tip,
.tag--has-info:focus-visible .tag-tip,
.tag--has-info:focus .tag-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* residency */
.residency {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  margin-top: clamp(2rem, 5vw, 3rem);
}
@media (min-width: 820px) { .residency { grid-template-columns: 0.9fr 1.1fr; } }
.residency .copy h2 { text-align: left; }
.residency .copy .eyebrow { text-align: left; }
.residency .copy p { margin: 1rem 0 0; color: var(--muted); font-size: var(--step-1); line-height: 1.5; max-width: 40ch; }
.residency .diagram {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(20px, 3vw, 34px);
}
.residency .diagram svg { width: 100%; height: auto; }

/* cta band */
.cta-band { text-align: center; padding-block: clamp(3.5rem, 9vh, 6rem); border-top: 1px solid var(--line); }
.cta-band h2 { margin: 0 0 0.6rem; font-size: var(--step-h2); letter-spacing: -0.025em; }
.cta-band .sub { color: var(--muted); margin: 0 0 1.8rem; }

/* ---- Readability scrim ----
   A soft, blurred white pad behind loose copy that overlaps the background map. Each block is
   shrink-wrapped (fit-content) so the pad hugs the text instead of being a full-width band, and
   the ::before is blurred so it reads as a soft halo, not a panel. It sits between the decorative
   scene and the text, lifting contrast without changing the layout (absolutely positioned). */
.hero .eyebrow,
.hero h1,
.hero p.lead,
.section__head .eyebrow,
.section__head h2,
.section__head .sub,
.residency .copy .eyebrow,
.residency .copy h2,
.residency .copy p,
.cta-band h2,
.cta-band .sub {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 100%;
}
/* centered blocks stay centered once shrink-wrapped (residency copy stays left-aligned) */
.hero .eyebrow,
.hero h1,
.hero p.lead,
.section__head .eyebrow,
.section__head h2,
.section__head .sub,
.cta-band h2,
.cta-band .sub {
  margin-inline: auto;
}
/* the secondary CTA line is a flex item (already content-width); just give it a scrim host */
.cta__alt { position: relative; isolation: isolate; }
.hero .eyebrow::before,
.hero h1::before,
.hero p.lead::before,
.cta__alt::before,
.section__head .eyebrow::before,
.section__head h2::before,
.section__head .sub::before,
.residency .copy .eyebrow::before,
.residency .copy h2::before,
.residency .copy p::before,
.cta-band h2::before,
.cta-band .sub::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.16em -0.7em;
  border-radius: 0.8em;
  background: var(--scrim-bg);
  filter: blur(7px);
}

/* ---- Footer ---- */
.site-footer {
  position: relative;
  background: var(--bg);   /* opaque white over the map, so the footer never shows the scene behind it */
  border-top: 1px solid var(--line);
  padding-block: 2rem 2.25rem;
  color: var(--muted-soft);
  font-size: var(--step--1);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1.5rem; }
.site-footer .ftrust { color: var(--muted); }
.site-footer .ftrust b { color: var(--ink); font-weight: 600; }
.site-footer .wordmark { font-size: 0.9rem; color: var(--muted); }
.site-footer .colophon { margin: 0.9rem 0 0; font-size: 0.72rem; line-height: 1.4; color: var(--muted-soft); }
.site-footer .colophon a { color: var(--muted-soft); text-decoration: underline; text-underline-offset: 2px; }
/* a small human touch: made with love in Barcelona. The heart is the brand petrol (graphic use). */
.site-footer .madelove { margin: 0.9rem 0 0; display: inline-flex; align-items: center; gap: 0.34em; font-size: 0.72rem; color: var(--muted-soft); white-space: nowrap; }
.site-footer .madelove .heart { flex: none; fill: var(--petrol); }

/* ---- Focus & a11y ---- */
:focus-visible { outline: 2px solid var(--petrol-text); outline-offset: 3px; }

/* ---- Scroll-linked motion ----
   Modern browsers: content fades/slides based on its position in the scrollport,
   continuously and REVERSIBLY (it re-animates whenever it passes through the viewport,
   even after you've scrolled down), via `animation-timeline: view()`. Pure CSS, works
   without JS. The hero animates on load. Older browsers fall back to the one-time
   IntersectionObserver reveal (main.js adds `.in`, gated on `.js`). All off when
   reduced motion is requested -> content is simply visible. */
@media (prefers-reduced-motion: no-preference) {
  .hero .reveal { animation: rise 0.6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 80ms + 40ms); opacity: 0; transform: translateY(10px); }

  @supports (animation-timeline: view()) {
    .section .reveal, .cta-band .reveal {
      animation-name: reveal-in;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: view();
      animation-range: entry 0% entry 62%;
    }
    /* subtle parallax depth on accents (children of reveals, so no animation conflict) */
    .principle .pmark, .residency .diagram > svg {
      animation-name: drift;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: view();
      animation-range: cover;
    }
  }
  @supports not (animation-timeline: view()) {
    .js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
    .js .reveal.in { opacity: 1; transform: none; }
  }
}
@keyframes rise { to { opacity: 1; transform: none; } }
/* slide only (no opacity) so text never drops below full contrast at any scroll position */
@keyframes reveal-in { from { transform: translateY(26px); } to { transform: none; } }
@keyframes drift { from { transform: translateY(14px); } to { transform: translateY(-14px); } }

/* ---- Higher contrast ---- */
@media (prefers-contrast: more) {
  :root {
    --muted: #36384a; --muted-soft: #36384a; --ink-soft: #15172a;
    --line: #b9bac2; --line-strong: #9a9ca6; --petrol-text: #075a5a;
  }
  :focus-visible { outline-width: 3px; }
  .scene { display: none; }
}
@media (forced-colors: active) { .scene { display: none; } :root { --scrim-bg: transparent; } }

/* ---- Kill all motion when asked ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .scene__reveal, .scene__spot { display: none; }
}

@media (max-width: 560px) {
  .residency .copy h2, .residency .copy .eyebrow { text-align: center; }
  .residency .copy p { margin-inline: auto; }
}
