/* Non-critical site styles (loaded without blocking render). Bump ?v= in BaseLayout when changed. */
.muted{color:var(--ink-3)}
.row{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
.row.between{justify-content:space-between}
.fine{font-size:var(--step--1);color:var(--ink-3);line-height:1.5}
.h-sm{font-size:var(--step-2);margin-bottom:1rem}
.linklike{background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer;font:inherit}
.translate-note{background:var(--paper-3);font-size:.92rem;padding:.6rem 0;border-bottom:1px solid var(--rule)}

/* Breadcrumbs */
.crumbs{padding-top:1rem}
.crumbs ol{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.25rem;font-size:.86rem;color:var(--ink-3)}
.crumbs li+li::before{content:"/";margin-right:.35rem;color:var(--rule)}
.crumbs a{color:var(--ink-2);text-decoration:none}
.crumbs a:hover{text-decoration:underline}

/* Page scaffolding */
.page-head{padding:clamp(1.5rem,4vw,3rem) 0 clamp(1rem,2.5vw,1.75rem)}
.page-head h1{font-size:var(--step-4);max-width:18ch}
.page-head .lede{margin-top:1rem;font-size:var(--step-1);color:var(--ink-2);max-width:60ch;line-height:1.5}
.section{padding:clamp(2.5rem,6vw,5rem) 0}
.section-tight{padding:clamp(1.5rem,4vw,3rem) 0}
.section-rule{border-top:1px solid var(--rule)}
.section h2{font-size:var(--step-3);margin-bottom:1rem;max-width:22ch}
.section-intro{max-width:62ch;color:var(--ink-2);margin-bottom:1.75rem}
.band-night{background:var(--night);color:var(--night-text)}
.band-night .section-intro,.band-night p{color:var(--night-muted)}
.band-night a{color:#d9d3ff}
.band-paper2{background:var(--paper-2)}
.split{display:grid;gap:clamp(1.5rem,4vw,3.5rem);grid-template-columns:minmax(0,1fr)}
@media (min-width:900px){.split{grid-template-columns:1fr 1fr;align-items:start}.split-wide{grid-template-columns:1.35fr 1fr}}

/* Prose */
.prose{max-width:var(--measure)}
.prose>*+*{margin-top:1.05em}
.prose h2{font-size:var(--step-2);margin-top:2.2em;max-width:none}
.prose h3{font-size:var(--step-1);margin-top:1.8em}
.prose h4{font-size:1.02rem;margin-top:1.5em;font-family:var(--f-body);letter-spacing:0}
.prose ul,.prose ol{padding-left:1.3rem}
.prose li+li{margin-top:.35em}
.prose blockquote{margin:1.5em 0;padding:.2em 0 .2em 1.1em;border-left:1px solid var(--ink-3);color:var(--ink-2)}
.prose table{width:100%;border-collapse:collapse;font-size:.94rem;display:block;overflow-x:auto}
.prose th,.prose td{text-align:left;padding:.6rem .7rem;border-bottom:1px solid var(--rule);vertical-align:top}
.prose th{font-weight:700;background:var(--paper-3)}
.prose code{font-size:.9em;background:var(--paper-3);padding:.1em .35em;border-radius:4px}
.prose figure{margin:1.6em 0}
.prose figcaption{font-size:.86rem;color:var(--ink-3);margin-top:.5rem}
.prose .answer{font-size:var(--step-1);line-height:1.5;color:var(--ink)}
.callout{padding:1rem 1.2rem;border-radius:var(--r-2);background:var(--paper-3)}
.callout strong:first-child{display:block;margin-bottom:.2rem}
.toc{padding:1rem 1.2rem;border-radius:var(--r-2);border:1px solid var(--rule);background:var(--paper-2);font-size:.95rem}
.toc ol{margin:.4rem 0 0;padding-left:1.2rem}
.byline{display:flex;flex-wrap:wrap;gap:.25rem .9rem;color:var(--ink-3);font-size:.9rem;margin-top:1rem}

/* Cards and lists of puzzles */
.card-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr))}
.p-card{position:relative;display:grid;gap:.6rem;padding:1rem;border-radius:var(--r-3);background:var(--paper-2);border:1px solid var(--rule);text-decoration:none;color:var(--ink);transition:transform var(--dur-2) var(--ease-out),box-shadow var(--dur-2) var(--ease-out),border-color var(--dur-1)}
.p-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-2);border-color:transparent}
.p-card h3{font-size:1.15rem;letter-spacing:-.01em}
.p-card p{font-size:.92rem;color:var(--ink-2)}
.p-card .meta{font-size:.82rem;color:var(--ink-3)}
.p-card .stretched::after{content:"";position:absolute;inset:0;border-radius:inherit}
.p-card a{color:inherit;text-decoration:none}
.mini-grid{display:grid;gap:0;aspect-ratio:1;width:100%;padding:8%;border-radius:var(--r-2);font-weight:700;color:rgb(0 0 0/.72);font-size:clamp(.5rem,1.6vw,.72rem);line-height:1;user-select:none}
.mini-grid span{display:grid;place-items:center}
.mini-grid .hl{background:rgb(255 255 255/.55);border-radius:3px}
.topic-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(min(100%,270px),1fr))}
.t-card{position:relative;display:grid;grid-template-rows:auto 1fr;border-radius:var(--r-3);overflow:hidden;text-decoration:none;color:var(--card-ink);background:var(--card);min-height:220px;transition:transform var(--dur-2) var(--ease-out),box-shadow var(--dur-2)}
.t-card:hover{transform:translateY(-3px) rotate(-.4deg);box-shadow:var(--shadow-2)}
.t-card .t-body{padding:1.1rem 1.2rem;display:grid;gap:.35rem;align-content:start}
.t-card h3{font-size:1.4rem}
.t-card p{font-size:.9rem;opacity:.86}
.t-card img{width:100%;height:150px;object-fit:cover;object-position:center 40%}
.badge{display:inline-flex;align-items:center;gap:.3rem;padding:.15rem .6rem;border-radius:var(--r-pill);font-size:.75rem;font-weight:700;background:var(--paper-3);color:var(--ink-2)}
.badge-lp{background:var(--accent);color:var(--accent-ink)}

/* Filter bar on collections (state on canonical page, not separate URLs) */
.filters{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;margin-bottom:1.25rem}
.filters label{display:inline-flex;gap:.4rem;align-items:center;font-size:.92rem}
.filters select{border:1px solid var(--rule);background:var(--paper-2);border-radius:var(--r-1);padding:.45rem .6rem;min-height:44px}
[data-filter-hidden]{display:none!important}

/* Steps and tables used by guides and landing pages */
.steps{counter-reset:step;list-style:none;padding:0;display:grid;gap:1rem}
.steps>li{counter-increment:step;display:grid;grid-template-columns:2.4rem 1fr;gap:.2rem 1rem;align-items:start}
.steps>li::before{content:counter(step);grid-row:1/3;display:grid;place-items:center;width:2.4rem;height:2.4rem;border-radius:50%;background:var(--ink);color:var(--paper);font-weight:700;font-family:var(--f-display)}
.steps h3{font-size:1.1rem;margin-top:.35rem}
.data-table{width:100%;border-collapse:collapse;font-size:.95rem}
.data-table caption{text-align:left;font-weight:700;margin-bottom:.5rem}
.data-table th,.data-table td{text-align:left;padding:.65rem .7rem;border-bottom:1px solid var(--rule);vertical-align:top}
.data-table thead th{background:var(--paper-3)}
.table-scroll{overflow-x:auto;max-width:100%}

/* FAQ */
.faq-list{display:grid;gap:.5rem;max-width:var(--measure)}
.faq-list details{border:1px solid var(--rule);border-radius:var(--r-2);background:var(--paper-2)}
.faq-list summary{cursor:pointer;padding:1rem 1.1rem;font-weight:700;min-height:44px;list-style-position:inside}
.faq-list details>div{padding:0 1.1rem 1rem}

/* Ads: reserved, labeled, only when enabled */
/* Ads: zero footprint until AdSense reports the slot filled; unfilled slots stay collapsed. */
.ad-slot{margin:0 auto;max-width:var(--wrap);display:grid;justify-items:center;gap:0}
.ad-slot .ad-label{display:none;font-size:.72rem;color:var(--ink-3);text-transform:uppercase;letter-spacing:.08em}
.ad-slot ins{display:block;width:100%}
.ad-slot ins:not([data-ad-status=filled]){height:0!important;min-height:0!important;overflow:hidden}
.ad-slot ins[data-ad-status=unfilled]{display:none!important}
.ad-slot:has(ins[data-ad-status=filled]){margin:2rem auto;gap:.3rem}
.ad-slot:has(ins[data-ad-status=filled]) .ad-label{display:block}

/* Footer */
.site-foot{margin-top:clamp(3rem,8vw,6rem);background:var(--night);color:var(--night-muted);padding:clamp(2.5rem,6vw,4rem) 0 1.5rem;font-size:.94rem}
.site-foot .brand{color:var(--night-text)}
.foot-grid{display:grid;gap:2rem;grid-template-columns:repeat(2,minmax(0,1fr))}
.foot-brand{grid-column:1/-1;display:grid;gap:.9rem;align-content:start}
@media (min-width:960px){.foot-grid{grid-template-columns:1.5fr repeat(4,1fr)}.foot-brand{grid-column:auto}}
.foot-col h2{font-family:var(--f-body);font-size:.82rem;letter-spacing:.06em;text-transform:uppercase;color:var(--night-text);margin-bottom:.6rem}
.foot-col ul{list-style:none;margin:0;padding:0;display:grid;gap:.15rem}
.foot-col a,.foot-legal a{color:var(--night-muted);text-decoration:none;display:inline-flex;min-height:36px;align-items:center}
.foot-col a:hover,.foot-legal a:hover{color:var(--night-text);text-decoration:underline}
.foot-controls{display:flex;flex-wrap:wrap;gap:.75rem}
.ctl{display:grid;gap:.25rem;font-size:.8rem}
.ctl select{min-height:44px;border-radius:var(--r-1);border:1px solid var(--night-rule);background:var(--night-3);color:var(--night-text);padding:0 .6rem}
.site-foot .fine{color:var(--night-muted);font-size:.8rem}
.foot-legal{display:flex;flex-wrap:wrap;gap:.5rem 1.5rem;justify-content:space-between;align-items:center;margin-top:2.5rem;padding-top:1.25rem;border-top:1px solid var(--night-rule)}
.foot-legal nav{display:flex;flex-wrap:wrap;gap:.25rem 1.1rem}
.foot-legal .linklike{color:var(--night-muted);min-height:36px}

/* Interface-language RTL (Arabic): mirror chrome only; puzzle grids stay left-to-right. */
html.ui-rtl .site-head .bar,html.ui-rtl .foot-grid,html.ui-rtl .foot-legal{direction:rtl}
html.ui-rtl .ws-editor,html.ui-rtl .print-panel,html.ui-rtl .bar-actions,html.ui-rtl .words-col{direction:rtl;text-align:right}
html.ui-rtl .board-frame,html.ui-rtl .board-grid{direction:ltr}

/* 404 */
.nf-grid{font-family:var(--f-display);font-size:clamp(3rem,12vw,8rem);font-weight:800;letter-spacing:-.04em;line-height:.9}

@media print{.site-head,.site-foot,.crumbs,.ad-slot,.translate-note,.skip{display:none!important}body{background:#fff;color:#000}}

/* ── Phone sizing (≤ 640px): compact, scannable, nothing oversized ───────── */
@media (max-width:640px){
  .wrap{width:calc(100% - 2rem)}
  .page-head{padding:1.25rem 0 .9rem}
  .page-head h1{max-width:none}
  .page-head .lede{font-size:1rem;margin-top:.6rem}
  .section{padding:2.25rem 0}
  .section-tight{padding:1.5rem 0}
  .section h2{margin-bottom:.75rem}
  .section-intro{margin-bottom:1.1rem;font-size:.95rem}
  .crumbs{padding-top:.75rem}
  .crumbs ol{font-size:.8rem}
  .card-grid,.topic-grid{gap:.6rem}
  /* Topic cards become slim horizontal rows */
  .t-card{grid-template-rows:none;grid-template-columns:84px 1fr;min-height:0;align-items:center;border-radius:var(--r-2)}
  .t-card img{width:84px;height:84px;object-fit:cover;object-position:center}
  .t-card .t-body{padding:.6rem .85rem;gap:.15rem}
  .t-card h3{font-size:1.02rem}
  .t-card p{font-size:.78rem;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .t-card:hover{transform:none}
  /* Puzzle cards: thumbnail grid left, text right */
  .p-card{grid-template-columns:72px 1fr;gap:.15rem .8rem;align-items:start;padding:.75rem;border-radius:var(--r-2)}
  .p-card>.mini-grid{grid-row:1/span 3;width:72px;padding:6%;font-size:.42rem;border-radius:8px}
  .p-card>:not(.mini-grid){grid-column:2}
  .p-card h3,.p-card h4,.p-card .h-card{font-size:1rem}
  .p-card p{font-size:.84rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .p-card .meta{font-size:.74rem}
  .p-card .badge{display:none}
  .p-card:hover{transform:none}
  .prose{font-size:1rem}
  .prose h2{margin-top:1.8em}
  .steps>li{grid-template-columns:2rem 1fr;gap:.15rem .75rem}
  .steps>li::before{width:2rem;height:2rem;font-size:.9rem}
  .faq-list summary{padding:.85rem .95rem;font-size:.95rem}
  .site-foot{margin-top:2.5rem}
  .foot-grid{gap:1.5rem}
}
