/* Propaganda/stencil fonts: same as styles.css, --propaganda-font set by scripts.js */
/* Same fonts as styles.css: local + Google + deFharo */
@font-face {
  font-family: 'CustomFont';
  src: url('../fonts/customfont.ttf');
}
@font-face {
  font-family: 'Flamante Stencil';
  src:
    url('../fonts/flamante-stencil.otf') format('opentype'),
    url('../fonts/flamante-stencil.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: 'Panfleta Stencil';
  src:
    url('../fonts/panfleta-stencil.otf') format('opentype'),
    url('../fonts/panfleta-stencil.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
}
@font-face {
  font-family: 'Seisdedos Dead';
  src:
    url('../fonts/seisdedos-dead.otf') format('opentype'),
    url('../fonts/seisdedos-dead.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'Stencil';
  src:
    url('../fonts/stencil.otf') format('opentype'),
    url('../fonts/stencil.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

html {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  --propaganda-font: 'CustomFont', Arial, sans-serif;
}

body {
  font-family: var(--propaganda-font);
  font-weight: normal;
  font-style: normal;
  /* Use smaller of width or height to ensure fit in both dimensions */
  font-size: clamp(6px, min(2vw, 2.5vh), 24px);
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

table,
tbody {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 2.5vh 2.5vw;
  margin: 0;
  overflow: hidden;
  /* Distribute rows evenly across full height */
  justify-content: space-around;
}

tr {
  display: flex;
  flex-direction: row;
  /* Rows share the available height */
  flex: 0 1 auto;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  /* Never wrap lines */
  flex-wrap: nowrap;
  white-space: nowrap;
  min-height: 0;
}

td {
  flex: 0 0 auto;
  min-width: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  color: var(--letter-color, inherit);
  letter-spacing: -0.02em;
  transition:
    opacity 0.4s ease-out,
    color 0.6s ease-in-out;
  will-change: opacity, color;
  white-space: nowrap;
  overflow: hidden;
}

td.letter.space {
  flex: 0 0 0.5em;
  min-width: 0.5em;
}

td.visible {
  opacity: 1;
}

tr.visible {
  opacity: 1;
}

/* Portrait orientation - prioritize width fitting */
@media screen and (orientation: portrait) {
  body {
    font-size: clamp(5px, min(1.8vw, 2vh), 18px);
  }
}

/* Very narrow screens */
@media screen and (max-width: 400px) {
  body {
    font-size: clamp(4px, 1.6vw, 14px);
  }
}

/* Very short screens (landscape mobile) */
@media screen and (max-height: 500px) {
  body {
    font-size: clamp(5px, 2vh, 14px);
  }
}
