:root {
  color-scheme: light;
  --library-ink: #16313a;
  --library-muted: #5b7078;
  --library-teal: #0b6b67;
  --library-teal-dark: #064b49;
  --library-teal-soft: #e7f4f1;
  --library-gold: #e4a72c;
  --library-paper: #f5f8f7;
  --library-white: #fff;
  --library-line: #d5e2df;
  --library-shadow: 0 14px 40px rgb(19 49 58 / 10%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--library-paper);
  color: var(--library-ink);
  line-height: 1.55;
}

a { color: var(--library-teal-dark); }
a:hover { color: var(--library-teal); }

button, input { font: inherit; }

button { cursor: pointer; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 5;
  padding: .65rem .9rem;
  border-radius: .5rem;
  background: var(--library-ink);
  color: #fff;
}

.skip-link:focus { top: 1rem; }

.library-shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
}

.library-header {
  background: var(--library-ink);
  color: #fff;
  border-bottom: 5px solid var(--library-gold);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 64px;
}

.brand, .brand-section { color: #fff; text-decoration: none; }
.brand { font-weight: 800; letter-spacing: -.02em; }
.brand-section { color: #c8dfdc; font-size: .95rem; }
.brand-divider { color: #789291; }

.library-hero {
  max-width: 780px;
  padding: 4.5rem 0 2.2rem;
}

.eyebrow, .section-kicker {
  margin: 0 0 .35rem;
  color: var(--library-teal);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.library-hero h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.45rem, 7vw, 5rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.hero-copy {
  max-width: 680px;
  margin: 1.25rem 0 0;
  font-size: 1.2rem;
  color: #38545c;
}

.privacy-line {
  display: inline-block;
  margin: 1.1rem 0 0;
  padding: .65rem .85rem;
  border-left: 4px solid var(--library-gold);
  background: #fff;
  color: #38545c;
  font-size: .95rem;
}

.status {
  min-height: 1.6rem;
  margin: 0 0 .7rem;
  color: var(--library-muted);
  font-size: .95rem;
}

.status.error {
  padding: .7rem .85rem;
  border: 1px solid #e3b5ae;
  border-left: 4px solid #b53e32;
  background: #fff7f5;
  color: #7b241c;
}

.resolver-card, .library-picker, .results-section, .bookmarklet-section, .guardrails {
  margin: 0 0 1.3rem;
  padding: 1.35rem;
  border: 1px solid var(--library-line);
  border-radius: 1rem;
  background: var(--library-white);
  box-shadow: var(--library-shadow);
}

.section-heading { margin-bottom: 1rem; }
.section-heading.compact { margin-bottom: .9rem; }
.section-heading h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.85rem); line-height: 1.15; }
.section-copy { margin: 0 0 1rem; color: var(--library-muted); }

label { display: block; margin-bottom: .4rem; font-weight: 750; }

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .65rem;
}

input[type="url"], input[type="search"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid #9db4b0;
  border-radius: .55rem;
  background: #fff;
  color: var(--library-ink);
  padding: .7rem .85rem;
}

input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid #f0bf46;
  outline-offset: 2px;
}

.primary-button, .secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: .55rem;
  padding: .7rem 1rem;
  font-weight: 800;
}

.primary-button { background: var(--library-teal); color: #fff; }
.primary-button:hover { background: var(--library-teal-dark); }
.secondary-button { border: 1px solid #8fb1aa; background: #fff; color: var(--library-teal-dark); }
.secondary-button:hover { background: var(--library-teal-soft); }
.field-help { margin: .5rem 0 0; color: var(--library-muted); font-size: .9rem; }
.library-search { max-width: 420px; margin-bottom: .85rem; }

.library-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.library-group { grid-column: 1 / -1; margin: .5rem 0 0; color: var(--library-teal-dark); font-size: .85rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }

.library-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: start;
  min-height: 84px;
  padding: .8rem;
  border: 1px solid var(--library-line);
  border-radius: .7rem;
  background: #fbfdfc;
}

.library-choice:has(input:checked) { border-color: #6fa79d; background: var(--library-teal-soft); }
.library-choice input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--library-teal); }
.library-choice strong { display: block; }
.library-choice small { display: block; margin-top: .15rem; color: var(--library-muted); line-height: 1.35; }
.library-choice a { display: inline-block; margin-top: .25rem; font-size: .82rem; }
.support-note { margin: 1rem 0 0; color: var(--library-muted); font-size: .88rem; }

.article-summary {
  margin: 0 0 1.1rem;
  padding: 1rem;
  border-radius: .7rem;
  background: var(--library-ink);
  color: #fff;
}

.article-summary h3 { margin: 0 0 .3rem; font-size: clamp(1.2rem, 3vw, 1.6rem); line-height: 1.2; }
.article-summary p { margin: 0; color: #cfe4e0; }

.activation-panel {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 2px solid var(--library-gold);
  border-radius: .7rem;
  background: #fffaf0;
}

.activation-panel h3 { margin: 0 0 .35rem; }
.activation-panel p { margin: 0 0 .75rem; color: #5d4b23; }
.activation-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

.route-group { margin: 1.1rem 0 0; }
.route-group h3 { margin: 0 0 .55rem; font-size: 1.05rem; }
.route-list { display: grid; gap: .7rem; }

.route-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .9rem;
  padding: .95rem;
  border: 1px solid var(--library-line);
  border-radius: .7rem;
  background: #fff;
}

.route-card.best { border-color: #77a69e; box-shadow: 0 0 0 3px var(--library-teal-soft); }
.route-title { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.route-title a { color: var(--library-teal-dark); font-weight: 800; }
.route-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: .45rem 0; }
.tag { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: .15rem .5rem; background: #edf3f1; color: #345b57; font-size: .75rem; font-weight: 800; }
.tag.best-tag { background: #d8f0e9; color: #075b51; }
.tag.warn-tag { background: #fff1d0; color: #79521a; }
.route-steps, .route-constraints { margin: .45rem 0 0 1.1rem; padding: 0; color: var(--library-muted); font-size: .9rem; }
.route-constraints { color: #704b28; }
.route-source { display: inline-block; margin-top: .55rem; font-size: .82rem; }
.route-open { align-self: start; white-space: nowrap; }
.route-details { grid-column: 1 / -1; color: var(--library-muted); font-size: .84rem; }
.route-details summary { cursor: pointer; color: var(--library-teal-dark); font-weight: 700; }
.route-details p { margin: .35rem 0 0; }
.empty-results { margin: 1rem 0 0; color: var(--library-muted); }

.bookmarklet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.bookmarklet-link { display: inline-flex; min-height: 48px; align-items: center; border-radius: .55rem; background: var(--library-teal); color: #fff; padding: .7rem 1rem; font-weight: 800; text-decoration: none; }
.bookmarklet-link:hover { background: var(--library-teal-dark); color: #fff; }
.bookmarklet-steps { margin-bottom: 0; color: var(--library-muted); }
.guardrail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.guardrail-grid h3 { margin: 0; color: var(--library-teal-dark); font-size: 1rem; }
.guardrail-grid p { margin: .3rem 0 0; color: var(--library-muted); }

.library-footer { margin-top: 2.5rem; padding: 1.6rem 0 3rem; color: var(--library-muted); font-size: .9rem; }
.library-footer p { margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .library-hero { padding-top: 3rem; }
  .url-row, .library-list, .guardrail-grid { grid-template-columns: 1fr; }
  .route-card { grid-template-columns: 1fr; }
  .route-open { justify-self: start; }
  .brand-section { font-size: .85rem; }
}

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