/* Shared styles for every page of backgammonclubs.app.
   Tokens come from the Backgammon Clubs design system (night lounge: navy/violet scene, cream text,
   gold titles, cyan emphasis, glossy pill buttons with a hard ledge).
   Fonts: Cera is the game's face but only trial files exist, so Outfit + Barlow Condensed stand in.
   Once a licensed web Cera is available, add its @font-face and it takes over through the stacks below. */

/* ── TOKENS ── */
:root {
  --bg-deep: #15162F;
  --bg-scene: radial-gradient(120% 90% at 50% 0%, #3A2170 0%, #241C52 42%, #171734 78%, #101024 100%);
  --surface-panel: linear-gradient(180deg, rgba(43, 31, 85, .94) 0%, rgba(30, 24, 66, .94) 100%);
  --surface-card: linear-gradient(180deg, #5B44A6 0%, #7A4FBC 100%);
  --surface-slot: rgba(14, 10, 32, .55);
  --surface-row: rgba(20, 16, 46, .62);
  --plate: #100D28;

  --text-body: #FBEBCB;
  --text-white: #FFFFFF;
  --text-dim: rgba(251, 235, 203, .72);
  --text-cyan: #5FC9EA;
  --text-cyan-hover: #8FDCF4;
  --gold: #F5C455;
  --text-title: linear-gradient(180deg, #FFFBE2 0%, #FCE398 48%, #F2C455 100%);

  --btn-green: linear-gradient(180deg, #C9E811 0%, #87C60D 22%, #6BAE0E 62%, #B1DB23 100%);
  --btn-blue: linear-gradient(180deg, #5BD3E8 0%, #23B4C4 22%, #20ABD2 62%, #35B5E8 100%);
  --gloss-top: linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .06) 46%, rgba(255, 255, 255, 0) 60%);
  --ledge-green: 0 6px 0 #4C7C08, 0 10px 16px rgba(0, 0, 0, .45);
  --ledge-blue: 0 6px 0 #0E6C8C, 0 10px 16px rgba(0, 0, 0, .45);
  --ledge-press: 0 2px 0 rgba(0, 0, 0, .4), 0 4px 8px rgba(0, 0, 0, .4);
  --shadow-card: 0 10px 24px rgba(0, 0, 0, .45);
  --shadow-tile: 0 6px 0 rgba(0, 0, 0, .28), 0 14px 26px rgba(0, 0, 0, .45);

  --rule-soft: rgba(255, 255, 255, .14);
  --rule-gold: rgba(245, 196, 109, .55);

  --text-fx: -1px -1px 0 rgba(0, 0, 0, .35), 1px -1px 0 rgba(0, 0, 0, .35), -1px 1px 0 rgba(0, 0, 0, .35), 1px 1px 0 rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .45);
  --title-fx: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)) drop-shadow(0 3px 6px rgba(0, 0, 0, .45));

  --font-core: "Cera Compact", "Outfit", system-ui, sans-serif;
  --font-display: "Cera Condensed", "Barlow Condensed", "Outfit", system-ui, sans-serif;

  --r-sm: 14px;
  --r-md: 20px;
  --r-tile: 24px;
  --r-lg: 28px;

  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  --header-h: 64px;
}

/* ── BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-core);
  font-weight: 500;
  color: var(--text-body);
  line-height: 1.6;
  /* the skyline fades into the page colour at its bottom edge (the image is 16:9) */
  background:
    linear-gradient(rgba(21, 22, 47, 0) 55%, var(--bg-deep) 98%) center top / 100% max(787.5px, 56.25vw) no-repeat,
    url("/images/ui/night-city.webp") center top / max(100%, 1400px) auto no-repeat,
    radial-gradient(120% 90% at 50% 0%, #3A2170 0%, #241C52 42%, #171734 78%, #15162F 100%) center top / 100% 1400px no-repeat,
    var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--text-cyan);
}

a:hover {
  color: var(--text-cyan-hover);
}

:focus-visible {
  outline: 3px solid var(--text-cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--plate);
  color: var(--text-body);
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  font-weight: 700;
}

.skip-link:focus {
  top: 8px;
}

/* ── BUTTONS (glossy pill + hard ledge) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: .7rem 1.6rem;
  border-radius: 999px;
  font-family: var(--font-core);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-white);
  text-shadow: var(--text-fx);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 140ms ease;
}

.btn:hover {
  color: var(--text-white);
  filter: brightness(1.07);
}

.btn:active {
  transform: translateY(4px) scale(.97);
}

.btn-green {
  background: var(--gloss-top) top / 100% 42% no-repeat, var(--btn-green);
  box-shadow: var(--ledge-green);
}

.btn-blue {
  background: var(--gloss-top) top / 100% 42% no-repeat, var(--btn-blue);
  box-shadow: var(--ledge-blue);
}

.btn-green:active,
.btn-blue:active {
  box-shadow: var(--ledge-press);
}

.btn-sm {
  min-height: 40px;
  padding: .45rem 1.1rem;
  font-size: .85rem;
}

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--plate);
  border-bottom: 1px solid var(--rule-soft);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: .6rem 1.25rem;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: block;
  padding: 3px 0;
}

.brand img {
  height: 38px;
  width: auto;
}

/* logo left, sections centred, download right */
.site-nav {
  margin-inline: auto;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: .25rem;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .85rem;
  border-radius: 999px;
  color: var(--text-body);
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: var(--text-fx);
  transition: background 140ms ease, color 140ms ease;
}

.site-nav a:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, .08);
}

/* current page, or the section a rules sub-page belongs to */
.site-nav a[aria-current] {
  color: var(--gold);
  background: rgba(245, 196, 85, .12);
  box-shadow: inset 0 0 0 1.5px var(--rule-gold);
}

@media (max-width: 760px) {
  :root {
    --header-h: 106px;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0 1rem;
    padding: .5rem 1rem 0;
  }

  .header-cta {
    margin-left: auto;
  }

  /* phones: the four sections become a second row that scrolls sideways if it has to */
  .site-nav {
    order: 3;
    width: calc(100% + 2rem);
    margin: .25rem -1rem 0;
    border-top: 1px solid var(--rule-soft);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav ul {
    padding: .25rem .75rem;
    width: max-content;
  }

  .site-nav a {
    padding: 0 .7rem;
    font-size: .9rem;
  }
}

/* ── GUIDE ARTICLE ── */
.guide {
  max-width: 800px;
  margin: 2.5rem auto 4rem;
  padding: clamp(1.25rem, 5vw, 3rem);
  background: var(--surface-panel);
  border: 2px solid rgba(255, 255, 255, .1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

@media (max-width: 840px) {
  .guide {
    margin: 1.25rem 1rem 3rem;
  }
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  /* baseline, not center: the separator changes each item's line box, so centring shifted "Home" up */
  align-items: baseline;
  font-size: .9rem;
  color: var(--text-dim);
  margin: -.5rem 0 .75rem;
}

.breadcrumb li + li::before {
  content: "›";
  padding: 0 .5rem;
  color: var(--text-dim);
}

.guide .breadcrumb a {
  display: inline-block;
  padding: .6rem 0;
  font-weight: 700;
  text-decoration: none;
}

.breadcrumb [aria-current] {
  color: var(--text-body);
}

.guide h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: .005em;
  text-wrap: balance;
  background: var(--text-title);
  -webkit-background-clip: text;
  background-clip: text;
  /* background-clip: text only paints inside the box, so give descenders (g, y, p) room below the last line */
  padding-bottom: .12em;
  color: transparent;
  filter: var(--title-fx);
  margin-bottom: 1.5rem;
}

.guide h2 {
  font-weight: 800;
  font-size: clamp(1.3rem, 3.4vw, 1.55rem);
  line-height: 1.25;
  color: var(--gold);
  text-shadow: var(--text-fx);
  text-wrap: balance;
  margin: 2.75rem 0 .85rem;
}

.guide h3 {
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--text-white);
  margin: 1.6rem 0 .35rem;
}

.guide p,
.guide li {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.guide p + p {
  margin-top: .85rem;
}

.guide ol,
.guide ul {
  padding-left: 1.35rem;
  margin: .5rem 0;
}

.guide li + li {
  margin-top: .55rem;
}

.guide li::marker {
  color: var(--gold);
  font-weight: 700;
}

.guide strong {
  color: var(--gold);
  font-weight: 800;
}

.guide a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.guide h2[id],
.guide h3[id] {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

/* the answer right under the H1 sits in a dark inset slot, like the game's value slots */
.answer {
  background: var(--surface-slot);
  border: 2px solid var(--rule-gold);
  border-radius: var(--r-md);
  padding: 1.25rem 1.5rem;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .35);
}

.answer strong:first-child {
  color: var(--gold);
}

.example {
  background: rgba(255, 255, 255, .05);
  border-radius: var(--r-sm);
  padding: .9rem 1.2rem;
  margin: 1rem 0;
}

.diagram {
  margin: 1.5rem 0;
}

.board-diagram,
.screenshot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
}

.diagram figcaption {
  font-size: .9rem;
  color: var(--text-dim);
  margin-top: .6rem;
}

.guide-visual {
  padding: clamp(.75rem, 3vw, 1.25rem);
  background: var(--surface-slot);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
}

.guide-visual .board-diagram {
  max-width: 560px;
  margin-inline: auto;
}

.guide-visual .visual-list {
  display: grid;
  grid-template-columns: repeat(var(--steps, 3), minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-visual .visual-list > li {
  margin: 0;
  min-width: 0;
}

.visual-list strong,
.visual-list span {
  display: block;
}

.visual-list span {
  margin-top: .25rem;
  font-size: .95rem;
}

.visual-track > li {
  position: relative;
  padding-top: .9rem;
  border-top: 1px solid var(--rule-soft);
}

.visual-track > li::before {
  content: "";
  position: absolute;
  inset: -.27rem auto auto 0;
  width: .48rem;
  height: .48rem;
  border-radius: 50%;
  background: #5fc9ea;
}

.visual-points {
  color: #5fc9ea;
  font-weight: 800;
}

.result-boards {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0;
}

.result-board {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.15fr);
  align-items: center;
  gap: .65rem 1rem;
  margin: 0;
  padding: clamp(.65rem, 2vw, 1rem);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
  background: var(--surface-slot);
}

.result-board-heading {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .25rem 1rem;
}

.result-board-heading h3 {
  margin: 0;
}

.result-board figcaption {
  font-size: .95rem;
  color: var(--text-dim);
}

@media (max-width: 600px) {
  .result-board {
    grid-template-columns: minmax(0, 1fr);
  }
}

.guide-visual .figure-leagues {
  margin: .5rem 0 !important;
  gap: clamp(.15rem, 2vw, .5rem);
}

.guide-visual .figure-leagues img {
  display: block;
  height: auto;
}

.guide-visual .figure-leagues span {
  font-size: .8rem;
}

.tier-directions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem 1rem;
}

.tier-directions svg {
  width: 1.25em;
  height: 1em;
  vertical-align: -.15em;
}

.tier-directions span:last-child {
  flex-basis: 100%;
}

.visual-icon {
  width: 2rem;
  height: 2rem;
  vertical-align: middle;
  object-fit: contain;
}

@media (541px <= width <= 700px) {
  .guide-visual .visual-list.clash-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .guide-visual .visual-list {
    grid-template-columns: 1fr;
    gap: .85rem;
  }

  .visual-track > li {
    padding-top: 0;
    padding-inline-start: 1rem;
    border-top: 0;
    border-inline-start: 1px solid var(--rule-soft);
  }

  .visual-track > li::before {
    inset: .55em auto auto -.27rem;
  }
}

.figure-clubs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  list-style: none;
  padding: 0 !important;
  margin: 1rem 0 1.25rem !important;
  text-align: center;
}

.figure-clubs li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: 1rem .5rem;
  border-radius: var(--r-md);
  background: var(--surface-slot);
  border: 1px solid var(--rule-soft);
}

.figure-clubs li + li {
  margin-top: 0;
}

.figure-clubs img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: .35rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45));
}

.figure-clubs span {
  font-weight: 800;
  font-size: .95rem;
  color: var(--text-white);
}

.figure-clubs small {
  font-size: .85rem;
  color: var(--text-dim);
}

.figure-leagues {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .5rem;
  list-style: none;
  padding: 0 !important;
  margin: 1.75rem 0 0 !important;
  text-align: center;
}

.figure-leagues li + li {
  margin-top: 0;
}

.figure-leagues img {
  width: 100%;
  max-width: 84px;
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto .35rem;
}

.figure-leagues span {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* tables: zebra rows on the dark slot surface; wide ones scroll sideways with an edge shadow as the cue */
table {
  width: 100%;
  border-collapse: collapse;
  margin: .75rem 0;
}

th,
td {
  text-align: left;
  padding: .65rem .75rem;
  font-size: .95rem;
  vertical-align: top;
}

th {
  color: var(--gold);
  font-weight: 800;
  border-bottom: 2px solid var(--rule-gold);
}

tbody tr:nth-child(odd) {
  background: var(--surface-row);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  background:
    linear-gradient(90deg, #241C52 30%, rgba(36, 28, 82, 0)) left / 24px 100% no-repeat local,
    linear-gradient(270deg, #241C52 30%, rgba(36, 28, 82, 0)) right / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .5), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .5), transparent) right / 12px 100% no-repeat scroll;
}

.table-wrap table {
  min-width: 560px;
  margin: 0;
}

/* ── ON THIS PAGE ── */
.toc {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--rule-soft);
}

.toc-title {
  font-weight: 800;
  font-size: .85rem !important;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.toc ol {
  margin: .4rem 0 0 !important;
  columns: 2 16rem;
  column-gap: 2rem;
}

.toc li {
  font-size: .95rem !important;
  break-inside: avoid;
}

.toc li + li {
  margin-top: 0 !important;
}

.toc a {
  display: block;
  padding: .3rem 0;
  color: var(--text-body);
  text-decoration: none !important;
}

.toc a:hover {
  color: var(--text-cyan-hover);
}

/* ── KEEP READING ── */
.keep-reading {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-soft);
}

.keep-title {
  font-weight: 800;
  font-size: .85rem !important;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: .9rem;
}

.keep-reading ul {
  list-style: none;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.keep-reading li + li {
  margin-top: 0;
}

.keep-reading a {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  height: 100%;
  padding: 1rem 1.15rem 1.1rem;
  border-radius: var(--r-md);
  background: var(--surface-card);
  border: 2px solid rgba(255, 255, 255, .22);
  box-shadow: var(--shadow-tile);
  color: var(--text-white);
  text-decoration: none !important;
  transition: transform 140ms var(--ease-pop), filter 140ms ease;
}

.keep-reading a:hover {
  transform: translateY(-3px);
  filter: brightness(1.07);
}

.keep-reading .k-label {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
}

.keep-reading .k-title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.3;
  text-shadow: var(--text-fx);
}

.keep-reading .k-desc {
  font-size: .9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, .86);
}

.reviewed {
  margin-top: 2.5rem;
  font-size: .875rem !important;
  color: var(--text-dim);
}

/* ── FOOTER ── */
.site-footer {
  background: rgba(10, 8, 26, .82);
  border-top: 1px solid var(--rule-soft);
  padding: 3.5rem 1.25rem 2rem;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-cta h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.1;
  background: var(--text-title);
  -webkit-background-clip: text;
  background-clip: text;
  /* background-clip: text only paints inside the box, so give descenders (g, y, p) room below the last line */
  padding-bottom: .12em;
  color: transparent;
  filter: var(--title-fx);
  text-wrap: balance;
}

.footer-cta p {
  color: var(--text-dim);
  font-size: .95rem;
  margin: .6rem 0 1.25rem;
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.store-badges img {
  height: 52px;
  width: auto;
  transition: transform 140ms var(--ease-pop);
}

.store-badges a:hover img {
  transform: translateY(-2px);
}

.footer-col p {
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .4rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col a {
  display: inline-block;
  padding: .5rem 0;
  color: var(--text-body);
  font-weight: 500;
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--text-cyan-hover);
}

.footer-legal {
  max-width: 1120px;
  margin: 2.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  font-size: .875rem;
  color: var(--text-dim);
}

.footer-legal a {
  display: inline-block;
  padding: .75rem 0;
  color: var(--text-dim);
  text-decoration: none;
}

.footer-legal a:hover {
  color: var(--text-body);
}

@media (max-width: 760px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1.5rem;
  }

  .footer-cta {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
