/* ============================================================================
   course-components.css  —  Shared component look-and-feel for all HSCI modules
   ----------------------------------------------------------------------------
   Single source of truth for the repeated UI components across HSCI 130, 230,
   341, 410 and 841. Linked LAST in every module (immediately before </body>)
   so that, at equal specificity, these rules win over any drifted inline CSS.

   All rules reference the shared :root palette already defined in every module
   (--teal, --green, --dark-teal, --grey, --very-light-teal, --light-green,
    --radius, --shadow, --shadow-lg, --text, --text-light, --accent, etc.),
   so nothing here hard-codes a theme colour except the deliberately faint
   greys used as neutral surfaces.

   Canonical references:
     • Learning-objectives box  → HSCI 130 L1 S1  (.info-box.green)
     • Flash-card popup         → HSCI 230 L1 S2  (.flip-card / .card-modal*)
     • Tabbed content           → HSCI 341 L1 S2  (.tabs) + faint grey surface
   ============================================================================ */


/* ── 1. Learning-objectives box & info boxes ─────────────────────────────────
   The green variant is the standard "Learning Objectives" container shown after
   the Introduction and Overview block on every section. */
.info-box        { border-radius: var(--radius); padding: 24px; margin: 24px 0; border-left: 4px solid var(--teal); }
.info-box.teal   { background: var(--very-light-teal); border-color: var(--teal); }
.info-box.green  { background: var(--light-green);     border-color: var(--green); }
.info-box.rose   { background: var(--light-rose);      border-color: var(--accent); }
.info-box.amber  { background: #FFF8E1;                border-color: #FFA000; }
.info-box h4         { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--dark-teal); }
.info-box.green h4   { color: var(--green); }
.info-box .box-title { font-weight: 700; margin-bottom: 6px; color: inherit; }
.info-box ul     { margin: 0 0 0 22px; padding: 0; }
.info-box li     { margin-bottom: 5px; }


/* ── 2. Flash cards (popup style) ────────────────────────────────────────────
   Face = title + hint on a teal gradient tile; click opens a centred modal. */
.flip-grid,
.flip-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin: 24px 0;
}
.flip-card {
  cursor: pointer; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s;
  background: linear-gradient(135deg, rgba(11,123,107,0.9), rgba(6,92,80,0.95)), url('../bg_texture.jpg') center/cover no-repeat;
  color: #fff; padding: 24px 18px; text-align: center; min-height: 100px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.flip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* Standard face markup is <span class="card-title"> + <span class="card-hint">.
   .card-label / .card-icon are legacy faces kept here as a visual safety net:
   the label is styled like a title and the "+" icon is hidden, so any face that
   was not converted still matches the standard look. */
.flip-card .card-title,
.flip-card .card-label { font-weight: 600; font-size: 15px; line-height: 1.4; color: #fff; }
.flip-card .card-hint  { position: absolute; bottom: 8px; left: 0; right: 0; font-size: 11px; opacity: 0.6; }
.flip-card .card-icon  { display: none; }

/* Modal */
.card-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn 0.2s ease;
}
.card-modal-overlay.show { display: flex; }
.card-modal {
  background: #fff; border-radius: 16px; max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: fadeIn 0.3s ease;
  max-height: 80vh; display: flex; flex-direction: column;
}
.card-modal-header {
  background: linear-gradient(135deg, rgba(11,123,107,0.92), rgba(6,92,80,0.95)), url('../bg_texture.jpg') center/cover no-repeat;
  color: #fff; padding: 24px 28px; position: relative;
}
.card-modal-header h3 { font-size: 18px; font-weight: 700; margin: 0; color: #fff; }
.card-modal-close {
  position: absolute; top: 12px; right: 16px; background: rgba(255,255,255,0.2);
  border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.card-modal-close:hover { background: rgba(255,255,255,0.35); }
.card-modal-body { padding: 24px 28px; font-size: 15px; line-height: 1.7; color: var(--text); overflow-y: auto; }


/* ── 3. Tabbed content (bordered, faint grey surface) ────────────────────────
   341 L1 tab styling, set on a very faint light-grey surface as requested. */
.tabs {
  margin: 24px 0;
  background: #F6F7F8;
  border: 1px solid var(--grey);
  border-radius: var(--radius);
  padding: 8px 8px 0;
}
.tab-buttons {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 2px solid var(--grey);
  padding-bottom: 0; margin-bottom: 0;
}
.tab-btn {
  padding: 10px 18px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-light);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
  border-radius: 8px 8px 0 0;
}
.tab-btn:hover { background: var(--very-light-teal); color: var(--dark-teal); }
.tab-btn.active { color: var(--dark-teal); border-bottom-color: var(--accent); font-weight: 600; background: var(--very-light-teal); }
.tab-panel {
  display: none; padding: 24px;
  background: #FCFCFD;
  border: 1px solid var(--grey); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 15px; line-height: 1.7;
}
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }


/* ── 4. Other shared components (standardized for consistency) ───────────────
   Accordion, data tables and glossary entries had drifted between courses;
   these pin them to one look. Reflection boxes, R-boxes and quizzes carry
   interactive state styling and are intentionally left to each module. */

/* Accordion */
.accordion { margin: 24px 0; }
.accordion-item { border: 1px solid var(--grey); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; background: var(--white); }
.accordion-header {
  padding: 16px 20px; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; font-weight: 600; font-size: 15px;
  transition: background 0.2s; user-select: none;
}
.accordion-header:hover { background: var(--very-light-teal); }
.accordion-header .arrow { transition: transform 0.3s; font-size: 12px; color: var(--accent); }
.accordion-item.open .accordion-header { background: var(--very-light-teal); color: var(--dark-teal); }
.accordion-item.open .accordion-header .arrow { transform: rotate(180deg); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.accordion-body-inner { padding: 0 20px 20px; font-size: 15px; line-height: 1.7; color: var(--text-light); }

/* Data tables */
.data-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 14px; }
.data-table th { background: var(--dark-teal); color: #fff; padding: 10px 14px; text-align: left; font-weight: 600; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--grey); }
.data-table tr:nth-child(even) { background: var(--very-light-teal); }
.data-table .highlight { background: var(--light-amber); font-weight: 600; }

/* Glossary entries */
.glossary-entry {
  background: var(--white);
  border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px; margin-bottom: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-left-color 0.15s;
}
.glossary-entry:hover { transform: translateX(2px); }
.glossary-entry.glossary-person  { border-left-color: var(--accent); }
.glossary-entry.glossary-concept { border-left-color: var(--teal); }
.glossary-entry.glossary-method  { border-left-color: var(--purple); }
.glossary-entry .glossary-term {
  display: block; font-weight: 700; color: var(--dark-teal);
  font-size: 15.5px; margin-bottom: 4px;
}
.glossary-entry.glossary-person .glossary-term { color: var(--accent-dark); }
.glossary-entry .glossary-def { font-size: 14.5px; color: var(--text); line-height: 1.6; }
.glossary-entry.hidden { display: none; }


/* ============================================================================
   SWEEP ADDITIONS (2026-06-12) — shared house-style components
   Added by the editorial sweep. Linked last, so these win at equal specificity.
   ============================================================================ */

/* ── A. External-link house style ───────────────────────────────────────────
   Links are NOT coloured. The linked text keeps the surrounding text colour and
   is marked with a dotted underline only. Applies to every external link in the
   reading column and on slides. (Inline color/text-decoration on a link still
   wins over this — the sweep strips those inline styles so this rule governs.) */
.module-body a[href^="http"],
.module-body a.cite,
.module-body a.ext,
.av-slide a[href^="http"],
.av-slide a.cite {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  -webkit-text-decoration-skip-ink: none; text-decoration-skip-ink: none;
}
.module-body a[href^="http"]:hover,
.module-body a.cite:hover,
.module-body a.ext:hover {
  border-bottom-color: var(--teal, #0B7B6B);
  border-bottom-style: solid;
}
.av-slide a[href^="http"]:hover, .av-slide a.cite:hover { border-bottom-style: solid; }

/* ── B. Formula component colour key (shared palette) ────────────────────────
   Use the SAME hex in MathJax \color{...}{} so the symbol and its plain-language
   definition share a colour. fc-1..fc-6 are distinct and legible on white. */
.fc-1 { color: #0B7B6B; }   /* teal   */
.fc-2 { color: #C2410C; }   /* orange */
.fc-3 { color: #6D28D9; }   /* violet */
.fc-4 { color: #1D4ED8; }   /* blue   */
.fc-5 { color: #BE185D; }   /* pink   */
.fc-6 { color: #047857; }   /* green  */
.fc-1,.fc-2,.fc-3,.fc-4,.fc-5,.fc-6 { font-weight: 600; }

/* ── C. Reading-column formula box: symbol ⇄ plain-language toggle ───────────
   Markup (authored per formula):
     <div class="formula-box">
       <div class="formula-label">…</div>
       <div class="formula-sym">\[  …\color{#C2410C}{m}…  \]</div>
       <button class="formula-toggle" type="button">Plain language</button>
       <div class="formula-plain"><span class="fc-2">mass</span> … </div>
     </div>                                                                      */
.formula-box { position: relative; }
.formula-box .formula-toggle {
  position: absolute; top: 10px; right: 10px;
  background: #fff; border: 1px solid var(--grey, #E8ECEE);
  color: var(--text-light, #555); font: 600 11px/1 inherit;
  padding: 5px 10px; border-radius: 6px; cursor: pointer; letter-spacing: .3px;
  transition: background .15s, color .15s, border-color .15s;
}
.formula-box .formula-toggle:hover { background: var(--very-light-teal, #E6F3F0); color: var(--dark-teal, #065C50); border-color: var(--light-teal, #6BB5A6); }
.formula-box .formula-plain { display: none; font-size: 15.5px; line-height: 1.7; color: var(--text, #2D3436); padding-right: 96px; }
.formula-box.show-plain .formula-sym { display: none; }
.formula-box.show-plain .formula-plain { display: block; }

/* Slide formula key: on slides BOTH the symbols and their colour-coded
   definitions are always shown (no toggle). One line of "sym = meaning" chips. */
.av-formula .av-formula-key {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px;
  font-size: 13px; color: var(--av-ink-soft);
}
.av-formula .av-formula-key span.def { white-space: nowrap; }
.av-formula .av-formula-key b { font-weight: 700; }

/* ── D. Glossary hover tooltips ──────────────────────────────────────────────
   A jargon term carries its definition in data-def; hovering or focusing the
   term shows it. Terms are tagged automatically from the shared map, or by hand
   with <span class="gloss" data-def="…">term</span>. */
.gloss {
  border-bottom: 1px dotted var(--teal, #0B7B6B);
  cursor: help; position: relative; color: inherit;
}
.gloss:focus { outline: 2px solid var(--teal, #0B7B6B); outline-offset: 2px; border-radius: 2px; }
.gloss::after {
  content: attr(data-def);
  position: absolute; left: 0; bottom: 100%; margin-bottom: 9px;
  width: max-content; max-width: 304px;
  background: #0F2E2A; color: #fff;
  font: 400 12.5px/1.5 inherit; letter-spacing: normal; text-transform: none; text-align: left;
  padding: 9px 12px; border-radius: 8px; box-shadow: 0 8px 26px rgba(4,42,37,.28);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease;
  z-index: 120; pointer-events: none; white-space: normal;
}
.gloss::before {
  content: ''; position: absolute; left: 16px; bottom: 100%; margin-bottom: 3px;
  border: 6px solid transparent; border-top-color: #0F2E2A;
  opacity: 0; visibility: hidden; transition: opacity .14s ease; z-index: 121; pointer-events: none;
}
.gloss:hover::after, .gloss:focus::after,
.gloss:hover::before, .gloss:focus::before { opacity: 1; visibility: visible; transform: translateY(0); }
/* Tooltips that would clip past the right edge flip leftward. */
.gloss.gloss-rt::after { left: auto; right: 0; }
.gloss.gloss-rt::before { left: auto; right: 16px; }
