/* BSD7 Policy Explorer — styled to match patrickzimny.com (Ghost Scope theme).
   ACCENT: keep --accent in sync with the Ghost admin accent color
   (Settings → Design & branding). One line to change, everything follows.
   --accent-2 (sea glass) is the supporting tone: tints, badges, hovers only. */

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}

::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--bg);
  padding: 0.5rem 1rem; z-index: 10; font-size: 0.85rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.container { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }

/* ---- chrome ---------------------------------------------------------- */

.tool-header { max-width: 46rem; margin: 0 auto; padding: 1.2rem 1.25rem 0; }
.tool-header a {
  font-size: 0.85rem; font-weight: 500; text-decoration: none;
  color: var(--ink-soft);
}
.tool-header a:hover { color: var(--accent-text); }

.breadcrumb { font-size: 0.8rem; color: var(--ink-soft); padding-top: 1.2rem; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-text); text-decoration: underline; }

/* ---- title block ----------------------------------------------------- */

.tool-title { margin: 1.6rem 0 2.4rem; }

.tape {
  display: inline-block;
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-2-text);
  background: var(--accent-soft);
  border-radius: 2rem;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1rem;
}

.tool-title h1 {
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.tool-title h1 mark { background: none; color: inherit; }

.tagline { color: var(--ink-soft); font-size: 1.02rem; margin-top: 0.6rem; max-width: 34rem; }

.shop-status { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.7rem; }

/* ---- series ----------------------------------------------------------- */

.policy-series {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 0.8rem;
  padding-bottom: 0.3rem;
  background: var(--bg);
  animation: rowIn 0.4s both;
}
.policy-series[hidden] { display: none; }
.policy-series:nth-of-type(1) { animation-delay: 0.02s; }
.policy-series:nth-of-type(2) { animation-delay: 0.05s; }
.policy-series:nth-of-type(3) { animation-delay: 0.08s; }
.policy-series:nth-of-type(4) { animation-delay: 0.11s; }
.policy-series:nth-of-type(5) { animation-delay: 0.14s; }
.policy-series:nth-of-type(6) { animation-delay: 0.17s; }
.policy-series:nth-of-type(7) { animation-delay: 0.20s; }
.policy-series:nth-of-type(8) { animation-delay: 0.23s; }
.policy-series:nth-of-type(9) { animation-delay: 0.26s; }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .policy-series { animation: none; }
}

.series-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.9rem;
  padding: 1rem 1.2rem;
  border-radius: 12px 12px 0 0;
  font-size: 1.05rem; font-weight: 600;
}

.series-no {
  font-weight: 600; font-size: 0.95rem;
  color: var(--accent-text);
  min-width: 3.4rem;
}

.series-count {
  font-size: 0.78rem; font-weight: 500; color: var(--accent-2-text);
  background: var(--accent-soft);
  border-radius: 2rem;
  padding: 0.2rem 0.75rem;
  margin-left: auto;
  white-space: nowrap;
}

/* ---- policy rows ------------------------------------------------------- */

.policy-item {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.9rem;
  padding: 0.9rem 1.2rem; border-top: 1px solid var(--line);
  scroll-margin-top: 1.5rem;
}
.policy-item[hidden] { display: none; }
.policy-item:target { background: var(--accent-soft); border-radius: 8px; }

.policy-number {
  font-weight: 600; font-size: 0.9rem;
  color: var(--accent-text); padding-top: 0.05rem;
  text-decoration: none;
}
.policy-body { min-width: 0; }
/* No underline at rest. Every one of the 577 rows carries a title link, and
   underlining them all turns the page into a wall of rules. Underline on hover
   keeps the affordance without the noise. */
.policy-title {
  font-weight: 600; color: var(--ink);
  text-decoration: none; text-underline-offset: 3px;
}
.policy-title:hover { color: var(--accent-text); text-decoration: underline; }
.policy-desc { font-size: 0.93rem; color: var(--ink-soft); margin-top: 0.25rem; }
.policy-note {
  font-size: 0.85rem; color: var(--accent-2-text); background: var(--accent-soft);
  border-radius: 6px; padding: 0.4rem 0.6rem; margin-top: 0.45rem;
}

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { opacity: 0.8; }

em { color: var(--ink-soft); }

/* ---- footer ----------------------------------------------------------- */

.shop-footer {
  max-width: 46rem; margin: 2.5rem auto 0; padding: 1.4rem 1.25rem 2.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem; color: var(--ink-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
}
.shop-footer a { color: var(--accent-text); text-decoration: none; }
.shop-footer a:hover { text-decoration: underline; }

@media (max-width: 540px) {
  .series-header { gap: 0.4rem 0.9rem; }
  .series-count { order: 3; }
  .policy-item { grid-template-columns: 1fr; gap: 0.1rem; }
}

.tool-loop { flex-basis: 100%; margin-top: 0.4rem; font-size: 0.85rem; }

/* ---- search ----------------------------------------------------------- */

.policy-search { margin: 1.5rem 0; }
.policy-search label {
  display: block; font-size: 0.85rem; font-weight: 500;
  color: var(--ink-soft); margin-bottom: 0.4rem;
}
.policy-search input {
  width: 100%; font: inherit; font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.policy-search input:focus-visible {
  outline: 2px solid var(--accent-ui); outline-offset: 2px; border-color: var(--accent-ui);
}
.search-status { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.5rem; min-height: 1.2em; }

/* ---- layout ------------------------------------------------------------ */

.policy-layout { display: block; }

@media (min-width: 900px) {
  /* 46rem was sized for a single reading column. With a 14rem sidebar beside
     it the content had ~30rem left and titles wrapped for no reason, so the
     container widens once the sidebar appears. Other tools keep 46rem; this
     one earns the extra width by carrying 577 rows and a nav. */
  .container { max-width: 64rem; }
  .policy-layout { display: grid; grid-template-columns: 14rem 1fr; gap: 2.5rem; align-items: start; }
  .policy-nav { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
}

.policy-nav ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.policy-nav a {
  display: block; padding: 0.4rem 0.6rem; border-radius: 6px;
  font-size: 0.85rem; font-weight: 500; text-decoration: none; color: var(--ink-soft);
}
.policy-nav a:hover { background: var(--accent-soft); color: var(--accent-text); }
.policy-nav a span { display: block; font-weight: 400; font-size: 0.8rem; }

/* Below the sidebar breakpoint the nav stacks, and nine series links eat the
   whole first screen before a single policy appears. Collapse it to one
   horizontally scrolling row of chips so the list starts above the fold. */
@media (max-width: 899px) {
  .policy-nav ul {
    display: flex; gap: 0.5rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: thin;
  }
  .policy-nav li { flex: 0 0 auto; }
  .policy-nav a {
    display: flex; align-items: baseline; gap: 0.35rem;
    white-space: nowrap;
    border: 1px solid var(--line); border-radius: 2rem;
    padding: 0.35rem 0.8rem;
  }
  .policy-nav a span { display: inline; font-size: 0.8rem; }
}
