/* Cadenza website. Colors and the sample's card, badge and panel follow the extension's
   design tokens (packages/extension/lib/kit.css). */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/newsreader.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --ground: light-dark(#edf1ef, #0c100f);
  --surface: light-dark(#ffffff, #1d2522);
  --subtle: light-dark(#f4f6f5, #252e2b);
  --border: light-dark(#d7dedb, #37433f);
  --control: light-dark(#74827d, #73847e);
  --text: light-dark(#17211e, #ecf1ef);
  --muted: light-dark(#51605b, #a7b5b0);
  --accent: light-dark(#0f6b5a, #63cbb2);
  --accent-hover: light-dark(#0b5748, #84d9c5);
  --on-accent: light-dark(#ffffff, #07201a);
  --accent-soft: light-dark(#e0f0eb, #17382f);
  --focus: light-dark(#0f6b5a, #7fdcc5);
  --band: light-dark(#0f6b5a, #10201c);
  --band-text: light-dark(#ffffff, #ecf1ef);
  --band-muted: light-dark(#d8efe8, #a7b5b0);
  --band-rule: light-dark(#5a998c, #37433f);
  --band-line: light-dark(#ffffff, #63cbb2);
  --correctness: #e5484d;
  --clarity: #3e63dd;
  --style: #f5a623;
  --tone: #8e4ec6;
  --correctness-text: light-dark(#b4232a, #ff9a9d);
  --clarity-text: light-dark(#2f4fb8, #a8b9ff);
  --style-text: light-dark(#855200, #f7ba52);
  --tone-text: light-dark(#7a31ad, #d6a8f5);
  --shadow-card:
    0 0 0 1px light-dark(rgb(10 24 19 / 0.1), rgb(255 255 255 / 0.12)),
    0 10px 28px light-dark(rgb(10 24 19 / 0.18), rgb(0 0 0 / 0.55)),
    0 2px 6px light-dark(rgb(10 24 19 / 0.1), rgb(0 0 0 / 0.4));
  --shadow-sheet:
    0 0 0 1px light-dark(rgb(10 24 19 / 0.08), rgb(255 255 255 / 0.1)),
    0 24px 60px -24px light-dark(rgb(10 24 19 / 0.28), rgb(0 0 0 / 0.7));
  --serif: "Newsreader", Charter, "Iowan Old Style", Cambria, Georgia, serif;
  --ui:
    system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  --card-text:
    Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, "Noto Serif",
    serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Ubuntu Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: hidden must win over display rules. */
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 19px / 1.6 var(--serif);
  font-optical-sizing: auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  text-wrap: balance;
}

h1 {
  font-size: clamp(40px, 4.9vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.018em;
}

h2 {
  font-size: clamp(32px, 3.8vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.012em;
}

h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

p,
ul,
ol,
figure {
  margin: 0;
}

p {
  text-wrap: pretty;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

code,
kbd {
  font-family: var(--mono);
  font-size: 0.8em;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  line-height: 24px;
  text-align: center;
}

.wrap {
  width: min(1200px, 100%);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--surface);
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--control);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 600 14px / 20px var(--ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button:hover {
  background: var(--subtle);
  color: var(--text);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--on-accent);
}

.button-large {
  min-height: 46px;
  padding: 0 22px;
  font-size: 16px;
}

/* ---------- header and hero ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
}

.brand {
  display: block;
  border-radius: 6px;
}

.top nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font: 400 15px / 20px var(--ui);
}

.top nav a:not(.button),
.bottom nav a:not(.button) {
  color: var(--text);
  text-decoration: none;
}

.top nav a:not(.button):hover,
.bottom nav a:not(.button):hover {
  text-decoration: underline;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 5fr);
  align-items: end;
  gap: 24px 48px;
  padding-block: clamp(24px, 3vw, 40px) 32px;
}

.hero-side {
  display: grid;
  gap: 14px;
  padding-bottom: 4px;
  font-size: 18px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
}

.fine {
  color: var(--muted);
  font: 400 13px / 19px var(--ui);
}

/* ---------- sample ---------- */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 40px;
  padding-bottom: clamp(72px, 9vw, 128px);
}

.sheet {
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  background: var(--subtle);
  font: 400 13px / 18px var(--ui);
}

.field {
  position: relative;
  padding: 24px 28px 52px;
}

.writing {
  display: grid;
  gap: 0.85em;
  font-size: clamp(19px, 2vw, 23px);
  line-height: 1.75;
}

.mark {
  border-radius: 2px;
  text-decoration-line: underline;
  text-decoration-skip-ink: none;
  text-underline-offset: 5px;
  cursor: pointer;
  transition:
    text-decoration-color 200ms,
    background-color 120ms;
}

.mark.correctness {
  --line: var(--correctness);
  text-decoration-style: wavy;
  text-decoration-thickness: 1.5px;
}

.mark.clarity {
  --line: var(--clarity);
  text-decoration-style: solid;
  text-decoration-thickness: 2px;
}

.mark.style {
  --line: var(--style);
  text-decoration-style: dotted;
  text-decoration-thickness: 2.5px;
}

.mark.tone {
  --line: var(--tone);
  text-decoration-style: dashed;
  text-decoration-thickness: 2px;
}

.mark {
  text-decoration-color: var(--line);
}

.mark:hover,
.mark.is-open {
  background: color-mix(in srgb, var(--line) 16%, transparent);
}

.is-checking .mark {
  text-decoration-color: transparent;
}

.changed {
  border-radius: 3px;
  animation: settle 1600ms ease-out;
}

@keyframes settle {
  from {
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
}

.margin {
  display: grid;
  gap: 16px;
  padding-top: 8px;
  font-size: 17px;
  line-height: 1.5;
}

.margin h2 {
  font-size: 26px;
  line-height: 1.2;
}

.legend {
  padding: 0;
  list-style: none;
}

.legend li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font: 400 14px / 20px var(--ui);
}

.legend span {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 13px;
}

.legend strong {
  font-weight: 600;
}

.legend li[data-category="correctness"] strong {
  color: var(--correctness-text);
}

.legend li[data-category="clarity"] strong {
  color: var(--clarity-text);
}

.legend li[data-category="style"] strong {
  color: var(--style-text);
}

.legend li[data-category="tone"] strong {
  color: var(--tone-text);
}

.legend .count {
  grid-column: 3;
  grid-row: 1;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--control);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 600 13px / 1 var(--ui);
  cursor: pointer;
}

.legend .count:disabled {
  border-color: transparent;
  color: var(--muted);
  cursor: default;
}

.line {
  width: 24px;
  height: 8px;
  fill: none;
  stroke-width: 2;
}

.line.correctness {
  stroke: var(--correctness);
  stroke-width: 1.6;
}

.line.clarity {
  stroke: var(--clarity);
}

.line.style {
  stroke: var(--style);
  stroke-width: 2.5;
  stroke-dasharray: 2.5 2.5;
}

.line.tone {
  stroke: var(--tone);
  stroke-dasharray: 6 3;
}

/* ---------- the sample's badge, card and panel ---------- */

.badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font: 700 12px / 1 var(--ui);
  box-shadow: 0 1px 3px rgb(10 24 19 / 0.22);
  cursor: pointer;
}

.badge[data-state="checking"],
.badge[data-state="idle"] {
  padding: 0;
  border-color: var(--border);
  background: var(--surface);
  color: var(--accent);
}

.badge svg {
  width: 15px;
  height: 15px;
}

.badge[data-state="checking"] svg {
  animation: turn 900ms linear infinite;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.popover {
  position: absolute;
  z-index: 10;
  width: min(320px, calc(100% - 16px));
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font: 400 14px / 20px var(--ui);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 8px;
}

.panel {
  right: 8px;
  bottom: 48px;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 16px));
  max-height: min(520px, calc(100% + 100px));
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 14px;
}

.card-head,
.panel-head,
.group-head {
  display: flex;
  align-items: center;
  gap: 2px;
}

.count-of {
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
}

.category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.card-head .category {
  margin-right: auto;
}

.category.correctness {
  color: var(--correctness-text);
}

.category.clarity {
  color: var(--clarity-text);
}

.category.style {
  color: var(--style-text);
}

.category.tone {
  color: var(--tone-text);
}

.icon-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--subtle);
  color: var(--text);
}

.popover .icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font: 400 16px / 24px var(--card-text);
}

.change.stacked {
  flex-direction: column;
  align-items: flex-start;
}

.change del,
.between del {
  color: var(--muted);
  text-decoration: line-through 1px;
}

.change ins {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  font-weight: 700;
  text-decoration: none;
}

.arrow {
  color: var(--muted);
  font-family: var(--ui);
}

.why {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card .button {
  min-height: 32px;
  font-size: 13px;
}

.never {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.card .quiet {
  margin-left: -8px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
}

.done {
  flex-direction: row;
  align-items: center;
  padding: 10px 8px 10px 12px;
}

.done p {
  flex: 1;
}

.panel-head {
  gap: 8px;
  padding: 10px 8px 10px 14px;
  font-weight: 600;
}

.panel-head span {
  flex: 1;
}

.panel section {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.group-head {
  gap: 8px;
  padding: 2px 14px 4px;
}

.group-head .button {
  min-height: 28px;
  margin-left: auto;
  font-size: 13px;
}

.panel ul {
  padding: 0;
  list-style: none;
}

.panel li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 14px;
}

.panel li .change {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.panel-note {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* ---------- where text goes ---------- */

.route {
  padding-block: clamp(72px, 9vw, 120px);
  background: var(--band);
  color: var(--band-text);
}

.band-link,
.band-link:hover {
  color: var(--band-text);
}

.route :focus-visible {
  outline-color: var(--band-text);
}

.section-head {
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin-bottom: 56px;
}

.route .section-head p {
  color: var(--band-muted);
}

.trip {
  display: grid;
  grid-template-columns: auto minmax(60px, 160px) minmax(0, 1fr);
  align-items: stretch;
}

.from {
  align-self: center;
  padding: 18px 22px;
  border: 1.5px solid var(--band-line);
  border-radius: 6px;
  font-size: 22px;
  line-height: 1.3;
}

.fork {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--band-line);
  stroke-width: 2;
}

.fork path {
  vector-effect: non-scaling-stroke;
}

.to {
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 0;
  list-style: none;
}

/* Each destination is centered on the end of its branch (20% and 80% of the fork). */
.to li {
  align-self: center;
  max-width: 480px;
  padding: 12px 0 12px 22px;
}

.route .to p {
  color: var(--band-muted);
  font-size: 17px;
  line-height: 1.55;
}

.between {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-top: 48px;
  font-size: clamp(22px, 2.6vw, 30px);
}

.between del {
  color: var(--band-muted);
}

.between ins {
  padding: 0 10px;
  border-radius: 6px;
  background: var(--band-text);
  color: light-dark(#0f6b5a, #10201c);
  font-weight: 600;
  text-decoration: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 64px;
  margin-top: 64px;
}

.facts ul {
  margin: 14px 0 18px;
  padding: 0;
  list-style: none;
}

.facts li {
  padding: 11px 0;
  border-top: 1px solid var(--band-rule);
  font-size: 18px;
  line-height: 1.45;
}

/* ---------- settings ---------- */

.settings {
  padding-block: clamp(72px, 9vw, 128px);
}

.shown {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: 32px 64px;
}

.shown > div {
  display: grid;
  gap: 16px;
}

.shown h3:not(:first-child) {
  margin-top: 20px;
}

.shown figure,
.steps figure {
  overflow: hidden;
  border-radius: 14px;
  box-shadow: var(--shadow-sheet);
}

.shown-popup {
  margin-top: 96px;
}

.shown-popup figure {
  justify-self: center;
  width: min(340px, 100%);
}

/* ---------- install ---------- */

.install {
  padding-block: clamp(72px, 9vw, 120px);
  background: var(--surface);
}

.install .wrap {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  align-items: start;
  gap: 0 64px;
}

.steps {
  display: grid;
  gap: 48px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-left: 60px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: -3px;
  left: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 19px;
  line-height: 1;
}

.code {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 16px 16px 16px 20px;
  border-radius: 10px;
  background: var(--ground);
}

.code pre {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  font-size: 18px;
  line-height: 1.7;
}

.steps figure {
  max-width: 672px;
  margin-top: 8px;
}

/* ---------- questions and footer ---------- */

.questions {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  align-items: start;
  gap: 32px 64px;
  padding-block: clamp(72px, 9vw, 120px);
}

details {
  border-bottom: 1px solid var(--border);
}

details:first-child {
  border-top: 1px solid var(--border);
}

summary {
  position: relative;
  padding: 18px 40px 18px 0;
  font-size: 22px;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 4px;
  color: var(--accent);
  font: 400 24px / 1 var(--ui);
  transform: translateY(-50%);
}

details[open] summary::after {
  content: "\2212";
}

.answer {
  max-width: 62ch;
  padding-bottom: 22px;
  color: var(--muted);
}

.bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding-block: 32px 48px;
  border-top: 1px solid var(--border);
}

.bottom nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font: 400 14px / 20px var(--ui);
}

/* ---------- privacy policy ---------- */

.policy {
  max-width: 800px;
  padding-block: 32px 96px;
}

.policy h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 4.4vw, 52px);
}

.policy h2 {
  margin: 48px 0 14px;
  font-size: 28px;
}

.policy :where(p, ul) {
  margin-bottom: 16px;
}

.policy li {
  margin-bottom: 6px;
}

.policy .table {
  margin-bottom: 20px;
  overflow-x: auto;
}

.policy table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  line-height: 1.45;
}

.policy th,
.policy td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.todo {
  padding: 0 4px;
  border-radius: 3px;
  background: light-dark(#fdf3e0, #352a16);
  color: var(--style-text);
}

/* ---------- small screens and preferences ---------- */

@media (max-width: 980px) {
  .hero,
  .demo,
  .shown,
  .install .wrap,
  .questions {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-side {
    max-width: 620px;
  }

  .demo {
    gap: 48px;
  }

  .margin {
    max-width: 620px;
  }

  .legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
}

@media (max-width: 720px) {
  .top nav a:not(.button) {
    display: none;
  }

  .sheet-head,
  .field {
    padding-inline: 18px;
  }

  .trip {
    grid-template-columns: minmax(0, 1fr);
  }

  .from {
    justify-self: start;
  }

  .fork {
    display: none;
  }

  .to {
    margin: 0 0 0 20px;
    border-left: 2px solid var(--band-line);
  }

  .to li {
    padding-top: 24px;
  }

  .facts,
  .legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps li {
    padding-left: 0;
    padding-top: 52px;
  }

  .steps li::before {
    top: 0;
  }

  .code {
    flex-direction: column;
  }

  .code pre {
    width: 100%;
    font-size: 15px;
  }
}

/* Phones get the narrow screenshots, at their own size at most. */
@media (max-width: 600px) {
  .shown figure,
  .steps figure {
    justify-self: center;
    width: min(420px, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .mark {
    transition: none;
  }

  .changed,
  .badge[data-state="checking"] svg {
    animation: none;
  }
}

@media (forced-colors: active) {
  .mark {
    text-decoration-color: CanvasText;
  }

  .line {
    stroke: CanvasText;
  }

  .popover,
  .sheet {
    border: 1px solid CanvasText;
  }
}
