/* Our ideas page and full-screen player. Colors, fonts, buttons and the footer come from style.css. */

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

.brand-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.brand-back .ico {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.brand:hover .brand-back {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* ---------- Intro ---------- */

.proto-hero {
  max-width: 780px;
  padding-block: clamp(40px, 7vw, 84px) clamp(30px, 4.5vw, 48px);
}

.proto-hero .eyebrow { margin-bottom: 14px; }

.proto-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 850;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.proto-lede {
  margin: 22px 0 0;
  max-width: 54ch;
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
  line-height: 1.5;
}

.proto-pub {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--muted);
}

.proto-pub a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* ---------- Cards ---------- */

.proto-list {
  padding-block: clamp(26px, 4vw, 40px) clamp(44px, 6vw, 80px);
  border-top: 2px solid var(--line);
}

.proto-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 0 0 18px;
}

.proto-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proto-chip {
  padding: 8px 14px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 650 14px/1 var(--font-body);
  cursor: pointer;
}

.proto-chip:hover { border-color: var(--ink); }

.proto-chip[aria-pressed="true"] {
  border-color: var(--btn-edge);
  background: var(--accent);
  color: var(--on-accent);
}

.proto-count-line {
  margin: 0;
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.protos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.proto {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 2px solid var(--edge);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.proto-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--edge);
  background: var(--tag);
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
}

.proto-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.proto-cover:hover img { transform: scale(1.03); }

.proto-cover:focus-visible {
  outline-offset: -5px;
  border-radius: 0;
}

/* No cover image: the game's initials on a plain panel */
.proto-cover.no-cover::before {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 850 clamp(2.4rem, 5vw, 3.4rem)/1 var(--font-display);
  letter-spacing: -0.02em;
}

.proto-cover-play {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--btn-edge);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 3px 0 var(--drop);
  transition: transform 0.12s ease;
}

.proto-cover-play .ico {
  width: 19px;
  height: 19px;
  margin-left: 3px;
}

.proto-cover:hover .proto-cover-play { transform: translateY(-2px); }

.proto-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 20px;
}

.proto-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 10px;
}

.proto-name {
  margin: 0;
  font: 750 1.2rem/1.2 var(--font-body);
}

.proto-status {
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--tag);
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.proto-by {
  margin: -4px 0 0;
  font: 600 12px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.proto-genre {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.proto-pitch {
  margin: 2px 0 0;
  font-size: 15.5px;
  line-height: 1.5;
}

.proto-note {
  margin: 0;
  font: 500 12px/1.45 var(--font-mono);
  color: var(--muted);
}

.proto-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
}

.proto-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 15px;
  cursor: pointer;
}

.proto-play .ico {
  width: 14px;
  height: 14px;
  margin: 0;
}

.proto-meta {
  margin: 0;
  font: 500 11px/1.5 var(--font-mono);
  color: var(--muted);
  text-align: right;
}

.proto-meta span { display: block; }

.protos-empty {
  padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 40px);
  border: 2px dashed var(--line-strong);
  border-radius: 18px;
  text-align: center;
}

.protos-empty p { margin: 0; }

.protos-empty-title { font: 750 1.2rem/1.3 var(--font-body); }

.protos-empty-text {
  max-width: 46ch;
  margin: 8px auto 0 !important;
  color: var(--muted);
}

/* ---------- Player ---------- */

html.player-open,
html.player-open body { overflow: hidden; }

.player {
  --p-bg: #0E0B09;
  --p-bar: #17120F;
  --p-ink: #F4ECE2;
  --p-muted: #B3A79A;
  --p-line: #3A302A;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--p-bg);
  color: var(--p-ink);
  color-scheme: dark;
}

.player-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--p-bar);
  border-bottom: 1px solid var(--p-line);
}

/* Previous game, the current game's name (opens the game list), next game */
.player-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.player-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 3px 10px 3px 8px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.player-pick:hover,
.player-pick[aria-expanded="true"] {
  border-color: var(--p-line);
  background: rgba(255, 255, 255, 0.04);
}

.player-pick:disabled {
  cursor: default;
  border-color: transparent;
  background: transparent;
}

.player-pick:disabled .player-caret { display: none; }

.player-caret {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--p-muted);
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-title,
.player-meta {
  display: block;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-title { font: 750 16px/1.25 var(--font-body); }

.player-meta {
  margin-top: 2px;
  font: 500 10.5px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--p-muted);
}

.player-meta:empty { display: none; }

.player-step {
  flex: none;
  width: 36px;
  padding: 0;
}

/* The game list */
.player-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: max(12px, env(safe-area-inset-left));
  width: min(380px, calc(100% - 24px));
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 8px;
  border: 1.5px solid var(--p-line);
  border-radius: 16px;
  background: #1E1814;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.player-menu-head {
  margin: 4px 8px 8px;
  font: 500 10.5px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-muted);
}

.player-menu-list {
  display: grid;
  gap: 4px;
}

.player-opt {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--p-ink);
  text-align: left;
  cursor: pointer;
}

.player-opt:hover,
.player-opt:focus-visible { background: rgba(255, 255, 255, 0.06); }

.player-opt:focus-visible { outline-offset: -2px; }

.player-opt[aria-current="true"] { background: rgba(255, 106, 71, 0.16); }

.player-opt-img {
  display: block;
  width: 44px;
  height: 55px;
  border-radius: 8px;
  object-fit: cover;
  background: #2C241F;
}

.player-opt-text { min-width: 0; }

.player-opt-title {
  display: block;
  font: 700 15px/1.25 var(--font-body);
}

.player-opt-genre {
  display: block;
  margin-top: 3px;
  font: 500 11px/1.35 var(--font-mono);
  color: var(--p-muted);
}

.player-opt-tag {
  display: none;
  padding: 4px 6px;
  border-radius: 6px;
  background: #FF6A47;
  color: #17120F;
  font: 700 9.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-opt[aria-current="true"] .player-opt-tag { display: inline-block; }

.player-tools {
  display: flex;
  flex: none;
  gap: 8px;
}

.player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--p-line);
  border-radius: 10px;
  background: transparent;
  color: var(--p-ink);
  font: 600 12px/1 var(--font-mono);
  cursor: pointer;
}

.player-btn:hover { border-color: var(--p-muted); }

.player-btn .ico {
  width: 15px;
  height: 15px;
}

.player-close {
  border-color: #FF6A47;
  background: #FF6A47;
  color: #17120F;
}

.player-close:hover { border-color: #FF8F75; background: #FF8F75; }

.player :focus-visible { outline-color: #FF6A47; }

.player-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  container-type: size;
}

/* Every game gets the whole stage, whatever its orientation. The games lay
   themselves out for the screen they're given (a portrait game centres its
   play area on a wide screen), so in full screen the game is the screen. */
.player-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.player.is-loaded .player-frame { opacity: 1; }

.player-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--p-muted);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.player-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--p-line);
  border-top-color: #FF6A47;
  border-radius: 50%;
  animation: player-spin 0.8s linear infinite;
}

.player.is-loaded .player-loading { display: none; }

/* A phone held the other way from the game: a short hint over the game, which fades */
.player-rotate {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 2;
  display: none;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--p-line);
  border-radius: 999px;
  background: rgba(14, 11, 9, 0.92);
  color: #FF6A47;
  font: 600 11px/1.3 var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  animation: player-hint 4.5s ease forwards;
}

.player-rotate span { display: none; }
.player[data-orientation="portrait"] .player-rotate .is-portrait,
.player[data-orientation="landscape"] .player-rotate .is-landscape { display: inline; }

@container (min-aspect-ratio: 5 / 4) and (max-height: 500px) {
  .player[data-orientation="portrait"] .player-rotate { display: block; }
}

@container (max-aspect-ratio: 4 / 5) and (max-width: 600px) {
  .player[data-orientation="landscape"] .player-rotate { display: block; }
}

@keyframes player-hint {
  0% { opacity: 0; }
  8%, 80% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* Shown only when a game hasn't loaded after 8 seconds */
.player-direct {
  position: absolute;
  top: 14px;
  left: 50%;
  display: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(14, 11, 9, 0.85);
  color: #FF6A47;
  font: 600 12px/1.3 var(--font-mono);
  text-underline-offset: 3px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.player.is-slow .player-direct { display: block; }

@keyframes player-spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */

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

@media (max-width: 560px) {
  /* Compact cards on phones: cover on the left, details on the right */
  .protos {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .proto { flex-direction: row; }
  .proto-cover {
    width: 38%;
    flex: none;
    aspect-ratio: auto;
    min-height: 200px;
    border-bottom: 0;
    border-right: 2px solid var(--edge);
  }
  .proto-cover-play {
    right: 10px;
    bottom: 10px;
    width: 40px;
    height: 40px;
  }
  .proto-cover-play .ico {
    width: 15px;
    height: 15px;
    margin-left: 2px;
  }
  .proto-body {
    gap: 7px;
    padding: 14px 14px 16px;
  }
  .proto-name { font-size: 1.08rem; }
  .proto-genre { font-size: 14px; }
  .proto-pitch { font-size: 14.5px; }
  .proto-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .proto-meta { text-align: left; }
}

/* A compact bar on phones, upright or sideways, so the game keeps as much of the screen as possible */
@media (max-width: 560px), (max-height: 500px) {
  .player-bar {
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }
  .player-tools { gap: 6px; }
  .player-btn {
    width: 34px;
    height: 34px;
    padding: 0;
  }
  .player-btn span { display: none; }
  .player-nav { gap: 2px; }
  .player-pick {
    gap: 4px;
    padding: 3px 4px;
  }
  .player-title { font-size: 14px; }
  .player-more { display: none; }
  .player-caret {
    width: 12px;
    height: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proto-cover img,
  .proto-cover-play,
  .player-frame { transition: none; }
  .player-loading::before { animation: none; }
  .player-rotate { animation-timing-function: steps(1, end); }
}
