/* The Renal System at a Glance — companion site styles */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #1c2530;
  --ink-soft: #55636f;
  --line: #dde4ec;
  --brand: #0d6e8c;       /* renal teal-blue */
  --brand-dark: #0a5468;
  --brand-soft: #e2f1f5;
  --accent: #c0325a;      /* clinical crimson */
  --accent-soft: #fbe6ec;
  --shadow: 0 1px 3px rgba(16,32,48,.08), 0 8px 24px rgba(16,32,48,.06);
  --radius: 14px;
  --maxw: 1160px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b;
    --surface: #182029;
    --surface-2: #1f2933;
    --ink: #e7edf3;
    --ink-soft: #a2b0bd;
    --line: #2b3742;
    --brand: #3fb3d1;
    --brand-dark: #2a8ba7;
    --brand-soft: #16323b;
    --accent: #e56a8b;
    --accent-soft: #3a1f27;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

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

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 20px;
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; color: var(--ink); font-size: 1.02rem;
  text-decoration: none; line-height: 1.15;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: grid; place-items: center; color: #fff; font-size: 20px;
}
.brand small { display: block; font-weight: 500; color: var(--ink-soft); font-size: .74rem; letter-spacing: .02em; }

.nav-links { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--ink-soft); font-weight: 600; font-size: .9rem;
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links a.active { color: var(--brand); background: var(--brand-soft); }

.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; color: var(--ink); font-size: 1.1rem; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; margin: 8px 0 0; }
  .nav-links.open { display: flex; }
  .nav { flex-wrap: wrap; }
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--brand-soft), transparent 60%),
    linear-gradient(180deg, transparent, var(--bg));
  padding: 56px 0 40px;
}
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p.lead { font-size: 1.12rem; color: var(--ink-soft); margin: 0 0 24px; max-width: 44ch; }
.hero .edition { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); background: var(--brand-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }

.cover {
  aspect-ratio: 3/4; border-radius: 16px; box-shadow: var(--shadow);
  background: linear-gradient(150deg, var(--brand), var(--brand-dark));
  color: #fff; padding: 30px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(300px 300px at 120% 0%, rgba(255,255,255,.22), transparent 60%);
}
.cover .series { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.cover .ct { font-size: 1.9rem; font-weight: 800; line-height: 1.05; }
.cover .author { font-size: .95rem; opacity: .9; }
.cover .kidney { font-size: 4.5rem; align-self: flex-end; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .cover { max-width: 280px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .95rem;
  padding: 11px 20px; border-radius: 10px; border: none; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section.block { padding: 44px 0; }
.section-title { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -.01em; }
.section-sub { color: var(--ink-soft); margin: 0 0 26px; }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  transition: transform .12s ease, border-color .12s ease;
}
.feature:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; }
.feature .ic { font-size: 1.8rem; }
.feature h3 { margin: 4px 0 0; font-size: 1.1rem; color: var(--ink); }
.feature p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* Parts / TOC list */
.parts { display: grid; gap: 18px; }
.part-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.part-head { padding: 14px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; }
.part-head .num { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff;
  font-size: .8rem; font-weight: 700; display: grid; place-items: center; flex: none; }
.part-head h3 { margin: 0; font-size: 1.05rem; }
.chap-list { list-style: none; margin: 0; padding: 6px 0; }
.chap-list li { display: flex; align-items: baseline; gap: 12px; padding: 7px 20px; border-top: 1px solid transparent; }
.chap-list li + li { border-top: 1px solid var(--line); }
.chap-list .cn { color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.8em; }
.chap-list .ct2 { color: var(--ink); }
.chap-list .badge { margin-left: auto; font-size: .72rem; color: var(--brand); background: var(--brand-soft);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap; align-self: center; }

/* ---------- Flashcards ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; }
.toolbar select, .toolbar input {
  font: inherit; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.toolbar .count { margin-left: auto; color: var(--ink-soft); font-size: .9rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

.flash {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: transform .12s ease, border-color .12s ease;
}
.flash:hover { transform: translateY(-3px); border-color: var(--brand); }
.flash .thumb { aspect-ratio: 4/3; background: #fff; display: grid; place-items: center; padding: 10px; }
.flash .thumb img { max-height: 100%; width: auto; object-fit: contain; }
.flash .meta { padding: 12px 14px; border-top: 1px solid var(--line); }
.flash .meta .ch { font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
.flash .meta .ti { font-size: .92rem; color: var(--ink); margin-top: 2px; line-height: 1.3; }

.part-heading { grid-column: 1 / -1; margin: 22px 0 2px; font-size: 1.05rem; color: var(--ink-soft);
  border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.part-heading:first-child { margin-top: 0; }

/* Lightbox / study modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  padding: 24px; background: rgba(8,14,20,.72); backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-card { background: var(--surface); border-radius: 16px; max-width: 720px; width: 100%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.modal-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-top .ch { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #fff; background: var(--brand); padding: 3px 10px; border-radius: 999px; }
.modal-top h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.modal-img { padding: 16px; background: #fff; overflow: auto; text-align: center; flex: 1; }
.modal-img img { margin: 0 auto; max-height: 62vh; width: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .92rem;
  display: flex; align-items: center; gap: 12px; }
.modal-foot .nav-btns { margin-left: auto; display: flex; gap: 8px; }
.modal-foot button { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.modal-foot button:hover { background: var(--surface-2); }
.dots { display: flex; gap: 5px; }
.dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--line); cursor: pointer; }
.dots span.on { background: var(--brand); }

/* ---------- MCQs ---------- */
.quiz { display: grid; gap: 18px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; }
.q-card .qtag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--brand); }
.q-card .qtext { font-weight: 600; margin: 6px 0 14px; font-size: 1.04rem; }
.opts { display: grid; gap: 9px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; background: var(--surface); transition: background .12s, border-color .12s; }
.opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.opt .letter { font-weight: 700; color: var(--brand); flex: none; }
.opt.correct { border-color: #1f9d6b; background: color-mix(in srgb, #1f9d6b 14%, var(--surface)); }
.opt.wrong { border-color: var(--accent); background: var(--accent-soft); }
.opt.disabled { cursor: default; pointer-events: none; }
.explain { margin-top: 14px; padding: 13px 15px; border-radius: 10px; background: var(--surface-2);
  border-left: 4px solid var(--brand); font-size: .93rem; display: none; }
.explain.show { display: block; }
.explain b { color: var(--brand); }

.quiz-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.score-pill { margin-left: auto; font-weight: 700; background: var(--brand-soft); color: var(--brand);
  padding: 8px 16px; border-radius: 999px; }

/* ---------- Downloads ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 18px; }
.dl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dl-card .ic { font-size: 2.2rem; }
.dl-card h3 { margin: 0; }
.dl-card p { margin: 0; color: var(--ink-soft); font-size: .93rem; flex: 1; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; padding: 30px 20px; }
.footer-in p { margin: 0; color: var(--ink-soft); font-size: .88rem; max-width: 58ch; }
.footer-in .credit { display: inline-block; margin-top: 8px; font-size: .8rem; opacity: .85; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }

.notice { font-size: .82rem; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px; margin-top: 22px; }
