:root {
  --bg: #0b1510;
  --shell: #0f1c15;
  --panel: #14241b;
  --panel-2: #1b3024;
  --line: rgba(201, 186, 140, 0.32);
  --line-soft: rgba(201, 186, 140, 0.16);
  --tan: #c9b98a;
  --tan-2: #a99f78;
  --text: #ece8d8;
  --muted: #b3baa9;
  --red: #8e2b2b;
  --green: #74b35e;
  --radius: 14px;
  --nav-h: 68px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
:focus-visible { outline: 2px solid var(--tan); outline-offset: 2px; }

.shell {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--shell);
  border-inline: 1px solid var(--line-soft);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 34px;
  background: rgba(11, 21, 16, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--tan); color: var(--tan);
  font-size: 22px; font-weight: 700; line-height: 1;
}
.brand-text strong { display: block; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.brand-text small { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.top-actions { display: flex; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  font-size: 17px; cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); }

.menu {
  position: absolute; right: 34px; top: calc(100% + 6px);
  width: 280px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.menu a { display: block; padding: 10px 12px; border-radius: 8px; }
.menu a:hover { background: var(--panel-2); }
.menu-label { padding: 10px 12px 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--tan); }

/* ---------- layout ---------- */
main { padding: 28px 34px 30px; outline: none; }
.view { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.eyebrow { margin: 0 0 6px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--tan); font-weight: 700; }
.lead { color: var(--text); opacity: .92; font-size: 16.5px; margin: 0; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 270px;
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(105deg, #13261c 0%, #1e3a2a 55%, #3a5240 100%);
}
.hero-art { position: absolute; inset: 0 0 0 auto; width: 62%; }
.hero-art svg { width: 100%; height: 100%; display: block; }
.hero-copy { position: relative; padding: 40px 44px; max-width: 520px; }
.hero h1 { font-size: 48px; line-height: 1.05; margin: 4px 0 18px; letter-spacing: .01em; }
.pill {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 24px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- section heads ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 32px 0 14px;
}
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: .1em; text-transform: uppercase; }
.section-head span { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.view > .section-head:first-child { margin-top: 0; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  position: relative; overflow: hidden;
  min-height: 178px;
  display: flex; flex-direction: column; justify-content: flex-end;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, #2f4834 0%, #1b2e22 100%);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: var(--tan); box-shadow: 0 10px 26px rgba(0,0,0,.35); }
.card-art, .card-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-art svg { width: 100%; height: 100%; display: block; }
.card-img { object-fit: cover; }
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,18,13,0) 25%, rgba(10,18,13,.88) 100%);
}
.card-body { position: relative; z-index: 1; padding: 16px 18px 16px; }
.card-icon { display: block; font-size: 20px; margin-bottom: 6px; color: var(--text); }
.card h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.2; }
.card p { margin: 0; font-size: 12.5px; color: var(--text); opacity: .92; }
.tag {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(10,16,12,.85); border: 1px solid var(--line-soft);
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.tag.static { position: static; display: inline-block; margin-bottom: 10px; }

.note { margin: 20px 0 0; font-size: 12px; color: var(--muted); }
.note b { color: var(--tan); }

/* ---------- resource page ---------- */
.back { display: inline-block; margin-bottom: 14px; color: var(--tan); font-size: 14px; font-weight: 600; }
.res-hero {
  position: relative; overflow: hidden;
  min-height: 190px; display: flex; align-items: flex-end;
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(180deg, #2f4834, #1b2e22);
}
.res-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,18,13,.92) 30%, rgba(10,18,13,.2)); }
.res-hero .card-art { left: 35%; }
.res-hero-copy { position: relative; z-index: 1; padding: 26px 30px; max-width: 640px; }
.res-hero h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.15; }
.res-hero p { margin: 0; color: var(--muted); }
.res-hero > .save-btn { position: absolute; top: 16px; right: 16px; z-index: 2; }

/* ---------- document lists ---------- */
.doc-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.doc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px;
}
.doc-row:hover { border-color: var(--line); }
.doc-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px; }
.doc-type {
  flex: none; min-width: 64px; padding: 6px 8px; text-align: center;
  border-radius: 6px; background: var(--panel-2); color: var(--tan);
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.doc-main { min-width: 0; display: grid; }
.doc-main strong { font-size: 15.5px; }
.doc-main span { color: var(--text); opacity: .85; font-size: 13px; }
.doc-main em { font-style: normal; color: var(--muted); font-size: 12px; }
.save-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(10,16,12,.6);
  color: var(--text); font-size: 18px; cursor: pointer;
}
.save-btn.on { color: #e6c55c; border-color: #e6c55c; }

/* ---------- doc view ---------- */
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.doc-head h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.15; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 18px; border-radius: 10px;
  background: var(--tan); color: #14201a; border: 1px solid var(--tan);
  font: 700 13px var(--font); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.pdf { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.prose, .panel {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 22px 26px;
}
.prose { max-width: 820px; font-size: 16px; }
.prose h2, .prose h3 { color: var(--tan); }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--tan); text-decoration: underline; }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 44px 20px;
  border: 1px dashed var(--line); border-radius: 14px; background: rgba(20,36,27,.5);
}
.empty-mark {
  width: 46px; height: 46px; margin: 0 auto 12px; display: grid; place-items: center;
  border: 2px solid var(--tan); color: var(--tan); font-size: 28px; font-weight: 700;
}
.empty h3 { margin: 0 0 6px; }
.empty p { margin: 0 auto; max-width: 460px; color: var(--muted); }
.empty a { color: var(--tan); }

/* ---------- search ---------- */
.search {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.search span { color: var(--tan); font-size: 20px; }
.search input {
  flex: 1; min-width: 0; height: 52px; border: 0; background: transparent;
  color: var(--text); font: 16px var(--font); outline: none;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; }
.chip:hover { background: var(--panel-2); }
#results .doc-list + .doc-list { margin-top: 10px; }

/* ---------- profile ---------- */
.panel { display: grid; gap: 14px; max-width: 640px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--tan); font-weight: 700; }
.field input {
  height: 46px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 16px var(--font);
}
.panel .actions { margin: 4px 0 0; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 20;
  width: 100%; max-width: 1240px;
  display: flex; justify-content: center; gap: 40px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(11, 21, 16, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line-soft);
}
.bottom-nav a {
  width: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.bottom-nav a span { font-size: 18px; line-height: 1; color: var(--tan); }
.bottom-nav a[aria-current] { color: var(--text); }
.bottom-nav a[aria-current]::after { content: ""; width: 18px; height: 2px; background: var(--tan); border-radius: 2px; }

/* ---------- tablet ---------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 40px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .shell { border: 0; }
  .topbar { padding: 10px 16px; }
  .brand { gap: 10px; }
  .brand-mark { width: 30px; height: 30px; font-size: 19px; }
  .brand-text strong { font-size: 15.5px; }
  .brand-text small { font-size: 8.5px; letter-spacing: .12em; }
  .top-actions { gap: 6px; }
  .top-actions a.icon-btn { display: none; }   /* search & saved live in the bottom nav on phones */
  .icon-btn { width: 36px; height: 36px; }
  .menu { right: 12px; left: 12px; width: auto; }

  main { padding: 16px 16px 24px; }

  .hero { min-height: 230px; }
  .hero-art { width: 75%; right: -22%; opacity: .35; }
  .hero-copy { padding: 26px 22px; }
  .hero h1 { font-size: 34px; margin-bottom: 12px; }
  .lead { font-size: 15px; }
  .pill { margin-top: 18px; font-size: 10.5px; }

  .section-head { flex-direction: column; gap: 2px; margin: 24px 0 12px; }
  .section-head h2 { font-size: 17px; }
  .section-head span { font-size: 10.5px; }

  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { min-height: 150px; }
  .card h3 { font-size: 17px; }

  .res-hero { min-height: 170px; }
  .res-hero-copy { padding: 20px; }
  .res-hero h1 { font-size: 24px; }
  .res-hero .card-art { left: 45%; opacity: .45; }

  .doc-head h1 { font-size: 24px; }
  .doc-type { min-width: 52px; font-size: 9.5px; padding: 5px 6px; }
  .doc-link { gap: 10px; }
  .prose, .panel { padding: 18px; }
  .pdf { height: 65vh; }
  .actions .btn { flex: 1; }

  .bottom-nav { gap: 0; justify-content: space-around; }
  .bottom-nav a { width: auto; flex: 1; font-size: 9.5px; letter-spacing: .08em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- featured textbook card ---------- */
.card.featured { min-height: 200px; margin-top: 16px; background: linear-gradient(100deg, #182c20 0%, #26402e 60%, #3a5240 100%); }
.card.featured::after { background: linear-gradient(90deg, rgba(10,18,13,.9) 35%, rgba(10,18,13,.15) 80%); }
.card.featured .card-body { max-width: 640px; padding: 24px 26px; }
.card.featured h3 { font-size: 24px; margin-bottom: 8px; }
.card.featured p { font-size: 14px; }
.card.featured .eyebrow { font-size: 10.5px; margin-bottom: 8px; }
.card-meta { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tan); }
.doc-row.pending { opacity: .72; }
.doc-row.pending .doc-type { background: transparent; border: 1px dashed var(--line); }
@media (max-width: 640px) {
  .card.featured { min-height: 220px; margin-top: 12px; }
  .card.featured .card-art { opacity: .4; }
  .card.featured::after { background: linear-gradient(180deg, rgba(10,18,13,.3), rgba(10,18,13,.92) 55%); }
  .card.featured .card-body { padding: 18px; }
  .card.featured .eyebrow { padding-right: 110px; }
  .card.featured h3 { font-size: 20px; }
  .card.featured p { font-size: 13px; }
}

/* ---------- filters, task details ---------- */
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 0; }
.filter-label { margin-right: 4px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tan); }
.chip.on { background: var(--tan); border-color: var(--tan); color: #14201a; font-weight: 700; }
.filter-hint { margin-top: 10px; }
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px;
  margin: 0 0 18px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px;
}
.meta-grid div { padding: 12px 16px; background: var(--panel); box-shadow: 0 0 0 1px var(--line-soft); }
.meta-grid dt { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tan); }
.meta-grid dd { margin: 3px 0 0; font-size: 15px; }
.details { max-width: 900px; padding: 6px 24px 18px; background: var(--panel); border: 1px solid var(--line-soft); border-left: 3px solid var(--tan); border-radius: 12px; }
.details h2 { margin: 16px 0 6px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--tan); }
.details p { margin: 0; font-size: 15.5px; line-height: 1.6; }
.details .cite { margin-top: 16px; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .filter { gap: 6px; }
  .filter-label { width: 100%; }
  .filter .chip { padding: 7px 12px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid div { padding: 10px 12px; }
  .meta-grid dd { font-size: 14px; }
  .details { padding: 4px 16px 14px; }
  .details p { font-size: 15px; }
}

/* ---------- currency notice, list details ---------- */
.notice {
  max-width: 900px; margin: 0 0 16px; padding: 12px 16px;
  border: 1px solid rgba(230, 197, 92, .45); border-left: 3px solid #e6c55c; border-radius: 10px;
  background: rgba(230, 197, 92, .07); font-size: 14px;
}
.notice b { color: #e6c55c; }
.details ul { margin: 0; padding-left: 20px; }
.details li { margin-bottom: 8px; font-size: 15px; line-height: 1.55; }

/* ---------- in-app PDF viewer (pdf.js) ---------- */
.pdf-viewer { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #3b403d; }
.pdf-bar {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tan);
}
.pdf-pages { position: relative; height: 75vh; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.pdf-page { width: 100%; max-width: 900px; margin: 0 auto 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.pdf-page canvas { display: block; width: 100%; height: auto; }
.pdf-fallback { color: var(--text); padding: 20px; }
.pdf-fallback a { color: var(--tan); }
@media (max-width: 640px) {
  .pdf-pages { height: 70vh; padding: 8px; }
  .pdf-page { margin-bottom: 8px; }
}
.pdf-full .pdf-pages { height: calc(100vh - 230px); min-height: 360px; }
.pdf-dl { color: var(--text); text-decoration: underline; letter-spacing: .08em; }
@media (max-width: 640px) { .pdf-full .pdf-pages { height: calc(100vh - 210px); } }

/* ---------- class password gate ---------- */
.gate { max-width: 460px; margin: 8vh auto 0; text-align: center; }
.gate h1 { font-size: 28px; margin: 4px 0 8px; }
.gate-form { display: flex; gap: 10px; margin: 20px 0 8px; }
.gate-form input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 16px var(--font); }
.gate .err { color: #ef6b5b; min-height: 1.2em; }
@media (max-width: 640px) { .gate { margin-top: 4vh; } .gate-form { flex-direction: column; } }
