/* Site styles. The diner pieces (frames, buttons, banners, the sign, fonts and the
   --bf-* palette) come from assets/bf-ui/bf-ui.css, which tools/build-ui.ps1 renders
   from Burger Factory's UI code. Link it before this file. */

:root {
  --bg-mid: #4a1111;
  --bg-deep: #140404;
  --text: var(--bf-text);
  --muted: var(--bf-ui-ink-dim);
  --accent: var(--bf-ui-gold);
  --rule: color-mix(in srgb, var(--bf-brass) 45%, transparent);
  /* bf-ui.css's --bf-checker / --bf-checker-block hold relative url()s, which resolve
     against the stylesheet that uses them, so they break here; point at the files */
  --checker: url("./assets/bf-ui/checker.png");
  --checker-block: url("./assets/bf-ui/checker-block.png");
  --maxw: 1240px;
  --header-h: 68px;
  --header-gap: 10px;
  --gutter: 40px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  color: var(--text);
  font-family: var(--bf-font-body);
}

/* Only the root gets a colour, so the backdrop layer below shows through body */
html {
  background: var(--bg-deep);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* The maroon backdrop, pinned to the viewport so long pages don't stretch or repeat
   it (background-attachment: fixed is ignored on iOS). The noise dithers banding. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 90% 75% at 50% 28%, var(--bg-mid), var(--bg-deep) 78%);
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: min(calc(100% - var(--gutter)), var(--maxw));
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Header ---------- */

/* Floats just below the top of the page, then docks flush to the top when stuck */
.site-header {
  position: sticky;
  top: calc(var(--header-gap) * -1);
  z-index: 20;
  padding-top: var(--header-gap);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
  padding: 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  font-family: var(--bf-font-logo-serif);
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  color: var(--bf-ui-ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.brand .bf-brand {
  width: 46px;
  height: 46px;
  transition: transform 160ms ease;
}

.brand:hover .bf-brand {
  transform: rotate(-6deg);
}

/* Checkerboard run between the brand and the nav, as on the cards' awnings */
.header-checker {
  flex: 1;
  max-width: 420px;
  height: 14px;
  margin-inline: auto;
  border-block: 1px solid var(--bf-brass-edge);
  background: var(--checker) 0 0 / var(--bf-checker-size) repeat-x;
  opacity: 0.9;
}

.nav {
  display: flex;
  gap: 26px;
  align-items: center;
  margin-left: auto;
}

.nav a {
  position: relative;
  padding: 6px 0;
  font-family: var(--bf-font-label);
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: var(--bf-text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  transition: color 120ms ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--accent);
}

.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Shown in place of the per-game links on narrow screens */
.nav .nav-games {
  display: none;
}

/* ---------- Hero ---------- */

.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero h1 {
  margin: 0;
  font-weight: normal;
}

.hero h1 img {
  margin-inline: auto;
}

/* Home page: the diner sign is the heading */
.hero.home {
  padding-top: 28px;
}

.sign img {
  width: min(100%, 760px, 105vh);
  height: auto;
}

.tagline {
  margin: 0;
  max-width: 36em;
  color: var(--bf-text);
  font-size: 1.15rem;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.game-logo {
  width: min(100%, 540px);
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
}

/* ---------- Buttons ---------- */

/* Skins come from .bf-button / .bf-button-primary; these only size and lay them out */
.cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.cta-row > :is(.bf-button, .bf-button-primary) {
  min-width: 270px;
}

.cta-row.inline {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
}

.cta-row.inline > :is(.bf-button, .bf-button-primary) {
  --bf-h: 48px;
  min-width: 180px;
}

/* BF's disabled ink nearly vanishes on the greyed plate at web sizes; darken it */
:is(.bf-button, .bf-button-primary)[aria-disabled="true"] {
  color: color-mix(in srgb, var(--bf-button-ink-disabled) 55%, black);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

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

.section {
  margin: 40px auto 64px;
}

/* The red banner on a brass rail running across the section */
.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 30px;
  font-weight: normal;
  text-align: center;
}

.section-title::before,
.section-title::after {
  content: "";
  flex: 1 1 0;
  height: 8px;
  border: 1px solid var(--bf-brass-edge);
  border-radius: 4px;
  background:
    radial-gradient(circle at var(--rivet-x) 50%, var(--bf-brass-hi) 0 1.6px, var(--bf-brass-lo) 2.2px 2.8px, transparent 3.2px),
    linear-gradient(to bottom, var(--bf-brass-hi), var(--bf-brass) 45%, var(--bf-brass-lo));
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

.section-title::before {
  --rivet-x: 7px;
  margin-right: -6px;
}

.section-title::after {
  --rivet-x: calc(100% - 7px);
  margin-left: -6px;
}

.section-title .bf-banner {
  position: relative;
  flex: none;
  min-height: 54px;
  padding-inline: 88px;
  font-size: 34px;
  white-space: nowrap;
}

.lede {
  max-width: 44em;
  margin: 0 auto;
  color: var(--bf-text);
  font-size: 1.15rem;
  line-height: 1.6;
  text-align: center;
}

/* ---------- Game cards (home) ---------- */

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

.game-card {
  container: card / inline-size;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: transform 180ms ease;
}

.game-card:hover {
  transform: translateY(-4px);
}

.game-art {
  position: relative;
  display: block;
}

.art-window {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 3px;
  container-type: inline-size;
}

.art-window > img {
  transition: transform 300ms ease;
}

.game-card:hover .art-window > img {
  transform: scale(1.04);
}

.art-window .cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-window.burger-factory {
  background: radial-gradient(ellipse at 50% 60%, #3a2412, #120a05 75%);
}

.art-window.burger-factory img {
  width: 78%;
}

.hilberts-grand-hotel {
  --title: #f2e2b8;
  --title-shadow: #1d5553;
}

.art-window.hilberts-grand-hotel {
  background: radial-gradient(ellipse at 50% 60%, #123d3b, #051312 75%);
}

.art-title {
  font-family: var(--bf-font-title);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: normal;
  line-height: 1.15;
  color: var(--title, var(--accent));
  text-shadow: 0 3px 0 var(--title-shadow, var(--bf-logo-burger-shade)), 0 8px 24px rgba(0, 0, 0, 0.6);
}

.art-window .art-title {
  padding: 0 20px;
  font-size: clamp(1.5rem, 10cqi, 2.8rem);
  text-align: center;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  --bf-h: 28px;
}

.game-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 16px 4px 0;
  text-align: center;
}

/* Card title in the diner script between checkerboard blocks */
.game-body h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-family: var(--bf-font-title);
  /* Scales with the card so long names stay on one line between the checkers */
  font-size: min(1.75rem, 7cqi);
  font-weight: normal;
  line-height: 1.2;
  color: var(--bf-panel-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.game-body h3::before,
.game-body h3::after {
  content: "";
  flex: none;
  width: 32px;
  height: 17px;
  background: var(--checker-block) center / contain no-repeat;
}

.game-body p {
  margin: 0;
  color: var(--bf-ui-ink-dark);
  line-height: 1.45;
}

.game-body .cta-row {
  margin-top: auto;
  padding-top: 8px;
  gap: 10px;
}

.game-body .cta-row > :is(.bf-button, .bf-button-primary) {
  --bf-h: 44px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

/* Narrow cards: three across on a landscape phone */
@container card (max-width: 300px) {
  .game-body {
    gap: 8px;
    padding-top: 12px;
  }

  /* No room for the checkers beside the name here */
  .game-body h3 {
    font-size: min(1.3rem, 9.4cqi);
  }

  .game-body h3::before,
  .game-body h3::after {
    display: none;
  }

  .game-body p {
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .game-body .cta-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .game-body .cta-row > :is(.bf-button, .bf-button-primary) {
    --bf-h: 38px;
    width: 100%;
  }

  .badge {
    top: 8px;
    right: 8px;
    --bf-h: 22px;
  }
}

/* ---------- Game page: stats and features ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 820px;
  margin: 36px auto 0;
  padding: 20px 24px;
}

.stat {
  padding: 8px 12px;
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--rule);
}

.stat strong {
  display: block;
  font-family: var(--bf-font-title);
  font-size: 2.2rem;
  font-weight: normal;
  line-height: 1.2;
  color: var(--bf-ui-gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.stat span {
  font-family: var(--bf-font-label);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bf-ui-ink-dim);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 22px;
}

.feature {
  padding: 32px 36px 36px;
  text-align: center;
}

.feature h3 {
  margin: 0 0 10px;
  font-family: var(--bf-font-title);
  font-size: 1.6rem;
  font-weight: normal;
  line-height: 1.2;
  color: var(--bf-panel-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.feature p {
  margin: 0;
  color: var(--bf-ui-ink-dark);
  line-height: 1.55;
}

/* Red diner panel round a call to action */
.closing-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 900px;
  margin-inline: auto;
  padding: 44px 56px 48px;
  text-align: center;
}

.closing-cta h2 {
  margin: 0;
  font-family: var(--bf-font-title);
  font-size: 2.2rem;
  font-weight: normal;
  line-height: 1.2;
  color: var(--bf-ui-ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.closing-cta .lede {
  font-size: 1.05rem;
}

/* ---------- Screenshots ---------- */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 26px;
}

.shot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.shot-frame {
  display: block;
  cursor: zoom-in;
}

.shot-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 3px;
  transition: filter 180ms ease;
}

.shot-frame:hover img {
  filter: brightness(1.12);
}

/* Phone-store screenshots: four across, two on narrow screens */
.shots.portrait {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .shots.portrait {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

.shots.portrait .shot-frame img {
  aspect-ratio: 9 / 16;
}

.shot figcaption {
  padding: 0 10px;
  color: var(--bf-text);
  font-size: 1rem;
  line-height: 1.45;
  text-align: center;
}

.lightbox {
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 96vh;
  padding: 22px 24px 8px;
  outline: none;
  cursor: zoom-out;
}

.lightbox.portrait {
  width: min(96vw, 600px);
}

.lightbox::backdrop {
  background: rgba(20, 4, 4, 0.88);
  backdrop-filter: blur(4px);
}

.lightbox img {
  width: 100%;
  max-height: calc(96vh - 110px);
  object-fit: contain;
}

.lightbox p {
  margin: 0;
  padding: 12px 18px;
  color: var(--bf-text);
  text-align: center;
}

/* ---------- Beta ---------- */

/* Side by side when there's room, one column on narrow screens */
.beta-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  max-width: 860px;
  margin: 30px auto 0;
}

/* Capped so a single option doesn't stretch full width */
.beta-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 430px;
  justify-self: center;
  padding: 34px 38px 40px;
  text-align: center;
}

.beta-option h3 {
  margin: 0 0 10px;
  font-family: var(--bf-font-title);
  font-size: 1.9rem;
  font-weight: normal;
  line-height: 1.2;
  color: var(--bf-ui-gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.beta-option p {
  margin: 0 0 22px;
  color: var(--bf-text);
  line-height: 1.55;
}

/* Pin the button to the bottom so side-by-side options line up */
.beta-option > :is(.bf-button, .bf-button-primary) {
  margin-top: auto;
  min-width: 200px;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 8px 0 16px;
  font-family: var(--bf-font-label);
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 20px 28px;
  color: var(--bf-ui-ink-dim);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.footer-links a {
  color: var(--bf-text);
}

.site-footer a:hover,
.site-footer a[aria-current="page"] {
  color: var(--accent);
}

/* ---------- Policy pages ---------- */

.policy {
  max-width: 46rem;
  margin: 48px auto 72px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--bf-text);
}

.policy h1,
.policy h2,
.policy h3 {
  font-family: var(--bf-font-title);
  font-weight: normal;
  line-height: 1.25;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.policy h1 {
  margin: 0 0 6px;
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  color: var(--bf-ui-gold);
}

.policy h2 {
  margin: 48px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: 1.9rem;
  color: var(--bf-ui-ink);
}

.policy h3 {
  margin: 30px 0 8px;
  font-size: 1.4rem;
  color: var(--bf-ui-gold);
}

.policy p,
.policy ul {
  margin: 0 0 14px;
}

.policy ul {
  padding-left: 1.3em;
}

.policy li {
  margin-bottom: 6px;
}

.policy strong {
  color: var(--bf-ui-ink);
}

.policy a {
  color: var(--bf-ui-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.policy a:hover {
  color: var(--bf-brass-hi);
}

.policy .updated {
  margin-bottom: 28px;
  color: var(--muted);
}

/* The short version, on a cream card */
.policy .summary {
  margin: 28px 0;
  padding: 30px 34px 22px;
  color: var(--bf-ui-ink-dark);
}

.policy .summary strong {
  color: var(--bf-panel-ink);
}

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

@media (max-width: 1000px) {
  .header-checker {
    display: none;
  }
}

/* Stack the game cards only on portrait screens; landscape keeps three across */
@media (max-width: 900px) and (orientation: portrait) {
  .games {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin-inline: auto;
  }
}

@media (max-width: 800px) {
  .nav .nav-game {
    display: none;
  }

  .nav .nav-games {
    display: inline;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 24px;
    --header-h: 60px;
  }

  .header-inner {
    padding: 0 18px;
  }

  .brand .bf-brand {
    width: 40px;
    height: 40px;
  }

  .brand-name {
    display: none;
  }

  .nav {
    gap: 18px;
  }

  .nav a {
    font-size: 0.95rem;
  }

  .hero {
    padding: 36px 0 24px;
  }

  .hero.home {
    padding-top: 20px;
  }

  .cta-row {
    gap: 12px;
  }

  .cta-row > :is(.bf-button, .bf-button-primary) {
    --bf-h: 48px;
    min-width: 250px;
  }

  .section {
    margin-top: 28px;
  }

  .section-title .bf-banner {
    min-height: 44px;
    padding-inline: 74px;
    font-size: 26px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:nth-child(3) {
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }

  .lede {
    font-size: 1.02rem;
  }

  .feature {
    padding: 30px 30px 34px;
  }

  /* Clear of the corner plates */
  .closing-cta {
    padding: 50px 30px 46px;
  }

  .closing-cta h2 {
    font-size: 1.6rem;
  }

  .beta-option {
    padding: 32px 30px 38px;
  }

  .footer-inner {
    justify-content: center;
    text-align: center;
  }

  .policy .summary {
    padding: 28px 26px 20px;
  }
}

/* Short landscape screens (phones on their side): keep the hero compact */
@media (orientation: landscape) and (max-height: 520px) {
  .hero {
    padding: 24px 0 20px;
  }

  .hero-inner {
    gap: 12px;
  }

  .game-logo {
    width: min(100%, 360px);
  }

  .section {
    margin-top: 24px;
  }
}
