/* clrd: one stylesheet for the site and the inbox. Tokens from docs/SPEC.md section 10. */

@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #0F1114; --paper: #F5F3EE; --surface: #FFFFFF; --line: #DEDAD1;
  --slate: #5B6470; --body: #3D444D; --clear: #0B7A55; --on-clear: #F5F3EE;
  --signal: #C2410C;
  --bg: var(--paper); --text: var(--ink);
  --chip-active-bg: #FCE9DF; --chip-active: #9A3412;
  --chip-ack-bg: #E9E6DE; --chip-ack: #3D444D;
  --chip-res-bg: #DDF1E8; --chip-res: #065F42;
  --chip-snz-bg: #F7EBD3; --chip-snz: #7A4D0B;
  --chip-dis-line: #DEDAD1; --chip-dis: #5B6470;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  /* Paper and ink swap; accents stay, lifted where the spec value fails contrast on ink. */
  :root {
    --bg: var(--ink); --text: var(--paper); --surface: #171A1E; --line: #2C3036;
    --slate: #98A1AC; --body: #C9CED4; --clear: #3DDC97; --on-clear: #0F1114;
    --signal: #F97316;
    --chip-active-bg: #3A1C0F; --chip-active: #FDBA8C;
    --chip-ack-bg: #24282D; --chip-ack: #C9CED4;
    --chip-res-bg: #0F3326; --chip-res: #7FE3B6;
    --chip-snz-bg: #382A10; --chip-snz: #F2C66D;
    --chip-dis-line: #2C3036; --chip-dis: #98A1AC;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--sans); }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--clear); }
code, pre { font-family: var(--mono); font-size: 13px; }
:not(pre) > code { padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
pre { margin: 0 0 1em; padding: 16px 18px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; line-height: 1.6; color: var(--body); }
:focus-visible { outline: 2px solid var(--clear); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 10; padding: 8px 12px; background: var(--text); color: var(--bg); border-radius: 12px; }
.skip:focus { top: 12px; }
.no-js .js-only { display: none !important; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark { font-weight: 600; font-size: 22px; letter-spacing: -0.05em; }
.meta { font: 400 12px/1.5 var(--mono); color: var(--slate); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: 500 14px/1 var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--slate); }
.btn-ink { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ink:hover { border-color: var(--text); opacity: .9; }
.btn-clear { background: var(--clear); color: var(--on-clear); border-color: var(--clear); }
.btn-clear:hover { border-color: var(--clear); filter: brightness(1.08); }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font: 500 12px/1 var(--sans); white-space: nowrap; }
.chip-active { background: var(--chip-active-bg); color: var(--chip-active); }
.chip-acknowledged { background: var(--chip-ack-bg); color: var(--chip-ack); }
.chip-resolved { background: var(--chip-res-bg); color: var(--chip-res); }
.chip-snoozed { background: var(--chip-snz-bg); color: var(--chip-snz); }
.chip-dismissed { border: 1px solid var(--chip-dis-line); color: var(--chip-dis); }

.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot-high { background: var(--text); }
.dot-urgent { background: var(--signal); }

/* ---------- Site ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 640px; }
.row { display: flex; align-items: center; gap: 24px; }
.site-header { border-bottom: 1px solid var(--line); }
.site-header .row { height: 64px; justify-content: space-between; }
.site-header nav { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.site-header nav a:not(.btn) { text-decoration: none; color: var(--body); }
.site-header nav a:not(.btn):hover { color: var(--text); }

.site section { padding: 72px 0; }
.site section.wrap { padding-left: 24px; padding-right: 24px; }
.band { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.band pre, .band :not(pre) > code { background: var(--bg); }
.site h2 { font-size: 32px; letter-spacing: -0.035em; }
.site h3 { font-size: 18px; margin-top: 4px; }
.site p, .site dd, .site li { color: var(--body); }
.section-lede { font-size: 18px; max-width: 60ch; margin-bottom: 32px; }
.quiet { font-size: 14px; color: var(--slate) !important; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; padding-top: 88px !important; padding-bottom: 88px !important; }
.hero h1 { font-size: clamp(44px, 6.4vw, 80px); line-height: .98; letter-spacing: -0.05em; margin-bottom: 24px; max-width: 9ch; }
.lede { font-size: 19px; max-width: 34em; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 20px; }
.cta .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
.status { font: 400 12px/1.5 var(--mono); color: var(--slate) !important; }

/* The sync demo: one alert on three devices. Swiped on the phone, the others follow. */
.demo { margin: 0; }
.devices { display: grid; grid-template-columns: .8fr 1.25fr 1fr; gap: 14px; align-items: end; }
.device { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px 12px; overflow: hidden; }
.device.phone { min-height: 280px; }
.device.web { min-height: 200px; border-radius: 14px; }
.device.tablet { min-height: 236px; }
.device-name { font: 400 11px/1 var(--mono); color: var(--slate) !important; margin-bottom: 14px; }
.mini { border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; background: var(--surface); }
.mini p { margin: 0; }
.mini-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text) !important; line-height: 1.3; }
.mini-body { font-size: 12px; line-height: 1.4; margin: 4px 0 6px !important; }
.mini .meta { font-size: 10.5px; }
.mini-cleared { position: absolute; left: 12px; right: 12px; top: 40px; display: flex; align-items: center; gap: 7px; padding: 10px 11px; border-radius: 12px; font-size: 12px; font-weight: 500; color: var(--clear) !important; opacity: 0; }
.mini-cleared::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--clear) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4 7.2l2 2 4-4' fill='none' stroke='%23F5F3EE' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.demo figcaption { margin-top: 14px; font-size: 14px; color: var(--slate); }
@media (prefers-reduced-motion: no-preference) {
  .swipe { animation: swipe 7s cubic-bezier(.4, 0, .2, 1) infinite; }
  .follow { animation: follow 7s ease infinite; }
  .mini-cleared { animation: cleared 7s ease infinite; }
}
@keyframes swipe { 0%, 18% { transform: none; opacity: 1; } 26% { transform: translateX(120%); opacity: 0; } 88% { transform: translateX(120%); opacity: 0; } 89% { transform: none; opacity: 0; } 96%, 100% { opacity: 1; } }
@keyframes follow { 0%, 27% { opacity: 1; border-color: var(--line); } 30% { border-color: var(--clear); opacity: 1; } 36% { opacity: 0; transform: scale(.97); } 88% { opacity: 0; transform: none; } 96%, 100% { opacity: 1; } }
@keyframes cleared { 0%, 32% { opacity: 0; } 38%, 78% { opacity: 1; } 86%, 100% { opacity: 0; } }

.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 14px; }
.steps li::marker { font: 500 14px var(--mono); color: var(--slate); }
.steps strong { color: var(--text); font-weight: 600; }
.log { font-size: 12.5px; }
.log span { color: var(--clear); }

.states { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.states > div { padding: 20px 20px 0 0; }
.states > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.states dt { margin-bottom: 12px; }
.states dd { margin: 0; }

.tools-h { margin-top: 40px !important; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 1px solid var(--line); }
.tools > div { padding: 16px 16px 16px 0; border-bottom: 1px solid var(--line); }
.tools dt { font-weight: 600; margin-bottom: 4px; }
.tools dd { margin: 0; font-size: 14px; }

.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { text-align: left; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font: 500 12px var(--mono); color: var(--slate); }
.compare tbody th { font-weight: 500; color: var(--text); width: 44%; }
.compare td { color: var(--body); }
.compare td.yes { color: var(--clear); font-weight: 500; }

.site-footer { border-top: 1px solid var(--line); padding: 32px 0; font-size: 14px; }
.site-footer .row { flex-wrap: wrap; }
.site-footer p { margin: 0; flex: 1; color: var(--slate); }
.site-footer nav { display: flex; gap: 18px; }

.signin { padding-top: 72px; padding-bottom: 72px; }
.offline { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--chip-active-bg); color: var(--chip-active); }
.offline a { color: inherit; }
.signin-error { padding: 10px 14px; border: 1px solid var(--signal); border-radius: 12px; color: var(--signal); }
.signin-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 24px 0; }
.signin-form label { flex: 1 1 100%; font-weight: 500; color: var(--text); }
.signin .signin-form input { flex: 1 1 240px; height: 40px; }
.signin-form .btn { min-height: 40px; }

/* Docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 72px; }
.docs-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; align-self: start; font-size: 14px; }
.docs-nav a { padding: 6px 10px; border-radius: 12px; text-decoration: none; color: var(--body); }
.docs-nav a[aria-current] { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.prose { max-width: 76ch; min-width: 0; }
.prose h1 { font-size: 36px; letter-spacing: -0.04em; }
.prose h2 { font-size: 24px; margin-top: 2em; padding-top: 1em; border-top: 1px solid var(--line); }
.prose h3 { font-size: 18px; margin-top: 1.6em; }
.prose p, .prose li { color: var(--body); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.4em; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; }
.prose blockquote { margin: 0 0 1em; padding-left: 16px; border-left: 2px solid var(--line); }

/* ---------- Inbox ---------- */
.app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { display: flex; flex-direction: column; gap: 28px; padding: 22px 16px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 8px; }
.views, .topics { display: flex; flex-direction: column; gap: 2px; }
.views a, .topics a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; text-decoration: none; color: var(--body); font-size: 15px; }
.views a:hover, .topics a:hover { background: var(--surface); }
.views a[aria-current], .topics a[aria-current] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line); }
.count { font: 400 12px var(--mono); color: var(--slate); }
.topics h2 { font-size: 12px; font-weight: 500; color: var(--slate); margin: 0 10px 6px; letter-spacing: 0; }
.sync { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-size: 13px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.sync.is-live .sync-dot { background: var(--clear); }
.sync-state { flex-basis: 100%; padding-left: 16px; font: 400 12px var(--mono); color: var(--slate); }
.sync-state:empty { display: none; }

.main { padding: 22px 32px 96px; max-width: 880px; width: 100%; }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; min-height: 40px; }
.bar h1 { font-size: 22px; margin: 0; letter-spacing: -0.03em; }
.in-topic { color: var(--slate); font-weight: 400; }
.search { margin-left: auto; }
.search input, .signin-form input { width: 240px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: 400 14px var(--sans); }
.search input:focus-visible, .signin-form input:focus-visible { outline-offset: 0; border-color: var(--clear); }

.list { display: grid; gap: 10px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
.card > * { grid-column: 1; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-body { font-size: 15px; color: var(--body); margin: 6px 0 0 18px; overflow-wrap: anywhere; white-space: pre-line; }
.card .meta { margin: 8px 0 0 18px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.card .meta a { text-decoration: none; }
.card .meta a:hover { text-decoration: underline; }
.links { margin: 10px 0 0 18px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; font-weight: 500; }
.actions { grid-column: 2; grid-row: 1 / span 4; display: flex; gap: 8px; align-items: flex-start; }
.actions .btn { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.snooze { position: relative; }
.snooze > summary { list-style: none; }
.snooze > summary::-webkit-details-marker { display: none; }
.snooze-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: grid; gap: 6px; min-width: 180px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / .12); }
.snooze-custom { display: flex; gap: 6px; }
.snooze-custom input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; background: var(--bg); color: var(--text); font: 13.5px var(--sans); }

/* A card leaving: green line, the reason, then it folds away. */
.card.is-leaving { border-color: var(--clear); }
.card .gone { display: none; }
.card.is-leaving .gone { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; margin: 8px 0 0 18px; color: var(--clear); font-size: 14px; font-weight: 500; }
.card.is-folding { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: opacity .2s ease, transform .25s ease, border-color .2s ease; }
  .card.is-folding { opacity: 0; transform: translateX(24px); }
}

.empty { padding: 48px 0; color: var(--body); max-width: 560px; }
.empty h2 { font-size: 20px; }

.panel { padding: 20px 0; border-top: 1px solid var(--line); max-width: 640px; }
.panel h2 { font-size: 17px; }
.panel p { color: var(--body); }
.devices-list { list-style: none; margin: 0; padding: 0; }
.devices-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; padding: 10px 10px 10px 18px; border-radius: 16px; background: var(--text); color: var(--bg); font-size: 14px; z-index: 20; max-width: calc(100vw - 32px); }
.toast button { min-height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--bg); font: 600 14px var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.toast button:focus-visible { outline-color: var(--bg); }

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .hero, .split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .states, .tools { grid-template-columns: 1fr 1fr; }
  .states > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .states > div { padding-bottom: 20px; }
  .docs { grid-template-columns: 1fr; gap: 24px; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .views { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 2; }
  .views a { padding: 6px 10px; font-size: 14px; }
  .topics { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; gap: 6px; }
  .topics h2 { display: none; }
  .topics a { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
  .sync { margin: 0 0 0 auto; order: 1; padding: 6px 10px; border-radius: 999px; font-size: 12px; }
  .sync-state { flex-basis: auto; padding: 0; }
  .main { padding: 16px 16px 96px; }
  .bar { flex-wrap: wrap; }
  .search { order: 3; flex: 1 1 100%; margin: 0; }
  .search input { width: 100%; }
  .card { grid-template-columns: 1fr; padding: 14px 16px; }
  .actions { grid-column: 1; grid-row: auto; margin: 12px 0 0 18px; }
  .snooze-menu { right: auto; left: 0; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .site section { padding: 56px 0; }
  .site section.wrap { padding-left: 16px; padding-right: 16px; }
  .site-header nav { gap: 14px; }
  .site-header nav a[href^="https"] { display: none; }
  .hero { padding-top: 48px !important; padding-bottom: 56px !important; }
  .devices { grid-template-columns: 1fr 1.3fr; }
  .device.tablet { display: none; }
  .states, .tools { grid-template-columns: 1fr; }
  .states > div, .states > div + div { padding: 16px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .site h2 { font-size: 26px; }
  .site-footer p { flex-basis: 100%; }
}
