/* =========================================================================
   Shared styles for Research Methodology — Unit I interactive lectures
   Light, readable, mobile-first. Self-contained (no dependency on site CSS).
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --ink: #14202b;
  --body: #2c3e4c;
  --muted: #6b7b8a;
  --primary: #1a5276;
  --primary-dark: #12384f;
  --accent: #2e86c1;
  --bg: #f5f8fb;
  --card: #ffffff;
  --border: #e2eaf0;
  --good: #1e8449;
  --good-bg: #eafaf1;
  --warn: #b9770e;
  --warn-bg: #fff7e6;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --think: #7d3c98;
  --think-bg: #f6eefb;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(20, 60, 90, 0.07);
  --maxw: 820px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Lora', Georgia, serif;
  background: var(--bg);
  color: var(--body);
  line-height: 1.75;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
}

/* ---- Reading progress bar ---- */
#progress {
  position: fixed; top: 0; left: 0; height: 4px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  z-index: 200; transition: width 0.1s linear;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 150;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; gap: 12px;
  font-family: 'Inter', sans-serif;
}
.topbar a.home { color: var(--primary); text-decoration: none; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.topbar a.home span { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.topbar .nav { display: flex; gap: 8px; }
.topbar .nav a {
  font-size: 0.85rem; text-decoration: none; color: var(--primary);
  border: 1px solid var(--border); background: #fff; padding: 6px 12px;
  border-radius: 8px; font-weight: 600; transition: all 0.15s; white-space: nowrap;
}
.topbar .nav a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.topbar .nav a.disabled { opacity: 0.4; pointer-events: none; }

/* ---- Layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 80px; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 46px 20px 40px; text-align: center;
  font-family: 'Inter', sans-serif;
}
.hero .tag {
  display: inline-block; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: #cfe6f5; border: 1px solid rgba(255,255,255,0.35);
  padding: 4px 12px; border-radius: 20px; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); font-weight: 800; line-height: 1.2; max-width: 760px; margin: 0 auto 14px; }
.hero p.lede { font-size: clamp(1rem, 2.4vw, 1.15rem); color: #dbeaf4; max-width: 640px; margin: 0 auto; font-family: 'Lora', serif; }
.hero .meta { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero .meta span { background: rgba(255,255,255,0.14); padding: 5px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 500; }

/* ---- Content typography ---- */
.content { margin-top: 34px; }
.content h2 {
  font-family: 'Inter', sans-serif; color: var(--ink); font-size: clamp(1.35rem, 3.5vw, 1.7rem);
  font-weight: 700; margin: 44px 0 14px; line-height: 1.3; scroll-margin-top: 70px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.content h2 .num { color: var(--accent); font-weight: 800; margin-right: 10px; }
.content h3 {
  font-family: 'Inter', sans-serif; color: var(--primary); font-size: 1.2rem;
  font-weight: 600; margin: 28px 0 8px;
}
.content p { margin: 0 0 16px; }
.content ul, .content ol { margin: 0 0 18px; padding-left: 26px; }
.content li { margin-bottom: 9px; }
.content a { color: var(--accent); }
.content strong { color: var(--ink); font-weight: 600; }
.content em { color: var(--primary-dark); }

.lead {
  font-size: 1.15rem; color: var(--ink); font-weight: 500;
  border-left: 4px solid var(--accent); padding-left: 16px; margin-bottom: 24px;
}

/* ---- Objectives card ---- */
.objectives {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); margin-top: 30px;
  font-family: 'Inter', sans-serif;
}
.objectives h4 { color: var(--primary); font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.objectives ul { list-style: none; padding: 0; }
.objectives li { padding-left: 28px; position: relative; margin-bottom: 10px; font-size: 0.96rem; color: var(--body); }
.objectives li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }

/* ---- Callout boxes ---- */
.box {
  border-radius: var(--radius); padding: 18px 20px 18px 22px; margin: 22px 0;
  border: 1px solid var(--border); border-left-width: 5px; background: var(--card);
  font-size: 0.99rem;
}
.box .box-title { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 0.98rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }

.box.example { border-left-color: var(--accent); background: #f2f8fc; }
.box.example .box-title { color: var(--primary); }
.box.think { border-left-color: var(--think); background: var(--think-bg); }
.box.think .box-title { color: var(--think); }
.box.pitfall { border-left-color: var(--bad); background: var(--bad-bg); }
.box.pitfall .box-title { color: var(--bad); }
.box.tip { border-left-color: var(--good); background: var(--good-bg); }
.box.tip .box-title { color: var(--good); }
.box.note { border-left-color: var(--warn); background: var(--warn-bg); }
.box.note .box-title { color: var(--warn); }

/* ---- Comparison table ---- */
.tbl-wrap { overflow-x: auto; margin: 22px 0; }
table.compare {
  width: 100%; border-collapse: collapse; font-family: 'Inter', sans-serif; font-size: 0.92rem;
  background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
table.compare th { background: var(--primary); color: #fff; text-align: left; padding: 11px 14px; font-weight: 600; }
table.compare td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--body); }
table.compare tr:last-child td { border-bottom: none; }
table.compare tr:nth-child(even) td { background: #f7fafc; }
table.compare td:first-child { font-weight: 600; color: var(--ink); }

/* ---- Self-check (reveal) ---- */
.selfcheck { margin: 26px 0; }
.selfcheck > h4 { font-family: 'Inter', sans-serif; color: var(--ink); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.qa {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 12px; overflow: hidden;
}
.qa .q {
  padding: 14px 18px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 600;
  color: var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 0.98rem; user-select: none;
}
.qa .q::after { content: "＋"; color: var(--accent); font-size: 1.2rem; flex-shrink: 0; transition: transform 0.2s; }
.qa.open .q::after { content: "－"; }
.qa .a {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  padding: 0 18px; color: var(--body); font-size: 0.97rem;
}
.qa.open .a { max-height: 600px; padding: 0 18px 16px; }
.qa .a .a-inner { border-top: 1px dashed var(--border); padding-top: 12px; }

/* ---- Takeaways ---- */
.takeaways {
  background: linear-gradient(135deg, #eef6fb, #f7fbfd); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 26px; margin: 40px 0 10px; box-shadow: var(--shadow);
  font-family: 'Inter', sans-serif;
}
.takeaways h4 { color: var(--primary); font-size: 1.15rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.takeaways ol { padding-left: 22px; }
.takeaways li { margin-bottom: 10px; color: var(--body); font-size: 0.98rem; }
.takeaways li strong { color: var(--ink); }

/* ---- Glossary chips ---- */
.keyterms { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.keyterms .term { background: #eaf2f8; color: var(--primary-dark); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px; font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 500; }

/* ---- Diagrams (inline SVG) ---- */
.figure {
  margin: 28px 0; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px 16px; box-shadow: var(--shadow); text-align: center;
}
.figure svg { width: 100%; height: auto; max-width: 560px; display: block; margin: 0 auto; }
.figure svg text { font-family: 'Inter', sans-serif; }
.figure figcaption {
  font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--muted);
  margin-top: 14px; line-height: 1.5;
}
.figure figcaption strong { color: var(--primary); }

/* ---- Prev/next footer ---- */
.lecture-nav {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 46px;
  font-family: 'Inter', sans-serif;
}
.lecture-nav a {
  flex: 1; text-decoration: none; border: 1px solid var(--border); background: var(--card);
  border-radius: 12px; padding: 16px 18px; transition: all 0.15s; box-shadow: var(--shadow);
}
.lecture-nav a:hover { border-color: var(--accent); transform: translateY(-2px); }
.lecture-nav a.next { text-align: right; }
.lecture-nav a .dir { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.lecture-nav a .ttl { display: block; color: var(--primary); font-weight: 700; margin-top: 4px; font-size: 0.98rem; }
.lecture-nav a.disabled { opacity: 0.4; pointer-events: none; }

/* ---- Back to top ---- */
#toTop {
  position: fixed; bottom: 22px; right: 22px; z-index: 120;
  background: var(--primary); color: #fff; border: none; width: 46px; height: 46px;
  border-radius: 50%; font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.25s; font-family: 'Inter', sans-serif;
}
#toTop.show { opacity: 0.92; pointer-events: auto; }
#toTop:hover { background: var(--accent); }

/* ---- Footer ---- */
.foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 40px; font-family: 'Inter', sans-serif; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  body { font-size: 1rem; line-height: 1.7; }
  .topbar a.home span { display: none; }
  .hero { padding: 34px 16px 30px; }
  .lecture-nav { flex-direction: column; }
  .wrap { padding: 0 16px 70px; }
}
