@font-face {
  font-family: "Share Tech Mono";
  src: url("../fonts/share-tech-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #0a0c10;
  color: #f4f1ea;
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

body {
  position: relative;
}

#bgs {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0a0c10;
}

#bgs .sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity var(--fade, 2.8s) ease-in-out;
  will-change: opacity;
}

#bgs .sky.is-on {
  opacity: 1;
}

#veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(6, 8, 12, 0.62) 0%,
      rgba(6, 8, 12, 0.28) 38%,
      rgba(6, 8, 12, 0.10) 58%,
      rgba(6, 8, 12, 0.22) 100%
    ),
    linear-gradient(
      180deg,
      rgba(6, 8, 12, 0.22) 0%,
      rgba(6, 8, 12, 0.00) 28%,
      rgba(6, 8, 12, 0.18) 70%,
      rgba(6, 8, 12, 0.48) 100%
    );
}

#app {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 6.5vh 5vw 7vh;
  gap: 4vw;
}

.clock-col {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-bottom: 2vh;
}

.date-gregorian {
  font-family: "Outfit", sans-serif;
  font-weight: 400;
  font-size: 2.15rem;
  font-size: clamp(1.35rem, 2.15vw, 2.15rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.82);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.date-hijri {
  margin-top: 0.55vh;
  font-family: "Cormorant", Georgia, serif;
  font-weight: 400;
  font-size: 2rem;
  font-size: clamp(1.25rem, 2vw, 2rem);
  letter-spacing: 0.06em;
  color: rgba(244, 241, 234, 0.68);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.board-clock {
  --flap-h: clamp(7.6rem, 22vh, 13.6rem);
  display: inline-flex;
  align-items: stretch;
  margin-top: 2.6vh;
  height: var(--flap-h);
  font-size: var(--flap-h);
  -webkit-perspective: 0;
  perspective: none;
}

.place-label {
  position: relative;
  margin-top: 2.8vh;
  font-family: "Outfit", sans-serif;
  font-weight: 400;
  font-size: 1.15rem;
  font-size: clamp(0.95rem, 1.15vw, 1.15rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.55);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.cards {
  flex: 0 0 auto;
  width: min(26vw, 420px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.2vh;
  align-self: center;
}

.card {
  background: rgba(10, 12, 16, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 2.3vh 1.6vw 2.1vh;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  min-height: 16vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-kicker {
  display: flex;
  align-items: center;
  gap: 0.55vw;
  font-size: 0.95rem;
  font-size: clamp(0.78rem, 0.95vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.62);
}

.card-kicker svg {
  width: clamp(16px, 1.25vw, 22px);
  height: clamp(16px, 1.25vw, 22px);
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.card-main {
  margin-top: 0.9vh;
  display: flex;
  align-items: baseline;
  gap: 0.6vw;
}

.card-value {
  font-family: "Cormorant", Georgia, serif;
  font-weight: 300;
  font-size: 4.5rem;
  font-size: clamp(2.6rem, 4.4vw, 4.5rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: #f7f3ea;
}

.card-unit {
  font-size: 1.3rem;
  font-size: clamp(1rem, 1.25vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(244, 241, 234, 0.72);
}

.card-meta {
  margin-top: 0.7vh;
  font-size: 1.2rem;
  font-size: clamp(0.95rem, 1.15vw, 1.2rem);
  font-weight: 300;
  line-height: 1.35;
  color: rgba(244, 241, 234, 0.72);
}

.card.is-placeholder .card-value {
  font-size: 2.15rem;
  font-size: clamp(1.55rem, 2.1vw, 2.15rem);
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: rgba(244, 241, 234, 0.88);
}

.forecast-row {
  display: flex;
  gap: 1.2vw;
  margin-top: 1.1vh;
  color: rgba(244, 241, 234, 0.7);
  font-size: 1.1rem;
  font-size: clamp(0.9rem, 1.05vw, 1.1rem);
  font-weight: 300;
}

.forecast-row span {
  white-space: nowrap;
}

.countdown {
  display: flex;
  align-items: baseline;
  gap: 0.85vw;
  margin-top: 0.6vh;
  flex-wrap: wrap;
}

.count-block {
  display: flex;
  align-items: baseline;
  gap: 0.22vw;
}

.count-num {
  font-family: "Cormorant", Georgia, serif;
  font-weight: 300;
  font-size: 3.6rem;
  font-size: clamp(2.3rem, 3.6vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.count-lbl {
  font-size: 0.95rem;
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.55);
}

#status {
  position: fixed;
  z-index: 3;
  right: 2.2vw;
  bottom: 2.2vh;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.45);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

#status.is-on {
  opacity: 1;
}

#status.is-error {
  color: #f0c9a0;
}

/* DashCast on older Chromecasts often renders around 1280x720 */
@media (max-width: 1400px) {
  #app {
    padding: 6vh 4.5vw 6.5vh;
  }

  .cards {
    width: min(32vw, 380px);
  }

  .card {
    border-radius: 14px;
    min-height: 15vh;
  }
}

@media (max-height: 800px) {
  .board-clock {
    --flap-h: clamp(6.2rem, 24vh, 10.5rem);
  }

  .card {
    padding: 1.8vh 1.5vw 1.7vh;
    min-height: 0;
  }
}

/* Spacing fallbacks if flex gap is unsupported (older Chromecast Chrome) */
.cards > .card + .card { margin-top: 2.2vh; }
.forecast-row span + span { margin-left: 1.2vw; }
.countdown > .count-block + .count-block { margin-left: 0.85vw; }
.card-kicker svg { margin-right: 0.55vw; }
.card-main .card-unit { margin-left: 0.6vw; }

/* ---------- Split-flap (Solari) tiles ---------- */
.flap {
  position: relative;
  display: block;
  height: 100%;
  background: #0e0c0a;
  border-radius: 0.08em;
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 -2px 0 rgba(0, 0, 0, 0.45) inset,
    0 8px 22px rgba(0, 0, 0, 0.38);
  -webkit-perspective: 1.15em;
  perspective: 1.15em;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  overflow: hidden;
  flex: 0 0 auto;
}

.flap-digit {
  width: 0.72em;
  margin-right: 0.07em;
}

.flap-ampm {
  width: 0.78em;
  margin-left: 0.12em;
}

.flap-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.flap-half.top {
  top: 0;
  -webkit-transform-origin: 50% 100%;
  transform-origin: 50% 100%;
  background: -webkit-linear-gradient(top, #2c2923 0%, #1d1b17 100%);
  background: linear-gradient(180deg, #2c2923 0%, #1d1b17 100%);
  border-radius: 0.07em 0.07em 0 0;
}

.flap-half.bottom {
  bottom: 0;
  -webkit-transform-origin: 50% 0%;
  transform-origin: 50% 0%;
  background: -webkit-linear-gradient(top, #12110e 0%, #1a1815 100%);
  background: linear-gradient(180deg, #12110e 0%, #1a1815 100%);
  border-radius: 0 0 0.07em 0.07em;
}

.flap-half.fold {
  display: none;
  z-index: 3;
}

.flap-half.back {
  z-index: 1;
}

.flap-half span {
  position: absolute;
  left: 0;
  right: 0;
  height: 200%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-family: "Share Tech Mono", "Courier New", Courier, monospace;
  font-weight: 400;
  font-size: 0.74em;
  line-height: 1;
  color: #f3e6b0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
  white-space: pre;
}

.flap-ampm .flap-half span {
  font-size: 0.36em;
  letter-spacing: 0.02em;
}

.flap-half.top span { top: 0; }
.flap-half.bottom span { bottom: 0; }

.flap-slit {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: #070605;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 6;
  pointer-events: none;
}

@-webkit-keyframes flap-top-down {
  from { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); }
  to { -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); }
}
@keyframes flap-top-down {
  from { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); }
  to { -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); }
}
@-webkit-keyframes flap-bottom-down {
  from { -webkit-transform: rotateX(90deg); transform: rotateX(90deg); }
  to { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); }
}
@keyframes flap-bottom-down {
  from { -webkit-transform: rotateX(90deg); transform: rotateX(90deg); }
  to { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); }
}

.flap.is-flipping .flap-half.top.fold {
  display: block;
  -webkit-animation: flap-top-down 0.28s ease-in forwards;
  animation: flap-top-down 0.28s ease-in forwards;
}

.flap.is-flipping.phase-2 .flap-half.top.fold {
  display: none;
}

.flap.is-flipping.phase-2 .flap-half.bottom.fold {
  display: block;
  z-index: 4;
  -webkit-animation: flap-bottom-down 0.3s ease-out forwards;
  animation: flap-bottom-down 0.3s ease-out forwards;
}

.flap-colon {
  width: 0.22em;
  margin: 0 0.02em;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.flap-colon i {
  display: block;
  width: 0.09em;
  height: 0.09em;
  border-radius: 50%;
  background: #f3e6b0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  opacity: 0.92;
}

.flap-colon i + i {
  margin-top: 0.22em;
}

.flight-board {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
  align-items: flex-end;
  margin-top: 0.4vh;
}

.flight-board[hidden] {
  display: none;
}

.flight-board .count-block {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
  align-items: flex-end;
  margin-right: 0.7vw;
}

.flight-board .count-lbl {
  margin-left: 0.25vw;
  margin-bottom: 0.15em;
}

.flap-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  height: clamp(2.5rem, 6.2vh, 3.6rem);
  font-size: clamp(2.5rem, 6.2vh, 3.6rem);
}

.flap-sm {
  width: 0.72em;
  margin-right: 0.06em;
  border-radius: 0.1em;
}

.flap-sm .flap-half span {
  font-size: 0.72em;
}

.flight-board + .flight-board,
.card-main .flight-board {
  /* keep card-value and board from sitting on one baseline when both present */
}

#card-flight .card-main {
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
  align-items: flex-end;
}
