/* =========================================================
   CHROME — preloader, page transition, cursor, header, menu,
   marquee, footer. Everything that lives on every page.
   ========================================================= */

/* ---------------------------------------------------------
   1. PRELOADER
   --------------------------------------------------------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: 1fr auto;
  background: var(--bg);
  padding: var(--gutter);
  transition: opacity 0.4s linear;
}
.preloader__stage {
  display: grid;
  place-items: center;
  overflow: hidden;
}
.preloader__words {
  position: relative;
  height: 1.2em;
  font-size: var(--t-h3);
  letter-spacing: var(--tr-tight);
}
.preloader__words span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(28px);
  white-space: nowrap;
}
.preloader__words span.is-on {
  animation: word-in 0.62s var(--ease) forwards;
}
@keyframes word-in {
  0%   { opacity: 0; transform: translateY(28px); }
  22%  { opacity: 1; transform: translateY(0); }
  78%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-24px); }
}

.preloader__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gutter);
}
.preloader__count {
  font-size: clamp(3rem, 1rem + 9vw, 9rem);
  line-height: 0.8;
  letter-spacing: var(--tr-tight);
  font-variant-numeric: tabular-nums;
}
.preloader__bar {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}
/* Curtain-up exit: two panels sliding off */
.preloader.is-done { pointer-events: none; }
.preloader.is-done .preloader__stage,
.preloader.is-done .preloader__foot { opacity: 0; transition: opacity 0.25s linear; }

/* ---------------------------------------------------------
   2. PAGE TRANSITION CURTAIN
   --------------------------------------------------------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  pointer-events: none;
}
.curtain i {
  display: block;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
}
/* Leaving the page: panels grow from the bottom, staggered */
.curtain.is-out i {
  transform-origin: bottom;
  animation: curtain-out 0.62s var(--ease-inout) forwards;
  animation-delay: calc(var(--n) * 55ms);
}
/* Arriving: panels shrink upward */
.curtain.is-in i {
  transform: scaleY(1);
  transform-origin: top;
  animation: curtain-in 0.66s var(--ease-inout) forwards;
  animation-delay: calc(var(--n) * 55ms);
}
@keyframes curtain-out { to { transform: scaleY(1); } }
@keyframes curtain-in  { to { transform: scaleY(0); } }

/* ---------------------------------------------------------
   3. CUSTOM CURSOR
   --------------------------------------------------------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  z-index: 950;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity var(--dur-s) linear;
}
.cursor.is-on { opacity: 1; }
.cursor__dot,
.cursor__ring {
  position: absolute;
  top: 0; left: 0;
  border-radius: 50%;
  will-change: transform;
}
.cursor__dot {
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  background: #fff;
}
.cursor__ring {
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  transition:
    width var(--dur-s) var(--ease),
    height var(--dur-s) var(--ease),
    margin var(--dur-s) var(--ease),
    background var(--dur-s) var(--ease),
    border-color var(--dur-s) var(--ease);
}
.cursor__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #000;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-xs) linear, transform var(--dur-s) var(--ease);
  white-space: nowrap;
}
/* Hovering something clickable */
.cursor.is-hover .cursor__ring {
  width: 72px; height: 72px;
  margin: -36px 0 0 -36px;
  background: rgba(255, 255, 255, 0.16);
  border-color: transparent;
}
.cursor.is-hover .cursor__dot { opacity: 0; }
/* Hovering something with data-cursor="Text" */
.cursor.is-label .cursor__ring {
  width: 92px; height: 92px;
  margin: -46px 0 0 -46px;
  background: #fff;
  border-color: transparent;
}
.cursor.is-label .cursor__label { opacity: 1; transform: scale(1); }
.cursor.is-label .cursor__dot { opacity: 0; }
.cursor.is-down .cursor__ring { transform: scale(0.82); }

/* Over the work list the disc is doing the pointing. The ring would
   land inside it as a pale blob covering the very image the disc
   exists to show, so the cursor steps aside and the disc carries its
   own small label instead (.preview__label, in home.css). */
.cursor.is-quiet { opacity: 0; }

/* No custom cursor on touch or when the user asked for less motion */
@media (pointer: coarse) { .cursor { display: none; } }
@media (prefers-reduced-motion: reduce) { .cursor { display: none; } }

/* ---------------------------------------------------------
   4. HEADER
   --------------------------------------------------------- */
.header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--header-h);
  z-index: 800;
  display: flex;
  align-items: center;
  transition: transform var(--dur-m) var(--ease),
              background-color var(--dur-s) var(--ease),
              border-color var(--dur-s) var(--ease);
  color: #fff;
  background-color: transparent;
  border-bottom: 1px solid transparent;
}
[data-theme="light"] .header { color: var(--fg); }

/* How the header stays readable over whatever is under it.

   It used to be mix-blend-mode: difference — the header inverted
   itself out of the backdrop, white over the dark hero and dark
   over a pale photograph, with no bar of its own. Clever, and
   fine while the header was pure text. It stops being fine the
   moment the logotype has a colour: difference repaints the brand
   green into whatever the photograph behind happens to decide,
   and a brand colour that changes with the wallpaper is not one.

   (Moving the blend onto the children does not rescue it either:
   .header is fixed with a z-index, so it is its own stacking
   context, and a child can only blend with what its own parent
   painted — which is nothing. The text simply stops blending.)

   So the trick is gone and the header earns its keep honestly:
   transparent while it is still over the hero it was designed
   against, and from the first scroll onwards a surface of its
   own in the page's own background colour. Nothing has to be
   inverted, so the logotype keeps its exact green — or its exact
   blue on the light theme — everywhere on the site. */
.header.is-stuck {
  background-color: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom-color: var(--line-soft);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
          backdrop-filter: blur(14px) saturate(1.25);
}
/* The open menu is already a full-bleed surface of its own. */
.header.is-menu { color: var(--fg); }
.header.is-menu.is-stuck {
  background-color: transparent;
  border-bottom-color: transparent;
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
}

.header__inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
  letter-spacing: -0.02em;
  font-variation-settings: "wght" 200;
  line-height: 1;
}
.brand sup { font-family: var(--font-mono); font-size: 0.5em; opacity: 0.6; }

/* The EdG logotype, in front of the name, in its own colour.

   It used to be a mask filled with currentColor, which made it a
   monochrome silhouette of the header text. Now it is the vector
   itself, one file per theme, so the mark in the corner is the
   same mark that goes on a business card:

     dark   assets/logo.svg        brand green  #B8D851
     light  assets/logo-azul.svg   brand blue   #0057B8

   Both are the same shape and viewBox, so the ratio below holds
   for either. The green is the one the whole identity is built
   on and it is a near-relative of --accent; the blue is the
   light theme's own accent family, and it is the colour that
   survives on cream — the green does not. */
.brand__mark {
  display: block;
  height: 1.28em;
  width: calc(1.28em * 2.1673);        /* 411.73 / 189.98, the logotype's ratio */
  background: url(../assets/logo.svg) center / contain no-repeat;
  transition: transform var(--dur-m) var(--ease), opacity var(--dur-s) var(--ease);
}
[data-theme="light"] .brand__mark { background-image: url(../assets/logo-azul.svg); }
.brand:hover .brand__mark { transform: scale(1.05); }

.header__nav { display: flex; align-items: center; gap: clamp(1rem, 2vw, 2.6rem); }
.header__nav a {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
}
.header__nav a[aria-current="page"] { color: var(--accent); }
[data-theme="light"] .header__nav a[aria-current="page"] { color: inherit; text-decoration: underline; text-underline-offset: 5px; }

.header__end { display: flex; align-items: center; gap: clamp(0.75rem, 1.4vw, 1.5rem); }

/* Availability pill with a breathing dot */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid currentColor;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.status i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
  animation: pulse 2.4s var(--ease-soft) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition: background var(--dur-s) var(--ease), color var(--dur-s) var(--ease), transform var(--dur-s) var(--ease);
}
.icon-btn:hover { transform: rotate(35deg); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ---------------------------------------------------------
   4b. LANGUAGE SWITCH — two links, the current one filled.
   The href always points at the twin page in the other
   language, so switching never loses your place.
   --------------------------------------------------------- */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid currentColor;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lang a {
  display: block;
  padding: 0.36rem 0.62rem;
  border-radius: 100px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity var(--dur-s) var(--ease), background var(--dur-s) var(--ease), color var(--dur-s) var(--ease);
}
.lang a:hover { opacity: 1; }
.lang a[aria-current="true"] {
  background: var(--fg);
  color: var(--bg);
  opacity: 1;
}

/* The same control, sized up, inside the full-screen menu */
.menu__lang { font-size: calc(var(--t-mono) * 1.15); }
.menu__lang a { padding: 0.45rem 0.8rem; }

/* Burger */
.burger {
  width: 46px; height: 46px;
  display: none;
  place-items: center;
  position: relative;
}
.burger i {
  position: absolute;
  left: 11px;
  width: 24px; height: 1.5px;
  background: currentColor;
  transition: transform var(--dur-s) var(--ease), opacity var(--dur-xs) linear;
}
.burger i:nth-child(1) { transform: translateY(-5px); }
.burger i:nth-child(2) { transform: translateY(5px); }
.burger.is-open i:nth-child(1) { transform: rotate(45deg); }
.burger.is-open i:nth-child(2) { transform: rotate(-45deg); }

/* ---------------------------------------------------------
   5. FULL-SCREEN MENU
   --------------------------------------------------------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 780;
  background: var(--bg-raised);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: calc(var(--header-h) + var(--gutter)) var(--gutter) var(--gutter);
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--dur-l) var(--ease-inout);
  visibility: hidden;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; }

.menu__list { align-self: center; display: grid; gap: 0.2em; }
.menu__list li { overflow: hidden; }
.menu__list a {
  display: inline-flex;
  align-items: baseline;
  gap: 1rem;
  font-size: clamp(2.6rem, 1rem + 9vw, 8rem);
  line-height: 1.02;
  letter-spacing: var(--tr-tight);
  transform: translateY(105%);
  transition: transform var(--dur-l) var(--ease), color var(--dur-s) linear;
  transition-delay: calc(var(--n) * 60ms);
}
.menu.is-open .menu__list a { transform: translateY(0); }
.menu__list a small {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.5rem + 0.3vw, 0.75rem);
  color: var(--fg-dim);
  letter-spacing: var(--tr-wide);
}
.menu__list a:hover { color: var(--accent); }
/* The word opens up under the pointer instead of leaning over. */
.menu__list a:hover .menu__word { font-variation-settings: "wght" 500, "wdth" var(--em-wdth); }
.menu__word { transition: none; }

.menu__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--stack);
  border-top: 1px solid var(--line);
  padding-top: var(--stack);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-m) var(--ease) 0.35s, transform var(--dur-m) var(--ease) 0.35s;
}
.menu.is-open .menu__foot { opacity: 1; transform: none; }
.menu__socials { display: flex; flex-wrap: wrap; gap: 1.4rem; }

/* ---------------------------------------------------------
   6. MARQUEE
   --------------------------------------------------------- */
.marquee {
  --speed: 42s;
  display: flex;
  overflow: hidden;
  user-select: none;
  gap: 0;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee__track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 4rem);
  padding-right: clamp(1.5rem, 3vw, 4rem);
  min-width: 100%;
  animation: slide var(--speed) linear infinite;
  will-change: transform;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee--rev .marquee__track { animation-direction: reverse; }
@keyframes slide { to { transform: translateX(-100%); } }

.marquee__item {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 4rem);
  font-size: var(--t-h2);
  line-height: 1;
  letter-spacing: var(--tr-tight);
  white-space: nowrap;
}
.marquee__item i {
  display: block;
  width: 0.32em; height: 0.32em;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.marquee--outline .marquee__item {
  color: transparent;
  -webkit-text-stroke: 1px var(--fg);
}

/* ---------------------------------------------------------
   7. FOOTER
   --------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 1.5rem + 3vw, 5rem);
  position: relative;
}
.footer__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
}
.footer__col h4 {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 400;
  margin-bottom: 1.2rem;
}
.footer__col li + li { margin-top: 0.5rem; }
.footer__clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.2rem, 1rem + 1vw, 2rem);
  letter-spacing: -0.01em;
  color: var(--fg);
}
.footer__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(2.5rem, 5vw, 5rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-soft);
}
.to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
}
.to-top svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; transition: transform var(--dur-s) var(--ease); }
.to-top:hover svg { transform: translateY(-4px); }

/* Big wordmark that fills the footer edge to edge */
.footer__word {
  font-size: clamp(3rem, 0.5rem + 15.5vw, 19rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
  text-align: center;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  margin-top: clamp(2rem, 5vw, 5rem);
  transition: color var(--dur-l) var(--ease);
  cursor: default;
}
.footer__word:hover { color: var(--fg); -webkit-text-stroke-color: transparent; }
