/*
 * Anonymous demo — the hub of three adventures, and the sign-in wall.
 *
 * The hub is the first thing an ad click sees, so it borrows the sign-in page's
 * antiquarian-manuscript idiom rather than inventing a second visual language:
 * parchment surface (see pages/sessions.css), Cinzel for display type, Lora
 * italic for prose, and the same brown palette. The wall is different — it
 * appears inside the dark game console, so it is styled for that surface below.
 */

/* ── Hub ────────────────────────────────────────────────────────────────── */

/*
 * The header is kept deliberately short. These cards are 9:16, so they are tall
 * by construction, and on an ad landing page three portraits below the fold are
 * three portraits nobody sees. Everything above them earns its height or goes.
 */
.demo-hub {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  text-align: center;
}

.demo-ornament {
  display: block;
  font-size: 1.6rem;
  color: #8a7354;
  letter-spacing: 0.3em;
  line-height: 1;
  opacity: 0.6;
  user-select: none;
  margin-bottom: 0.75rem;
}

.demo-logo {
  max-width: 190px;
  width: 55%;
  height: auto;
  margin-bottom: 0.9rem;
}

.demo-heading {
  font-family: 'Cinzel', 'Palatino Linotype', serif;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #3a2a14;
  margin: 0 0 0.6rem;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.5);
}

.demo-subtitle {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: #7a6548;
  max-width: 40rem;
  margin: 0 auto 1.6rem;
  line-height: 1.6;
}

.demo-resume { margin-bottom: 1.6rem; }

/* ── The three plates ───────────────────────────────────────────────────── */

.demo-cards {
  display: grid;
  /* The track minimum must stay under the width three columns actually get
     (~10.8rem), or auto-fit silently drops to two and the plates double in
     height. Note html is font-size: 125%, so 1rem is 20px here, not 16. */
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1.25rem;
  /* Sized so three 9:16 plates clear the fold on a laptop viewport. */
  max-width: 35rem;
  margin: 0 auto 1.75rem;
}

/* button_to wraps each card in a form; the form must add no layout of its own. */
.demo-cards form { margin: 0; display: block; }

/*
 * 9:16 because these hold character portraits. The aspect ratio is on the
 * button itself, so the caption overlays the portrait rather than sitting
 * beneath it — otherwise the card is 9:16 plus a text block and no longer
 * matches the art it was cut for.
 */
.demo-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: inherit;
  text-align: left;
  border: 1px solid rgba(138, 115, 84, 0.55);
  /* Image comes from an inline custom property, so a fourth demo needs no CSS. */
  background: var(--card-image) center / cover no-repeat, #cbb894;
  box-shadow: 0 1px 3px rgba(90, 60, 20, 0.18);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.demo-card:hover {
  transform: translateY(-4px);
  border-color: #8a7354;
  box-shadow: 0 6px 18px rgba(90, 60, 20, 0.28);
}

/* Warm rather than neutral black, so the portrait sits on parchment tones. */
.demo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(28, 18, 8, 0.92) 0%,
    rgba(28, 18, 8, 0.72) 28%,
    rgba(28, 18, 8, 0.15) 55%,
    transparent 75%
  );
  transition: opacity 0.35s ease;
}

.demo-card:hover .demo-card-overlay { opacity: 0.88; }

.demo-card-content {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.1rem 1.15rem 1.25rem;
}

.demo-card-title {
  font-family: 'Cinzel', serif;
  /* Tuned so a two-word title sits on one line at the plate's width; longer
     ones wrap, which is fine. */
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f2e6cc;
  /* Insurance for a title that lands on a bright patch of portrait. */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.demo-card-tagline {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(238, 224, 198, 0.88);
}

/* The cards already carry a bottom margin, so the shared divider's own 2rem
   would push the pitch a full screen away from what it is pitching against. */
.demo-hub .signin-divider { width: 40%; margin: 0.25rem auto 1.4rem; }

/* The pitch for an account: curated worlds are the demo, your own is the product. */
.demo-own-adventure {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #6a5540;
  max-width: 34rem;
  margin: 0 auto 1rem;
}

.demo-own-adventure-cta { margin: 0; }

/* ── The wall ───────────────────────────────────────────────────────────── */

/*
 * .console-panel is a bounded flex column with overflow:hidden, and #action-area
 * is an ordinary shrinkable item sized for the one-line action form. The wall is
 * several times taller, so it has to claim its height from the scrolling turn
 * log rather than be squeezed against the panel edge.
 */
.console-panel > #action-area:has(.demo-wall) { flex-shrink: 0; }

.demo-wall {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--theme-accent, #8ab4a0);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
}

.demo-wall-title {
  margin: 0 0 0.6rem;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.demo-wall-body {
  margin: 0 auto 1rem;
  max-width: 48ch;
  line-height: 1.6;
  opacity: 0.85;
}

.demo-wall-benefits {
  list-style: none;
  margin: 0 auto 1.25rem;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* The same fleuron the landing page uses for its feature list. */
.demo-wall-benefits li::before {
  content: "❦";
  color: var(--theme-accent, #8ab4a0);
  margin-right: 0.6rem;
}

.demo-wall .google-btn {
  margin: 0 auto;
  /*
   * sessions.css gives this button a 1s-delayed fadeIn with fill-mode "both",
   * which holds it at opacity 0 until the delay elapses. That is part of the
   * landing page's staged reveal; here the wall arrives mid-game via turbo
   * stream and an invisible call to action at the highest-intent moment in the
   * funnel is the last thing it can afford.
   */
  animation: none;
  background: rgba(138, 180, 160, 0.12);
  border-color: var(--theme-accent, #8ab4a0);
  box-shadow: none;
  color: var(--theme-text, #c8c8b4);
}

.demo-wall .google-btn:hover {
  background: rgba(138, 180, 160, 0.2);
  color: #fff;
}

/*
 * The standalone wall page is the non-turbo fallback and renders on parchment,
 * not in the console — so the dark treatment above has to be undone.
 */
.demo-wall-screen {
  max-width: 34rem;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.demo-wall-screen .demo-wall {
  border-color: rgba(138, 115, 84, 0.55);
  background: transparent;
  color: #5a4a30;
}

.demo-wall-screen .demo-wall-title { color: #3a2a14; }

/*
 * Inside the console the wall inherits the game's monospace, which is right
 * there. On parchment it has to read as the manuscript does.
 */
.demo-wall-screen .demo-wall-body,
.demo-wall-screen .demo-wall-benefits {
  font-family: 'Lora', Georgia, serif;
  line-height: 1.75;
  color: #5a4a30;
  opacity: 1;
}
.demo-wall-screen .demo-wall-benefits li::before { color: #a0895e; }

.demo-wall-screen .demo-wall .google-btn {
  background: rgba(210, 190, 155, 0.12);
  border-color: #a08058;
  color: #5a4a30;
}

.demo-wall-screen .demo-wall .google-btn:hover { color: #3a2a14; }

.demo-wall-back {
  margin-top: 1.5rem;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.demo-wall-back a { color: #6a5540; text-decoration: none; }
.demo-wall-back a:hover { color: #3a2a14; }

/* ── Demo chrome on the game screen ─────────────────────────────────────── */

/*
 * game/layout.css hides .app-nav on the game screen so the console fills the
 * viewport. The demo nav has to survive that: the turns-left counter is what
 * keeps the wall from feeling like a bait-and-switch, and the sign-in link is
 * the only route to an account from inside the demo.
 */
body:has(.game-screen) .app-nav--demo {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  gap: 0.6rem;
  align-items: center;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-bottom-left-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

/* The console already carries a logo, so the nav's own would be a second one. */
body:has(.game-screen) .app-nav--demo .app-nav-home { display: none; }

/*
 * The bar is fixed, so the right panel has to start below it or the setting
 * name reads with a chunk bitten out of it.
 */
body:has(.game-screen):has(.app-nav--demo) .right-panel { padding-top: 2.25rem; }

.app-nav-demo-turns { font-size: 0.85rem; opacity: 0.8; white-space: nowrap; }

.app-nav-demo-cta {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--theme-accent, #8ab4a0);
  border-radius: 3px;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .demo-hub { padding: 2rem 1.25rem 3rem; }
  .demo-heading { font-size: 1.15rem; }
  /* Two across rather than one: a single 9:16 card fills a phone screen. */
  .demo-cards { grid-template-columns: repeat(2, 1fr); gap: 0.9rem; }
  .demo-card-title { font-size: 0.78rem; letter-spacing: 0.12em; }
  .demo-card-tagline { font-size: 0.72rem; }
  body:has(.game-screen) .app-nav--demo { font-size: 0.6rem; padding: 0.3rem 0.5rem; }
}

/* ── Age and terms gate ── */
.demo-terms {
  max-width: 35rem;
  margin: 0 auto 1.1rem;
}
.demo-terms-label {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.55rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.85rem;
  line-height: 1.45;
  /* Parchment ink, like the heading and subtitle above it. --theme-text is the
     dark game theme's light grey and vanishes on this surface. */
  color: #5a4a30;
  cursor: pointer;
  text-align: left;
}
.demo-terms-label input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 0.2rem;
  width: 0.95rem;
  height: 0.95rem;
  accent-color: #5a4a30;
  cursor: pointer;
}
.demo-terms-label a {
  color: #3a2a14;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-terms-label a:hover {
  color: #1f1608;
}
/* The plates stay visible while closed — hiding them would leave a paid click
   looking at an empty page — but they read as unavailable and cannot be sent. */
.demo-card[disabled] {
  opacity: 0.55;
  filter: saturate(0.55);
  cursor: not-allowed;
}
