/* Wordly — design system
   Grounded in the game's own material: Scrabble-style letter tiles on felt. */

:root {
  --board: #1b3328;
  --board-dark: #142720;
  --tile: #f0e6cf;
  --tile-edge: #b89a6a;
  --tile-shadow: rgba(0, 0, 0, 0.45);
  --ink: #2e2013;
  --paper: #ede6d8;
  --paper-dim: #c9c3b4;
  --red: #c0392b;
  --blue: #3e7cb1;
  --rule: rgba(237, 230, 216, 0.16);

  --font-tile: "Alfa Slab One", serif;
  --font-head: "Fraunces", "Georgia", serif;
  --font-body: "Source Serif 4", "Georgia", serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--board);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ---------- Historical notice ---------- */

.historical-notice {
  background: var(--tile);
  color: var(--ink);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
  margin: 1.75rem auto 0;
  max-width: 620px;
  text-align: center;
  font-family: var(--font-body);
  box-shadow: 0 6px 14px var(--tile-shadow);
}

.historical-notice .eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tile-edge);
  margin-bottom: 0.5rem;
}

.historical-notice p {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.historical-notice b {
  color: var(--ink);
}

.historical-notice a.btn {
  margin-top: 0.1rem;
}

/* ---------- Hero / tile rack ---------- */

.hero {
  padding: 4.5rem 0 2.5rem;
  text-align: center;
}

.tile-rack {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.tile {
  --tilt: 0deg;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  background: linear-gradient(160deg, var(--tile) 0%, #e4d6b4 100%);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 -3px 0 rgba(0, 0, 0, 0.12),
    0 6px 10px var(--tile-shadow);
  transform: rotate(var(--tilt));
  opacity: 0;
  animation: tile-drop 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1) forwards;
  animation-delay: calc(var(--i) * 90ms);
}

.tile span.letter {
  font-family: var(--font-tile);
  font-size: 1.7rem;
  color: var(--ink);
  line-height: 1;
}

.tile span.value {
  position: absolute;
  right: 5px;
  bottom: 3px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.75;
}

@keyframes tile-drop {
  from {
    opacity: 0;
    transform: translateY(-14px) rotate(var(--tilt));
  }
  70% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(var(--tilt));
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    animation: none;
    opacity: 1;
  }
}

.tagline {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--paper);
  max-width: 34rem;
  margin: 0 auto;
}

.tagline em {
  color: var(--paper-dim);
  font-style: normal;
}

.cta-row {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
  font-family: var(--font-head);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--tile);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--tile-edge);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: var(--ink);
  box-shadow: 0 6px 0 var(--tile-edge);
}

.btn-outline {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper-dim);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  border-color: var(--paper);
  background: rgba(237, 230, 216, 0.08);
}

/* ---------- Sections ---------- */

section {
  padding: 2.4rem 0;
  border-top: 1px solid var(--rule);
  overflow: hidden; /* contain the floated sponsor rail so the next section's rule sits below it */
}

.hero + section {
  border-top: none;
}

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

h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--tile);
  margin: 0 0 1rem;
}

h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--paper);
  margin: 1.2rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: #e8c477;
}

a:hover,
a:focus-visible {
  color: var(--tile);
}

b {
  color: var(--tile);
  font-weight: 700;
}

/* Step list styled as mini tiles, since How to Play is a genuine sequence */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.steps li {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.9rem;
  align-items: start;
}

.steps .mini-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--tile);
  color: var(--ink);
  font-family: var(--font-tile);
  font-size: 1.05rem;
  border-radius: 4px;
  box-shadow: 0 3px 6px var(--tile-shadow);
}

.steps p {
  margin: 0;
  padding-top: 0.15rem;
}

/* Screenshots as tile-framed photos */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.1rem;
}

.shot {
  background: var(--tile);
  border-radius: 6px;
  padding: 0.5rem 0.5rem 0.7rem;
  box-shadow: 0 6px 14px var(--tile-shadow);
  text-align: center;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.shot figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
  opacity: 0.8;
}

.shot a {
  color: inherit;
}

/* Downloads as game-box cards */

.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.download-card {
  background: rgba(237, 230, 216, 0.06);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
}

.download-card h3 {
  margin-top: 0;
  color: var(--tile);
}

.download-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.download-card li {
  margin-bottom: 0.5rem;
}

.download-card li a {
  text-decoration: none;
}

.download-card li a:hover {
  text-decoration: underline;
}

/* Donate / paypal */

.donate-form {
  margin-top: 0.5rem;
}

/* Sponsor slot — visually quiet, clearly labeled, doesn't compete with the tile system */

.sponsor {
  border: 1px dashed var(--rule);
  border-radius: 8px;
  padding: 1.2rem;
  text-align: center;
}

.sponsor .eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 0.8rem;
}

.sponsor-rail {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.sponsor-rail img,
.sponsor img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Footer / legal */

.legal {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--paper-dim);
  line-height: 1.7;
}

.legal p {
  margin-bottom: 0.85rem;
}

.legal a {
  color: var(--paper-dim);
}

@media (max-width: 640px) {
  .hero {
    padding: 3rem 0 2rem;
  }
  .tile {
    width: 2.6rem;
    height: 2.6rem;
  }
  .tile span.letter {
    font-size: 1.3rem;
  }
  .sponsor-rail {
    float: none;
    margin: 0 0 1.5rem;
    text-align: center;
  }
}
