/* londonsystemchess.com: the London System guide. Shared pieces live in site.css. */

.line { font: 600 17px/1.45 var(--display); letter-spacing: .005em; }

/* The contents: the section being read is marked. On phones it's a strip under the header (see Responsive). */
.guide-toc a[aria-current="true"] { background: var(--ink); color: var(--yellow); border-color: var(--ink); }

/* At a glance: the tabiya beside the facts -------------------------------- */
.guide .glance h2 { margin-top: 0; }
.glance-grid { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 18px 26px; align-items: start; margin-top: 18px; }
.guide .facts { margin: 0; border: 2.5px solid var(--ink); border-radius: 20px; overflow: hidden; max-width: none; }
.facts > div { display: grid; grid-template-columns: minmax(0, 8.6em) minmax(0, 1fr); gap: 2px 14px; padding: 10px 15px 11px; border-bottom: 2px dashed rgba(18, 19, 20, .25); }
.facts > div:nth-child(odd) { background: #FFF4D2; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font: 600 15.5px/1.35 var(--display); }
.facts dd { margin: 0; font-size: 15.5px; line-height: 1.45; color: var(--ink-soft); }
.guide .glance + .short { margin-top: 34px; }

/* Why learn it: four reasons --------------------------------------------- */
.guide .reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.reason { border: 2.5px solid var(--ink); border-radius: 22px; padding: 16px 18px 18px; background: #FFF4D2; }
.guide .reason h3 { margin: 0 0 6px; font-size: 19.5px; }
.guide .reason p { margin-top: 0; font-size: 16px; line-height: 1.5; color: var(--ink-soft); }

/* The London in numbers: three figures, bar charts and a table, written by Apps/London/Website/tools/build_stats.py ---- */
.guide .stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; max-width: none; }
.guide .stat { margin: 0; border: 2.5px solid var(--ink); border-radius: 20px; padding: 14px 16px 16px; background: var(--yellow); font-size: 15px; line-height: 1.4; }
.stat strong { display: block; margin-bottom: 6px; font: 700 clamp(26px, 2.6vw, 34px)/1.05 var(--display); }
.guide .bars { margin: 26px 0 0; max-width: none; }
.bars figcaption { font-size: 15px; line-height: 1.45; color: var(--ink-soft); }
.bars figcaption .moves { display: block; font: 700 18px/1.3 var(--display); color: var(--ink); }
.guide .bars ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.guide .bars li { margin: 0; display: grid; grid-template-columns: 4.4em minmax(0, 1fr) 3.4em; gap: 10px; align-items: center; }
.bar-move { font: 600 16px/1.2 var(--display); white-space: nowrap; }
.bar { height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, var(--mint) var(--w), var(--paper) var(--w)); }
.bar-n { font: 600 15px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.guide .rates { width: 100%; border-collapse: separate; border-spacing: 0; border: var(--stroke) solid var(--ink); border-radius: 22px; overflow: hidden; font-size: 15.5px; line-height: 1.4; }
.rates th, .rates td { text-align: left; padding: 11px 14px 12px; border-bottom: 2px dashed rgba(18, 19, 20, .25); font-variant-numeric: tabular-nums; }
.rates thead th { background: var(--ink); color: var(--paper); font: 600 15px/1.2 var(--display); border-bottom: 0; }
.rates tbody th { font: 600 16px/1.3 var(--display); }
.rates tbody tr:nth-child(odd) { background: #FFF4D2; }
.rates tbody tr:last-child > * { border-bottom: 0; }
.guide .bars .table-wrap { margin-top: 10px; }

/* Famous games: the two players, where and when, and where the score and photos come from ------ */
.guide .game-players { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 12px; }
.game-players figure { display: flex; align-items: center; gap: 10px; margin: 0; }
.game-players img { width: 54px; height: 54px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); }
.game-players figcaption { font: 600 16px/1.2 var(--display); }
.game-players small { display: block; margin-top: 2px; font: 600 12.5px/1.2 var(--text); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.guide .player-item > .game-meta { margin: -2px 0 10px; font: 600 15px/1.35 var(--text); color: var(--ink-soft); }
.guide .player-item > .credit { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

/* The short history: a line of dated stops, like the course map ------------------ */
.guide .timeline { list-style: none; margin: 20px 0 0; padding: 0; position: relative; }
.guide .timeline::before { content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--ink); }
.guide .timeline li { position: relative; margin: 0; padding: 0 0 22px 42px; }
.guide .timeline li:last-child { padding-bottom: 0; }
.guide .timeline li::before { content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); background: var(--yellow); }
.guide .timeline .when { margin: 0; font: 700 15px/1.3 var(--display); letter-spacing: .02em; color: var(--ink-soft); }
.guide .timeline h3 { margin: 2px 0 6px; font-size: 20px; }
.guide .timeline p + p, .guide .timeline h3 + p { margin-top: 0; }
.guide .timeline li > p:last-child { font-size: 16.5px; line-height: 1.55; }

/* The London in four pictures: pawn skeletons, two by two ------------------------ */
.guide .pictures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; margin-top: 18px; max-width: none; }

/* The strategy map: three boards side by side ------------------------------ */
.guide .map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; max-width: none; }
.map figcaption { font-size: 15px; }

/* Players: tabs, a board with step buttons, and the line being played ----------- */
.guide .player { margin-top: 18px; max-width: none; scroll-margin-top: calc(var(--header-h) + 12px); }
.player-tabs { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.player-tab {
  font: 600 15.5px/1.2 var(--display); color: var(--ink); background: var(--paper); cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 7px 14px 8px; box-shadow: 2px 3px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.player-tab:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--ink); }
.player-tab[aria-selected="true"] { background: var(--ink); color: var(--yellow); box-shadow: none; transform: translate(2px, 3px); }
.player-stage { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px 28px; align-items: start; }
.player-side { display: grid; gap: 12px; }
.player-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.player-controls .btn-small { padding-inline: 6px; }
.player-controls .btn-small[aria-disabled="true"] { background: var(--paper); color: var(--ink-soft); box-shadow: none; }
.guide .player-item h3 { margin: 0 0 8px; font-size: 22px; }
.guide .player-item > p { margin-top: 12px; }
.guide .player-item > .player-moves { margin-top: 0; }
.player-moves { position: relative; max-height: 15.2em; overflow-y: auto; font: 600 16.5px/1.9 var(--display); color: var(--ink); }
.mv-n { color: var(--ink-soft); font-weight: 500; margin-right: 1px; }
.mv {
  appearance: none; background: none; border: 0; margin: 0; padding: 1px 4px; border-radius: 8px;
  font: inherit; color: inherit; cursor: pointer;
}
.mv:hover { background: #FFF4D2; }
.mv[aria-current="step"] { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--ink); }
.guide .lesson { padding: 11px 15px 12px; background: #E3F6EA; border: 2px solid var(--ink); border-radius: 16px; font-size: 16px; line-height: 1.5; }

/* The setup, move by move -------------------------------------------- */
.guide .stepper { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px 28px; align-items: start; margin-top: 22px; }
.stepper-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 14px; }
.stepper-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.stepper-controls .btn-small { flex: 1 1 auto; }
.guide .steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.guide .steps li { margin: 0; display: grid; gap: 3px; padding: 10px 14px 12px; border: 2.5px solid transparent; border-radius: 18px; transition: background-color .2s ease, border-color .2s ease; }
.guide .steps li.is-on { background: var(--yellow); border-color: var(--ink); }
.step-moves { font: 700 19px/1.25 var(--display); color: var(--ink); justify-self: start; }
button.step-moves {
  appearance: none; background: none; border: 0; margin: 0; padding: 0; cursor: pointer; text-align: left;
  text-decoration: underline 2px; text-decoration-color: rgba(18, 19, 20, .3); text-underline-offset: 4px;
}
button.step-moves:hover { text-decoration-color: var(--ink); }
.steps li.is-on button.step-moves { text-decoration-color: transparent; }
.step-text { font-size: 16px; line-height: 1.5; color: var(--ink-soft); }

/* A diagram beside its explanation --------------------------------------- */
.guide .pair { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 16px 26px; align-items: start; margin-top: 14px; }
.pair > div > p + p { margin-top: 12px; }

/* What to play against each defence ------------------------------------ */
.table-wrap { margin-top: 18px; }
.defences { width: 100%; border-collapse: separate; border-spacing: 0; border: var(--stroke) solid var(--ink); border-radius: 22px; overflow: hidden; font-size: 15.5px; line-height: 1.45; }
.defences th, .defences td { text-align: left; vertical-align: top; padding: 13px 15px 14px; border-bottom: 2px dashed rgba(18, 19, 20, .25); }
.defences thead th { background: var(--ink); color: var(--paper); font: 600 15px/1.2 var(--display); border-bottom: 0; }
.defences tbody th { width: 26%; font: 600 16.5px/1.3 var(--display); }
.defences td:last-child { color: var(--ink-soft); }
.defences tbody tr:nth-child(odd) { background: #FFF4D2; }
.defences tbody tr:last-child > * { border-bottom: 0; }

/* Bertie's three questions --------------------------------------------- */
.guide .bertie-tip { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 20px; align-items: center; margin-top: 28px; }
.bertie-tip bertie-coach { width: 104px; }
.bertie-tip .bubble { background: var(--yellow); }
.bertie-tip .bubble p { font-size: 16.5px; line-height: 1.5; }
.bertie-tip .tip-head { font: 700 19px/1.2 var(--display); margin-bottom: 6px; }

/* For and against ------------------------------------------------------ */
.guide .verdicts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.verdict { border: 2.5px solid var(--ink); border-radius: 22px; padding: 16px 18px 18px; background: #E3F6EA; }
.verdict + .verdict { background: #FFF4D2; }
.guide .verdict h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 20px; }
.verdict .sym { min-width: 38px; height: 30px; font-size: 17px; }
.guide .verdict ul { margin: 0; padding-left: 1.1em; }
.verdict li { font-size: 16px; line-height: 1.5; }
.guide .verdict li + li { margin-top: 6px; }

/* Learn it in the app -------------------------------------------------- */
.guide .guide-cta { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 18px 24px; align-items: center; margin-top: 30px; background: var(--yellow); border: var(--stroke) solid var(--ink); border-radius: 26px; padding: 22px 26px 26px 18px; }
.guide-cta bertie-coach { width: 116px; }
.guide .guide-cta h3 { margin: 0 0 8px; font-size: clamp(24px, 2.4vw, 30px); font-weight: 700; }
.guide .guide-cta p { font-size: 16.5px; line-height: 1.55; color: var(--ink-soft); }
.guide-cta .cta-row { margin-top: 18px; }

.guide .faq-list { margin-top: 18px; }

/* Responsive ------------------------------------------------------- */
@media (max-width: 980px) {
  /* The contents become one row of chips that stays under the header and scrolls sideways. */
  :root { --toc-h: 58px; }
  .guide-toc {
    position: sticky; top: var(--header-h); z-index: 30; margin: 0 calc(-1 * var(--gutter));
    padding: 10px var(--gutter) 11px; background: var(--yellow); border-bottom: 2px dashed rgba(18, 19, 20, .3);
  }
  .guide-toc p { display: none; }
  .guide-toc ol { position: relative; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .guide-toc ol::-webkit-scrollbar { display: none; }
  .guide-toc a { white-space: nowrap; }
  .guide [id], .guide .player { scroll-margin-top: calc(var(--header-h) + var(--toc-h) + 12px); }
}
@media (max-width: 760px) {
  .guide .map, .guide .pictures { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
  .map .diagram, .pictures .diagram { scroll-snap-align: start; max-width: none; }
  .glance-grid, .player-stage { grid-template-columns: minmax(0, 1fr); }
  .glance-grid .diagram, .player-side { max-width: 320px; }
  .player-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -8px; padding: 2px 8px 6px; }
  .player-tabs::-webkit-scrollbar { display: none; }
  .player-tab { white-space: nowrap; }
  .facts > div { grid-template-columns: minmax(0, 7.4em) minmax(0, 1fr); padding-inline: 13px; }
  .guide .stat-row { grid-template-columns: minmax(0, 1fr); }
  .stat strong { display: inline; margin: 0 6px 0 0; font-size: 26px; }
  .rates th, .rates td { padding: 9px 10px 10px; font-size: 14.5px; }
  .rates thead th { font-size: 13.5px; }
  /* Four columns fit a phone: the games count goes, and each rating stays on one line. */
  .rates th:nth-child(2), .rates td:nth-child(2) { display: none; }
  .rates tbody th, .rates td { white-space: nowrap; }
}
@media (max-width: 760px) {
  /* The board and its buttons stay in view while the moves scroll past underneath. */
  .guide .stepper { grid-template-columns: minmax(0, 1fr); }
  .stepper-side {
    top: calc(var(--header-h) + var(--toc-h)); z-index: 2; grid-template-columns: minmax(0, 176px) minmax(0, 1fr); gap: 14px; align-items: end;
    margin: 0 -8px; padding: 10px 8px 12px; background: var(--paper); border-bottom: 2px dashed rgba(18, 19, 20, .25);
  }
  .stepper-controls { flex-direction: column; }
  .stepper-controls .btn-small { white-space: nowrap; padding-inline: 12px; }
}
@media (max-width: 640px) {
  .guide .pair { grid-template-columns: minmax(0, 1fr); }
  .diagram { max-width: 300px; }
  .guide .verdicts { grid-template-columns: minmax(0, 1fr); }
  .guide .bertie-tip { grid-template-columns: 76px minmax(0, 1fr); gap: 16px; }
  .bertie-tip bertie-coach { width: 76px; }
  .guide .guide-cta { grid-template-columns: minmax(0, 1fr); padding: 20px 18px 22px; }
  .guide-cta bertie-coach { width: 92px; }

  /* The table becomes one card per defence. */
  .defences thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .defences, .defences tbody, .defences tr, .defences th, .defences td { display: block; width: auto; }
  .defences tbody tr { padding: 14px 16px 16px; border-bottom: 2px dashed rgba(18, 19, 20, .25); }
  .defences tbody tr:last-child { border-bottom: 0; }
  .defences tbody th, .defences td { width: auto; padding: 0; border: 0; }
  .defences td::before { content: attr(data-label); display: block; margin-top: 10px; font: 600 12.5px/1.3 var(--text); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
}
