/*
 * Swatch Book: components
 * Built only from tokens.css. Load tokens.css first.
 */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
.sb { margin: 0; background: var(--sb-page); color: var(--sb-ink); font-family: var(--sb-mono); font-size: var(--sb-text-body); line-height: var(--sb-leading); -webkit-font-smoothing: antialiased; overflow-x: clip; }
.sb svg { display: block; max-width: 100%; }
:where(.sb) a { color: inherit; }
:where(.sb) :where(h1, h2, h3, p, ul, ol) { margin: 0; }
:where(.sb) :where(ul, ol) { padding: 0; list-style: none; }

/* Layout */
.sb-container { width: min(100% - 2 * var(--sb-gutter), var(--sb-container)); margin-inline: auto; }
.sb-narrow { width: min(100% - 2 * var(--sb-gutter), var(--sb-narrow)); margin-inline: auto; }
.sb-section { padding-block: var(--sb-section); }
.sb-section--fog { background: var(--sb-fog); }
.sb-section--ink { background: var(--sb-ink); color: var(--sb-page); }
.sb-section--ink .sb-muted { color: var(--sb-faint); }
.sb-stack > * + * { margin-top: 18px; }
.sb-rule { border: 0; border-top: var(--sb-border); margin: 0; }
.sb-rule--dotted { border-top: var(--sb-border-dotted); }

/* Type: one face, hierarchy by size and weight only */
.sb-hero-title, .sb-h2, .sb-h3 { font-weight: 500; letter-spacing: -0.01em; line-height: var(--sb-leading-tight); }
.sb-hero-title { font-size: var(--sb-text-hero); max-width: 22ch; }
.sb-h2 { font-size: var(--sb-text-h2); }
.sb-h3 { font-size: var(--sb-text-h3); font-weight: 700; }
.sb-lede { font-size: clamp(17px, 1.5vw, 20px); max-width: 60ch; color: var(--sb-soft); }
.sb-muted { color: var(--sb-soft); }
.sb-small { font-size: var(--sb-text-small); }
.sb-pixel { font-family: var(--sb-pixel); font-size: var(--sb-text-micro); text-transform: uppercase; letter-spacing: .04em; }
.sb-textlink { color: var(--sb-blue); text-decoration: underline; text-underline-offset: 3px; }
.sb-textlink:hover { background: var(--sb-highlight); color: var(--sb-ink); }

/* Labels: the inverse "Note:" tag and the highlighter sticker */
.sb-label { display: inline-block; padding: 1px 6px; background: var(--sb-ink); color: var(--sb-page); font-weight: 500; font-size: var(--sb-text-small); line-height: 1.5; white-space: nowrap; }
.sb-label--light { background: var(--sb-page); color: var(--sb-ink); }
.sb-sticker { display: inline-block; padding: 2px 8px; background: var(--sb-highlight); color: var(--sb-ink); font-size: var(--sb-text-small); font-weight: 500; white-space: nowrap; text-decoration: none; }
.sb-sticker:hover { background: var(--sb-ink); color: var(--sb-highlight); }

/* Masthead: pixel mark top left, name under it, plain links top right */
.sb-masthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: var(--sb-gutter) var(--sb-gutter) 0; }
.sb-brand { display: grid; gap: 14px; text-decoration: none; }
.sb-brand__mark { width: clamp(72px, 8vw, 112px); height: auto; }
.sb-brand__name { font-size: var(--sb-text-body); }
.sb-topnav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px; font-size: var(--sb-text-body); }
.sb-topnav a { text-decoration: none; }
.sb-topnav a:hover, .sb-topnav a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }

/* Tabs: outlined square boxes in a row. The active one has a heavier frame */
.sb-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 26px var(--sb-gutter) 0; }
.sb-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: var(--sb-border-soft); border-color: var(--sb-faint); background: var(--sb-page); color: var(--sb-ink); font: inherit; font-size: var(--sb-text-body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--sb-speed); }
.sb-tab:hover { background: var(--sb-fog); }
.sb-tab[aria-current], .sb-tab.is-active { border: 2px solid var(--sb-ink); padding: 0 11px; }
.sb-search { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--sb-faint); border-radius: var(--sb-radius-pill); font: inherit; background: var(--sb-page); color: var(--sb-ink); width: 9.5em; }
.sb-search::placeholder { color: var(--sb-ink); }
.sb-filter { display: inline-flex; align-items: center; gap: 8px; margin: 22px var(--sb-gutter) 16px; min-height: 34px; padding: 0 14px; border: var(--sb-border-dotted); border-color: var(--sb-faint); border-radius: var(--sb-radius-pill); background: none; font: inherit; font-size: var(--sb-text-small); cursor: pointer; }
.sb-filter::before { content: ""; border-left: 6px solid var(--sb-ink); border-block: 4px solid transparent; }

/* Buttons: square, outlined or solid ink, monospace, no caps */
.sb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 18px; border: var(--sb-border); border-radius: var(--sb-radius); background: var(--sb-page); color: var(--sb-ink); font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--sb-speed), color var(--sb-speed); }
.sb-btn:hover { background: var(--sb-ink); color: var(--sb-page); }
.sb-btn--ink { background: var(--sb-ink); color: var(--sb-page); }
.sb-btn--ink:hover { background: var(--sb-highlight); color: var(--sb-ink); }
.sb-btn--block { width: 100%; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Hero: left aligned, plain, with an optional sticker */
.sb-hero { padding: clamp(28px, 4vw, 56px) var(--sb-gutter) clamp(28px, 4vw, 48px); display: grid; gap: 22px; }

/* The tile wall: the signature. Square color tiles, title top, meta pinned bottom */
.sb-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: var(--sb-gap); padding: 0 var(--sb-gutter); }
.sb-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; aspect-ratio: var(--sb-tile-ratio); padding: var(--sb-pad); background: var(--sb-fog); color: var(--sb-ink); text-decoration: none; font-weight: 500; line-height: 1.4; overflow: hidden; }
.sb-tile__title { font-size: var(--sb-text-body); max-width: 24ch; }
.sb-tile__meta { display: flex; justify-content: space-between; align-items: end; gap: 10px; font-size: var(--sb-text-body); }
.sb-tile__art { width: 56%; margin: auto; opacity: .95; }
.sb-tile:hover .sb-tile__title { text-decoration: underline; text-underline-offset: 3px; }
.sb-tile--note { background: var(--sb-page); border: var(--sb-border-dotted); }
.sb-tile--orange { background: var(--sb-orange); color: var(--sb-page); }
.sb-tile--sky { background: var(--sb-sky); }
.sb-tile--cyan { background: var(--sb-cyan); color: var(--sb-blue); }
.sb-tile--mustard { background: var(--sb-mustard); }
.sb-tile--plum { background: var(--sb-plum); color: var(--sb-page); }
.sb-tile--peach { background: var(--sb-peach); }
.sb-tile--tomato { background: var(--sb-tomato); color: var(--sb-page); }
.sb-tile--lime { background: var(--sb-lime); }
.sb-tile--slate { background: var(--sb-slate); color: var(--sb-page); }
.sb-tile--fog { background: var(--sb-fog); color: var(--sb-soft); }
.sb-tile--ink { background: var(--sb-ink); color: var(--sb-page); }
.sb-tile--short { aspect-ratio: auto; min-height: 160px; }

/* Section head: a label and a title on one line, a rule under */
.sb-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px 24px; padding-bottom: 14px; border-bottom: var(--sb-border); margin-bottom: 22px; }

/* Index list: dated rows like a table of contents */
.sb-index li { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 16px; padding: 12px 0; border-bottom: var(--sb-border-dotted); align-items: baseline; }
.sb-index__date { color: var(--sb-soft); font-size: var(--sb-text-small); }
@media (max-width: 560px) { .sb-index li { grid-template-columns: 1fr auto; } .sb-index__date { grid-column: 1 / -1; } }

/* Pricing: plan tiles reuse the tile colors, details in a plain list */
.sb-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sb-gap); }
.sb-plan { display: flex; flex-direction: column; gap: 18px; padding: 16px; border: var(--sb-border-soft); border-color: var(--sb-faint); background: var(--sb-page); }
.sb-plan--feature { border: 2px solid var(--sb-ink); padding: 15px; }
.sb-plan__swatch { aspect-ratio: 16 / 7; padding: var(--sb-pad); display: flex; flex-direction: column; justify-content: space-between; font-weight: 500; }
.sb-plan__price { display: flex; align-items: baseline; gap: 10px; font-size: clamp(36px, 4vw, 48px); font-weight: 500; line-height: 1; }
.sb-plan__price small { font-size: var(--sb-text-small); font-weight: 400; }
.sb-plan ul { display: grid; gap: 8px; font-size: var(--sb-text-small); }
.sb-plan li::before { content: "+ "; font-weight: 700; }
.sb-plan .sb-btn { margin-top: auto; }
.sb-toggle { display: inline-flex; border: var(--sb-border); }
.sb-toggle button { min-height: 40px; padding: 0 14px; border: 0; background: var(--sb-page); font: inherit; cursor: pointer; white-space: nowrap; }
.sb-toggle button[aria-pressed="true"] { background: var(--sb-ink); color: var(--sb-page); }
.sb-table { width: 100%; border-collapse: collapse; font-size: var(--sb-text-small); }
.sb-table th, .sb-table td { text-align: left; padding: 10px 8px; border-bottom: var(--sb-border-dotted); }
.sb-table th { font-weight: 700; border-bottom: var(--sb-border); }
.sb-table-wrap { overflow-x: auto; }

/* FAQ: plain details rows */
.sb-faq details { border-bottom: var(--sb-border-dotted); padding: 14px 0; }
.sb-faq summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.sb-faq summary::after { content: "+"; }
.sb-faq details[open] summary::after { content: "-"; }
.sb-faq details p { margin-top: 10px; color: var(--sb-soft); max-width: 64ch; }

/* Article: a color cover tile, then plain prose in the one face */
.sb-article-cover { aspect-ratio: 21 / 8; padding: clamp(14px, 2vw, 24px); display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.sb-article-cover .sb-hero-title { max-width: 26ch; }
.sb-byline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--sb-text-small); color: var(--sb-soft); }
.sb-prose { font-size: var(--sb-text-prose); line-height: 1.65; }
.sb-prose > * + * { margin-top: 1.1em; }
.sb-prose h2 { font-size: 22px; font-weight: 700; margin-top: 2em; }
.sb-prose a { color: var(--sb-blue); }
.sb-prose .sb-q { font-weight: 700; }
.sb-prose ul li { padding-left: 1.6em; text-indent: -1.6em; }
.sb-prose ul li::before { content: "->  "; white-space: pre; }
.sb-pull { padding: 18px; background: var(--sb-mustard); font-size: clamp(19px, 2vw, 24px); font-weight: 500; line-height: 1.35; }
.sb-code { display: block; padding: 14px; border: var(--sb-border-dotted); background: var(--sb-fog); font-size: var(--sb-text-small); white-space: pre-wrap; }

/* Forms: square boxes, plain labels, a black focus frame */
.sb-form { display: grid; gap: 18px; }
.sb-field { display: grid; gap: 6px; }
.sb-field label, .sb-legend { font-size: var(--sb-text-small); font-weight: 500; }
.sb-input, .sb-select, .sb-textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--sb-faint); border-radius: var(--sb-radius); background: var(--sb-page); color: var(--sb-ink); font: inherit; }
.sb-input:focus, .sb-select:focus, .sb-textarea:focus { outline: 0; border: 2px solid var(--sb-ink); padding: 9px 11px; }
.sb-hint { font-size: var(--sb-text-micro); color: var(--sb-soft); }
.sb-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.sb-choice { position: relative; display: block; cursor: pointer; }
.sb-choice input { position: absolute; opacity: 0; }
.sb-choice span { display: flex; align-items: flex-end; min-height: 76px; padding: 10px; background: var(--sb-fog); font-size: var(--sb-text-small); font-weight: 500; border: 2px solid transparent; }
.sb-choice input:checked + span { border-color: var(--sb-ink); }
.sb-choice input:focus-visible + span { outline: 2px dotted var(--sb-ink); outline-offset: 2px; }
.sb-check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--sb-text-small); }
.sb-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--sb-ink); flex: none; }
.sb-steps { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--sb-text-small); }
.sb-steps li { padding: 2px 8px; border: 1px solid var(--sb-faint); color: var(--sb-soft); }
.sb-steps li[aria-current] { border-color: var(--sb-ink); background: var(--sb-ink); color: var(--sb-page); }

/* Footer: a wall of plain links, a dotted rule, a pixel sign-off */
.sb-footer { margin-top: var(--sb-section); padding: 28px var(--sb-gutter) 40px; border-top: var(--sb-border); display: grid; gap: 28px; }
.sb-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; font-size: var(--sb-text-small); }
.sb-footer__cols strong { display: block; margin-bottom: 6px; }
.sb-footer__cols a { display: block; text-decoration: none; padding: 3px 0; }
.sb-footer__cols a:hover { text-decoration: underline; }
.sb-footer__end { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: var(--sb-border-dotted); font-size: var(--sb-text-small); color: var(--sb-soft); }

@media (max-width: 640px) {
  .sb-topnav { font-size: var(--sb-text-small); }
  .sb-tabs { gap: 6px; }
  .sb-tab, .sb-search { min-height: 38px; font-size: var(--sb-text-small); }
  .sb-tile--wide-mobile { aspect-ratio: 2 / 1; }
  .sb-article-cover { aspect-ratio: auto; min-height: 260px; }
}
.sb-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
