/* Self-hosted so the page works behind school web filters.
   Variable font, SIL Open Font License, latin subset. */
@font-face {
  font-family: 'Baloo 2';
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/baloo2.woff2) format('woff2');
}

:root { --ink: #1d1a17; --green: #2f5d3a; --line: #d9d4cc; --paper: #f6f3ee; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: 'Baloo 2', system-ui, sans-serif;
  display: flex; flex-direction: column;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
[hidden] { display: none !important; }

button {
  padding: 5px 12px; border: 2px solid var(--ink); border-radius: 9px; background: #fff;
  font-weight: 700; line-height: 1.2;
}
button.primary { background: var(--green); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
button.link { border: 0; padding: 2px 0; background: none; text-decoration: underline; color: #555; }

/* ---------- Top bar ---------- */

#top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 3px solid var(--ink); background: #fff;
}
#top h1 { margin: 0; font-size: 1.6rem; line-height: 1; white-space: nowrap; }
.home { color: #666; font-weight: 700; text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
.place { border-color: var(--line); }
.place::before { content: '📍 '; }
.tools { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* ---------- Board ---------- */

#app { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); min-height: 0; }

#stage { position: relative; overflow: hidden; border-right: 3px solid var(--ink); background: #d9d4cc; }
#sky, #sky svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#bear { position: absolute; left: 50%; bottom: 3%; height: 82%; aspect-ratio: 430 / 590; transform: translateX(-50%); }
#bear svg { width: 100%; height: 100%; display: block; }
.curtain {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1;
  background: repeating-linear-gradient(90deg, #c8443a 0 34px, #b23a31 34px 48px);
  border: 3px solid var(--ink); transition: transform 1.2s ease-in-out;
}
.curtain.left { left: 0; transform: translateX(-92%); }
.curtain.right { right: 0; transform: translateX(92%); }
#stage.closed .curtain { transform: none; }
#stage.closed #bear { z-index: 2; }

#info { padding: 16px 26px 14px; overflow-y: auto; display: flex; flex-direction: column; }
#date { margin: 0; font-size: clamp(1.3rem, 2.2vw, 1.9rem); font-weight: 700; color: #555; }
#info h2 { margin: 0 0 8px; font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1.05; }
#info h3 { margin: 12px 0 6px; font-size: 1.3rem; }
.lead { font-size: clamp(1.2rem, 2vw, 1.6rem); margin: 0 0 14px; }
#source { margin: auto 0 0; padding-top: 10px; font-size: 0.85rem; color: #777; }

#choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
#choices button {
  display: flex; flex-direction: column; align-items: center; padding: 8px 6px 6px;
  border-width: 3px; border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); font-size: 1.2rem;
}
#choices svg { width: 72px; height: 72px; }
#choices button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

#verdict { margin: 0 0 4px; font-size: 1.4rem; font-weight: 800; }
#verdict.right { color: #2f7a3e; }
#verdict.close { color: #8a5a12; }

#temps { display: flex; gap: 14px; align-items: center; --feel: #e0752d; }
#temps[data-feel="hot"] { --feel: #d2412f; }
#temps[data-feel="cool"] { --feel: #3fa0c9; }
#temps[data-feel="cold"] { --feel: #3b6fd8; }
.thermo { width: 54px; height: 150px; flex: none; }
.nums { display: grid; grid-template-columns: repeat(2, auto); gap: 0 26px; }
.nums p { margin: 0; display: flex; align-items: baseline; gap: 10px; font-size: 1.2rem; }
.nums p span { color: #666; min-width: 2.6em; }
.nums p b { font-size: clamp(1.8rem, 2.8vw, 2.4rem); line-height: 1.1; }
.nums .feel {
  grid-column: 1 / -1; justify-self: start; margin-bottom: 4px; padding: 0 14px; border-radius: 99px;
  background: var(--feel); color: #fff; font-weight: 800; font-size: 1.5rem;
}

#wear { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
#wear li {
  width: 112px; padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center;
  border: 3px solid var(--ink); border-radius: 14px; background: #fff; font-weight: 700; font-size: 1.05rem; text-align: center; line-height: 1.1;
}
#wear svg { width: 60px; height: 60px; }

#moon { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
#moon svg { width: 54px; height: 54px; }
#moon p { margin: 0; display: grid; line-height: 1.15; }
#moon small { color: #666; font-size: 0.95rem; }
#moon b { font-size: 1.3rem; }

#problem p { font-size: 1.2rem; }

/* ---------- Settings ---------- */

.cover {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: rgb(29 26 23 / 0.45);
}
.card {
  width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 22px 26px;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink);
}
.card h2 { margin: 0 0 10px; font-size: 2rem; line-height: 1.1; }
.card h3 { margin: 16px 0 6px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 9px; }
#results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
#results button { width: 100%; text-align: left; border-color: var(--line); }
#results button:hover { border-color: var(--ink); }
.hint { color: #666; margin: 6px 0; }
.row { display: flex; gap: 14px; align-items: center; }
.check { display: flex; gap: 8px; align-items: baseline; margin: 6px 0; }
.buttons { display: flex; justify-content: center; margin-top: 14px; }

/* ---------- Moving weather ---------- */

.spin { animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drift { animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateX(26px); } }
.drop { animation: fall 0.9s linear infinite; }
@keyframes fall { from { transform: translateY(-40px); } to { transform: translateY(420px); } }
.flake { animation: snow 6s linear infinite; }
@keyframes snow { from { transform: translate(0, -60px); } 50% { transform: translate(14px, 160px); } to { transform: translate(0, 380px); } }
.flash { animation: flash 4s steps(1) infinite; }
@keyframes flash { 0%, 6%, 12% { opacity: 1; } 3%, 9%, 14%, 100% { opacity: 0; } }
.fog { animation: fog 9s ease-in-out infinite alternate; }
@keyframes fog { to { transform: translateX(60px); } }
.gust { animation: gust 3s ease-in-out infinite; }
@keyframes gust { from { transform: translateX(-60px); opacity: 0; } 30%, 70% { opacity: 1; } to { transform: translateX(80px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .spin, .drift, .drop, .flake, .flash, .fog, .gust { animation: none; }
  .curtain { transition: none; }
}

/* On a narrow screen the weather goes under the picture. */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 46vh auto; overflow-y: auto; }
  #stage { border-right: 0; border-bottom: 3px solid var(--ink); }
}
