/* FastEmu landing page. Plain CSS. Animations use transform and opacity only. */
:root {
  --bg: #0a0a0a;
  --card: #141414;
  --panel: #1c1c1c;
  --panel-2: #242424;
  --border: rgba(255, 255, 255, 0.06);
  --text: #fafafa;
  --muted: #a3a3a3;
  --faint: #929292;
  --accent: #2dd4bf;
  --accent-ink: #04201c;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: Inter, Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; }

/* Header */
.top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: inline-flex; }
.brand img { display: block; height: auto; }
.top nav { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.top nav a:not(.btn) { color: var(--muted); text-decoration: none; }
.top nav a:not(.btn):hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--text);
  color: #0a0a0a;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s;
}
.btn:hover { transform: translateY(-1px); background: #fff; }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-ghost { background: transparent; color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn-small { padding: 7px 16px; font-size: 14px; }

/* Hero */
.hero { max-width: 960px; margin: 0 auto; padding: 72px 16px 64px; text-align: center; }
/* The heading is the whole tagline, so it is set smaller than a short title. */
.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 650;
  text-wrap: balance;
}
.lead { margin: 24px auto 0; max-width: 620px; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.2rem); }
.lead code { color: var(--text); }
.cta { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Bento grid */
.bento {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.mock {
  flex: 1;
  margin-bottom: 24px;
  min-height: 220px;
  background: var(--panel);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
@media (min-width: 760px) {
  .bento { grid-template-columns: repeat(12, 1fr); gap: 20px; }
  .c-wide { grid-column: span 7; }
  .c-narrow { grid-column: span 5; }
  .c-third { grid-column: span 6; }
  .c-full { grid-column: span 12; }
  .card { padding: 28px; }
}
@media (min-width: 1040px) {
  .c-third { grid-column: span 4; }
}

/* Phone screens */
.ph {
  aspect-ratio: 3 / 4;
  background: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* Frames of real games, recorded with `fastemu run --record`. Each tile
   shows a still frame; landing.js swaps in the looping recording while the
   card is on screen, unless the reader asks for reduced motion. */
.ph img.game { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.card .frames-note { margin-top: 8px; font-size: 13px; color: var(--faint); }

/* Card 1 */
.phones {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 420px;
  gap: 12px;
}

/* Card 2 */
.twin { display: flex; gap: 16px; width: 100%; max-width: 360px; justify-content: center; }
.unit { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 5px 8px;
  height: 28px;
}
.rows span { color: var(--muted); }
.rows b { font-weight: 500; font-family: var(--mono); font-size: 11px; color: var(--accent); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq u { width: 3px; height: 14px; background: var(--accent); border-radius: 1px; transform-origin: bottom; transform: scaleY(0.7); }
.js .eq u { animation: eq 4s ease-in-out infinite; }
.js .eq u:nth-child(2) { animation-delay: -0.9s; }
.js .eq u:nth-child(3) { animation-delay: -1.8s; }
.js .eq u:nth-child(4) { animation-delay: -2.7s; }
.js .unit.late .eq u { animation-delay: -0.4s; }
.js .unit.late .eq u:nth-child(2) { animation-delay: -1.5s; }
.js .unit.late .eq u:nth-child(3) { animation-delay: -2.2s; }
.js .unit.late .eq u:nth-child(4) { animation-delay: -3.1s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 20% { transform: scaleY(1); } 45% { transform: scaleY(0.4); } 70% { transform: scaleY(0.85); } }
.js .rows li { animation: row 6s var(--ease) infinite; }
.js .rows li:nth-child(2) { animation-delay: 0.15s; }
.js .rows li:nth-child(3) { animation-delay: 0.3s; }
.js .unit.late .rows li { animation-delay: 0.6s; }
.js .unit.late .rows li:nth-child(2) { animation-delay: 0.75s; }
.js .unit.late .rows li:nth-child(3) { animation-delay: 0.9s; }
@keyframes row {
  0% { opacity: 0; transform: translateY(8px); }
  8%, 88% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; transform: none; }
}

/* Card 3 */
.m-os { flex-direction: column; justify-content: flex-start; gap: 18px; }
.tabs { position: relative; display: flex; width: 100%; background: var(--panel-2); border-radius: 999px; padding: 3px; font-size: 12px; }
.tab { position: relative; z-index: 1; flex: 1; text-align: center; padding: 6px 0; color: var(--text); opacity: 0.55; }
.tab:nth-child(2) { opacity: 1; }
.pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); background: #3a3a3a; border-radius: 999px; }
.panels { position: relative; width: 100%; flex: 1; min-height: 130px; }
.pn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; }
.pn:first-child { opacity: 1; }
.js .pill { animation: pill 8s var(--ease) infinite; }
@keyframes pill {
  0%, 20% { transform: translateX(0); }
  25%, 45% { transform: translateX(100%); }
  50%, 70% { transform: translateX(200%); }
  75%, 95% { transform: translateX(300%); }
  100% { transform: translateX(0); }
}
.js .pn, .js .tab { animation: show 8s var(--ease) infinite; }
.js .tab { animation-name: showtab; }
.js .pn:nth-child(2), .js .tab:nth-child(3) { animation-delay: 2s; }
.js .pn:nth-child(3), .js .tab:nth-child(4) { animation-delay: 4s; }
.js .pn:nth-child(4), .js .tab:nth-child(5) { animation-delay: 6s; }
@keyframes show { 0% { opacity: 0; transform: translateY(6px); } 5%, 21% { opacity: 1; transform: none; } 25%, 100% { opacity: 0; transform: none; } }
@keyframes showtab { 0% { opacity: 0.55; } 4%, 21% { opacity: 1; } 25%, 100% { opacity: 0.55; } }
.win { width: 190px; background: #111; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; overflow: hidden; }
.win .bar { display: flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; background: #2a2a2a; }
.win .bar em { font-style: normal; font-size: 9px; color: var(--muted); margin-right: auto; }
.win .bar s { width: 7px; height: 7px; background: #6b6b6b; border-radius: 1px; }
.win.lx .bar { border-bottom: 1px solid #333; }
.win.lx .bar b { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.win.lx .bar em { margin: 0; }
.win.mac .bar s { border-radius: 50%; }
.win.mac .bar em { margin: 0 auto; padding-right: 30px; }
.win .body, .droid .body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; }
.win .body u, .droid .body u { aspect-ratio: 4 / 3; background: #232323; border-radius: 3px; text-decoration: none; }
.win .body u:first-child, .droid .body u:first-child { background: color-mix(in srgb, var(--accent) 55%, #0a0a0a); }
.droid { width: 96px; background: #111; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px; overflow: hidden; }
.droid .body { padding: 10px 8px 6px; }
.droid .nav { height: 14px; display: flex; align-items: center; justify-content: center; }
.droid .nav s { width: 24px; height: 3px; border-radius: 2px; background: #6b6b6b; }

/* Card 4 */
.apis { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.apis li { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.apis span { font-weight: 500; }
.apis code { margin-left: auto; color: var(--faint); font-size: 11px; white-space: nowrap; }
.apis i {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
}
.apis i::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.js .apis li { animation: row 8s var(--ease) infinite; }
.js .apis i { animation: pop 8s var(--ease) infinite; }
.js .apis li:nth-child(2), .js .apis li:nth-child(2) i { animation-delay: 0.4s; }
.js .apis li:nth-child(3), .js .apis li:nth-child(3) i { animation-delay: 0.8s; }
.js .apis li:nth-child(4), .js .apis li:nth-child(4) i { animation-delay: 1.2s; }
.js .apis li:nth-child(5), .js .apis li:nth-child(5) i { animation-delay: 1.6s; }
.js .apis i { animation-name: pop; }
@keyframes pop {
  0%, 6% { transform: scale(0.6); opacity: 0; }
  12%, 90% { transform: scale(1); opacity: 1; }
  96%, 100% { transform: scale(1); opacity: 0; }
}

/* Card 5 */
.m-keys { flex-direction: column; gap: 18px; }
.kbd { display: flex; gap: 6px; }
.cap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-width: 3px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  position: relative;
}
.cap i { font-style: normal; position: relative; z-index: 1; }
.cap::after, .d::after, .key::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  opacity: 0;
}
.lit::after { opacity: 1; }
.lit { color: var(--text); }
.pad { display: flex; flex-direction: column; align-items: center; gap: 12px; background: #111; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 26px; padding: 14px 16px 16px; }
.dpad { display: grid; grid-template: repeat(3, 26px) / repeat(3, 26px); gap: 3px; }
.d, .key {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
}
.d b, .key b { position: relative; z-index: 1; font-weight: 500; }
.d-up { grid-area: 1 / 2; } .d-left { grid-area: 2 / 1; } .d-ok { grid-area: 2 / 2; border-radius: 50%; }
.d-right { grid-area: 2 / 3; } .d-down { grid-area: 3 / 2; }
.d b { font-size: 9px; }
.keys { display: grid; grid-template-columns: repeat(3, 40px); gap: 5px; }
.key { height: 24px; font-size: 12px; }
.js .lit::after { opacity: 0; }
.js .cap.k1::after, .js .d.k1::after, .js .cap.k2::after, .js .d.k2::after, .js .cap.k3::after, .js .d.k3::after, .js .cap.k4::after, .js .key.k4::after { animation: hl 6s var(--ease) infinite; }
.js .cap.k1, .js .cap.k2, .js .cap.k3, .js .cap.k4 { animation: press 6s var(--ease) infinite; }
.js .k2, .js .k2::after { animation-delay: 1.5s !important; }
.js .k3, .js .k3::after { animation-delay: 3s !important; }
.js .k4, .js .k4::after { animation-delay: 4.5s !important; }
@keyframes hl { 0% { opacity: 0; } 4%, 18% { opacity: 1; } 24%, 100% { opacity: 0; } }
@keyframes press { 0% { transform: none; } 4%, 18% { transform: translateY(2px); } 24%, 100% { transform: none; } }

/* Card 6 */
.m-term { align-items: stretch; justify-content: stretch; padding: 0; background: #0f0f0f; min-height: 200px; }
.term { width: 100%; }
.chrome { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.chrome s { width: 9px; height: 9px; border-radius: 50%; background: #3a3a3a; }
.chrome em { margin-left: 8px; font-style: normal; font-size: 12px; color: var(--faint); }
.tbody { margin: 0; padding: 18px 20px 22px; font-family: var(--mono); font-size: 13px; line-height: 1.75; color: #d4d4d4; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt { color: var(--accent); }
.caret { display: inline-block; width: 7px; height: 14px; background: #d4d4d4; vertical-align: -2px; margin-left: 2px; }
.js .caret { animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.ol { color: var(--muted); }
.ol.ok { color: var(--accent); }
.arm .ol { opacity: 0; transform: translateY(4px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); display: inline-block; }
.arm .ol.show { opacity: 1; transform: none; }

/* Pause every card's animation while it is off screen */
.card:not(.on) .mock *, .card:not(.on) .mock *::after, .card:not(.on) .mock *::before { animation-play-state: paused !important; }

/* Delayed loops hold their first frame until they start */
.js .card .mock *, .js .card .mock *::after { animation-fill-mode: backwards; }

/* Closing block */
.closing {
  max-width: 1168px;
  width: calc(100% - 32px);
  margin: 16px auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 40px 24px;
  text-align: center;
}
.closing h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -0.03em; font-weight: 650; }
.facts { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; text-align: left; }
.facts li { background: var(--panel); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.facts b { font-weight: 600; }
.facts span { color: var(--muted); font-size: 14px; }
@media (min-width: 760px) {
  .closing { padding: 56px 40px; }
  .facts { grid-template-columns: repeat(4, 1fr); }
}

/* Footer */
footer { max-width: 1200px; margin: 56px auto 0; padding: 32px 16px 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.foot { display: grid; gap: 24px; }
.foot p { margin: 12px 0 0; }
.foot a { color: var(--text); text-decoration-color: rgba(255, 255, 255, 0.3); text-underline-offset: 3px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.foot nav a { text-decoration: none; color: var(--muted); }
.foot nav a:hover { color: var(--text); }
.credits { margin: 0; max-width: 520px; }
.foot .credits p:first-child { margin-top: 0; }
@media (min-width: 860px) {
  .foot { grid-template-columns: 1.1fr 1.6fr auto; align-items: start; gap: 40px; }
  .credits { margin-top: 0; }
}

/* Reduced motion: no loops, every card shows its final state */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* The keypad card hides its lit keys for the loop; show them again. */
  .lit::after { opacity: 1 !important; }
}
