:root {
  --wall: #1e4f8f;
  --wall-deep: #163b6b;
  --ink: #1b1511;
  --paper: #fffdf8;
  --mat: #f3eee3;
  --wood: #3a2a1e;
  --crema: #f0b04a;
  --crema-ink: #3b2200;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root { --wall: #12335e; --wall-deep: #0d2644; }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--wall);
  color: #fff;
  font: 1.125rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--crema); outline-offset: 3px; }

.top {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: baseline;
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
}
.wordmark { font: 700 1.1rem/1 var(--display); text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; }
.top nav a { text-underline-offset: .25em; }

main { padding: 0 clamp(1rem, 4vw, 3rem) 4rem; max-width: 78rem; margin: 0 auto; }

.hero { padding: clamp(1.5rem, 5vw, 3.5rem) 0 clamp(2.5rem, 5vw, 4rem); max-width: 62rem; }
.hero h1 {
  font: 800 clamp(2.3rem, 6vw, 4.4rem)/1.04 var(--display);
  letter-spacing: -.02em; margin: 0 0 1.25rem; text-wrap: balance;
}
.lede { font-size: clamp(1.15rem, 2.2vw, 1.4rem); max-width: 34rem; margin: 0 0 1.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.btn {
  font: 600 1rem/1 var(--display);
  background: var(--crema); color: var(--crema-ink);
  border: 2px solid var(--crema); border-radius: 999px;
  padding: .85rem 1.4rem; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: #ffc566; border-color: #ffc566; }
.btn.ghost { background: transparent; color: #fff; border-color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--wall-deep); }

/* ---- Gallery wall ---- */
.gallery {
  padding-inline: .6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 4rem 2.5rem;
  align-items: start;
  padding-top: 1rem;
}
.pour { display: flex; flex-direction: column; gap: 1.1rem; scroll-margin-top: 2rem; }
.pour.spotlight .frame { box-shadow: 0 0 0 5px var(--crema), 0 14px 24px rgba(0,0,0,.35); }

.frame {
  --tilt: 0deg;
  background: var(--mat);
  border: .8rem solid var(--wood);
  padding: .9rem;
  box-shadow: 0 14px 24px rgba(0,0,0,.35);
  transform: rotate(var(--tilt));
  transform-origin: 50% 0;
  transition: transform .9s cubic-bezier(.3, 1.6, .5, 1);
  position: relative;
}
.frame::before { /* the nail */
  content: ""; position: absolute; top: -1.35rem; left: 50%; width: .6rem; height: .6rem;
  margin-left: -.3rem; border-radius: 50%; background: #d8d2c4; box-shadow: 0 2px 3px rgba(0,0,0,.4);
}
.frame img { display: block; width: 100%; height: auto; background: #cfc8b8; }
.pour:nth-child(5n+1) .frame { --tilt: -2.2deg; }
.pour:nth-child(5n+2) .frame { --tilt: 1.4deg; }
.pour:nth-child(5n+3) .frame { --tilt: -.9deg; }
.pour:nth-child(5n+4) .frame { --tilt: 2.6deg; }
.pour:nth-child(5n) .frame { --tilt: -1.6deg; }
.straight .frame { --tilt: 0deg !important; }

.plaque {
  background: var(--paper); color: var(--ink);
  padding: 1rem 1.15rem 1.15rem; border-radius: 2px;
  box-shadow: 0 6px 12px rgba(0,0,0,.25);
}
.plaque h3 { font: 700 1.3rem/1.2 var(--display); margin: 0 0 .3rem; text-wrap: balance; }
.meta { margin: 0 0 .9rem; font-style: italic; font-size: 1rem; color: #5a4d42; }
.ask { margin: 0 0 .5rem; font: 600 .95rem/1.3 var(--display); }

.guesses { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.guess {
  width: 100%; text-align: left; font: 500 1rem/1.2 var(--text);
  padding: .6rem .8rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 6px; cursor: pointer;
}
.guess:hover:not(:disabled) { background: var(--crema); }
.guess:disabled { opacity: .55; cursor: wait; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.results li { position: relative; padding: .45rem .7rem; border-radius: 6px; background: #efe9dc; overflow: hidden; display: flex; justify-content: space-between; gap: .75rem; font-size: 1rem; line-height: 1.25; }
.results .bar { position: absolute; inset: 0 auto 0 0; background: var(--crema); width: 0; transition: width .7s ease-out; z-index: 0; }
.results span { position: relative; z-index: 1; }
.results .mine { outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 600; }
.thanks { margin: .7rem 0 0; font-size: .95rem; color: #5a4d42; }
.err { margin: .6rem 0 0; font-size: .95rem; color: #9b1c1c; }

.about { max-width: 38rem; margin-top: 6rem; }
.about h2 { font: 700 2rem/1.1 var(--display); margin: 0 0 1rem; }
.about a { text-underline-offset: .2em; }

footer { text-align: center; padding: 2.5rem 1rem 3rem; background: var(--wall-deep); font-style: italic; }
footer p { margin: 0; }

.lost { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.lost h1 { font: 800 clamp(2rem, 6vw, 3.5rem)/1.05 var(--display); margin: 0 0 1rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .frame, .results .bar { transition: none; }
}
