/* CÖC · Bienvenida bilingüe (estudiococ.com/)
   Dos mitades, una línea de 1 px y la ö sobre la línea: un punto por idioma. */

.welcome { overflow: hidden; }

.w {
  --split: 50%;
  --o: clamp(84px, 9vw, 130px);
  --t: .55s;
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--papel);
}

/* Hover o foco: la mitad se ensancha al 55 % */
.w:has(.half-es:is(:hover, :focus-visible)) { --split: 55%; }
.w:has(.half-ca:is(:hover, :focus-visible)) { --split: 45%; }

.w-logo {
  position: absolute; z-index: 3; left: 0; right: 0; top: 44px; margin: 0;
  text-align: center; font-weight: 300; font-size: 22px; line-height: 1;
  letter-spacing: .34em; padding-left: .34em;
  pointer-events: none;
  transition: opacity .3s ease, color .25s ease;
}

/* ---------- Mitades ---------- */
.half {
  position: absolute; top: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center;
  color: var(--tinta); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: width var(--t) var(--ease), left var(--t) var(--ease),
              opacity .4s ease, background-color .25s ease;
}
.half-es {
  left: 0; width: var(--split);
  justify-content: flex-end; text-align: right;
  padding-right: clamp(48px, 10.4vw, 150px);
}
.half-ca {
  left: var(--split); right: 0;
  justify-content: flex-start; text-align: left;
  padding-left: clamp(48px, 10.4vw, 150px);
}
.half:focus-visible { outline: 1px solid var(--tinta); outline-offset: -28px; }

.half-in { display: block; }
.q {
  display: block;
  font-weight: 300; font-size: clamp(36px, 3.9vw, 56px);
  line-height: 1.06; letter-spacing: -.01em;
  transition: color .25s ease;
}
.q .k { font-size: 1.143em; line-height: 1; transition: color .3s ease; }

.cta {
  display: inline-block; margin-top: 34px; padding-bottom: 6px;
  color: var(--gris); border-bottom: 1px solid transparent;
  transition: color .3s ease, border-color .3s ease;
}
.arrow {
  display: inline-block; overflow: hidden; vertical-align: bottom;
  width: 0; margin-left: 0; opacity: 0;
  letter-spacing: 0;
  transition: width .35s var(--ease), margin .35s var(--ease), opacity .3s ease;
}

.note {
  position: absolute; bottom: 56px;
  font-size: 13px; line-height: 1.4; color: var(--gris); white-space: nowrap;
  transition: opacity .3s ease, color .25s ease;
}
.half-es .note { right: 40px; }
.half-ca .note { left: 40px; }

/* Estado activo (hover / foco) */
.half:is(:hover, :focus-visible) .k { color: var(--oliva); }
.half:is(:hover, :focus-visible) .cta { color: var(--tinta); border-color: var(--tinta); }
.half:is(:hover, :focus-visible) .arrow { width: 1.2em; margin-left: 14px; opacity: 1; }
.w:has(.half-es:is(:hover, :focus-visible)) .half-ca,
.w:has(.half-ca:is(:hover, :focus-visible)) .half-es { opacity: .4; }
.w:has(.half-es:is(:hover, :focus-visible)) .dot-es,
.w:has(.half-ca:is(:hover, :focus-visible)) .dot-ca { fill: var(--oliva); }

/* Navegador en catalán: la mitad catalana, levemente destacada */
.w[data-suggest="ca"] .half-ca .cta { color: var(--tinta); border-color: var(--piedra); }

/* ---------- Eje: línea + ö ---------- */
.axis {
  position: absolute; z-index: 3; left: var(--split);
  top: clamp(88px, 14vh, 128px); bottom: clamp(88px, 14vh, 128px);
  width: var(--o); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  transition: left var(--t) var(--ease);
}
.ln { flex: 1; width: 1px; background: var(--piedra); transition: opacity .25s ease; }
.ln-a { margin-bottom: calc(var(--o) * -23.5 / 130); }
.ln-b { margin-top: calc(var(--o) * 13.5 / 130); }
.o {
  flex: none; width: var(--o); height: calc(var(--o) * 167 / 130);
  overflow: visible; transform-origin: 50% 60.48%; /* centro del anillo */
}
.ring { fill: none; stroke: var(--tinta); stroke-width: 3; transition: stroke .25s ease; }
.dot { fill: var(--tinta); transition: fill .3s ease; }

/* Capa de color para la segunda fase */
.fill {
  position: fixed; z-index: 4; left: 0; top: 0; width: 100%; height: 100%;
  background: var(--oliva); opacity: 0; pointer-events: none;
}

/* ---------- Transición (≈800 ms) ----------
   Fase 1 · 0–400 ms: la mitad elegida se llena de oliva y ocupa la pantalla. */
.w[data-go] .half { transition-duration: .4s, .4s, .3s, .2s; }
.w[data-go="es"] { --split: 100%; }
.w[data-go="ca"] { --split: 0%; }
.w[data-go] .axis { transition: none; }
.w[data-go] .ln { opacity: 0; }
.w[data-go] .ring { stroke: var(--papel); }
.w[data-go] .dot { fill: var(--papel) !important; }
.w[data-go] .w-logo { color: var(--papel); }
.w[data-go] .half[data-chosen] { background-color: var(--oliva); }
.w[data-go] .half[data-chosen] .q { color: var(--papel); }
.w[data-go] .half[data-chosen] .k { color: var(--rosa); }
.w[data-go] .half[data-chosen] .cta { color: var(--hoja); border-color: var(--papel); }
.w[data-go] .half[data-chosen] .arrow { width: 1.2em; margin-left: 14px; opacity: 1; }
.w[data-go] .half[data-chosen] .note { opacity: 0; }
.w[data-go] .half:not([data-chosen]) { opacity: .18; }

/* Fase 2 · 400–800 ms: la ö viaja al logo, el oliva se retira hacia arriba. */
.w[data-phase="2"] .fill {
  opacity: 1; height: var(--band, 110px);
  transition: height .4s var(--ease);
}
.w[data-phase="2"] .axis { z-index: 5; }
.w[data-phase="2"] .o { transition: transform .4s var(--ease); }
.w[data-phase="2"] .w-logo,
.w[data-phase="2"] .half,
.w[data-phase="2"] .half:not([data-chosen]) { opacity: 0; transition: opacity .2s ease; }

/* Movimiento reducido: solo fundido */
.w[data-go="fade"] { opacity: 0; transition: opacity .3s ease; }

/* ---------- Móvil: mitades apiladas ---------- */
@media (max-width: 760px) {
  .w { --o: 58px; min-height: 600px; }
  .w-logo { top: 28px; font-size: 17px; }

  .half,
  .w[data-go] .half {
    left: 0; right: 0; width: auto;
    flex-direction: column; justify-content: center; align-items: center; text-align: center;
    box-shadow: 0 0 0 0 var(--oliva);
    transition-property: opacity, background-color, box-shadow;
    transition-duration: .3s, .2s, .4s;
  }
  .half-es { top: 0; height: 50%; padding: 64px 24px 44px; }
  .half-ca { top: 50%; bottom: auto; height: 50%; padding: 44px 24px 40px; }
  .half-in { display: flex; flex-direction: column; align-items: center; }
  .q { font-size: clamp(30px, 8.8vw, 38px); }
  .cta { margin-top: 20px; }
  .note { position: static; display: block; margin-top: 22px; font-size: 12.5px; white-space: normal; }
  .half:focus-visible { outline-offset: -12px; }

  /* La mitad elegida se llena y el oliva se expande a toda la pantalla */
  .w[data-go] .half[data-chosen] { z-index: 3; box-shadow: 0 0 0 100vmax var(--oliva); }

  .axis {
    left: 24px; right: 24px; top: 50%; bottom: auto; width: auto; height: 0;
    transform: none; flex-direction: row; align-items: center;
  }
  .ln { width: auto; height: 1px; flex: 1; }
  .ln-a { margin: 0 calc(var(--o) * 18 / 58) 0 0; }
  .ln-b { margin: 0 0 0 calc(var(--o) * 18 / 58); }
  .o { translate: 0 calc(var(--o) * -17.5 / 130); }
}

@media (max-width: 760px) and (max-height: 620px) {
  .note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .half, .axis, .arrow, .ln, .q, .k, .cta, .ring, .dot { transition: none !important; }
}
