/*
 * Snapszer Online — the landing page is the game's table, seen before you sit down.
 *
 * The same four materials as the game (apps/web/src/styles.css): green felt for the page,
 * a walnut rail at the top and bottom edges, brass for the one thing to press, and ivory
 * card stock for everything you read up close. Flat colours, hairlines for frames, a
 * shadow only under what lies on the felt. Alfa Slab One is the printed face of the cards
 * and the headings; Bricolage Grotesque carries the text.
 */

@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/fonts/alfa-slab-one-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/fonts/alfa-slab-one-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* the classic table */
  --felt: #0f4a37;
  --felt-deep: #0a3527;
  --rail: #2f1d11;
  --rail-line: #4a3020;
  --brass: #e2b354;
  --brass-hover: #ecc46e;
  --brass-deep: #a8781f;
  --brass-ink: #3a2508;
  /* card stock and its print */
  --paper: #f7f0de;
  --ink: #2a1c12;
  --muted: #6e5c48;
  --line: rgba(90, 64, 34, 0.22);
  --on-felt: #f7f0de;
  --on-felt-muted: rgba(247, 240, 222, 0.78);
  --on-felt-line: rgba(247, 240, 222, 0.22);
  /* suit inks, as printed on Hungarian cards */
  --piros: #c8312a;
  --tok: #c47d0c;
  --zold: #2d7a3a;
  --makk: #7a4520;
  /* the only shadow: something lying on the felt */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);

  --font-display: 'Alfa Slab One', 'Rockwell', Georgia, serif;
  --font-ui: 'Bricolage Grotesque Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(64px, 10vw, 128px);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--felt);
  color: var(--on-felt);
  font-family: var(--font-ui);
  font-size: 1.125rem;
  line-height: 1.6;
  /* the cards fly in from beyond the edges: never a sideways scroll */
  overflow-x: clip;
}

::selection {
  background: var(--brass);
  color: var(--brass-ink);
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2.5px;
}

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- The rail: the walnut edge of the table, top and bottom ---------- */

.rail {
  background: var(--rail);
  color: var(--on-felt);
}

.rail-top {
  box-shadow: inset 0 -1px 0 var(--rail-line);
}

.rail-bottom {
  box-shadow: inset 0 1px 0 var(--rail-line);
  font-size: 0.95rem;
  color: var(--on-felt-muted);
}

.rail-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.rail-bottom .rail-inner {
  flex-wrap: wrap;
  padding-block: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-decoration: none;
  white-space: nowrap;
}

.brand svg {
  width: 36px;
  height: 36px;
  flex: none;
}

/* Language switch: a small menu without script. */
.lang {
  position: relative;
}

.lang summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--on-felt-line);
  font-size: 0.95rem;
  font-weight: 600;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  translate: 0 -2px;
  rotate: 45deg;
}

.lang[open] summary::after {
  translate: 0 2px;
  rotate: 225deg;
}

.lang summary:hover {
  box-shadow: inset 0 0 0 1px var(--on-felt-muted);
}

.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow), 0 12px 28px -12px rgba(0, 0, 0, 0.55);
}

.lang li a {
  display: block;
  padding: 8px 14px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 1rem;
}

.lang li a:hover {
  background: rgba(168, 120, 31, 0.14);
}

.lang a[aria-current='page'],
.lang-list a[aria-current='page'] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--brass);
}

.lang-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-list a {
  color: var(--on-felt);
  text-decoration: none;
}

.lang-list a:hover {
  text-decoration: underline;
}

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

.cta {
  display: inline-block;
  padding: 15px clamp(26px, 5vw, 38px);
  border-radius: 999px;
  background: var(--brass);
  color: var(--brass-ink);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background-color 0.15s ease;
}

.cta:hover {
  background: var(--brass-hover);
}

.cta:active {
  translate: 0 1px;
}

.cta:focus-visible {
  outline-color: var(--paper);
  border-radius: 999px;
}

/* ---------- Hero: the title, and a trick being played onto the felt ---------- */

.hero {
  display: grid;
  gap: 24px;
  align-items: center;
  padding-block: clamp(40px, 7vw, 96px) var(--section);
}

.hero h1 {
  font-size: clamp(3rem, 9.5vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: -0.005em;
  color: var(--paper);
}

.lead {
  max-width: 34rem;
  margin-top: 24px;
  font-size: clamp(1.15rem, 1.9vw, 1.3rem);
  line-height: 1.55;
  color: var(--on-felt-muted);
}

.hero .cta {
  margin-top: 32px;
}

.note {
  margin-top: 16px;
  font-size: 0.98rem;
  color: var(--on-felt-muted);
}

.trick {
  --card-w: clamp(84px, 24vw, 132px);
  --card-h: calc(var(--card-w) * 1.48);
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 0.92;
  justify-self: center;
}

/* the play area printed on the felt, as on the game's table */
.trick-ring {
  position: absolute;
  inset: 6% 2%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--on-felt-line);
}

.trick-card {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  /* The one entrance on the page: the trick is played, card by card, from its seats. */
  animation: play 0.6s cubic-bezier(0.2, 0.85, 0.25, 1) both;
  animation-delay: var(--d);
}

.trick-card.from-left {
  --x: -76%;
  --y: -16%;
  --r: -15deg;
  --fx: -60vw;
  --fy: -4vw;
  --d: 0.3s;
}

.trick-card.from-right {
  --x: 74%;
  --y: -24%;
  --r: 12deg;
  --fx: 60vw;
  --fy: -10vw;
  --d: 0.75s;
}

/* the trump that takes the trick lands last, on top */
.trick-card.from-bottom {
  --x: -4%;
  --y: 20%;
  --r: -4deg;
  --fx: 0px;
  --fy: 70vh;
  --d: 1.2s;
  z-index: 1;
}

@keyframes play {
  from {
    opacity: 0;
    translate: var(--fx) var(--fy);
    rotate: calc(var(--r) * -2);
  }
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 48px;
  }
}

/* ---------- Cards (as in the game) ---------- */

.card {
  --suit-cut: var(--paper);
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: calc(var(--card-w) * 0.1);
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px var(--line),
    var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
}

.card::before {
  content: '';
  position: absolute;
  inset: calc(var(--card-w) * 0.055);
  border-radius: calc(var(--card-w) * 0.06);
  border: 1px solid currentColor;
  opacity: 0.25;
}

.suit-icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: none;
}

.card-corner {
  position: absolute;
  top: calc(var(--card-w) * 0.08);
  left: calc(var(--card-w) * 0.09);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--card-w) * 0.02);
  line-height: 1;
}

.card-rank {
  font-size: calc(var(--card-w) * 0.24);
  letter-spacing: -0.02em;
}

.card-corner .rank-icon {
  display: block;
  width: calc(var(--card-w) * 0.31);
  height: calc(var(--card-w) * 0.31);
  margin-bottom: calc(var(--card-w) * 0.01);
}

.card-corner .suit-icon {
  font-size: calc(var(--card-w) * 0.17);
}

.card-center {
  display: grid;
  place-items: center;
  font-size: calc(var(--card-w) * 0.4);
  margin-top: calc(var(--card-w) * 0.06);
}

.card.rank-A .card-center {
  font-size: calc(var(--card-w) * 0.54);
}

.card.figure .card-center {
  width: calc(var(--card-w) * 0.6);
  height: calc(var(--card-w) * 0.6);
  border-radius: 50%;
  font-size: calc(var(--card-w) * 0.32);
  background: color-mix(in srgb, currentColor 10%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, currentColor 55%, transparent);
}

.card-name {
  position: absolute;
  bottom: calc(var(--card-w) * 0.08);
  font-family: var(--font-ui);
  font-size: max(9px, calc(var(--card-w) * 0.14));
  font-weight: 700;
  line-height: 1;
}

.card.suit-piros {
  color: var(--piros);
}
.card.suit-tok {
  color: var(--tok);
}
.card.suit-zold {
  color: var(--zold);
}
.card.suit-makk {
  color: var(--makk);
}

/* ---------- Sheets: ivory card stock with one printed frame line ---------- */

.sheet {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow);
}

.sheet::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 13px;
  border: 1px solid var(--line);
  pointer-events: none;
}

.sheet a {
  text-decoration-color: var(--brass-deep);
}

.sheet :focus-visible {
  outline-color: var(--brass-deep);
}

/* ---------- Three or four at the table ---------- */

.tables,
.ways,
.rules,
.closing {
  padding-bottom: var(--section);
}

.tables h2,
.ways h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  color: var(--paper);
}

.tables-grid {
  display: grid;
  gap: 20px;
  margin-top: clamp(28px, 4vw, 44px);
}

@media (min-width: 760px) {
  .tables-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
}

.variant h3 {
  margin-top: 20px;
  font-size: 1.35rem;
}

.variant p {
  margin-top: 8px;
  max-width: 34rem;
}

.seats {
  display: block;
  width: min(100%, 240px);
  height: auto;
}

.seats-table {
  fill: var(--felt);
  stroke: var(--rail);
  stroke-width: 7;
}

.seats circle,
.legend-seat {
  stroke-width: 1.5;
}

.seat-declarer {
  fill: var(--brass);
  stroke: var(--brass-deep);
}

.seat-opponent,
.seat-unknown {
  fill: var(--paper);
  stroke: var(--ink);
}

.seats .seat-unknown {
  stroke-dasharray: 3.2 2.6;
}

.seats text {
  font-family: var(--font-display);
  font-size: 16px;
  fill: var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-seat {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid;
}

.legend-seat.seat-declarer {
  background: var(--brass);
  border-color: var(--brass-deep);
}

.legend-seat.seat-opponent {
  background: var(--paper);
  border-color: var(--ink);
}

.legend-seat.seat-unknown {
  background: var(--paper);
  border: 1.5px dashed var(--ink);
}

/* ---------- Who you play with ---------- */

.ways-grid {
  display: grid;
  gap: 32px;
  margin-top: clamp(28px, 4vw, 44px);
}

@media (min-width: 760px) {
  .ways-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }
}

.way {
  padding-top: 18px;
  box-shadow: inset 0 1px 0 var(--on-felt-line);
}

.way p {
  margin-top: 8px;
  color: var(--on-felt-muted);
  max-width: 30rem;
}

/* ---------- The rules in short ---------- */

.rules-sheet h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
}

.deck {
  margin-top: 16px;
  max-width: 40rem;
}

.values {
  --card-w: clamp(76px, 22vw, 96px);
  --card-h: calc(var(--card-w) * 1.48);
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: space-between;
  gap: 24px 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .values {
    grid-template-columns: repeat(6, max-content);
  }
}

.values li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1;
}

.rules-text {
  display: grid;
  gap: 14px;
  max-width: 40rem;
  margin-top: 36px;
}

.rules-more {
  color: var(--muted);
}

/* ---------- Closing ---------- */

.closing h2 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1;
  color: var(--paper);
}

.closing p {
  margin-top: 14px;
  color: var(--on-felt-muted);
}

.closing .cta {
  margin-top: 28px;
}

@media (prefers-reduced-motion: reduce) {
  .trick-card {
    animation: none;
  }
  .cta {
    transition: none;
  }
}
