/*
 * The landing page in the game's Codex look: near-black wine, a gold hairline, chamfered buttons,
 * Marcellus SC for labels and Alegreya Sans for text. The tokens and buttons follow apps/web/src/styles.css.
 */
:root {
  --ink: #f3e7d3;
  --muted: #cdb9a8;
  --gold: #e2b04a;
  --gold-line: #c9a24a;
  --gold-line-rgb: 201, 162, 74;
  --deep: #0e0607;
  --panel: rgb(20, 9, 10);
  --display: "Marcellus SC", Georgia, serif;
  --chamfer: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  --chamfer-in: polygon(7.6px 0, calc(100% - 7.6px) 0, 100% 7.6px, 100% calc(100% - 7.6px), calc(100% - 7.6px) 100%, 7.6px 100%, 0 calc(100% - 7.6px), 0 7.6px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--deep);
}

body {
  margin: 0;
  background: var(--deep);
  color: var(--ink);
  font-family: "Alegreya Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

a {
  color: var(--gold);
}

/* Scrollbars as in the game: a gold thumb on a dark track. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--deep);
  box-shadow: inset 1px 0 0 rgba(var(--gold-line-rgb), 0.18);
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  background: linear-gradient(180deg, #d9b25c, #8f6a26) padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f0cf7c, #b48834) padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Browsers without the pseudo-elements (Firefox) get the closest match. */
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: #a87e30 var(--deep);
  }
}

.num {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 500;
}

/* The game's icons are masks painted in the text colour (the game's .gi). */
.gi {
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--gi) center / contain no-repeat;
  mask: var(--gi) center / contain no-repeat;
}

/* Buttons, as in the game: chamfered, bold capitals; a border wouldn't follow the cut corners, so rims are layers. */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 200px;
  padding: 0 28px;
  clip-path: var(--chamfer);
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  z-index: -1;
}

.btn-gold {
  background: #f6dd94;
  color: #2a1206;
}

.btn-gold::before {
  inset: 1px;
  background: #4a2a0c;
  clip-path: var(--chamfer-in);
}

.btn-gold::after {
  inset: 2px;
  background: linear-gradient(180deg, #f0cf7c, #c9962f);
  box-shadow: inset 0 1px 0 rgba(255, 246, 214, 0.55);
  clip-path: polygon(7.2px 0, calc(100% - 7.2px) 0, 100% 7.2px, 100% calc(100% - 7.2px), calc(100% - 7.2px) 100%, 7.2px 100%, 0 calc(100% - 7.2px), 0 7.2px);
}

.btn-gold:hover::after {
  background: linear-gradient(180deg, #f6da8e, #d3a23a);
}

.btn-outline {
  --face: rgb(20, 7, 8);
  background: var(--gold-line);
  color: var(--ink);
}

.btn-outline::before {
  inset: 1px;
  background: var(--face);
  clip-path: var(--chamfer-in);
}

.btn-outline:hover {
  --face: rgb(43, 26, 17);
}

/* ---- Opening screen: the name over the dusk backdrop, the keep left clear below. ---- */

.hero {
  position: relative;
  min-height: max(100svh, 640px);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

/* The backdrop covers the opening screen like a background image, kept to the bottom so the castle stays in
   view; tall screens get the portrait framing (the game's RealBackdrop switches below 4:5 as well). */
.real-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--deep);
}

.real-frame {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: max(100%, max(100svh, 640px) * var(--frame-aspect));
  transform: translateX(-50%);
}

.real-frame > * {
  position: absolute;
  display: block;
}

.real-frame.phone {
  display: none;
}

@media (max-aspect-ratio: 4 / 5) {
  .real-frame.desktop {
    display: none;
  }

  .real-frame.phone {
    display: block;
  }
}

/* Two copies of a tileable strip side by side, slid one copy's width and round again. */
.real-drift > div {
  position: absolute;
  inset: 0 auto 0 0;
  width: 200%;
  background-size: 50% 100%;
  background-repeat: repeat-x;
  animation: real-drift linear infinite;
}

@keyframes real-drift {
  to {
    transform: translateX(-50%);
  }
}

.real-flag {
  background-size: 1200% 100%;
  animation: real-flag 1s steps(12, jump-none) infinite;
}

@keyframes real-flag {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: 100% 0;
  }
}

/* The windows' own amber is in the plate; this glow only stirs faintly over it. */
.real-lights {
  opacity: 0.3;
  animation: real-lights 4s ease-in-out infinite;
}

@keyframes real-lights {
  0%,
  100% {
    opacity: 0.3;
  }
  30% {
    opacity: 0.18;
  }
  45% {
    opacity: 0.26;
  }
  70% {
    opacity: 0.12;
  }
}

@media (prefers-reduced-motion: reduce) {
  .real-backdrop * {
    animation: none !important;
  }
}

/* The name, pitch and buttons above the keep; the countdown on the dark trees at the foot. */
.hero-mark {
  position: relative;
  flex: 1;
  width: 100%;
  padding: max(48px, 7vh) 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 76px);
  letter-spacing: 0.05em;
  line-height: 1.1;
  color: var(--gold);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
}

.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(340px, 60vw);
  margin-top: 14px;
}

.rule i {
  flex: 1;
  height: 1px;
  background: var(--gold-line);
}

.rule b {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  background: var(--gold);
}

.pitch {
  max-width: 680px;
  margin: 18px 0 0;
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 500;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 18px rgba(14, 6, 7, 0.8);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.countdown {
  margin-top: auto;
  padding-top: 26px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.countdown p {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.countdown-units {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.countdown-units span {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}

.countdown-units b {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
}

.countdown-units small {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

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

main {
  display: flex;
  flex-direction: column;
  gap: 72px;
  padding: 24px 16px 72px;
}

main > section {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* Section names: small gold capitals between two hairlines. */
.label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 28px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.16em;
  color: var(--gold);
  white-space: nowrap;
}

.label::before,
.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--gold-line-rgb), 0.7));
}

.label::after {
  background: linear-gradient(90deg, rgba(var(--gold-line-rgb), 0.7), transparent);
}

/* Screenshots: each screen on desktop with its phone shot over the lower right corner, two pairs a row; on phones the pairs swipe. */
.shot-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}

figure {
  margin: 0;
}

/* The desktop shot leaves room on the right and below for the phone to stand out past it. */
.pair {
  position: relative;
  padding: 0 9% 22% 0;
}

.frame {
  display: block;
  padding: 1px;
  background: var(--gold-line);
  clip-path: var(--chamfer);
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  clip-path: var(--chamfer-in);
  background: var(--panel);
}

/* The shadow sits on a wrapper: on the frame itself its clip-path would cut it off. */
.tall {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26%;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.8));
}

figcaption {
  margin-top: 12px;
  text-align: center;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

@media (max-width: 899px) {
  .shot-row {
    display: flex;
    gap: 16px;
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
  }

  .shot-row::-webkit-scrollbar {
    display: none;
  }

  .shot-row li {
    flex: 0 0 min(86vw, 520px);
    scroll-snap-align: start;
  }
}

/* From I to X: level X underneath, level I over it up to the divider at --pos. */
.compare {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--gold-line);
  background: var(--panel);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.compare-before {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.compare-tag {
  position: absolute;
  top: 12px;
  padding: 4px 12px;
  background: rgba(14, 6, 7, 0.85);
  border: 1px solid rgba(var(--gold-line-rgb), 0.6);
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--gold);
  pointer-events: none;
}

.compare-tag.before {
  left: 12px;
}

.compare-tag.after {
  right: 12px;
}

/* The divider: a gold line with a chamfered grip in the middle. */
.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.compare-handle b {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  translate: -50% -50%;
  clip-path: var(--chamfer);
  background: linear-gradient(180deg, #f0cf7c, #c9962f);
  color: #2a1206;
  font: 800 30px/1 "Alegreya Sans", sans-serif;
  letter-spacing: 4px;
  padding: 0 0 5px 4px;
}

/* The range input only serves keyboards and screen readers; it sits unseen over the picture's foot. */
.compare input {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.compare:has(input:focus-visible) .compare-handle b {
  outline: 2px solid var(--ink);
  outline-offset: -4px;
}

@media (max-width: 700px) {
  .compare-tag {
    top: 8px;
    padding: 2px 8px;
    font-size: 14px;
  }

  .compare-tag.before {
    left: 8px;
  }

  .compare-tag.after {
    right: 8px;
  }

  .compare-handle b {
    width: 44px;
    height: 44px;
  }
}

/* The enlarged screenshot: nearly full screen over a dark veil, the shot letterboxed to fit. */
/* The page doesn't scroll behind it, and the viewer fills the window inside the scrollbar (100vw would run under it). */
html:has(.viewer[open]) {
  overflow: hidden;
}

.viewer {
  inset: 0;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 72px 96px 32px;
  border: none;
  background: transparent;
  color: var(--ink);
}

.viewer::backdrop {
  background: rgba(8, 3, 4, 0.96);
}

.viewer figure {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.viewer img {
  display: block;
  min-height: 0;
  max-width: 100%;
  max-height: calc(100% - 40px);
  object-fit: contain;
  outline: 1px solid var(--gold-line);
}

.viewer-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0 0 4px;
  border: none;
  clip-path: var(--chamfer);
  background: var(--gold-line);
  color: var(--gold);
  font: 400 34px/1 "Alegreya Sans", sans-serif;
  cursor: pointer;
  isolation: isolate;
}

.viewer-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  background: rgb(20, 7, 8);
  clip-path: var(--chamfer-in);
}

.viewer-btn:hover::before {
  background: rgb(43, 26, 17);
}

.viewer-close {
  top: 16px;
  right: 24px;
}

.viewer-prev,
.viewer-next {
  top: calc(50% - 24px);
}

.viewer-prev {
  left: 24px;
}

.viewer-next {
  right: 24px;
}

/* Phones: the shot takes the whole width; the arrows sit at the foot, either side of the caption. */
@media (max-width: 700px) {
  .viewer {
    padding: 72px 12px 84px;
  }

  .viewer-close {
    top: 12px;
    right: 16px;
  }

  .viewer-prev {
    left: 16px;
  }

  .viewer-next {
    right: 16px;
  }

  .viewer img {
    max-height: 100%;
  }

  .viewer-prev,
  .viewer-next {
    top: auto;
    bottom: max(18px, env(safe-area-inset-bottom));
  }

  .viewer figcaption {
    position: absolute;
    left: 72px;
    right: 72px;
    bottom: max(30px, env(safe-area-inset-bottom));
  }
}

/* What's different: icon beside a title and a line. */
.points ul {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 48px;
  margin: 0 auto;
  padding: 0;
  max-width: 920px;
  list-style: none;
}

.points li {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.points .gi {
  width: 44px;
  height: 44px;
  color: var(--gold);
}

.points h3,
.faq h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--ink);
}

.points p,
.faq p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 700px) {
  .points ul {
    grid-template-columns: 1fr;
  }
}

.faq {
  max-width: 720px !important;
}

.faq h3 {
  margin-top: 26px;
}

.faq h2 + h3 {
  margin-top: 0;
}

.closing {
  display: flex;
  justify-content: center;
}

footer {
  padding: 24px 16px max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(var(--gold-line-rgb), 0.35);
  text-align: center;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 12px;
}

footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  text-decoration-color: rgba(var(--gold-line-rgb), 0.45);
  text-underline-offset: 4px;
  font-size: 16px;
}

footer p {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Desktop: the name, pitch and buttons in the middle of the picture (owner), the countdown on the trees at the foot. */
@media (min-width: 701px) {
  .hero-mark {
    justify-content: center;
    padding: 48px 16px 140px;
  }

  .hero-mark .countdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 40px;
    margin: 0;
    padding: 0;
  }

  /* The middle of the sky is its brightest band: a darker glow keeps the gold legible there. */
  h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55), 0 0 28px rgba(14, 6, 7, 0.75), 0 0 60px rgba(14, 6, 7, 0.45);
  }
}

/* Phones: the castle stands low in the picture, so the countdown follows the buttons at the top instead of the foot. */
@media (max-width: 700px) {
  .countdown {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .actions {
    flex-direction: column;
    align-self: stretch;
  }

  .actions .btn {
    width: 100%;
  }
}
