/* ============================================================
   Skill Sections — shared component system (D1: "The Codex")
   Used by: skill.php, skill_details.php, question.php
   (event_sections.css @imports this + skill_forms.css, so event.php
   inherits it too.)

   Design tokens + fonts + apparatus color-coding live in css/codex.css,
   which every page loads. This file consumes those variables and must not
   redefine :root.
   ============================================================ */

* { box-sizing: border-box }
body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--paper) }
.wrap { max-width: var(--max); margin: 0 auto; padding: 24px 16px 72px; text-align: left }

/* ---- Cards & sections ------------------------------------------------ */
.card, details.section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
  overflow: hidden;
}
/* Collapsible section: a gold "spine" on the left edge (apparatus --ev on
   event pages). Fraunces title, restrained header. */
details.section {
  border-left: 4px solid var(--ev, var(--gold));
}
details.section > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--card);
}
details.section > summary::-webkit-details-marker { display: none }
details.section > summary > div:first-child,
details.section > summary > span:first-child {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.01em;
  color: var(--ink);
}
details.section[open] > summary { border-bottom: 1px solid var(--line) }

.sectionMeta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600 }
.pillCount {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  background: var(--ev-soft, var(--gold-soft));
  color: var(--ev, var(--gold-deep));
  border: 1px solid var(--ev-line, var(--gold-line));
}
.chevron { color: var(--muted); font-size: 12px }

.content { padding: 16px 20px 20px }
.list { display: flex; flex-direction: column; gap: 8px }

/* ---- Item cards (resources, deductions, questions, comments) --------- */
details.item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
details.item:hover { border-color: var(--line-2); background: var(--card); box-shadow: var(--shadow-sm) }
details.item[open] { background: var(--card); border-color: var(--line-2) }
details.item > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
}
details.item > summary::-webkit-details-marker { display: none }

/* ---- Vote control ---------------------------------------------------- */
.vote {
  display: flex; align-items: center;
  gap: var(--vote-gap, 4px);
  min-width: 72px; justify-content: center;
  font-family: var(--font-mono); font-weight: 700;
  color: var(--ink-soft);
}
.vote button {
  width: var(--vote-btn, 24px); height: var(--vote-btn, 24px);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--card);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  font-size: var(--vote-arrow, 11px);
  padding: 0; line-height: 1; color: var(--muted);
}
.vote button:hover { background: var(--paper); border-color: var(--muted); color: var(--ink) }
.vote button:active { transform: scale(.92) }
.vote button.voted-up { background: var(--good-soft); border-color: #a9cfae; color: var(--good) }
.vote button.voted-down { background: var(--bad-soft); border-color: #e3b3a6; color: var(--bad) }
.vote .score { padding: 0 2px; text-align: center; font-size: var(--vote-font, 14px); color: var(--ink) }

/* ---- Item body ------------------------------------------------------- */
.main { flex: 1; display: flex; justify-content: space-between; gap: 12px; min-width: 0 }
.q { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.rightInfo { display: flex; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; flex-shrink: 0; align-items: center }

.tag {
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--paper-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--ink-soft);
}

.detail {
  padding: 12px 15px 14px;
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.6;
}

/* External link button */
.extLink {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--gold-soft); border: 1px solid var(--gold-line);
  color: var(--gold-deep); font-size: 14px; text-decoration: none; flex-shrink: 0;
  transition: background .15s;
}
.extLink:hover { background: #f0e0b8 }
/* NB: the F7 .sp-copylink / .sp-anchor-flash / .answer-actions rules live in the shared
   css/codex.css (used by skill.php, skill_details.php AND event.php) so the copy-link
   component is styled identically on every surface. */

/* Deduction amount badge */
.deduction {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--bad); background: var(--bad-soft); border: 1px solid #e3b3a6;
  padding: 4px 8px; border-radius: var(--r-sm); white-space: nowrap;
}

.showMore {
  display: block; text-align: center;
  padding: 12px; margin-top: 10px;
  color: var(--gold-deep); font-weight: 600; font-size: 13px;
  text-decoration: none; border-radius: var(--r-md);
  border: 1px dashed var(--gold-line);
  transition: background .15s, border-color .15s;
}
.showMore:hover { background: var(--gold-soft); border-color: var(--gold) }

.emptyState { padding: 22px; text-align: center; color: var(--muted); font-size: 14px; font-style: italic }

/* ---- Answers --------------------------------------------------------- */
.answers-list { display: flex; flex-direction: column; gap: 12px }
.answer {
  display: flex; gap: 12px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px;
}
.answer.accepted { border-left: 3px solid var(--good); background: var(--good-soft) }
.answer .vote { min-width: auto }
.answer-content { flex: 1; min-width: 0 }
.accepted-badge {
  display: inline-block; background: var(--good); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--r-pill); margin-bottom: 8px; letter-spacing: .02em;
}
.answer-text { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink) }
.no-answers { margin: 0; color: var(--muted); font-style: italic }

/* ---- Contributor line ------------------------------------------------ */
.contributor-sep { margin: 10px 0 8px; border: none; border-top: 1px solid var(--line) }
.contributor { font-size: 12px; color: var(--muted); font-weight: 500 }
.contributor-name { color: var(--gold-deep); font-weight: 600 }

/* Filters (full detail pages) */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px }
.filters .tag { cursor: pointer; transition: background .15s, border-color .15s }
.filters .tag:hover { background: var(--gold-soft); border-color: var(--gold-line) }

/* ============================================================
   Skill / content header — dark editorial masthead
   (apparatus-tinted top rule via .ev-* on the header)
   ============================================================ */
.skillHeader {
  background: linear-gradient(158deg, #23252e 0%, #14161c 100%);
  color: #f4f1ea;
  border: 1px solid #14161c;
  border-top: 4px solid var(--ev, var(--gold));
  border-radius: var(--r-lg);
}
.skillHeader .head { padding: 26px 24px 24px; border-bottom: none }
.skillHeader .title {
  margin: 0;
  font-family: var(--font-display); font-optical-sizing: auto;
  font-weight: 600; font-size: clamp(26px, 4vw, 38px); line-height: 1.05;
  letter-spacing: -.015em; color: #fdfbf6;
}
.skillHeader .aliasLabel { color: rgba(244,241,234,.6) }
.skillHeader .alias {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #f4f1ea;
  font-family: var(--font-body);
}
.skillHeader .usagTag { background: rgba(255,255,255,.08); color: #f4f1ea; font-family: var(--font-mono); font-weight: 500 }
.skillHeader .kbd { font-family: var(--font-mono); font-weight: 700; color: var(--gold-bright) }

.titleRow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px }
.headerActions { display: flex; gap: 8px; flex-shrink: 0 }
.headerBtn {
  display: inline-flex; align-items: center; gap: 4px;
  color: #f4f1ea; text-decoration: none; font-weight: 600; font-size: 12px;
  background: rgba(255,255,255,.1); padding: 7px 13px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.18); transition: background .15s;
}
.headerBtn:hover { background: rgba(255,255,255,.2) }
.headerBtnAlt { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1) }
.headerBtnAlt:hover { background: rgba(255,255,255,.12) }

.aliasBlock { margin-top: 16px }
.aliasLabel {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: .12em;
}
.aliasList { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.alias { font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: var(--r-pill) }
/* X6d — canonical alternates (full CoP name + decimal code) read as catalog data, not community
   aliases: they carry no vote or hide affordance because they are neither. Rendered off the
   manual_skills columns, never inserted as skill_aliases rows (see skill_name_lib.php). */
.skillHeader .alias--canonical {
  background: rgba(255,255,255,.03);
  border-style: dashed;
  border-color: rgba(255,255,255,.22);
  font-weight: 500;
  cursor: help;
}
/* F14b — ONE ACCOUNT'S OWN name for the skill. Gold and solid-bordered so it reads as neither
   catalog data (.alias--canonical, dashed white) nor a community alias (.alias, plain white):
   nobody but this account can see this string, and a chip that looked like the other two would
   invite a coach to assume the whole site calls the skill by their word for it.
   ⚠️ MEASURED, not eyeballed (X3's rule): --gold-bright #e2b85a on the masthead's darkest stop
   #14161c is 10.4:1 and on its lightest #23252e is 8.2:1 — both well past WCAG AA's 4.5:1. The
   translucent gold fill only lightens the backdrop, which raises the ratio further. */
.skillHeader .alias--account {
  background: rgba(226,184,90,.12);
  border-color: rgba(226,184,90,.45);
  color: var(--gold-bright);
  cursor: help;
}
/* The same chip used as a LABEL beside the <h1> ("Your account's name") rather than in the
   alias list, so it needs its own spacing — .aliasList's flex gap does not reach it. */
.skillHeader .titleMain > .alias--account { display: inline-block; margin-top: 9px }
.accountNameHint {
  flex-basis: 100%; margin: 6px 0 0;
  font-size: 11.5px; line-height: 1.45; color: rgba(244,241,234,.6);
}
.usagInline { margin-top: 18px }
.usagTags { display: flex; gap: 8px; flex-wrap: wrap }
.usagTag { font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: var(--r-pill) }
/* B5d — category chips: clickable .usagTag variants sitting in the same row as the
   static Code / Value chips, so they carry a border + hover to read as actionable.
   Both callers render inside the dark .skillHeader card, hence the light-on-dark values. */
.usagTagLink {
  text-decoration: none; border: 1px solid rgba(255,255,255,.22);
  transition: background .15s, border-color .15s;
}
.usagTagLink:hover { background: rgba(255,255,255,.2); border-color: var(--gold-bright) }

/* Two-column layout */
.twoCol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px }
.twoCol > details.section { margin-top: 0 }

/* Detail-page bits (skill_details.php) */
.pageTitle {
  margin: 24px 0 16px;
  font-family: var(--font-display); font-optical-sizing: auto;
  font-weight: 600; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.015em; color: var(--ink);
}
.footer { text-align: center; margin-top: 28px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.detail a { color: var(--gold-deep); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--gold-line) }
.detail a:hover { border-bottom-color: var(--gold) }

/* Responsive */
@media (max-width: 700px) { .twoCol { grid-template-columns: 1fr } }
@media (max-width: 600px) {
  .main { flex-wrap: wrap }
  .rightInfo { width: 100%; justify-content: flex-start; margin-top: 6px }
  .q { white-space: normal }
  .skillHeader .head { padding: 20px 16px }
}
