/* Illde Cidia — landing basada en REFE_WEB_2.pdf (lámina de 800 × 600).
   Tres espacios verticales iguales: techo ↔ logo ↔ texto ↔ barra inferior.
   Se mantiene el PNG original del logo sin modificarlo. */
:root {
  --background: #e5e5e5;
  --text-color: #ababab;
  --line-color: #ababab;
  --footer-text: #d8d6d9;
  --contact-bg: #c1bbaf;
  --name-bg: #c79f7a;
  --instagram-bg: #c0aebe;

  /* 1 unidad equivale a 1 píxel en el documento original 800×600;
     adaptamos la escala a la dimensión más restrictiva de la pantalla. */
  --u: min(0.125vw, 0.166667svh);
  --footer-height: calc(18.5 * var(--u));
  --typeface: 'SimSun', 'Songti SC', 'Noto Serif CJK SC', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* Desplazamiento suave al pulsar el nombre de la franja naranja. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { background: var(--background); color: var(--text-color); font-family: var(--typeface); font-weight: 400; }

.landing {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - var(--footer-height)); /* fallback */
  min-height: calc(100svh - var(--footer-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.emblem {
  grid-row: 2;
  display: block;
  justify-self: center;
  width: calc(187.23 * var(--u));
  max-width: 95vw;
  height: auto;
  /* Imagen ya normalizada: sin rotación CSS ni metadatos de orientación. */
}

.introduction {
  grid-row: 4;
  justify-self: center;
  width: calc(509.6 * var(--u));
  max-width: calc(100% - 36px);
}

.introduction h1 {
  margin: 0;
  font-family: var(--typeface);
  font-size: calc(19 * var(--u));
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
  text-align: center;
}

.rule {
  margin-top: calc(9 * var(--u));
  border-top: max(0.5px, calc(.3 * var(--u))) solid var(--line-color);
}

.description {
  margin: calc(11 * var(--u)) 0 0;
  font-size: calc(13 * var(--u));
  line-height: calc(14 * var(--u));
  letter-spacing: 0;
  text-align: justify;
  overflow-wrap: break-word;
}


.footer-bar {
  position: fixed;
  z-index: 2;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(355.684 * var(--u));
  height: var(--footer-height);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  color: var(--footer-text);
  font-size: calc(15.2 * var(--u));
  font-family: var(--typeface);
  line-height: 1;
  white-space: nowrap;
}

.footer-bar > * {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.footer-contact { background: var(--contact-bg); }
.footer-name { background: var(--name-bg); }
.footer-bar .footer-name:hover { text-decoration: none; }
.footer-instagram { background: var(--instagram-bg); }
.footer-bar a:hover { text-decoration: underline; text-underline-offset: 2px; }
.footer-bar a:focus-visible { outline: 2px solid #6e6d74; outline-offset: 2px; }

/* En teléfonos se conserva la misma composición de tres espacios,
   pero con tamaños mínimos legibles en vez de escalar toda la tipografía. */
@media (max-width: 650px) {
  :root { --footer-height: 26px; }
  .landing {
    min-height: calc(100vh - var(--footer-height));
    min-height: calc(100svh - var(--footer-height));
    grid-template-rows: minmax(18px, 1fr) auto minmax(18px, 1fr) auto minmax(18px, 1fr);
  }
  .emblem { width: clamp(126px, 19svh, 170px); }
  .introduction { width: calc(100% - 36px); max-width: 510px; }
  .introduction h1 { font-size: 19px; }
  .rule { margin-top: 9px; border-top-width: 1px; }
  .description {
    margin-top: 11px;
    font-size: clamp(12px, 3.2vw, 14px);
    line-height: 1.12;
    letter-spacing: 0;
  }
  .footer-bar {
    width: min(calc(100% - 28px), 360px);
    font-size: clamp(11px, 3.2vw, 15.2px);
  }
}

/* En móviles excepcionalmente bajos se permite desplazamiento, en lugar de
   recortar el contenido o superponer el pie con el párrafo. */
@media (max-width: 650px) and (max-height: 600px) {
  .landing { grid-template-rows: minmax(10px, 1fr) auto minmax(10px, 1fr) auto minmax(34px, 1fr); }
  .emblem { width: clamp(108px, 20svh, 130px); }
  .introduction h1 { font-size: 17px; }
  .description { font-size: clamp(11px, 3.1vw, 12px); line-height: 1.12; }
}


/* NUEVA SECCIÓN DE VÍDEO. Respeta sin cambios el logo, el texto y el footer.
   En la lámina de referencia (800×600), el vídeo comienza a 600 − 2×18.5=563 px,
   es decir, unos 18.5 px antes del borde superior de la barra fija. */
.video-section {
  display: block;
  width: 100%;
  max-width: none;
  margin: calc(-1 * var(--footer-height)) 0 0;
  padding: 0 0 var(--footer-height);
  background: transparent;
}

.art-video {
  display: block;
  width: 100%;
  height: auto;
  /* Cada vídeo tiene su propia proporción nativa para no distorsionarlo. */
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: contain;
  background: transparent;
}

/* En móvil evitamos solapamientos si el texto exige más altura que la retícula. */
@media (max-width: 650px) {
  .video-section { margin-top: 0; }
}

/* Vídeo a ancho completo, sin recortar ni perder su posible canal alfa. */
.video-one { aspect-ratio: 640 / 379; } /* 1920 × 1137 */


/* Vídeo nativo por defecto (Chrome / Edge / Firefox). Safari recibe una
   reconstrucción alfa WebGL a partir de vídeo MP4 con color + máscara.
   El MP4 auxiliar solo se descarga allí; ambas versiones son responsivas. */
.art-video-slot { position: relative; display: block; width: 100%; }
.art-video-slot .art-video { width: 100%; display: block; margin: 0; }
.art-video-slot .alpha-canvas { display: none; width: 100%; height: auto; background: transparent; }
html.safari-alpha .art-video-slot .art-video { display: none; }
html.safari-alpha .art-video-slot .alpha-canvas { display: block; }
/* El vídeo auxiliar debe seguir decodificándose en Safari sin formar parte
   visual de la página; no usar display:none, ya que podría detenerse. */
.packed-source {
  position: absolute; width: 2px; height: 2px; left: 0; top: 0;
  opacity: 0; pointer-events: none; z-index: -1;
}
/* MOESongUN — 中華民國教育部. Original font; attribution: font-credits.html. */
@font-face {
  font-family: 'MOESongUN Web';
  src: url('assets/fonts/MOESongUN.ttf') format('truetype');
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}
:root { --typeface: 'MOESongUN Web', serif; }

/* Ordered dithering is applied over the WHOLE video container.
   For Safari it masks the WebGL alpha canvas; elsewhere, the native WebM. */
/* Blend the masked video group against the page: white becomes background grey.
   Applies to both the native video and Safari’s alpha canvas. */
.art-video-slot {
  mix-blend-mode: multiply;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
/* Preview just the dither silhouette, without the video imagery. */
.is-dev-mode .dev-mask-only { background: #2c2c31; }
.is-dev-mode .dev-mask-only > .art-video,
.is-dev-mode .dev-mask-only > .alpha-canvas { opacity: 0; }

/* The developer panel is NEVER visible to ordinary visitors.
   Enable explicitly via ?dev=1; it is otherwise display:none. */
.dev-panel[hidden], .dev-control[hidden] { display: none !important; }
.dev-panel {
  position: fixed;
  z-index: 30;
  bottom: calc(var(--footer-height) + 12px);
  left: 14px;
  width: min(390px, calc(100vw - 28px));
  color: #f1f3f2;
  font: 13px/1.35 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0;
  isolation: isolate;
  background: #171e22;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 11px;
  box-shadow: 0 10px 38px rgba(0,0,0,.22);
}
.dev-panel:not([open]) { width: auto; }
.dev-panel summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
  list-style: none;
  font-weight: 600;
  padding: 10px 13px;
  user-select: none;
  -webkit-user-select: none;
}
.dev-panel summary::-webkit-details-marker { display: none; }
.dev-panel summary::before { content: '⚙'; font-size: 14px; color: #74e7d8; }
.dev-panel summary::after { content: '⌃'; margin-left: auto; transform: rotate(180deg); opacity: .75; }
.dev-panel[open] summary::after { transform: rotate(0deg); }
.dev-body { max-height: min(65svh, 590px); overflow: auto; padding: 4px 14px 14px; }
.dev-note { color: #aab9c0; margin: 0 0 15px; font-size: 12px; }
.dev-control { margin: 0 0 15px; }
.dev-control label { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.dev-control output { color: #88e3d8; font-variant-numeric: tabular-nums; }
.dev-control input[type="range"] { width: 100%; margin: 2px 0; accent-color: #58d3c4; cursor: pointer; }
.dev-control select {
  width: 100%;
  background: #29343b;
  color: white;
  border: 1px solid #52636d;
  border-radius: 6px;
  padding: 8px;
  font: inherit;
}
.dev-control small { display: block; margin-top: 3px; color: #8798a1; }
.dev-panel .dev-inline-check { display: flex; gap: 9px; align-items: center; margin: 14px 0; }
.dev-buttons { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0; }
.dev-buttons button {
  border: 1px solid #54666e;
  color: #fff;
  background: #2e3b42;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}
.dev-buttons button:first-child { background: #267e75; border-color: #267e75; }
.dev-buttons button:hover { filter: brightness(1.15); }
.dev-json {
  margin: 8px 0;
  font: 11px/1.4 ui-monospace, SFMono-Regular, monospace;
  color: #b6c9ce;
  background: #0b1113;
  padding: 10px;
  border-radius: 5px;
  white-space: pre-wrap;
  user-select: all;
}
.dev-status { color: #88e3d8; min-height: 17px; font-size: 12px; }

.typeface-credit { display: block; width: fit-content; margin: 12px auto 20px; color: inherit; font: inherit; font-size: 11px; text-underline-offset: 3px; }
