/* The site's own pages (front page, game picker): a calm, neutral dark look. Each game has its own style
   on its own pages (e.g. splendor-duel/game.css). Builds on style.css (colors, buttons). */

:root {
  --ivory: #ece4d4;
  --gold-soft: #c9b38a;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

.front-page,
.site-page {
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #1a1d24 0%, var(--bg) 60%, #08090c 100%) fixed;
}

/* The site name, in an engraved serif */
.site-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 3.4rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--ivory);
  text-decoration: none;
}

.site-title.small {
  font-size: 1.5rem;
}

/* --- Front page: the name and "Log in", centered --- */

.front {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.front-sub {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold-soft);
}

.gold-button {
  width: auto;
  min-width: 200px;
  padding: 12px 28px;
  border: 1px solid rgb(233 196 106 / 0.45);
  border-radius: 999px;
  background: rgb(233 196 106 / 0.08);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.gold-button:hover {
  background: rgb(233 196 106 / 0.18);
}

/* --- Pages after login: a top bar across the window, then the content --- */

.site-page {
  display: block;
  place-items: normal; /* style.css centers the front page; new browsers apply that to blocks too */
  padding: 0;
}

/* The same bar as on a game's table (game.css .topbar): same height and edges, so nothing jumps between pages.
   Lined up with the content below (max 1600px wide, centered, at least 16px from the window's edges) */
.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 59px; /* as tall as with a round icon button (38px + padding + line), also on pages without one */
  padding: 10px max(16px, calc((100% - 1600px) / 2));
  background: linear-gradient(180deg, rgb(20 22 28 / 0.95), rgb(14 16 21 / 0.95));
  border-bottom: 1px solid rgb(233 196 106 / 0.22);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
}

.site-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.site-user #user-name {
  margin-right: 8px;
}

/* Small round icon buttons in the top bars (e.g. "leave": back one level), in a quiet gold.
   The bar's class in front: must beat ".game-page button { width: auto }" on the table */
:is(.site-bar, .topbar) .icon-button {
  display: grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid rgb(233 196 106 / 0.2);
  border-radius: 50%;
  background: rgb(24 27 33 / 0.55);
  color: #c9b38a;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:is(.site-bar, .topbar) .icon-button:hover {
  color: #fde68a;
  border-color: rgb(233 196 106 / 0.5);
  background: rgb(233 196 106 / 0.08);
}

.site-link {
  width: auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.site-link:hover {
  background: var(--card);
}

.site-main {
  max-width: calc(1600px + 32px); /* the content: 1600px at most, lined up with the top bar */
  margin: 0 auto;
  padding: 40px 16px 60px;
}

.site-heading {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--ivory);
}

/* --- The first login: choose a username (a dialog that can't be closed) --- */

.name-dialog {
  width: min(440px, 92vw);
  padding: 28px;
  border: 1px solid rgb(233 196 106 / 0.3);
  border-radius: 16px;
  background: #14161b;
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.6);
}

.name-dialog::backdrop {
  background: rgb(0 0 0 / 0.65);
  backdrop-filter: blur(4px);
}

.name-dialog .site-heading {
  margin-bottom: 8px;
}

.name-form {
  margin-top: 20px;
}

.name-input {
  font-size: 1.1rem;
}

.name-message {
  min-height: 1.3em;
  margin: 0 0 10px;
  font-size: 0.85rem;
}

.name-form .gold-button {
  justify-self: start;
}

.name-form .gold-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- The game picker: large tiles, 4 in a row --- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.game-tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgb(236 228 212 / 0.14);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.game-tile:hover {
  transform: translateY(-4px);
  border-color: rgb(233 196 106 / 0.55);
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.5);
}

.tile-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%; /* keep the crown and gems in view */
}

/* The name over a dark fade at the bottom */
.tile-caption {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 4px;
  padding: 60px 20px 20px;
  background: linear-gradient(180deg, transparent, rgb(8 9 12 / 0.92) 60%);
}

.tile-name {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--ivory);
}

.tile-tagline {
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold-soft);
}

/* "1 invitation · your turn in 2" */
.tile-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgb(59 130 246 / 0.92);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.4);
}

/* Placeholders for games to come */
.game-tile.soon {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgb(236 228 212 / 0.05), transparent 60%),
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.015) 0 12px, transparent 12px 24px),
    #14161b;
  border-style: dashed;
}

.soon-mark {
  font-size: 4.5rem;
  color: rgb(236 228 212 / 0.12);
}

.game-tile.soon .tile-name {
  color: var(--muted);
  font-size: 1.2rem;
}

@media (max-width: 900px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
