/* ─── Reset & Base ──────────────────────────────────────────────────────────── */

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

html, body {
  height: 100%;
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  /* Sky gradient — light at top, warmer near horizon */
  background: linear-gradient(
    180deg,
    #a8d8f0 0%,
    #c9e8f7 30%,
    #dff1fb 55%,
    #eef6fc 75%,
    #f5f0e8 88%,
    #e8dcc8 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: 90px; /* room for fixed ad bar */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

#site-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: #003580;
  letter-spacing: 0.03em;
}

#today-date {
  font-size: 0.95rem;
  color: #445;
}

#lang-toggle {
  background: #003580;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s;
  letter-spacing: 0.04em;
}

#lang-toggle:hover {
  background: #0050c0;
}

/* ─── Main content ───────────────────────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 24px;
  width: 100%;
}

/* ─── Status text ────────────────────────────────────────────────────────────── */

.status {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
  letter-spacing: 0.01em;
}

.status.is-flag-day {
  color: #003580;
}

.status.not-flag-day {
  color: #556;
}

.reason-label {
  color: #778;
  font-size: 0.95rem;
  font-style: italic;
}

.reason-name {
  color: #003580;
  font-size: 1.05rem;
  font-weight: bold;
}

#reason-text {
  text-align: center;
  margin-bottom: 8px;
}

#next-flag-day {
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-label {
  color: #778;
  font-size: 0.9rem;
  font-style: italic;
}

.next-date {
  color: #003580;
  font-size: 1.25rem;
  font-weight: bold;
}

.next-name {
  color: #445;
  font-size: 0.95rem;
}

/* ─── Flagpole Scene ─────────────────────────────────────────────────────────── */

#scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0 16px;
}

/* Ground line */
#scene::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #c8b898, #b0a080, #c8b898, transparent);
  border-radius: 2px;
}

#flagpole-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Finial (ball at top) */
.pole-finial {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8c860, #b8932a, #7a5c10);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 3;
  margin-bottom: -2px;
}

/* Pole shaft */
.pole-shaft {
  width: 10px;
  height: 360px;
  background: linear-gradient(90deg, #c0a030 0%, #e8c860 30%, #f0d870 50%, #c8a830 70%, #905010 100%);
  border-radius: 3px;
  box-shadow: 2px 0 8px rgba(0,0,0,0.18), inset -2px 0 4px rgba(0,0,0,0.12);
  position: relative;
  z-index: 2;
}

/* Pole base */
.pole-base {
  width: 22px;
  height: 12px;
  background: linear-gradient(90deg, #a08020, #d0b040, #a08020);
  border-radius: 4px 4px 2px 2px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  margin-top: -2px;
}

/* ─── Flag ───────────────────────────────────────────────────────────────────── */

#flag-container {
  position: absolute;
  top: 16px;
  left: calc(50% + 5px); /* right edge of centered 10px shaft */
  transform-origin: left center;
  z-index: 4;
  display: none;
}

#flagpole-wrapper.flag-up #flag-container {
  display: block;
}

#flag-svg {
  display: block;
  width: 180px;
  height: 110px;
  filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.25));
}

/* Waving animation */
@keyframes wave {
  0%   { transform: skewX(0deg)  scaleY(1.00); }
  15%  { transform: skewX(-3deg) scaleY(0.98); }
  30%  { transform: skewX(2deg)  scaleY(1.01); }
  45%  { transform: skewX(-4deg) scaleY(0.97); }
  60%  { transform: skewX(1deg)  scaleY(1.00); }
  75%  { transform: skewX(-2deg) scaleY(0.99); }
  90%  { transform: skewX(3deg)  scaleY(1.01); }
  100% { transform: skewX(0deg)  scaleY(1.00); }
}

#flagpole-wrapper.flag-up #flag-container {
  animation: wave 3.2s ease-in-out infinite;
  transform-origin: left center;
}

/* ─── Footer / Ad bar ────────────────────────────────────────────────────────── */

#ad-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}

#ad-placeholder {
  color: #aaa;
  font-family: sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px dashed #ccc;
  padding: 8px 32px;
  border-radius: 4px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #site-title {
    font-size: 1.1rem;
  }

  header {
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 6px;
  }

  main {
    padding: 8px 16px 8px;
  }

  #scene {
    margin: 6px 0 6px;
  }

  .status {
    font-size: 1.2rem;
    margin-bottom: 6px;
  }

  .pole-shaft {
    height: 280px;
  }

  #flag-svg {
    width: 140px;
    height: 86px;
  }
}

/* ─── Subtle cloud decoration (CSS only) ─────────────────────────────────────── */

.cloud {
  position: fixed;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50px;
  pointer-events: none;
  z-index: 0;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
}

.cloud-1 {
  width: 180px;
  height: 45px;
  top: 12%;
  left: 8%;
  animation: drift1 28s linear infinite;
}
.cloud-1::before {
  width: 80px;
  height: 70px;
  top: -35px;
  left: 20px;
}
.cloud-1::after {
  width: 60px;
  height: 55px;
  top: -28px;
  left: 75px;
}

.cloud-2 {
  width: 140px;
  height: 36px;
  top: 22%;
  right: 10%;
  animation: drift2 34s linear infinite;
}
.cloud-2::before {
  width: 65px;
  height: 55px;
  top: -28px;
  left: 15px;
}
.cloud-2::after {
  width: 50px;
  height: 44px;
  top: -22px;
  left: 58px;
}

.cloud-3 {
  width: 110px;
  height: 28px;
  top: 8%;
  left: 55%;
  animation: drift3 42s linear infinite;
}
.cloud-3::before {
  width: 50px;
  height: 44px;
  top: -22px;
  left: 12px;
}
.cloud-3::after {
  width: 40px;
  height: 34px;
  top: -16px;
  left: 44px;
}

@keyframes drift1 {
  from { transform: translateX(-120px); }
  to   { transform: translateX(calc(100vw + 200px)); }
}
@keyframes drift2 {
  from { transform: translateX(120px); }
  to   { transform: translateX(calc(-100vw - 200px)); }
}
@keyframes drift3 {
  from { transform: translateX(-60px); }
  to   { transform: translateX(calc(50vw + 200px)); }
}
