/*
 * Tool Tray: components
 * Built only from tokens.css. Load tokens.css first.
 */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
.tt { margin: 0; background: var(--tt-paper); color: var(--tt-ink); font-family: var(--tt-sans); font-size: var(--tt-text-body); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: clip; }
.tt img, .tt svg { display: block; max-width: 100%; }
:where(.tt) a { color: inherit; }
:where(.tt) :where(h1, h2, h3, p, ul, ol) { margin: 0; }
:where(.tt) :focus-visible { outline: none; box-shadow: var(--tt-focus); }

/* Layout */
.tt-container { width: min(100% - 2 * var(--tt-gutter), var(--tt-container)); margin-inline: auto; }
.tt-narrow { width: min(100% - 2 * var(--tt-gutter), var(--tt-narrow)); margin-inline: auto; }
.tt-section { padding-block: var(--tt-section); }
.tt-section--canvas { background: var(--tt-canvas); }
.tt-section--dots { background: var(--tt-canvas) var(--tt-dot-grid); background-size: var(--tt-dot-size); }
.tt-section--line { border-top: var(--tt-border); }
.tt-center { text-align: center; }
.tt-stack > * + * { margin-top: 16px; }
.tt-grid { display: grid; gap: 20px; }
.tt-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.tt-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* Type */
.tt-hero-title, .tt-h2, .tt-h3 { font-weight: 700; color: var(--tt-ink); }
.tt-hero-title { font-size: var(--tt-text-hero); line-height: 1.04; letter-spacing: var(--tt-tracking-tight); max-width: 15ch; }
.tt-h2 { font-size: var(--tt-text-h2); line-height: 1.1; letter-spacing: var(--tt-tracking-tight); }
.tt-h3 { font-size: var(--tt-text-h3); line-height: 1.3; font-weight: 600; letter-spacing: var(--tt-tracking-head); }
.tt-lead { font-size: var(--tt-text-lead); line-height: 1.55; color: var(--tt-soft); max-width: 560px; }
.tt-lead strong { color: var(--tt-ink); font-weight: 600; }
.tt-center .tt-lead, .tt-center .tt-hero-title { margin-inline: auto; }
.tt-eyebrow { font-family: var(--tt-mono); font-size: var(--tt-text-micro); font-weight: 500; letter-spacing: var(--tt-tracking-caps); text-transform: uppercase; color: var(--tt-blue); }
.tt-muted { color: var(--tt-soft); }
.tt-small { font-size: var(--tt-text-small); }
.tt-mono { font-family: var(--tt-mono); }
.tt-kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: var(--tt-border-strong); border-bottom-width: 2px; border-radius: var(--tt-radius-xs); background: var(--tt-paper); font-family: var(--tt-mono); font-size: 12px; line-height: 1.5; text-align: center; color: var(--tt-soft); }

/* Nav */
.tt-nav { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.tt-nav--line { border-bottom: var(--tt-border); }
.tt-nav__inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.tt-logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: var(--tt-tracking-head); text-decoration: none; white-space: nowrap; }
.tt-logo__mark { width: 22px; height: 22px; border-radius: var(--tt-radius-xs); background: var(--tt-ink); display: grid; place-items: center; }
.tt-nav__links { display: flex; gap: 22px; font-size: 14px; color: var(--tt-soft); }
.tt-nav__links a { text-decoration: none; transition: color var(--tt-speed) var(--tt-ease); }
.tt-nav__links a:hover, .tt-nav__links a[aria-current] { color: var(--tt-ink); }
.tt-nav__end { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; }
.tt-nav__end .tt-link { white-space: nowrap; }
@media (max-width: 860px) { .tt-nav__links, .tt-nav__hide { display: none; } }

/* Links and buttons */
.tt-link { color: var(--tt-blue); text-decoration: none; font-weight: 500; }
.tt-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tt-link--plain { color: var(--tt-soft); font-weight: 400; }
.tt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--tt-radius); font-family: var(--tt-sans); font-size: 14px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--tt-speed) var(--tt-ease), box-shadow var(--tt-speed) var(--tt-ease); }
.tt-btn--primary { background: var(--tt-blue); color: var(--tt-paper); }
.tt-btn--primary:hover { background: var(--tt-blue-deep); }
.tt-btn--ink { background: var(--tt-ink); color: var(--tt-paper); font-family: var(--tt-mono); font-size: 13px; }
.tt-btn--ink:hover { background: var(--tt-code-line); }
.tt-btn--ghost { background: var(--tt-paper); color: var(--tt-ink); box-shadow: var(--tt-shadow-card); }
.tt-btn--ghost:hover { box-shadow: var(--tt-shadow-lift); }
.tt-btn--lg { min-height: 48px; padding: 0 20px; font-size: 15px; }
.tt-btn--block { width: 100%; }
.tt-btn svg { width: 16px; height: 16px; flex: none; }
.tt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.tt-center .tt-actions { justify-content: center; }

/* Badge */
.tt-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; background: var(--tt-canvas); box-shadow: inset 0 0 0 1px var(--tt-line); font-size: 12px; font-weight: 500; color: var(--tt-soft); white-space: nowrap; }
.tt-badge--blue { background: var(--tt-tint); box-shadow: inset 0 0 0 1px var(--tt-blue-soft); color: var(--tt-blue-deep); }
.tt-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tt-swatch-green); }

/* Hero */
.tt-hero { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 64px); }
.tt-hero .tt-lead { margin-top: 20px; }
.tt-hero .tt-actions { margin-top: 28px; }
.tt-hero__stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin-top: clamp(40px, 5vw, 56px); }
@media (max-width: 860px) { .tt-hero__stage { grid-template-columns: 1fr; } }

/* Code panel: dark, with a tab strip */
.tt-code { background: var(--tt-code-bg); color: var(--tt-code-text); border-radius: var(--tt-radius-lg); box-shadow: 0 0 0 4px var(--tt-canvas), 0 0 0 5px var(--tt-line); overflow: hidden; min-width: 0; }
.tt-code__tabs { display: flex; gap: 18px; padding: 12px 16px 0; border-bottom: 1px solid var(--tt-code-line); font-size: 13px; color: var(--tt-code-dim); }
.tt-code__tab { padding-bottom: 10px; border-bottom: 2px solid transparent; }
.tt-code__tab[aria-current] { color: var(--tt-code-text); border-bottom-color: var(--tt-code-text); }
.tt-code pre { margin: 0; padding: 18px 16px; font-family: var(--tt-mono); font-size: 13px; line-height: 1.7; overflow-x: auto; }
.tt-code .k { color: var(--tt-swatch-pink); }
.tt-code .s { color: var(--tt-swatch-sun); }
.tt-code .f { color: var(--tt-swatch-sky); }
.tt-code .c { color: var(--tt-code-dim); }

/* The canvas: framed drawing surface with floating palettes */
.tt-canvas { position: relative; min-height: 340px; border: var(--tt-frame); border-radius: var(--tt-radius-lg); background: var(--tt-paper) var(--tt-dot-grid); background-size: var(--tt-dot-size); overflow: hidden; min-width: 0; }
.tt-canvas--quiet { border: var(--tt-border-strong); }
.tt-canvas__art { position: absolute; inset: 16px 16px 64px 16px; container-type: size; display: grid; place-items: center; }
.tt-canvas__board { position: relative; width: min(100cqw, 100cqh * var(--tt-ratio, 2)); aspect-ratio: var(--tt-ratio, 2); }
.tt-canvas__board svg { width: 100%; height: 100%; }
.tt-palette { position: absolute; background: var(--tt-paper); border-radius: var(--tt-radius); box-shadow: var(--tt-shadow-palette); padding: 8px; }
.tt-palette--styles { top: 12px; right: 12px; width: 132px; }
.tt-palette--tools { left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; }
.tt-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tt-swatch { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; background: var(--sw, var(--tt-ink)); cursor: pointer; }
.tt-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--tt-paper), 0 0 0 4px var(--tt-blue-soft); }
.tt-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin-top: 8px; padding-top: 8px; border-top: var(--tt-border); }
.tt-size { height: 24px; border: 0; border-radius: var(--tt-radius-xs); background: none; font-family: var(--tt-sans); font-size: 11px; font-weight: 600; color: var(--tt-soft); cursor: pointer; }
.tt-size[aria-pressed="true"] { background: var(--tt-canvas); color: var(--tt-ink); }
.tt-tool { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--tt-radius-sm); background: none; color: var(--tt-ink); cursor: pointer; }
.tt-tool svg { width: 16px; height: 16px; }
.tt-tool:hover { background: var(--tt-canvas); }
.tt-tool[aria-pressed="true"] { background: var(--tt-blue); color: var(--tt-paper); }
@media (max-width: 520px) { .tt-palette--styles { display: none; } .tt-tool--extra { display: none; } }

/* Selection box: blue outline with square handles, for any drawn object */
.tt-select { position: absolute; border: 1.5px solid var(--tt-blue); pointer-events: none; }
.tt-select i { position: absolute; width: 8px; height: 8px; background: var(--tt-paper); border: 1.5px solid var(--tt-blue); border-radius: 2px; }
.tt-select i:nth-child(1) { top: -5px; left: -5px; }
.tt-select i:nth-child(2) { top: -5px; right: -5px; }
.tt-select i:nth-child(3) { bottom: -5px; left: -5px; }
.tt-select i:nth-child(4) { bottom: -5px; right: -5px; }

/* Logo strip */
.tt-logos { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px 44px; padding-block: 28px; border-top: var(--tt-border); border-bottom: var(--tt-border); color: var(--tt-faint); font-weight: 700; font-size: 18px; letter-spacing: var(--tt-tracking-head); }
.tt-logos span { white-space: nowrap; }

/* Section head */
.tt-head { max-width: 640px; margin-bottom: clamp(32px, 4vw, 48px); }
.tt-head .tt-h2 { margin-top: 10px; }
.tt-head .tt-lead { margin-top: 14px; }
.tt-center.tt-head, .tt-center .tt-head { margin-inline: auto; }

/* Cards */
.tt-card { background: var(--tt-paper); border-radius: var(--tt-radius-lg); box-shadow: var(--tt-shadow-card); padding: 24px; transition: box-shadow var(--tt-speed) var(--tt-ease); min-width: 0; }
.tt-card:hover { box-shadow: var(--tt-shadow-lift); }
.tt-card__icon { width: 36px; height: 36px; border-radius: var(--tt-radius); background: var(--tt-tint); color: var(--tt-blue); display: grid; place-items: center; margin-bottom: 16px; }
.tt-card__icon svg { width: 18px; height: 18px; }
.tt-card__art { margin: -24px -24px 20px; height: 168px; border-bottom: var(--tt-border); background: var(--tt-canvas) var(--tt-dot-grid); background-size: var(--tt-dot-size); border-radius: var(--tt-radius-lg) var(--tt-radius-lg) 0 0; position: relative; overflow: hidden; }
.tt-card__art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tt-card p { margin-top: 6px; color: var(--tt-soft); }

/* Steps: numbered rows in mono */
.tt-steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 0; border-top: var(--tt-border); }
.tt-steps li { counter-increment: step; display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 18px 0; border-bottom: var(--tt-border); }
.tt-steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--tt-mono); font-size: var(--tt-text-small); color: var(--tt-blue); padding-top: 2px; }
.tt-steps p { color: var(--tt-soft); margin-top: 2px; }

/* Stats */
.tt-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--tt-line); border: var(--tt-border); border-radius: var(--tt-radius-lg); overflow: hidden; }
.tt-stat { background: var(--tt-paper); padding: 22px; }
.tt-stat__num { font-size: 32px; font-weight: 700; letter-spacing: var(--tt-tracking-tight); line-height: 1.1; }
.tt-stat__label { font-family: var(--tt-mono); font-size: 12px; color: var(--tt-soft); margin-top: 6px; }

/* Quote */
.tt-quote { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.4; font-weight: 500; letter-spacing: var(--tt-tracking-head); }
.tt-person { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 14px; }
.tt-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--av, var(--tt-swatch-orange)); flex: none; display: grid; place-items: center; color: var(--tt-paper); font-weight: 600; font-size: 13px; }

/* Pricing */
.tt-toggle { display: inline-flex; padding: 3px; border-radius: var(--tt-radius); background: var(--tt-canvas); box-shadow: inset 0 0 0 1px var(--tt-line); }
.tt-toggle button { border: 0; background: none; padding: 7px 14px; border-radius: var(--tt-radius-sm); font-family: var(--tt-sans); font-size: 13px; font-weight: 500; color: var(--tt-soft); cursor: pointer; white-space: nowrap; }
.tt-toggle button[aria-pressed="true"] { background: var(--tt-paper); color: var(--tt-ink); box-shadow: var(--tt-shadow-card); }
.tt-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; align-items: start; }
.tt-plan { background: var(--tt-paper); border-radius: var(--tt-radius-lg); box-shadow: var(--tt-shadow-card); padding: 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.tt-plan--featured { box-shadow: 0 0 0 3px var(--tt-blue), var(--tt-shadow-lift); }
.tt-plan__name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 16px; }
.tt-plan__price { font-size: 42px; font-weight: 700; letter-spacing: var(--tt-tracking-tight); line-height: 1; }
.tt-plan__price small { font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--tt-soft); margin-left: 4px; }
.tt-plan__note { font-size: 14px; color: var(--tt-soft); }
.tt-checks { list-style: none; padding: 0; display: grid; gap: 10px; font-size: 14px; border-top: var(--tt-border); padding-top: 18px; }
.tt-checks li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.tt-checks li::before { content: ""; width: 16px; height: 16px; margin-top: 3px; border-radius: var(--tt-radius-xs); background: var(--tt-tint) no-repeat center / 10px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.2 2.2 4.8-4.9' fill='none' stroke='%232563eb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* Comparison table */
.tt-table-wrap { overflow-x: auto; border: var(--tt-border); border-radius: var(--tt-radius-lg); }
.tt-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.tt-table th, .tt-table td { padding: 12px 16px; text-align: left; border-bottom: var(--tt-border); }
.tt-table thead th { font-family: var(--tt-mono); font-size: 12px; font-weight: 500; color: var(--tt-soft); background: var(--tt-canvas); }
.tt-table tbody tr:last-child td { border-bottom: 0; }
.tt-table td + td, .tt-table th + th { text-align: center; }

/* FAQ */
.tt-faq { border-top: var(--tt-border); }
.tt-faq details { border-bottom: var(--tt-border); padding: 18px 0; }
.tt-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; font-weight: 600; }
.tt-faq summary::-webkit-details-marker { display: none; }
.tt-faq summary::after { content: "+"; font-family: var(--tt-mono); color: var(--tt-faint); }
.tt-faq details[open] summary::after { content: "-"; }
.tt-faq p { margin-top: 10px; color: var(--tt-soft); }

/* Article */
.tt-article-head { padding-top: clamp(40px, 6vw, 80px); }
.tt-article-head .tt-h2 { font-size: clamp(32px, 4vw, 48px); margin-top: 14px; }
.tt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 20px; font-family: var(--tt-mono); font-size: 12px; color: var(--tt-soft); }
.tt-prose { font-size: var(--tt-text-prose); line-height: 1.75; }
.tt-prose > * + * { margin-top: 1.1em; }
.tt-prose h2 { font-size: 24px; line-height: 1.25; letter-spacing: var(--tt-tracking-head); margin-top: 2em; }
.tt-prose code { font-family: var(--tt-mono); font-size: .86em; padding: 2px 5px; border-radius: var(--tt-radius-xs); background: var(--tt-canvas); box-shadow: inset 0 0 0 1px var(--tt-line); }
.tt-prose ul { padding-left: 1.2em; }
.tt-prose li + li { margin-top: .4em; }
.tt-prose blockquote { margin: 1.6em 0; padding-left: 20px; border-left: 3px solid var(--tt-blue); font-size: 20px; line-height: 1.5; font-weight: 500; letter-spacing: var(--tt-tracking-head); }
.tt-figure { margin: 2em 0; }
.tt-figure .tt-canvas { min-height: 280px; }
.tt-figure figcaption { margin-top: 10px; font-family: var(--tt-mono); font-size: 12px; color: var(--tt-soft); }
.tt-callout { padding: 16px 18px; border-radius: var(--tt-radius); background: var(--tt-tint); box-shadow: inset 0 0 0 1px var(--tt-blue-soft); font-size: 15px; }

/* Forms */
.tt-form { display: grid; gap: 16px; }
.tt-field { display: grid; gap: 6px; }
.tt-label { font-size: 13px; font-weight: 500; }
.tt-input, .tt-select-input { width: 100%; min-height: 40px; padding: 8px 12px; border: var(--tt-border-strong); border-radius: var(--tt-radius); background: var(--tt-paper); font-family: var(--tt-sans); font-size: 14px; color: var(--tt-ink); transition: border-color var(--tt-speed) var(--tt-ease), box-shadow var(--tt-speed) var(--tt-ease); }
.tt-input::placeholder { color: var(--tt-faint); }
.tt-input:focus, .tt-select-input:focus { outline: none; border-color: var(--tt-blue); box-shadow: var(--tt-focus); }
.tt-hint { font-size: 12px; color: var(--tt-soft); }
.tt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px; }
.tt-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.tt-choice { position: relative; display: grid; gap: 2px; padding: 12px; border: var(--tt-border-strong); border-radius: var(--tt-radius); cursor: pointer; font-size: 14px; font-weight: 500; }
.tt-choice small { font-weight: 400; color: var(--tt-soft); font-size: 12px; }
.tt-choice input { position: absolute; opacity: 0; }
.tt-choice:has(input:checked) { border-color: var(--tt-blue); box-shadow: var(--tt-focus); }
.tt-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--tt-soft); }
.tt-check input { margin-top: 4px; accent-color: var(--tt-blue); }
.tt-divider { display: flex; align-items: center; gap: 12px; font-family: var(--tt-mono); font-size: 12px; color: var(--tt-faint); }
.tt-divider::before, .tt-divider::after { content: ""; flex: 1; border-top: var(--tt-border); }
.tt-auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 64px); }
.tt-auth__form { padding: clamp(40px, 6vw, 80px) var(--tt-gutter); display: grid; align-content: center; }
.tt-auth__form > div { width: min(100%, 400px); margin-inline: auto; }
.tt-auth__side { background: var(--tt-canvas) var(--tt-dot-grid); background-size: var(--tt-dot-size); border-left: var(--tt-border); padding: clamp(40px, 5vw, 64px); display: grid; align-content: center; gap: 28px; }
@media (max-width: 860px) { .tt-auth { grid-template-columns: 1fr; } .tt-auth__side { border-left: 0; border-top: var(--tt-border); } }

/* CTA band */
.tt-cta { border-radius: var(--tt-radius-lg); background: var(--tt-canvas) var(--tt-dot-grid); background-size: var(--tt-dot-size); box-shadow: inset 0 0 0 1px var(--tt-line); padding: clamp(40px, 6vw, 72px) var(--tt-gutter); text-align: center; }
.tt-cta .tt-lead { margin: 14px auto 0; }
.tt-cta .tt-actions { margin-top: 24px; justify-content: center; }

/* Footer */
.tt-footer { border-top: var(--tt-border); padding: 48px 0 32px; font-size: 14px; }
.tt-footer__grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; }
.tt-footer h4 { margin: 0 0 12px; font-family: var(--tt-mono); font-size: 12px; font-weight: 500; color: var(--tt-faint); text-transform: uppercase; letter-spacing: var(--tt-tracking-caps); }
.tt-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tt-footer a { text-decoration: none; color: var(--tt-soft); }
.tt-footer a:hover { color: var(--tt-ink); }
.tt-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: var(--tt-border); font-family: var(--tt-mono); font-size: 12px; color: var(--tt-faint); }
@media (max-width: 760px) { .tt-footer__grid { grid-template-columns: 1fr 1fr; } .tt-footer__grid > :first-child { grid-column: 1 / -1; } }
