:root {
  --paper: #f7f7f4;
  --ink: #071b36;
  --blue: #0869b4;
  --blue-bright: #13a5ee;
  --board: #111313;
  --board-edge: #050606;
  --tile: #1a1c1c;
  --tile-top: #202222;
  --tile-bottom: #141616;
  --tile-border: #050606;
  --letter: #f2ecdb;
  --amber: #ffc400;
  --muted: #a5a69f;
  --column-grid: minmax(0, 11fr) minmax(0, 6fr) minmax(0, 5fr)
    minmax(0, 28fr);
  --header-height: clamp(96px, 13vh, 140px);
  --row-gap: clamp(6px, 0.5vw, 12px);
  --cell-gap: clamp(1px, 0.1vw, 3px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--letter);
  background: #080909;
  font-family: "Arial Narrow", "Helvetica Neue Condensed", "Liberation Sans Narrow",
    Arial, sans-serif;
}

.screen-shell {
  width: 100vw;
  height: 100vh;
  min-height: 480px;
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  background: var(--board);
}

.club-header[hidden] {
  display: none;
}

.club-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 80px);
  padding: clamp(10px, 1.4vh, 22px) clamp(24px, 3vw, 68px);
  color: var(--ink);
  background: var(--paper);
  border-bottom: 2px solid #c9c9c4;
  box-shadow: 0 8px 28px rgb(0 0 0 / 32%);
}

.club-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 38px);
}

.club-mark {
  width: clamp(108px, 10vw, 180px);
  height: auto;
  flex: 0 0 auto;
}

.club-rule {
  width: 3px;
  height: clamp(64px, 8vh, 104px);
  flex: 0 0 auto;
  background: var(--blue);
}

.club-header h1 {
  max-width: 1050px;
  margin: 0;
  font-size: clamp(1.55rem, 3.35vw, 4.15rem);
  font-stretch: condensed;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.clock-panel {
  min-width: max-content;
  padding-left: clamp(22px, 3vw, 54px);
  text-align: right;
  border-left: 3px solid var(--blue);
}

.clock,
.date {
  display: block;
}

.clock {
  color: #090b0c;
  font-family: "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-size: clamp(3.2rem, 6.7vw, 7.4rem);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: -0.025em;
}

.date {
  margin-top: clamp(12px, 1.5vh, 20px);
  font-size: clamp(0.86rem, 1.5vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.board {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: clamp(14px, 1.8vh, 28px) clamp(16px, 1.7vw, 36px)
    clamp(12px, 1.4vh, 22px);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgb(255 255 255 / 3%), transparent 30%),
    linear-gradient(180deg, #161818 0%, #0c0e0e 100%);
  box-shadow: inset 0 0 0 6px var(--board-edge), inset 0 18px 40px rgb(0 0 0 / 28%);
}

.board-heading {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.3vw, 28px);
  min-height: clamp(54px, 7vh, 84px);
  padding-bottom: clamp(6px, 0.7vh, 10px);
  border-bottom: 2px solid #323636;
}

.departure-icon {
  /* Borné à la hauteur de la ligne (board-heading) pour ne jamais déborder quand elle est vide */
  width: clamp(54px, 7vh, 84px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--amber);
  border: 2px solid #ffd933;
  border-radius: 8px;
  box-shadow: inset 0 -5px 0 rgb(0 0 0 / 18%), 0 2px 0 #000;
}

.departure-icon img {
  width: 74%;
  height: 74%;
}

.title-flaps {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
}

.column-headings,
.flight-row {
  display: grid;
  grid-template-columns: var(--column-grid);
  gap: var(--row-gap);
}

.column-headings {
  align-items: end;
  padding: clamp(9px, 1.25vh, 18px) clamp(3px, 0.35vw, 8px)
    clamp(7px, 0.9vh, 12px);
  color: var(--letter);
  border-bottom: 1px solid #090a0a;
  font-size: clamp(0.78rem, 1.35vw, 1.55rem);
  font-weight: 500;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.column-headings > :nth-child(2) {
  padding-inline: clamp(6px, 0.55vw, 12px);
}

.flight-rows {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(10, clamp(38px, 5.4vh, 54px));
  align-content: start;
  overflow: hidden;
  border-top: 1px solid #353838;
}

.flight-row {
  min-height: 0;
  align-items: stretch;
  padding: clamp(3px, 0.4vh, 6px) clamp(3px, 0.35vw, 8px);
  border-bottom: 1px solid #3b3e3e;
  box-shadow: 0 1px 0 #050606;
}

.flight-row.is-empty {
  opacity: 0.58;
}

.flap-field {
  min-width: 0;
  display: flex;
  align-items: center;
}

.flap-field--registration {
  padding-inline: clamp(6px, 0.55vw, 12px);
  border-right: 1px solid #050606;
  border-left: 1px solid #050606;
}

.flap-string {
  width: 100%;
  height: clamp(30px, 4.6vh, 46px);
  display: grid;
  grid-template-columns: repeat(var(--characters), minmax(0, 1fr));
  gap: var(--cell-gap);
}

.flap-cell {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  perspective: 420px;
  color: var(--letter);
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: clamp(1px, 0.18vw, 4px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 8%),
    inset 0 -1px 0 rgb(255 255 255 / 2%),
    0 1px 2px rgb(0 0 0 / 85%);
  font-family: "Arial Narrow", "Helvetica Neue Condensed", "Liberation Sans Narrow",
    sans-serif;
  font-size: clamp(0.9rem, 2.15vw, 2.4rem);
  font-stretch: condensed;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.flap-cell::before,
.flap-cell::after {
  position: absolute;
  z-index: 8;
  top: calc(50% - 1px);
  width: clamp(2px, 0.17vw, 4px);
  height: 3px;
  content: "";
  background: #020303;
  border-radius: 1px;
  box-shadow: 0 1px 0 rgb(255 255 255 / 11%);
}

.flap-cell::before {
  left: 0;
}

.flap-cell::after {
  right: 0;
}

.flap-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
}

.flap-half::after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: grid;
  place-items: center;
  content: attr(data-char);
  text-shadow: 0 1px 1px #000;
}

.flap-string--title {
  height: min(6vh, 64px);
}

.flap-string--title .flap-cell {
  color: var(--amber);
  font-size: clamp(1.6rem, 3.85vw, 4.4rem);
  font-weight: 500;
}

.flap-half--top {
  top: 0;
  background: linear-gradient(180deg, #242626 0%, var(--tile-top) 100%);
}

.flap-half--top::after {
  top: 0;
}

.flap-half--bottom {
  bottom: 0;
  background: linear-gradient(180deg, var(--tile-bottom) 0%, #101212 100%);
}

.flap-half--bottom::after {
  bottom: 0;
}

.flap-fold {
  z-index: 5;
}

.flap-fold--top {
  transform-origin: 50% 100%;
  animation: fold-up 420ms cubic-bezier(0.55, 0.06, 0.68, 0.19)
    var(--delay, 0ms) both;
}

.flap-fold--bottom {
  transform: rotateX(90deg);
  transform-origin: 50% 0%;
  animation: fold-down 480ms cubic-bezier(0.22, 0.61, 0.36, 1)
    calc(var(--delay, 0ms) + 400ms) both;
}

.flap-cell.is-blank .flap-half::after {
  text-shadow: none;
}

@keyframes fold-up {
  0% {
    transform: rotateX(0deg);
    filter: brightness(1);
  }
  100% {
    transform: rotateX(-90deg);
    filter: brightness(0.42);
  }
}

@keyframes fold-down {
  0% {
    transform: rotateX(90deg);
    filter: brightness(1.35);
  }
  100% {
    transform: rotateX(0deg);
    filter: brightness(1);
  }
}

.board-footer {
  min-height: clamp(50px, 6.7vh, 78px);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1vw, 20px);
  padding: 0 clamp(8px, 0.7vw, 14px);
  color: var(--letter);
  font-size: clamp(0.78rem, 1.12vw, 1.42rem);
  font-weight: 400;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.board-footer p {
  margin: 0;
}

.refresh-symbol {
  color: var(--amber);
  font-family: Arial, sans-serif;
  font-size: clamp(1.8rem, 2.9vw, 3.7rem);
  line-height: 1;
}

.page-indicator {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.feed-state {
  width: 9px;
  height: 9px;
  margin-left: auto;
  flex: 0 0 auto;
  background: #727570;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(255 255 255 / 4%);
}

.feed-state.is-live {
  background: var(--amber);
  box-shadow: 0 0 12px rgb(255 196 0 / 55%);
}

.feed-state.is-error {
  background: #e4583e;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

noscript {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: white;
  background: #121414;
  font-size: 1.25rem;
  text-align: center;
}

@media (max-aspect-ratio: 4 / 3) {
  :root {
    --header-height: clamp(96px, 14vh, 142px);
    --column-grid: minmax(0, 11fr) minmax(0, 6fr) minmax(0, 5fr)
      minmax(0, 28fr);
  }

  .club-mark,
  .club-rule {
    display: none;
  }

  .club-header h1 {
    font-size: clamp(1.35rem, 4vw, 2.7rem);
  }

  .clock {
    font-size: clamp(2.6rem, 8vw, 5rem);
  }

  .board {
    padding-inline: 10px;
  }

  .board-heading {
    min-height: 76px;
  }

  .flap-string--title .flap-cell {
    font-size: clamp(1.35rem, 4vw, 3.2rem);
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .screen-shell {
    width: 100%;
    min-width: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flap-fold--top,
  .flap-fold--bottom {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }
}
