/* Páginas que arma el Worker: la invitación (/i/<código>, A3 y A4) y el destino de los links de la app
   (/app/*). Van después de tokens.css y styles.css, de donde toman el cuerpo, .display, el wordmark, las
   filas de B1 (.steps), .link y el pie. Una columna de hasta 560 px, como la landing. */

/* Hueso (color.background.primary en claro): la tarjeta de A3 es arcilla y hueso también en oscuro. */
:root {
  --hueso: #F6F3EE;
}

/* Letras de Latin Extendido A en los nombres ("Łucja", "Şule"): la fuente de la landing solo trae Latin-1.
   La de los correos trae ese bloque, y el navegador la pide solo si aparece una de esas letras. */
@font-face {
  font-family: "Bolea Display";
  src: url("/email/bolea-display.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: block;
  unicode-range: U+0100-017F;
}

ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sheet {
  width: 100%;
  max-width: calc(560px + 2 * var(--space-margin));
  margin-inline: auto;
  padding-top: max(var(--space-s6), env(safe-area-inset-top));
  padding-inline: max(var(--space-margin), env(safe-area-inset-left)) max(var(--space-margin), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: var(--space-s8);
}

/* A3: título display de 50 px con interlineado 0,88 y sus dos líneas sin partir. src/display-width.js elige
   --title para que la más larga quepa en los 353 px de una pantalla de 393; en una más angosta escala igual. */
.invite {
  display: flex;
  flex-direction: column;
  gap: var(--space-s5);
}

.invite-title {
  font-size: min(calc(var(--title) * 1px), calc((100vw - 2 * var(--space-margin)) * var(--title) / 353));
  line-height: 0.88;
}

.invite-title-50 {
  --title: 50;
}

.invite-title-46 {
  --title: 46;
}

.invite-title-42 {
  --title: 42;
}

.invite-title-38 {
  --title: 38;
}

.invite-title-34 {
  --title: 34;
}

.invite-title-30 {
  --title: 30;
}

/* Un nombre que no cabe ni a 26 px se parte. */
.invite-title-26 {
  --title: 26;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Lo de A3 y A4 mide como la tarjeta (353 px), también en pantallas grandes. */
.inviter,
.inviter-card {
  max-width: 353px;
  display: flex;
  align-items: center;
  gap: var(--space-s3);
}

/* A4: quien invitó, en una tarjeta. */
.inviter-card {
  padding: 14px var(--space-s4);
  border-radius: 16px;
  background: var(--s1);
}

/* Las iniciales en la letra display, como el avatar de M1 (sin foto: la web no carga imágenes de Supabase). */
.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--s2);
  color: var(--t1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bolea Display", "Arial Narrow", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 19px;
  line-height: 1;
}

.avatar-small {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.inviter-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Una línea cada uno: un nombre largo termina en "…". */
.inviter-name,
.inviter-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inviter-name {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: 600;
}

.inviter-name-small {
  font-size: var(--type-callout-size);
  line-height: var(--type-callout-line);
}

.inviter-detail {
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  color: var(--t2);
}

/* Ficha de BLE de A3. Provisional: sin fondo y con borde punteado (BoleaComponentes). */
.ble-chip {
  flex: none;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: var(--radius-full);
  background: var(--s2);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ble-chip-provisional {
  background: none;
  border: 1.5px dashed var(--t3);
}

.ble-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--band, var(--t3));
}

.ble-value {
  font-size: var(--type-callout-size);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ble-unit {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--t2);
}

.band-beginner {
  --band: var(--band-beginner);
}

.band-intermediate {
  --band: var(--band-intermediate);
}

.band-competent {
  --band: var(--band-competent);
}

.band-advanced {
  --band: var(--band-advanced);
}

.band-expert {
  --band: var(--band-expert);
}

.band-elite {
  --band: var(--band-elite);
}

.band-pro {
  --band: var(--band-pro);
}

/* A3: tarjeta arcilla de 353 × 344 con radio 22, igual en claro y oscuro; el corte es del color del fondo.
   En pantallas más angostas conserva la proporción y el nombre baja con su clase (.pass-name-*). */
.pass {
  position: relative;
  width: 100%;
  max-width: 353px;
  aspect-ratio: 353 / 344;
  padding: 24px 22px 18px;
  border-radius: 22px;
  background: var(--br);
  color: var(--hueso);
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(110, 40, 23, 0.28), 0 4px 10px rgba(110, 40, 23, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pass-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-s3);
}

.pass-wordmark {
  display: block;
  flex: none;
  width: 96px;
  fill: currentColor;
  fill-rule: evenodd;
}

.pass-tag {
  padding-top: 6px;
  font-size: var(--type-micro-size);
  line-height: var(--type-micro-line);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  color: rgba(246, 243, 238, 0.85);
}

/* A 150 de 344 en A3. */
.pass-cut {
  position: absolute;
  left: -20px;
  right: -20px;
  top: 43.6%;
  height: 7px;
  background: var(--bg);
  transform: rotate(-4deg);
}

/* "A nombre de" y el nombre van abajo, con los 19 px de A3 entre los dos. */
.pass-holder {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 19px;
}

.pass-label {
  padding-left: 2px;
  font-size: var(--type-callout-size);
  line-height: var(--type-callout-line);
  font-weight: 600;
  color: rgba(246, 243, 238, 0.9);
}

/* El nombre de pila a 104 px y menos si no cabe: src/display-width.js elige --name. Escala con el ancho: la
   tarjeta mide min(353, ancho − 40) y el nombre tiene 40 px menos (313 en la tarjeta de 353). */
.pass-name {
  margin-left: -4px;
  font-size: min(calc(var(--name) * 1px), calc((min(353px, 100vw - 2 * var(--space-margin)) - 40px) * var(--name) / 313));
  line-height: 0.78;
}

.pass-name-104 {
  --name: 104;
}

.pass-name-96 {
  --name: 96;
}

.pass-name-88 {
  --name: 88;
}

.pass-name-80 {
  --name: 80;
}

.pass-name-72 {
  --name: 72;
}

.pass-name-64 {
  --name: 64;
}

.pass-name-56 {
  --name: 56;
}

.pass-name-48 {
  --name: 48;
}

/* Un nombre que no cabe ni a 40 px se parte. */
.pass-name-40 {
  --name: 40;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Botones de 52 px de A3 y A4: el primario en acento y el secundario solo texto. */
.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-s3);
}

.actions-meta {
  max-width: 353px;
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  color: var(--t2);
  text-align: center;
}

.actions-note {
  max-width: 353px;
  font-size: var(--type-callout-size);
  line-height: var(--type-callout-line);
  color: var(--t2);
  text-wrap: pretty;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-s2);
  width: 100%;
  max-width: 353px;
  min-height: 52px;
  padding: 0 var(--space-s4);
  border-radius: var(--radius-full);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.button svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.button-primary {
  background: var(--ac);
  color: var(--on);
}

.button-primary:hover {
  background: var(--acp);
}

.button-plain {
  color: var(--brt);
}

.button-plain:hover {
  text-decoration: underline;
}

.button:focus-visible {
  outline: 2px solid var(--brt);
  outline-offset: 2px;
}

/* Cómo instalar: el título en headline y las filas de B1, con el número en la letra display (display.m). */
.install {
  display: flex;
  flex-direction: column;
  gap: var(--space-s6);
  padding-top: var(--space-s4);
}

.section-title {
  font-size: var(--type-headline-size);
  line-height: var(--type-headline-line);
  font-weight: var(--type-headline-weight);
}

.step-number {
  font-family: "Bolea Display", "Arial Narrow", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: var(--display-m-size);
  line-height: 1;
}

/* A4: ícono de 96 px, título de 28/34 y texto de 17/23 en --t2, con 28 px entre bloques. */
.message {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: var(--space-s8);
}

.message-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-title {
  font-size: var(--type-title-size);
  line-height: var(--type-title-line);
  font-weight: var(--type-title-weight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.message-body {
  max-width: 480px;
  line-height: 23px;
  color: var(--t2);
  text-wrap: pretty;
}

.broken-ball {
  display: block;
  width: 96px;
  height: 96px;
}

.broken-ball-outline {
  stroke: var(--bd2);
}

.broken-ball-cut {
  stroke: var(--br);
}

/* /app/*: la bola de la marca en arcilla. */
.message-symbol {
  display: block;
  width: 72px;
  height: 72px;
}

/* Pantallas grandes, como la landing. */
@media (min-width: 768px) and (min-height: 600px) {
  .sheet {
    padding-top: var(--space-s12);
  }

  /* 50 → 72 px (display.xl, con su interlineado 0,9) y el resto en proporción: 353 × 1,44 = 508 cabe en 560. */
  .invite-title {
    font-size: calc(var(--title) * 1.44px);
    line-height: var(--display-xl-line);
  }
}
