/* ═══════════════════════════════════════════════════════
   Guide pages — layered on /style.css (static file, not generated).
   Semantic tokens only (brand-tokens.css); no colour literals. Phone-first
   with a 16px gutter; wide tables scroll inside .table-wrap, never the page.
   Article column ~72ch at 18px; "On this page" sits beside it from 1100px.
═══════════════════════════════════════════════════════ */

.guide-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-10) 1rem var(--space-20);
}
@media (min-width: 720px) {
  .guide-layout { padding: var(--space-16) var(--space-6) var(--space-24); }
}
.guide-wrap {
  max-width: 72ch;
  margin: 0 auto;
  font-size: 1.125rem;
  overflow-wrap: break-word;
}
.guide-hub { max-width: 1040px; }

/* Sticky table of contents (desktop only). */
.guide-toc { display: none; }
@media (min-width: 1100px) {
  .guide-layout--toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: var(--space-12);
    align-items: start;
  }
  .guide-layout--toc .guide-wrap { margin: 0; justify-self: end; width: 100%; }
  .guide-toc {
    display: block;
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--nav-h) + var(--space-6));
    max-height: calc(100vh - var(--nav-h) - var(--space-12));
    overflow-y: auto;
    padding-left: var(--space-5);
    border-left: 1px solid var(--border-subtle);
  }
}
.guide-toc-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.guide-toc ol { display: grid; gap: var(--space-2); }
.guide-toc a { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; display: block; }
.guide-toc a:hover { color: var(--brand); }

.guide-breadcrumb {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}
.guide-breadcrumb a { color: var(--text-muted); }
.guide-breadcrumb a:hover { color: var(--brand); }

.guide-wrap h1 {
  font-size: var(--text-2xl);
  line-height: 1.1;
  margin-bottom: var(--space-3);
}
.guide-reviewed {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
}
.guide-wrap h2 {
  font-size: var(--text-xl);
  color: var(--brand);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.guide-wrap h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}
.guide-wrap p,
.guide-wrap li {
  color: var(--text-primary);
  font-size: 1em;
  line-height: 1.7;
  margin-bottom: var(--space-4);
}
.guide-wrap ul,
.guide-wrap ol {
  list-style: revert;
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}
.guide-wrap li { margin-bottom: var(--space-2); }
.guide-wrap strong { color: var(--text-primary); }
.guide-wrap a:not(.guide-btn):not(.learn-card) {
  color: var(--brand);
  border-bottom: 1px solid var(--border-subtle);
  transition: color var(--transition), border-color var(--transition);
}
.guide-wrap a:not(.guide-btn):not(.learn-card):hover {
  color: var(--brand-hover);
  border-bottom-color: var(--brand);
}
.guide-wrap .guide-breadcrumb a:link,
.guide-wrap .guide-breadcrumb a:visited { color: var(--text-muted); border-bottom-color: transparent; }
.guide-wrap .guide-breadcrumb a:hover { color: var(--brand); }
.guide-wrap code {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.05em 0.35em;
  font-size: 0.9em;
}
.guide-wrap pre {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  overflow-x: auto;
}
.guide-wrap pre code { background: none; border: 0; padding: 0; }
.guide-wrap img { max-width: 100%; height: auto; }
/* Callouts ("Dubai house rules differ here") are Markdown blockquotes. */
.guide-wrap blockquote {
  border-left: 4px solid var(--accent-gold);
  background: var(--accent-gold-soft);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-6) 0;
}
.guide-wrap blockquote p:last-child { margin-bottom: 0; }

/* ─── Tables (own scroll container) ────────────────────── */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-6) 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.guide-wrap table { border-collapse: collapse; width: 100%; }
.guide-wrap > table { margin: var(--space-6) 0; }
.guide-wrap .table-wrap table { min-width: 34rem; }
.guide-wrap th,
.guide-wrap td {
  text-align: left;
  vertical-align: middle;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-primary);
}
.guide-wrap thead th {
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.guide-wrap tbody tr:nth-child(even) td { background: var(--surface-panel); }
.guide-wrap tbody tr:last-child td,
.guide-wrap tfoot th,
.guide-wrap tfoot td { border-bottom: 0; }
.guide-wrap tfoot th,
.guide-wrap tfoot td { background: var(--surface-sunken); color: var(--text-primary); }
.guide-wrap td.num { white-space: nowrap; font-weight: 650; color: var(--brand); }
.guide-wrap .table-wrap .guide-breakdown { min-width: 0; }
/* Plain Markdown tables have no .table-wrap: on phones a wide one scrolls itself, never the page. */
@media (max-width: 640px) {
  .guide-wrap > table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ─── Tile art ─────────────────────────────────────────── */
.tiles {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0;
}
.tile-group { display: inline-flex; flex-wrap: wrap; gap: 1px; max-width: 100%; }
.tile {
  width: 30px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 3px;
  box-shadow: 0 1px 2px var(--tile-shadow);
}
@media (min-width: 720px) {
  .tile { width: 34px; height: 45px; }
}
.guide-table .tile { width: 24px; height: 32px; }
/* Tile names are real text for crawlers and screen readers (the strip itself is an image). */
.tiles figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.guide-table td.example { min-width: 9rem; }

/* ─── Worked-example hands ─────────────────────────────── */
.guide-hand {
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-gold);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  padding: var(--space-5) 1rem;
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-sm);
}
.guide-wrap .guide-hand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}
.guide-hand-row { margin-bottom: var(--space-3); }
.tiles-label {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}
.guide-wrap .guide-hand-meta {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: var(--space-3) 0 0;
}
.guide-score { margin: var(--space-4) 0 0; }

/* ─── Buttons / calls to action ────────────────────────── */
.guide-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 650;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  transition: background var(--transition), transform var(--transition);
}
.guide-btn:hover { background: var(--brand-hover); transform: translateY(-1px); }
.guide-btn-secondary {
  background: var(--surface-raised);
  color: var(--brand);
  border-color: var(--border-strong);
}
.guide-btn-secondary:hover { background: var(--brand-soft); }

.guide-cta {
  border: 1px solid var(--border-subtle);
  background: var(--brand-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  margin: var(--space-12) 0 var(--space-8);
}
.guide-wrap .guide-cta h2 { margin-top: 0; border-bottom: 0; padding-bottom: 0; }
.guide-wrap .guide-cta p:last-child { margin-bottom: 0; }
.guide-cta-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.guide-related { margin-top: var(--space-8); }
.guide-wrap .guide-related h2 { font-size: var(--text-lg); }

/* Previous / next in the series. */
.guide-series {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.guide-wrap .guide-series a {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.guide-wrap .guide-series a:hover { border-color: var(--border-strong); }
.guide-series-next { text-align: right; grid-column: 2; }
.guide-series-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.guide-series-title { font-weight: 600; color: var(--text-primary); line-height: 1.35; }
@media (max-width: 560px) {
  .guide-series { grid-template-columns: 1fr; }
  .guide-series-next { grid-column: 1; }
}

/* Guides hub cards reuse .learn-grid from style.css. */
.guide-hub .learn-grid { list-style: none; padding: 0; margin-bottom: var(--space-4); }
.guide-hub .learn-grid li { margin: 0; }
.guide-hub .learn-card { border-bottom: 1px solid var(--border-subtle); }

/* ─── Draft banner + build problems ────────────────────── */
.guide-banner {
  background: color-mix(in srgb, var(--accent-rose) 14%, var(--surface-app));
  border-bottom: 1px solid var(--accent-rose);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: var(--space-3) 1rem;
}
.guide-banner p,
.guide-banner li { margin: 0; line-height: 1.5; }
.guide-banner ul { margin: var(--space-2) 0 0; padding-left: var(--space-6); list-style: disc; }
.guide-problem {
  background: color-mix(in srgb, var(--accent-rose) 12%, var(--surface-app));
  border: 1px solid var(--accent-rose);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
}
