/* Undercard website. One design language with the game: paper ground, board-tray gray,
   chunky tiles with darker bottom edges, berry red, ink, sun yellow, Fredoka and Nunito. */

:root {
  --paper: #f4f1ec;
  --tray: #e7e2d9;
  --well: #dbd5ca;
  --line: #e3ddd3;
  --lip: #d6cfc3;
  --ink: #2b303b;
  --ink-deep: #181b22;
  --ink-soft: #5f6574;
  --red: #c8284a;      /* the one red: Red team, white text on it 5.4:1 */
  --red-lip: #931d39;
  --sun: #ffc53d;
  --sun-deep: #e2a417;
  --sun-text: #875c00;
  --sun-soft: #fff3cf;
  --mint: #34c389;
  --sky: #3fb0ea;
  --sky-text: #1a6f9e;
  --display: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --text: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 600 1.0625rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
a { color: var(--red); text-underline-offset: 3px; }
::selection { background: #dcf0fb; color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 10px; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header and footer ---------- */
.site-head {
  display: flex; align-items: center; gap: 24px;
  max-width: 72rem; margin: 0 auto; padding: 20px 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.6rem; }
.brand svg { width: 38px; height: 38px; overflow: visible; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 800; font-size: 0.98rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a.btn-red, .site-nav a.btn-red:hover { color: #fff; text-decoration: none; }
.btn-sm { padding: 8px 14px; font-size: 0.92rem; border-radius: 12px; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.site-foot {
  max-width: 72rem; margin: 0 auto; padding: 48px 24px 40px;
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center;
  color: var(--ink-soft); font-size: 0.95rem;
}
.site-foot nav { display: flex; gap: 20px; margin-left: auto; }
.site-foot a { color: var(--ink-soft); font-weight: 800; text-decoration: none; }
.site-foot a:hover { color: var(--ink); }

/* ---------- Buttons: game tiles that press down ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 14px; border: 0;
  background: #fff; color: var(--ink); font: 800 1.02rem var(--text); text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 var(--lip);
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}
.btn:hover { background: #fbfaf8; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-lip); }
.btn-red:hover { background: var(--red); }
.btn-red:active { box-shadow: 0 1px 0 var(--red-lip); }
.btn-tray { background: var(--tray); }
.btn-tray:hover { background: var(--well); }
.btn svg { width: 18px; height: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; text-align: left; text-wrap: balance;
  padding: 9px 16px; border-radius: 18px; background: var(--sun-soft); color: var(--ink);
  font-weight: 800; font-size: 0.95rem;
}
.pill svg { width: 16px; height: 16px; color: var(--sun-text); }

/* ---------- Playing cards, drawn like the game's ---------- */
.card {
  --lip-c: var(--lip);
  position: relative; display: flex; flex-direction: column;
  background: #fff; color: var(--ink); border-radius: 18px;
  box-shadow: 0 4px 0 var(--lip-c), 0 18px 32px -20px rgb(43 48 59 / 0.5);
  container-type: inline-size;
}
.card.red-suit .rank, .card.red-suit .suit { color: var(--red); }
.card.face-red { background: var(--red); color: #fff; --lip-c: var(--red-lip); }
.card.face-ink { background: var(--ink); color: #fff; --lip-c: var(--ink-deep); }
.card .rank { font-family: var(--display); font-weight: 600; line-height: 1; }
.card .crown { width: 0.9em; height: 0.55em; color: var(--sun); display: block; }
.card .eleven {
  position: absolute; right: 7%; bottom: 6%; font: 600 0.8rem var(--display);
  background: rgb(255 255 255 / 0.92); color: var(--ink); border-radius: 999px; padding: 2px 7px;
}

/* Small cards for demonstrations (the capture, latch and sweep pictures) */
.mini {
  width: 74px; height: 104px; border-radius: 13px; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--lip-c), 0 10px 18px -12px rgb(43 48 59 / 0.45);
}
.mini .rank { font-size: 2.1rem; }
.mini .suit { font-size: 1.15rem; line-height: 1; margin-top: 2px; }
.mini .crown { font-size: 1.5rem; margin-bottom: 3px; }
.mini .eleven { font-size: 0.68rem; padding: 1px 6px; }
.stack-badge {
  position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px;
  background: var(--sun); color: var(--ink); border-radius: 999px; padding: 1px 7px;
  font: 600 0.82rem var(--display); box-shadow: 0 2px 0 var(--sun-deep);
}
.stack-badge svg { width: 0.95em; height: 0.95em; }
.under { position: absolute; inset: 0; border-radius: 13px; transform: translate(6px, 6px); z-index: -1; }

/* ---------- Pages ---------- */
main { display: block; }
.page { max-width: 46rem; margin: 0 auto; padding: 8px 24px 0; }
.page-head { display: flex; align-items: center; gap: 22px; margin: 28px 0 36px; }
.page-head .card { width: 92px; height: 130px; flex: none; padding: 12px; }
.page-head .card .rank { font-size: 2.6rem; }
.page-head .card .suit { font-size: 1.3rem; }
.page-head .card .crown { font-size: 1.8rem; margin-bottom: 4px; }
.page-head h1 { font-size: clamp(2.3rem, 6vw, 3.4rem); }
.page-head p { margin: 6px 0 0; color: var(--ink-soft); font-size: 1.1rem; }
.page h2 { font-size: 1.7rem; margin: 2.4em 0 0.5em; }
.page h3 { font-size: 1.25rem; margin: 1.6em 0 0.4em; }
.page p, .page li { color: var(--ink-soft); }
.page strong { color: var(--ink); }
.page ul, .page ol { padding-left: 1.3em; }
.page li { margin: 0.35em 0; }
.panel { background: #fff; border-radius: 22px; padding: 24px; box-shadow: 0 2px 0 var(--line), 0 10px 24px -18px rgb(43 48 59 / 0.35); }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

/* A demonstration: small cards acting out a move, with a caption */
.demo { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; margin: 18px 0; }
.demo-cards { display: flex; align-items: center; gap: 14px; min-width: 190px; }
.demo-arrow { color: var(--ink-soft); font: 600 1.6rem var(--display); }
.demo p { margin: 0; }
.demo h3 { margin: 0 0 4px; }

/* Movement legend, as in the game */
.moves { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.moves li { display: flex; gap: 12px; align-items: baseline; margin: 0; }
.moves .dot { width: 12px; height: 12px; border-radius: 999px; flex: none; transform: translateY(1px); }

/* Two boxes side by side: capture and latch */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.duo > div { border-radius: 18px; padding: 16px 18px; }
.duo h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.duo h3 svg { width: 18px; height: 18px; }
.duo p { margin: 0; }
.tint-paper { background: #fff; box-shadow: 0 2px 0 var(--line); } /* on the paper page, the neutral box is a white tile */
.tint-sun { background: var(--sun-soft); }

/* Phone frame around a real game screenshot */
.phone {
  width: 260px; border-radius: 38px; padding: 10px; background: var(--ink);
  box-shadow: 0 5px 0 var(--ink-deep), 0 30px 50px -30px rgb(43 48 59 / 0.6);
}
.phone img { border-radius: 29px; width: 100%; height: auto; }

/* Facts with big numbers (the story) */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 18px 0; }
.fact { background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 2px 0 var(--line); }
.fact b { display: block; font: 600 2.2rem/1 var(--display); color: var(--ink); }
.fact span { display: block; margin-top: 6px; font-size: 0.95rem; color: var(--ink-soft); line-height: 1.4; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 40px 0 0; }

/* Shared-element transitions between pages: the chosen card carries into its page */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: 420ms; animation-timing-function: var(--ease); }

@media (max-width: 640px) {
  .site-head { padding: 16px; gap: 14px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 0.9rem; }
  .brand { font-size: 1.35rem; }
  .brand svg { width: 32px; height: 32px; }
  .brand-name { display: none; }
  .page { padding: 0 16px; }
  .page-head { gap: 16px; }
  .page-head .card { width: 70px; height: 98px; padding: 9px; }
  .page-head .card .rank { font-size: 2rem; }
  .demo { grid-template-columns: 1fr; gap: 12px; }
  .duo, .facts { grid-template-columns: 1fr; }
  .site-foot { padding: 40px 16px 32px; }
  .site-foot nav { margin-left: 0; }
}
@media (max-width: 400px) {
  .site-nav .hide-xs { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .btn:active { transform: none; }
}
