/* ============================================================
   HTML Formatter Online — site.css
   Design: "the indent ladder" — nesting as structure.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --paper:      #FCFCFD;
  --panel:      #FFFFFF;
  --panel-2:    #F4F6FA;
  --code-bg:    #F7F8FC;
  --ink:        #101B2D;
  --ink-soft:   #55647C;
  --ink-faint:  #627088;
  --rule:       #DEE4EE;
  --rule-soft:  #EDF0F6;
  --indigo:     #3B4FE4;
  --indigo-ink: #2A3ABF;
  --indigo-wash:#EEF0FE;
  --amber:      #B7791F;
  --amber-wash: #FDF6E7;
  --moss:       #17714A;
  --moss-wash:  #EAF7F1;
  --crimson:    #B93131;
  --crimson-wash:#FDEEEE;

  --step: 28px;
  --shell: 1180px;
  --r-lg: 14px;
  --r-md: 9px;
  --r-sm: 5px;

  --shadow: 0 1px 2px rgba(16, 27, 45, .05), 0 8px 28px -18px rgba(16, 27, 45, .35);
}

[data-theme="dark"] {
  --paper:      #0D1420;
  --panel:      #141E2E;
  --panel-2:    #1A2537;
  --code-bg:    #0A1019;
  --ink:        #E6ECF6;
  --ink-soft:   #9AAAC3;
  --ink-faint:  #7D8EA9;
  --rule:       #26334A;
  --rule-soft:  #1D2839;
  --indigo:     #8697FF;
  --indigo-ink: #A6B2FF;
  --indigo-wash:#1B2340;
  --amber:      #E0AA52;
  --amber-wash: #2A2317;
  --moss:       #4FC48B;
  --moss-wash:  #12261D;
  --crimson:    #F08A8A;
  --crimson-wash:#2A1719;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -20px rgba(0,0,0,.9);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

body {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, pre, .mono, kbd {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-feature-settings: "liga" 0;
}

h1, h2, h3, h4 {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.018em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.05rem, 1.35rem + 2.4vw, 3.1rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); }
h3 { font-size: 1.16rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }

a { color: var(--indigo-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--indigo); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip:focus { left: 0; }

/* ---------- layout ---------- */
.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: 22px; }
.narrow { max-width: 760px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar .shell { display: flex; align-items: center; gap: 18px; height: 62px; }

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--indigo); color: #fff;
  display: grid; place-items: center;
  font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 600;
  letter-spacing: -0.05em;
}
.brand-name {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700;
  font-size: 1.02rem; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1;
}
.brand-name span { display: block; font-size: .75rem; font-weight: 400; letter-spacing: .01em; color: var(--ink-faint); font-family: "IBM Plex Sans", sans-serif; }

.mainnav { margin-left: auto; display: flex; align-items: center; gap: 2px; }

.navlink, .navbtn {
  font: inherit; font-size: .93rem;
  color: var(--ink-soft); background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.navlink:hover, .navbtn:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.navlink[aria-current="page"], .navbtn.on { color: var(--indigo-ink); background: var(--indigo-wash); }
.navbtn .chev { width: 13px; height: 13px; opacity: .55; transition: transform .16s ease; }
.navbtn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.navitem { position: relative; }
.navpanel {
  position: absolute; top: calc(100% + 1px); left: 50%; transform: translateX(-50%);
  min-width: 330px; max-width: 380px; z-index: 80;
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 6px; display: none;
}
.navitem:hover > .navpanel,
.navbtn[aria-expanded="true"] + .navpanel { display: block; }
.navpanel a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--ink); }
.navpanel a:hover { background: var(--panel-2); text-decoration: none; }
.navpanel a strong { display: block; font-size: .91rem; font-weight: 500; line-height: 1.35; }
.navpanel a span { display: block; font-size: .8rem; color: var(--ink-faint); line-height: 1.45; margin-top: 1px; }
.navpanel a[aria-current="page"] { background: var(--indigo-wash); }
.navpanel a[aria-current="page"] strong { color: var(--indigo-ink); }

.icon-btn {
  width: 34px; height: 34px;
  position: relative; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--panel); cursor: pointer; color: var(--ink-soft); flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.icon-btn svg { width: 16px; height: 16px; }
#theme-toggle .moon { display: none; }
[data-theme="dark"] #theme-toggle .moon { display: block; }
[data-theme="dark"] #theme-toggle .sun { display: none; }

.navtoggle { display: none; }

@media (max-width: 1020px) {
  .mainnav {
    position: fixed; inset: 62px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--panel); border-bottom: 1px solid var(--rule);
    padding: 8px 18px 18px; box-shadow: var(--shadow);
    max-height: calc(100vh - 62px); overflow-y: auto;
    display: none;
  }
  .mainnav.open { display: flex; }
  .navlink, .navbtn {
    width: 100%; justify-content: space-between;
    padding: 13px 8px; border-radius: 0;
    border-bottom: 1px solid var(--rule-soft); font-size: 1rem;
  }
  .navitem { position: static; }
  .navpanel {
    position: static; transform: none; min-width: 0; max-width: none;
    border: 0; box-shadow: none; background: var(--panel-2);
    border-radius: 0 0 var(--r-sm) var(--r-sm); padding: 4px;
    margin-bottom: 6px;
  }
  .navitem:hover > .navpanel { display: none; }
  .navbtn[aria-expanded="true"] + .navpanel { display: block; }
  .navbtn[aria-expanded="true"] { border-bottom-color: transparent; }
  .navtoggle { display: grid; margin-left: auto; }
  .topbar .shell { gap: 10px; }
}

/* ---------- hero ---------- */
.lede { padding-block: 44px 26px; }
.lede p.sub {
  margin-top: 14px; font-size: 1.06rem; color: var(--ink-soft); max-width: 62ch;
}
.lede .trust {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; color: var(--ink-soft);
  background: var(--panel-2); border: 1px solid var(--rule-soft);
  padding: 4px 11px; border-radius: 999px;
}
.chip b { font-weight: 500; color: var(--ink); }

/* breadcrumb */
.crumbs { font-size: .82rem; color: var(--ink-faint); padding-top: 22px; }
.crumbs a { color: var(--ink-soft); }
.crumbs span { padding: 0 6px; }

/* ---------- the studio (tool) ---------- */
.studio {
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
}
.studio-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--rule);
  background: var(--panel-2);
}
.modes { display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 3px; }
.modes button {
  border: 0; background: transparent; cursor: pointer;
  font-size: .86rem; font-weight: 500; color: var(--ink-soft);
  padding: 6px 14px; border-radius: 6px;
}
.modes button:hover { color: var(--ink); }
.modes button[aria-pressed="true"] { background: var(--indigo); color: #fff; }

.opts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-left: auto; font-size: .85rem; color: var(--ink-soft); }
.opts label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.opts select {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 5px 8px; font-size: .84rem; cursor: pointer;
}
.opts input[type="checkbox"] { accent-color: var(--indigo); width: 15px; height: 15px; cursor: pointer; }

.panes { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: stretch; }

.pane { display: flex; flex-direction: column; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--rule); }
.pane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--rule-soft);
  font-size: .82rem; color: var(--ink-faint);
}
.pane-head strong { font-weight: 600; color: var(--ink); font-size: .87rem; }
.pane-head .spacer { margin-left: auto; }
.mini {
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink-soft);
  font-size: .78rem; padding: 4px 9px; border-radius: var(--r-sm); cursor: pointer;
}
.mini:hover { color: var(--ink); border-color: var(--ink-faint); }
.mini.ok { color: var(--moss); border-color: var(--moss); }

.pane textarea {
  width: 100%; flex: 1; min-height: 330px; resize: vertical;
  border: 0; outline: 0; background: var(--code-bg);
  font-size: 13px; line-height: 1.62; padding: 14px 16px;
  color: var(--ink); tab-size: 2; white-space: pre; overflow: auto;
}
.pane textarea::placeholder { color: var(--ink-faint); }
#out.flash { animation: wipe .4s ease-out; }
@keyframes wipe {
  from { clip-path: inset(0 0 100% 0); opacity: .35; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}

.gutter {
  display: grid; place-items: center; gap: 10px;
  background: var(--panel-2); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule);
  padding: 12px 0;
}
.run {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--indigo); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px -8px var(--indigo);
  transition: transform .15s ease, background .15s ease;
}
.run:hover { background: var(--indigo-ink); transform: scale(1.06); }
.run:active { transform: scale(.96); }
.run svg { width: 19px; height: 19px; }
.gutter .tiny { font-size: .75rem; color: var(--ink-faint); writing-mode: vertical-rl; letter-spacing: .04em; }

.studio-foot {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 11px 14px; border-top: 1px solid var(--rule); background: var(--panel-2);
  font-size: .84rem; color: var(--ink-soft); min-height: 46px;
}
#metrics { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.metric { display: inline-flex; align-items: baseline; gap: 6px; }
.metric span { font-size: .76rem; color: var(--ink-faint); }
.metric b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.delta { font-weight: 600; }
.delta.down { color: var(--moss); }
.delta.up { color: var(--amber); }
.foot-actions { margin-left: auto; display: flex; gap: 8px; }

.report { padding: 0; border-top: 1px solid var(--rule); display: none; }
.report.show { display: block; }
.report-head { padding: 11px 16px; font-size: .88rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.report.pass .report-head { background: var(--moss-wash); color: var(--moss); }
.report.fail .report-head { background: var(--crimson-wash); color: var(--crimson); }
.report ol { margin: 0; padding: 10px 16px 14px 34px; font-size: .88rem; color: var(--ink-soft); }
.report li { margin-bottom: 5px; }
.report li code { background: var(--code-bg); padding: 1px 5px; border-radius: 3px; font-size: .84em; color: var(--ink); }

@media (max-width: 860px) {
  .panes { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--rule); }
  .gutter {
    flex-direction: row; grid-auto-flow: column;
    border: 0; border-top: 1px solid var(--rule); padding: 10px 0;
  }
  .gutter .tiny { writing-mode: horizontal-tb; }
  .pane textarea { min-height: 230px; }
  .opts { margin-left: 0; width: 100%; }
}

/* ---------- sections: the indent ladder ---------- */
.rung {
  position: relative;
  border-left: 1px solid var(--rule);
  padding: 40px 0 40px var(--step);
  margin-left: 2px;
}
.rung > h2, .rung > h1 { position: relative; }
.rung > h2::before, .rung > h1::before {
  content: ""; position: absolute; top: .62em; left: calc(var(--step) * -1);
  width: 17px; height: 1px; background: var(--indigo);
}
.rung > p, .rung > ul, .rung > ol { max-width: 74ch; color: var(--ink-soft); }
.rung > h2 + p, .rung > h1 + p { margin-top: 14px; }
.rung > p + p { margin-top: 14px; }
.rung h3 { margin-top: 26px; }
.rung h3 + p { margin-top: 8px; }

.prose p { color: var(--ink-soft); max-width: 74ch; }
.prose p + p, .prose ul + p, .prose ol + p, .prose p + ul, .prose p + ol { margin-top: 14px; }
.prose h3 { margin-top: 30px; }
.prose h3 + p { margin-top: 8px; }
.prose ul, .prose ol { padding-left: 22px; color: var(--ink-soft); max-width: 74ch; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--ink-faint); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  background: var(--code-bg); border: 1px solid var(--rule-soft);
  padding: 1px 5px; border-radius: 4px; font-size: .86em; color: var(--ink);
}

.lead { font-size: 1.06rem; }

/* code sample block */
.sample {
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: var(--r-md);
  overflow: hidden; margin-top: 16px;
}
.sample-label {
  padding: 7px 13px; font-size: .76rem; color: var(--ink-faint);
  border-bottom: 1px solid var(--rule-soft); background: var(--panel-2);
}
.sample pre { padding: 13px 15px; overflow-x: auto; font-size: 12.6px; line-height: 1.7; color: var(--ink); }
.sample.good .sample-label { color: var(--moss); }
.sample.bad .sample-label { color: var(--crimson); }
.sample.bad pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; align-items: start; }
@media (max-width: 700px) { .pair { grid-template-columns: 1fr; } }

/* ---------- grids & cards ---------- */
.grid { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; margin-top: 22px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.cell { background: var(--panel); padding: 20px 22px; }
.cell h3 { font-size: 1.03rem; }
.cell p { margin-top: 7px; font-size: .92rem; color: var(--ink-soft); }
.cell .glyph { font-family: "IBM Plex Mono", monospace; color: var(--indigo); font-size: .82rem; margin-bottom: 9px; }
@media (max-width: 880px) { .grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.three, .grid.two { grid-template-columns: 1fr; } }

/* tool link cards */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 12px; margin-top: 22px; }
.tool {
  display: block; border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 16px 18px; background: var(--panel); color: inherit;
  transition: border-color .15s ease;
}
.tool:hover { text-decoration: none; border-color: var(--indigo); }
.tool h3 { font-size: 1rem; color: var(--ink); }
.tool p { font-size: .87rem; color: var(--ink-soft); margin-top: 5px; }
.tool .go { display: inline-block; margin-top: 10px; font-size: .83rem; color: var(--indigo-ink); font-weight: 500; }

/* steps (a genuine sequence) */
.steps { counter-reset: s; margin-top: 22px; display: grid; gap: 2px; }
.stepitem {
  counter-increment: s; position: relative;
  padding: 18px 20px 18px 62px; background: var(--panel);
  border: 1px solid var(--rule);
}
.steps .stepitem:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.steps .stepitem:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.steps .stepitem + .stepitem { border-top: 0; }
.stepitem::before {
  content: counter(s); position: absolute; left: 20px; top: 19px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--indigo-wash); color: var(--indigo-ink);
  font-family: "IBM Plex Mono", monospace; font-size: .8rem; font-weight: 600;
  display: grid; place-items: center;
}
.stepitem h3 { font-size: 1.02rem; }
.stepitem p { margin-top: 6px; font-size: .93rem; color: var(--ink-soft); }

/* table */
.tablewrap { margin-top: 20px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; min-width: 480px; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--rule-soft); }
thead th { background: var(--panel-2); font-weight: 600; font-size: .85rem; color: var(--ink); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { color: var(--ink-soft); }
td:first-child { color: var(--ink); }
.yes { color: var(--moss); font-weight: 600; }
.no  { color: var(--ink-faint); }

/* faq */
.faq { margin-top: 22px; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.faq details { border-bottom: 1px solid var(--rule); background: var(--panel); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; padding: 15px 44px 15px 18px; position: relative;
  font-weight: 500; color: var(--ink); list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-family: "IBM Plex Mono", monospace; color: var(--indigo); font-size: 1.1rem;
}
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { background: var(--panel-2); }
.faq .answer { padding: 4px 18px 18px; color: var(--ink-soft); font-size: .95rem; max-width: 78ch; }
.faq .answer p + p { margin-top: 12px; }

/* callout */
.note {
  margin-top: 20px; padding: 16px 18px; border-radius: var(--r-md);
  background: var(--indigo-wash); border: 1px solid color-mix(in srgb, var(--indigo) 25%, transparent);
  font-size: .94rem; color: var(--ink-soft);
}
.note strong { color: var(--ink); }
.note.warn { background: var(--amber-wash); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }

/* cta band */
.band {
  margin: 46px 0; padding: 28px 30px; border-radius: var(--r-lg);
  background: var(--panel); border: 1px solid var(--rule);
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.band h2 { font-size: 1.35rem; }
.band p { color: var(--ink-soft); font-size: .95rem; margin-top: 6px; max-width: 56ch; }
.band .btn { margin-left: auto; }
@media (max-width: 640px) { .band .btn { margin-left: 0; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--indigo); color: #fff; font-weight: 500; font-size: .95rem;
  padding: 11px 22px; border-radius: var(--r-md); border: 0; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--indigo-ink); text-decoration: none; color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); border-color: var(--ink-faint); }

/* ad slot */
.ad {
  margin: 34px auto; max-width: 100%; min-height: 90px;
  display: grid; place-items: center;
  border: 1px dashed var(--rule); border-radius: var(--r-md);
  color: var(--ink-faint); font-size: .74rem; background: var(--panel-2);
}
.ad:empty::after { content: "Advertisement"; }

/* related */
.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.related a {
  font-size: .87rem; padding: 7px 13px; border: 1px solid var(--rule);
  border-radius: 999px; color: var(--ink-soft); background: var(--panel);
}
.related a:hover { border-color: var(--indigo); color: var(--indigo-ink); text-decoration: none; }

/* forms */
.field { margin-top: 16px; max-width: 520px; }
.field label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule);
  border-radius: var(--r-md); background: var(--panel); font-size: .95rem;
}
.field textarea { min-height: 140px; resize: vertical; font-family: inherit; }

/* sitemap page */
.maplist { margin-top: 24px; display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.maplist h3 { font-size: .98rem; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.maplist ul { list-style: none; margin-top: 10px; }
.maplist li { margin-bottom: 7px; font-size: .92rem; }
.maplist a { color: var(--ink-soft); }
.maplist a:hover { color: var(--indigo-ink); }

/* 404 */
.lost { padding: 80px 0; text-align: center; }
.lost pre { display: inline-block; text-align: left; margin: 22px auto 0; }

/* ---------- dark-mode contrast on filled controls ---------- */
[data-theme="dark"] .modes button[aria-pressed="true"],
[data-theme="dark"] .run,
[data-theme="dark"] .btn,
[data-theme="dark"] .btn:hover,
[data-theme="dark"] .skip,
[data-theme="dark"] .skip:focus,
[data-theme="dark"] .brand-mark { color: #0B1119; }
[data-theme="dark"] .btn.ghost { color: var(--ink); }
[data-theme="dark"] .btn.ghost:hover { color: var(--ink); }

/* ---------- footer ---------- */
footer {
  margin-top: 60px; border-top: 1px solid var(--rule); background: var(--panel);
  padding: 42px 0 30px;
}
.fgrid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }

.fgrid ul { list-style: none; }
.fgrid li { margin-bottom: 8px; }
.fgrid a { color: var(--ink-soft); font-size: .89rem; }
.fgrid a:hover { color: var(--indigo-ink); }
.fabout p { color: var(--ink-soft); font-size: .89rem; margin-top: 10px; max-width: 34ch; }
.fbottom {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--rule-soft);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: .83rem; color: var(--ink-faint);
}
.fbottom nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 820px) { .fgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .fgrid { grid-template-columns: 1fr; } .fbottom nav { margin-left: 0; } }

/* footer column labels — nav landmarks, not document headings */
.fcol-title { font-size: .84rem; color: var(--ink); margin-bottom: 12px; font-weight: 600; }

/* ============================================================
   Generators — form on the left, live output on the right
   ============================================================ */
.gen {
  display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .gen { grid-template-columns: 1fr; } }

.gen-form {
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--shadow);
  padding: 6px 18px 18px; max-height: 720px; overflow-y: auto;
}
.gengroup { border: 0; padding: 0; margin: 16px 0 0; }
.gengroup > legend {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 600;
  font-size: .95rem; color: var(--ink); padding: 0 0 8px;
  border-bottom: 1px solid var(--rule-soft); width: 100%; margin-bottom: 12px;
}
.gnote { font-size: .83rem; color: var(--ink-faint); margin: -4px 0 12px; }

.gen-form .field { margin: 0 0 14px; max-width: none; position: relative; }
.gen-form label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; color: var(--ink); }
.gen-form .hint { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-faint); margin-top: 2px; }
.gen-form input[type="text"], .gen-form textarea, .gen-form select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--rule);
  border-radius: var(--r-sm); background: var(--paper); font-size: .9rem; color: var(--ink);
}
.gen-form textarea { font-family: "IBM Plex Mono", monospace; font-size: .82rem; resize: vertical; line-height: 1.6; }
.gen-form input:focus, .gen-form textarea:focus, .gen-form select:focus { border-color: var(--indigo); outline: none; }
.counter { position: absolute; right: 2px; top: 0; font-size: .74rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--crimson); font-weight: 600; }

.gen-form .check { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; font-weight: 400; }
.gen-form .check input { accent-color: var(--indigo); width: 15px; height: 15px; margin-top: 3px; flex-shrink: 0; cursor: pointer; }
.gen-form .check span { font-size: .88rem; color: var(--ink); }
.gen-form .check .hint { margin-top: 1px; }

.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type="color"] {
  width: 42px; height: 34px; padding: 2px; border: 1px solid var(--rule);
  border-radius: var(--r-sm); background: var(--paper); cursor: pointer; flex-shrink: 0;
}
.colorrow input[type="text"] { font-family: "IBM Plex Mono", monospace; font-size: .84rem; }

.rangefield output { float: right; font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); font-weight: 400; }
.gen-form input[type="range"] { width: 100%; accent-color: var(--indigo); cursor: pointer; }

/* repeatable rows (gradient stops, shadow layers) */
.rows { display: grid; gap: 8px; margin-bottom: 10px; }
.row {
  display: grid; grid-template-columns: 38px 1fr 58px 30px; gap: 8px; align-items: center;
  padding: 8px; border: 1px solid var(--rule-soft); border-radius: var(--r-sm); background: var(--paper);
}
.row input[type="color"] { width: 100%; height: 30px; padding: 2px; border: 1px solid var(--rule); border-radius: 4px; cursor: pointer; }
.row input[type="text"], .row input[type="number"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--panel); font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: var(--ink);
}
.row .drop { border: 0; background: none; color: var(--ink-faint); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 4px; }
.row .drop:hover { color: var(--crimson); }
.addrow { font-size: .84rem; padding: 7px 13px; border: 1px dashed var(--rule); border-radius: var(--r-sm);
  background: none; color: var(--ink-soft); cursor: pointer; width: 100%; }
.addrow:hover { border-color: var(--indigo); color: var(--indigo-ink); }

.shadowlayer { grid-template-columns: 38px repeat(4, 1fr) 30px; }
.layerhead { font-size: .74rem; color: var(--ink-faint); display: grid; gap: 8px; padding: 0 8px; }
.layerhead.shadowlayer { grid-template-columns: 38px repeat(4, 1fr) 30px; }

.gen-out { display: grid; gap: 16px; align-content: start; }
.gen-preview, .gen-code {
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
}
.preview-body { padding: 20px 22px; background: var(--panel-2); }
.gen-code textarea {
  width: 100%; min-height: 300px; border: 0; outline: 0; resize: vertical;
  background: var(--code-bg); color: var(--ink); padding: 14px 16px;
  font-family: "IBM Plex Mono", monospace; font-size: 12.6px; line-height: 1.62;
  white-space: pre; overflow: auto;
}

/* search-result preview */
.serp { background: var(--panel); border-radius: var(--r-md); padding: 16px 18px; max-width: 600px; }
.serp .crumb { font-size: .78rem; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.serp .favdot { width: 17px; height: 17px; border-radius: 50%; background: var(--indigo); flex-shrink: 0; }
.serp .t { color: #1a0dab; font-size: 1.12rem; line-height: 1.3; margin-top: 5px; font-family: "IBM Plex Sans", sans-serif; }
[data-theme="dark"] .serp .t { color: #8ab4f8; }
.serp .d { font-size: .86rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.55; }

/* social card preview */
.ogcard { max-width: 500px; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; background: var(--panel); margin-top: 16px; }
.ogcard .img { aspect-ratio: 1200/630; background: var(--panel-2); display: grid; place-items: center;
  color: var(--ink-faint); font-size: .78rem; background-size: cover; background-position: center; }
.ogcard .meta { padding: 11px 14px; border-top: 1px solid var(--rule); }
.ogcard .site { font-size: .74rem; color: var(--ink-faint); text-transform: none; }
.ogcard .t { font-size: .92rem; font-weight: 600; color: var(--ink); margin-top: 3px; line-height: 1.35; }
.ogcard .d { font-size: .82rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.45; }

.previewlabel { font-size: .76rem; color: var(--ink-faint); margin-bottom: 8px; }

/* swatch previews for gradient / shadow */
.swatch { height: 260px; border-radius: var(--r-md); }
.shadowstage { height: 260px; display: grid; place-items: center; border-radius: var(--r-md);
  background: repeating-conic-gradient(var(--rule-soft) 0% 25%, var(--panel) 0% 50%) 0 0 / 22px 22px; }
.shadowbox { width: 170px; height: 110px; border-radius: 12px; background: var(--panel); }

/* pathological titles must not blow out the preview cards */
.serp .t, .serp .d, .ogcard .t, .ogcard .d { overflow-wrap: anywhere; }

/* prose fields read better in the body face; paths and code stay monospaced */
.gen-form textarea { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: .88rem; }
.gen-form textarea.mono { font-family: "IBM Plex Mono", monospace; font-size: .82rem; }

/* ============================================================
   Templates library
   ============================================================ */
.tpl {
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
}

.tpl-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--panel-2);
}
.viewport { display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 3px; }
.viewport button {
  border: 0; background: none; cursor: pointer; color: var(--ink-soft);
  font-size: .82rem; padding: 5px 11px; border-radius: 6px;
}
.viewport button:hover { color: var(--ink); }
.viewport button[aria-pressed="true"] { background: var(--indigo); color: #fff; }
[data-theme="dark"] .viewport button[aria-pressed="true"] { color: #0B1119; }
.tpl-bar .spacer { margin-left: auto; }

.tpl-stage { padding: 18px; background: var(--panel-2); display: grid; place-items: start center; }
.tpl-stage iframe {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--r-md);
  background: #fff; display: block; transition: max-width .18s ease;
}
@media (prefers-reduced-motion: reduce) { .tpl-stage iframe { transition: none; } }

.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-top: 1px solid var(--rule); background: var(--panel); }
.tab {
  font: inherit; font-size: .86rem; font-weight: 500;
  border: 0; background: none; cursor: pointer; color: var(--ink-soft);
  padding: 8px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab[aria-selected="true"] { color: var(--indigo-ink); background: var(--code-bg); }
.tabs .spacer { margin-left: auto; display: flex; gap: 8px; padding-bottom: 8px; }

.codepane { background: var(--code-bg); border-top: 1px solid var(--rule); }
.codepane pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 12.6px; line-height: 1.62; }
.codepane code { font-family: "IBM Plex Mono", monospace; color: var(--ink); }
.codepane[hidden] { display: none; }

/* library index */
.tplgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 22px; }
.tplcard {
  display: flex; flex-direction: column;
  border: 1px solid var(--rule); border-radius: var(--r-md);
  background: var(--panel); overflow: hidden; color: inherit;
}
.tplcard:hover { border-color: var(--indigo); text-decoration: none; }
.tplcard .shot {
  height: 132px; background: var(--panel-2); border-bottom: 1px solid var(--rule-soft);
  display: grid; place-items: center; padding: 14px; overflow: hidden;
}
.tplcard .shot svg { width: 100%; height: 100%; }
.tplcard .txt { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.tplcard h3 { font-size: 1rem; color: var(--ink); }
.tplcard p { font-size: .87rem; color: var(--ink-soft); margin-top: 5px; flex: 1; }
.tplcard .langs { display: flex; gap: 5px; margin-top: 12px; }
.tplcard .langs span {
  font-family: "IBM Plex Mono", monospace; font-size: .68rem;
  color: var(--ink-faint); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 6px;
}

.cathead { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 22px; }
.catcard {
  border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 18px 20px; background: var(--panel); color: inherit;
}
.catcard:hover { border-color: var(--indigo); text-decoration: none; }
.catcard h3 { font-size: 1rem; color: var(--ink); }
.catcard p { font-size: .87rem; color: var(--ink-soft); margin-top: 5px; }
.catcard .n { display: inline-block; margin-top: 10px; font-size: .8rem; color: var(--indigo-ink); font-weight: 500; }

.taglist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.taglist span {
  font-size: .76rem; color: var(--ink-soft); background: var(--panel-2);
  border: 1px solid var(--rule-soft); padding: 3px 9px; border-radius: 999px;
}


/* ============================================================
   Touch target sizes
   WCAG 2.2 (2.5.8) requires 24x24 CSS px; 44x44 is the comfortable
   size on a phone. Controls are grown on coarse pointers only, so
   dense mouse-driven toolbars keep their compact desktop sizing.
   ============================================================ */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .modes button { min-height: 40px; padding-inline: 16px; }
  .mini { min-height: 36px; padding-inline: 12px; }
  .opts label { min-height: 36px; }
  .opts input[type="checkbox"] { width: 24px; height: 24px; }
  .opts select { min-height: 38px; }
  .gen-form .check input { width: 24px; height: 24px; }
  .tab { min-height: 44px; }
  .viewport button { min-height: 36px; }
  .related a { min-height: 40px; display: inline-flex; align-items: center; }
  .taglist span { min-height: 32px; display: inline-flex; align-items: center; }
  /* short words like "FAQ" fall under the 24px minimum on width alone */
  .fgrid a, .fbottom nav a { display: inline-block; padding-block: 6px; min-width: 24px; }
  .maplist a { display: inline-block; padding-block: 5px; }
}

/* breadcrumb links are short and sit in a row, so give them real height */
.crumbs a, .crumbs b { display: inline-block; padding-block: 6px; }
