/* Custom stencil fonts with full French alphabet support (OFL licensed) */
@font-face {
  font-family: 'CustomFont';
  src: url('../fonts/customfont.ttf');
}

/* Generated propaganda stencil fonts — full French accent support */
@font-face {
  font-family: 'Propaganda Stencil Bloc';
  src: url('../fonts/propaganda-stencil-bloc.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: 'Propaganda Stencil Coupe';
  src: url('../fonts/propaganda-stencil-coupe.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: 'Propaganda Stencil Rude';
  src: url('../fonts/propaganda-stencil-rude.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
}
@font-face {
  font-family: 'Propaganda Stencil Fine';
  src: url('../fonts/propaganda-stencil-fine.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Legacy deFharo fonts — kept as fallback (incomplete French support) */
@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;
}

* {
  box-sizing: border-box;
}

html {
  /* --propaganda-font set by JS for random stencil font (French accents supported) */
  --propaganda-font: 'CustomFont', Arial, sans-serif;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--propaganda-font);
  font-weight: normal;
  font-style: normal;
  /* Responsive font size - scales with viewport dimensions */
  font-size: clamp(8px, min(2.5vw, 4vh), 32px);
  background-color: #fff;
  color: #000;
}

#home {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 95vw;
  text-align: center;
}

#poem {
  text-align: center;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  padding: 2.5vh 2.5vw;
  margin: 0;
  overflow: hidden;
}

.line {
  display: flex;
  flex-direction: row;
  /* Never wrap lines */
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  /* Distribute height evenly among lines */
  flex: 1;
  opacity: 0;
  padding: 0;
  margin: 0;
  min-height: 0;
  width: 100%;
  white-space: nowrap;
  transition: opacity 0.3s ease-out;
}

.line.visible {
  opacity: 1;
}

.letter {
  min-height: 0;
  min-width: 0;
  opacity: 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;
}

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

.letter.visible {
  opacity: 1;
}

/* Portrait orientation - prioritize width fitting */
@media screen and (orientation: portrait) {
  body {
    font-size: clamp(6px, min(2.2vw, 3vh), 24px);
  }

  #home {
    max-width: 90vw;
  }
}

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

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