/* Capabilities page — extends styles.css (tokens + shell already defined there) */

:root {
  --green-ink: #0d3a29;
  --gray: #8a7fa0;
}

.cap-page { max-width: 900px; }

.cap-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* .lede's shared default (styles.css) caps at 640px for the homepage
   greeting's readable line length -- too narrow here. */
.cap-header .lede { font-size: 14px; margin-bottom: 16px; max-width: none; }

/* Browse-by mode switcher (top-level, above the per-view controls) */
.browse-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #efe7fb;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 20px;
}
.browse-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--violet-dark);
}
.browse-pills { display: flex; gap: 6px; }
.browse-pill {
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--violet-dark);
  cursor: pointer;
  transition: all .15s ease;
}
.browse-pill:hover { background: rgba(108,60,233,0.08); }
.browse-pill.is-active {
  background: var(--indigo);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(36,17,84,0.2);
}

.browse-view-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 640px;
  line-height: 1.5;
}

.cap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.cap-version-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cap-version-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.cap-version-pills { display: flex; gap: 6px; }
.cap-version-pill {
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.cap-version-pill:hover { border-color: #c9b8f5; color: var(--ink); }
.cap-version-pill.is-active {
  background: var(--violet);
  border-color: var(--violet);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(108,60,233,0.25);
}
/* Locked is a fact about the release, visible to everyone -- not just an
   editing detail -- so it shows on the pill itself, not only inside the
   edit modal. */
.cap-version-pill.is-locked::after { content: "🔒"; margin-left: 5px; font-size: 10px; }

.cap-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--muted-2);
  flex-grow: 1;
  max-width: 320px;
}
.cap-search input {
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
.cap-search input::placeholder { color: var(--muted-2); }

.cap-empty {
  text-align: center;
  color: var(--muted-2);
  font-size: 14px;
  padding: 40px 0;
}

.cap-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 36px;
}

.cap-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  transition: border-color .15s ease;
}
.cap-card:hover { border-color: #c9b8f5; }
.cap-card[open] { border-color: #c9b8f5; }

.cap-card summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  position: relative;
}
.cap-card summary::-webkit-details-marker { display: none; }
.cap-card summary::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 24px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted-2);
  border-bottom: 2px solid var(--muted-2);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.cap-card[open] summary::after { transform: rotate(-135deg); }

.cap-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-right: 28px;
}

.cap-id {
  font-family: 'Quicksand', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--violet-dark);
  background: #efe7fb;
  padding: 3px 9px;
  border-radius: 999px;
}

.status-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}
.status-badge.status-shipped { background: #e3f5ec; color: var(--green-ink); }
.status-badge.status-proposed { background: #fdf0dc; color: #6b4008; }
.status-badge.status-withdrawn { background: #f0eef4; color: var(--gray); }

/* Matches .cap-body's own padding-top (18px) so this divider's gap to its
   label reads the same as the gap from the card's top divider down to
   "What it enables" -- the shared .tag-row default (14px) is close but
   not quite equal. */
.cap-status-row { padding-top: 18px; }

.readiness-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}
.readiness-badge.readiness-ga { background: #e3f5ec; color: var(--green-ink); }
.readiness-badge.readiness-beta { background: #efe7fb; color: var(--violet-dark); }
.readiness-badge.readiness-under-development { background: #fdf0dc; color: #6b4008; }

.cap-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.cap-name-row .cap-pencil-btn { margin-top: 3px; flex-shrink: 0; }

.cap-name {
  font-family: 'Quicksand', sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.cap-description {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding-right: 28px;
}

.service-chip {
  cursor: pointer;
  transition: all .15s ease;
}
.service-chip:hover {
  color: var(--violet-dark);
  border-color: #c9b8f5;
}

/* Popover shown when a Service chip is clicked, or a Feature line with a
   long description is hovered. */
.service-popover, .feature-popover {
  position: absolute;
  z-index: 1200;
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 280px;
  box-shadow: 0 12px 36px rgba(36,17,84,0.25);
  border: 1px solid var(--card-border);
}
/* Hover-triggered, so it must never itself swallow the mouse (that would
   fire mouseout on the underlying <li>, closing it instantly). */
.feature-popover { max-width: 320px; pointer-events: none; }
.service-popover-title, .feature-popover-title {
  font-family: 'Quicksand', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
}
.feature-popover-title { color: var(--violet-dark); font-size: 12px; }
.service-popover-desc, .feature-popover-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 10px;
}
.feature-popover-desc { margin-bottom: 0; }
.service-popover-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--violet-dark);
  text-decoration: none;
}
.service-popover-link:hover { text-decoration: underline; }

.cap-body {
  padding: 0 24px 24px;
  border-top: 1px solid var(--card-border);
  margin-top: 4px;
  padding-top: 18px;
}

.cap-also-called {
  font-size: 12.5px;
  color: var(--muted-2);
  margin-bottom: 14px;
}

.cap-status-note {
  font-size: 12.5px;
  color: #8a5a10;
  background: #fdf0dc;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 14px;
}

.cap-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}

.cap-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cap-body li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}

.cap-since-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--violet-dark);
  background: #efe7fb;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 7px;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Citable feature id (CAP-01.3) -- same geometry as .cap-since-tag but a
   neutral palette, so the violet pill stays exclusively "version" and the
   two read apart when they sit side by side. */
.cap-feature-id {
  display: inline-block;
  font-family: 'Quicksand', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  background: var(--cream);
  border: 1px solid var(--card-border);
  padding: 0 7px;
  border-radius: 999px;
  margin-left: 7px;
  vertical-align: 1px;
  white-space: nowrap;
  user-select: all;
}
.cap-feature-id-pending {
  font-style: italic;
  border-color: transparent;
  background: none;
}
.cap-feature-has-desc { cursor: help; }
.cap-feature-has-desc .cap-feature-title { border-bottom: 1px dotted var(--muted-2); }
.cap-feature-has-desc:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.cap-source-note {
  font-size: 12.5px;
  color: var(--muted-2);
  line-height: 1.6;
  border-top: 1px solid var(--card-border);
  padding-top: 20px;
  margin-bottom: 40px;
}
.cap-source-note code {
  background: var(--cream);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
}

/* By Module view */

.module-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.module-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  transition: border-color .15s ease;
}
.module-card:hover { border-color: #c9b8f5; }
.module-card[open] { border-color: #c9b8f5; }

.module-card summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  position: relative;
}
.module-card summary::-webkit-details-marker { display: none; }
.module-card summary::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted-2);
  border-bottom: 2px solid var(--muted-2);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.module-card[open] summary::after { transform: rotate(-135deg); }

.module-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding-right: 28px;
}
.module-name {
  font-family: 'Quicksand', sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.module-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  background: var(--cream);
  border-radius: 999px;
  padding: 2px 10px;
}
.module-description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding-right: 28px;
}

.module-body {
  padding: 0 22px 20px;
  border-top: 1px solid var(--card-border);
  margin-top: 4px;
  padding-top: 16px;
}

.module-cap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.module-cap-empty { font-size: 13px; color: var(--muted-2); margin: 0; }

.module-cap-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  background: var(--cream);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.module-cap-link:hover { border-color: #c9b8f5; background: #ffffff; }
.module-cap-name {
  flex-grow: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* By Version view */

.version-timeline {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.version-entry {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px 22px;
}

.version-entry-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}
.version-entry-label {
  font-family: 'Quicksand', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--violet-dark);
}
.version-entry-count {
  font-size: 12.5px;
  color: var(--muted-2);
}

.version-entry-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}

/* Buttons shared by the edit modals (sign-in/out UI used to live here too,
   now handled globally via the sidebar user chip in site-gate.js) */

.cap-auth-btn {
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--indigo);
  color: #ffffff;
  cursor: pointer;
  transition: all .15s ease;
}
.cap-auth-btn:hover { opacity: .9; }
.cap-auth-btn:disabled { opacity: .6; cursor: default; }
.cap-auth-btn-ghost {
  background: transparent;
  color: var(--violet-dark);
  border: 1px solid var(--card-border);
}

/* Per-section edit pencils: one next to each section's own label,
   instead of a single "Edit" button covering the whole card. */
.cap-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.cap-section-head .cap-label { margin-bottom: 0; }

.cap-pencil-btn {
  background: none;
  border: none;
  padding: 3px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted-2);
  display: inline-flex;
  flex-shrink: 0;
  margin-left: auto;
  transition: all .15s ease;
}
.cap-pencil-btn:hover { color: var(--violet-dark); background: #efe7fb; }

/* Replaces the "What it enables" pencil when its version is locked --
   same footprint as .cap-pencil-btn so nothing shifts. */
.cap-lock-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 3px;
  flex-shrink: 0;
  color: var(--muted-2);
  cursor: help;
}

.modal-box-section { max-width: 420px; }

/* Modal (shared shell for sign-in + edit form) */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36,17,84,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}
.modal-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 26px 28px;
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(36,17,84,0.3);
}
.modal-box-narrow { max-width: 380px; text-align: center; }
.modal-title {
  font-family: 'Quicksand', sans-serif;
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 14px;
}
.modal-copy { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; }
.modal-copy-muted { color: var(--muted-2); font-size: 12.5px; }
.device-code {
  font-family: 'Quicksand', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--violet-dark);
  background: #efe7fb;
  border-radius: 10px;
  padding: 12px 0;
  margin: 10px 0 16px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}

/* Edit form */

.edit-field, .edit-versionmap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.edit-field > span, .edit-versionmap > span, .edit-subfield > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.edit-field > span em, .edit-subfield > span em {
  text-transform: none;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}
.edit-field input[type="text"],
.edit-field select,
.edit-field textarea,
.edit-subfield input[type="text"],
.edit-subfield select,
.edit-subfield textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  width: 100%;
  box-sizing: border-box;
}
.edit-checkboxes { display: flex; flex-wrap: wrap; gap: 10px; }
.edit-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.edit-multienum { border: none; padding: 0; margin: 0 0 16px; }

/* List editor (e.g. "What it enables"): one row per item instead of a
   single newline-separated textarea. */
.edit-list-rows { display: flex; flex-direction: column; gap: 8px; }
.edit-list-row { display: flex; align-items: center; gap: 8px; }
.edit-list-row .edit-list-input { flex-grow: 1; }
.edit-list-remove-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted-2);
  display: flex;
  flex-shrink: 0;
  transition: all .15s ease;
}
.edit-list-remove-btn:hover { color: #9c2b2b; background: #fdecec; }
.edit-list-add-btn {
  align-self: flex-start;
  margin-top: 8px;
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--violet-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.edit-list-add-btn:hover { text-decoration: underline; }

.edit-version-block {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.edit-version-block legend {
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--violet-dark);
  padding: 0 4px;
}
/* openMoreModal splits into a version-scoped fieldset (frozen when that
   version is locked) and a capability-wide one (Modules/Services, never
   locked) -- .6 matches .cap-auth-btn:disabled's existing dimmed look. */
.edit-locked-group { opacity: .6; background: var(--cream); }
.edit-locked-group legend { color: var(--muted-2); }
.edit-locked-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

.edit-feature-row {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.edit-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.edit-feature-inherited-list {
  margin: 0 0 4px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
}
.edit-feature-inherited-list li { margin-bottom: 4px; }
.edit-subfield {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.edit-subfield:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .cap-toolbar { flex-direction: column; align-items: stretch; }
  .cap-search { max-width: none; }
  .browse-switch { flex-direction: column; align-items: stretch; gap: 8px; }
}
