/* Rollwell shared styles. Plain CSS, light only, no external resources. */
:root {
  --bg: #FAFAF9; --surface: #FFFFFF; --text: #1C1917; --muted: #57534E;
  --accent: #1D4ED8; --accent-dark: #1E40AF; --success: #15803D; --danger: #B91C1C;
  --line: rgba(87, 83, 78, 0.25);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
section.container { margin-top: 48px; }
h1 { font-size: clamp(1.75rem, 5vw + 0.5rem, 2.5rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 16px; }
h2 { font-size: 1.5rem; font-weight: 650; line-height: 1.25; margin: 0 0 16px; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; margin: 0 0 8px; }
p { margin: 0 0 16px; }
h1, h2, h3, p, li { overflow-wrap: anywhere; }
.btn { max-width: 100%; overflow-wrap: anywhere; }
.prose, .lead { max-width: 68ch; }
.lead { max-width: 60ch; color: var(--muted); }
.small { font-size: 0.875rem; line-height: 1.5; }
.muted, .help { color: var(--muted); }
.help { font-size: 0.875rem; line-height: 1.5; margin: 0 0 8px; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 0.9375rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* How-to article page */
.article { max-width: 68ch; margin: 0 0 72px; }
.article h2 { margin-top: 48px; }
.article ul { padding-left: 20px; }
.article li { margin-bottom: 8px; overflow-wrap: anywhere; }
.article pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; overflow-x: auto; margin: 0 0 16px; }
.article nav h2.toc-title { font-size: 1.125rem; margin: 24px 0 8px; }
.cta-panel { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 24px; margin-top: 48px; }
.cta-panel h2 { margin-top: 0; }

/* Skip link: first focusable element */
.skip-link { position: absolute; left: 8px; top: -80px; background: var(--surface); padding: 12px 16px; border: 1.5px solid var(--muted); border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }

/* Links */
a { color: var(--accent); }
.text-link, .top-link, p a, li a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:visited { color: var(--accent); }
.text-link:hover, .top-link:hover, p a:hover, li a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Top bar */
.top-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "mark link" "pill pill"; align-items: center; gap: 8px 16px; padding-top: 16px; padding-bottom: 16px; }
.wordmark { grid-area: mark; font-weight: 700; min-width: 0; }
.pill, .tag { display: inline-flex; font-size: 0.875rem; line-height: 1.5; font-weight: 600; padding: 4px 10px; border: 1px solid var(--muted); border-radius: 999px; color: var(--muted); background: var(--surface); }
.top-link { display: inline-flex; align-items: center; min-height: 44px; }
.top-bar .pill { grid-area: pill; justify-self: start; min-width: 0; }
.top-bar .top-link { grid-area: link; }
@media (min-width: 640px) {
  .top-bar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "mark pill link"; }
}

/* Buttons */
.btn, .text-btn { font: inherit; font-size: 1rem; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 12px 20px; border-radius: 8px; font-weight: 600; text-decoration: none;
  border: 1.5px solid transparent; transition: background-color 150ms, border-color 150ms;
}
.btn-primary, .btn-primary:visited { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { background: var(--accent-dark); transform: translateY(1px); }
.btn-secondary, .btn-secondary:visited { background: #fff; color: var(--text); border-color: var(--muted); }
.btn-secondary:hover { background: #F5F5F4; border-color: var(--text); }
.btn:focus-visible, .text-btn:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn:disabled, .btn[aria-disabled="true"] { background: #E7E5E4; color: var(--muted); cursor: not-allowed; border-color: transparent; }
.btn-block, .btn-block-mobile { width: 100%; }
.text-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 48px; padding: 0 8px; }
@media (min-width: 640px) { .btn-block-mobile { width: auto; } }

/* Hero */
.hero { margin-top: 24px; }
.actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.actions .text-link { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 640px) { .actions { flex-direction: row; align-items: center; gap: 24px; } }

/* Lists */
.dash-list { list-style: none; padding: 0; margin: 0 0 16px; }
.dash-list li { position: relative; padding-left: 24px; margin-bottom: 16px; }
.dash-list li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }

/* Cards and grids */
.card, .panel, .faq details, .success-panel, .notice { background: var(--surface); border: 1px solid var(--line); }
.card { border-radius: 12px; padding: 20px; }
.tier { padding: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
@media (min-width: 640px) { .features, .tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .features { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.price { margin: 16px 0; }
.amount { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tier-action { margin-top: 16px; }
.mini-form label { display: block; font-weight: 600; margin-bottom: 8px; }
.mini-form input { margin-bottom: 8px; }
.mini-form .btn { margin: 8px 0; }

/* Form */
.panel { max-width: 560px; border-radius: 12px; padding: 24px; }
.field { margin: 0 0 24px; border: 0; padding: 0; min-width: 0; }
.field > label, legend { display: block; font-weight: 600; padding: 0; margin-bottom: 4px; }
input[type="email"], input[type="text"] {
  display: block; width: 100%; min-height: 48px; padding: 12px; background: #fff; color: var(--text);
  font: inherit; font-size: 1.0625rem; border: 1.5px solid var(--muted); border-radius: 6px;
  transition: border-color 150ms;
}
input:focus-visible { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 1px; }
input[aria-invalid="true"] { border: 2px solid var(--danger); }
.error { color: var(--danger); font-size: 0.875rem; line-height: 1.5; margin: 4px 0 0; }
.price-input { display: flex; align-items: center; gap: 8px; }
.price-input .prefix { display: flex; align-items: center; min-height: 48px; padding: 0 12px; color: var(--muted); border: 1.5px solid var(--muted); border-right: 0; border-radius: 6px 0 0 6px; background: #fff; margin-right: -8px; }
.price-input input { border-radius: 0 6px 6px 0; flex: 1; min-width: 0; }
.radio-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; margin-bottom: 8px; border: 1.5px solid transparent; border-radius: 6px; cursor: pointer; }
.radio-row input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.radio-row.selected, .radio-row:has(input:checked) { border-color: var(--accent); font-weight: 600; }
.radio-row:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Notices and states */
.notice { padding: 16px; margin-bottom: 16px; border-radius: 8px; }
.notice-danger { border: 2px solid var(--danger); }
#error-summary { border-width: 1px 1px 1px 2px; border-left: 2px solid var(--danger); border-color: var(--line); border-left-color: var(--danger); }
#error-summary h3 { margin-bottom: 8px; }
#error-summary ul { margin: 0; padding-left: 20px; }
.success-panel { border-left: 3px solid var(--success); border-radius: 8px; padding: 16px 20px; }
.success-panel h3 { color: var(--success); }
.success-panel h3:focus { outline: none; }
.tier-done p { color: var(--success); font-weight: 600; }
[hidden] { display: none !important; }

/* FAQ */
.faq details { border-width: 0 0 1px; padding: 0 16px; }
.faq details:first-child { border-top-width: 1px; }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 8px 0; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; flex: none; }
.faq details[open] summary::after { content: "−"; }

/* Stats page */
.stats-header { display: flex; flex-direction: column; gap: 8px; padding-top: 24px; }
.stats-download .btn { width: 100%; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.stats-section { margin-top: 48px; }
.stats-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.stats-table th, .stats-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stats-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stats-table tr, .stats-table td, .stats-table th { display: block; }
.stats-table td::before { content: attr(data-label) ": "; color: var(--muted); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.badge { display: inline-flex; align-self: flex-start; font-size: 0.875rem; line-height: 1.5; font-weight: 600; padding: 4px 10px; border: 1px solid currentColor; border-radius: 999px; background: #fff; }
.badge-pass { color: var(--success); }
.badge-fail { color: var(--danger); }
.badge-muted { color: var(--muted); }
.badge-text { color: var(--text); }

/* Footer */
.footer { margin-top: 72px; padding-bottom: 48px; }

@media (min-width: 640px) {
  .stats-table thead { position: static; width: auto; height: auto; clip: auto; }
  .stats-table tr { display: table-row; }
  .stats-table td, .stats-table th { display: table-cell; }
  .stats-table td::before { content: none; }
}
@media (min-width: 900px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-header { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .stats-download .btn { width: auto; }
}
@media (min-width: 768px) {
  .container { padding: 0 32px; }
  section.container { margin-top: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
