/* DeckVault — editorial study-deck library.
   Palette: deep navy ink + warm amber accent on a cream paper.
   Type: Inter (UI) + Source Serif Pro (display & long-form). */

:root {
  --bg:        #faf6ef;     /* cream paper */
  --paper:     #ffffff;
  --paper-2:   #f5efe2;
  --ink:       #0b2545;     /* deep navy */
  --ink-2:     #13315c;
  --ink-soft:  #3b5374;
  --ink-mute:  #6f7f95;
  --line:      #e1d9c4;
  --line-2:    #c8bfa6;
  --accent:    #f5b400;     /* warm amber */
  --accent-2:  #e6a200;
  --accent-soft:#fff3cf;
  --accent-ink:#7a5800;
  --rose:      #c25450;
  --shadow:    0 1px 0 rgba(11,37,69,.05), 0 8px 24px rgba(11,37,69,.07);
  --shadow-lg: 0 2px 0 rgba(11,37,69,.06), 0 18px 40px rgba(11,37,69,.10);
  --radius:    12px;
  --radius-sm: 8px;
  --serif:     "Source Serif Pro", "Source Serif 4", "Iowan Old Style", "Georgia", serif;
  --sans:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01","cv11";
}
a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .12s ease, color .12s ease; }
a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* -------------------------------------------------- Header */
.site-header {
  background: var(--ink);
  color: #f3eedd;
  border-bottom: 4px solid var(--accent);
  position: sticky; top: 0; z-index: 20;
}
.site-header a { color: #f3eedd; }
.site-header a:hover { color: #fff; border-bottom-color: var(--accent); }
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; border: 0; }
.brand:hover { border: 0; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--accent); color: var(--ink);
  border-radius: 8px; font-weight: 800; font-family: var(--serif);
  font-size: 22px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 22px; color: #fff; letter-spacing: .2px; }
.brand-tag  { font-family: var(--sans); font-size: 11px; color: #c4b88a; text-transform: uppercase; letter-spacing: .14em; margin-left: 8px; }
.primary-nav { display: flex; gap: 22px; flex-wrap: wrap; justify-content: flex-end; }
.primary-nav a { color: #e3dab6; font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; border: 0; padding: 6px 0; border-bottom: 2px solid transparent; }
.primary-nav a:hover { color: #fff; border-bottom-color: var(--accent); }
.search { display: flex; gap: 0; }
.search input {
  border: 1px solid #2c4569; background: #11305a; color: #fff;
  border-radius: 8px 0 0 8px; padding: 9px 12px; font-size: 14px; min-width: 220px;
  font-family: var(--sans);
}
.search input::placeholder { color: #8da6c9; }
.search button {
  border: 0; background: var(--accent); color: var(--ink);
  border-radius: 0 8px 8px 0; padding: 9px 16px; cursor: pointer;
  font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
}
.search button:hover { background: var(--accent-2); }

/* -------------------------------------------------- Main */
.site-main { padding: 32px 24px 64px; }

/* -------------------------------------------------- Hero */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 36px;
}
.hero-copy { padding: 48px 44px; }
.hero-eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero-copy h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: 46px; line-height: 1.08; margin: 0 0 16px;
  color: var(--ink); letter-spacing: -.01em;
}
.hero-copy h1 em { font-style: italic; color: var(--accent-ink); }
.hero-copy p { font-size: 18px; color: var(--ink-soft); max-width: 56ch; margin: 0 0 24px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.hero-stats .stat { }
.hero-stats .stat .n { font-family: var(--serif); font-size: 28px; color: var(--ink); font-weight: 700; }
.hero-stats .stat .l { font-size: 12px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .08em; }
.hero-art {
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 60%, #1d4079 100%);
  position: relative; overflow: hidden; min-height: 320px;
  display: grid; place-items: center;
}
.hero-art::before, .hero-art::after {
  content: ""; position: absolute; border-radius: 12px; background: var(--paper);
  box-shadow: 0 18px 40px rgba(0,0,0,.3); transform-origin: center;
}
.hero-art::before { width: 56%; height: 70%; top: 12%; left: 10%; transform: rotate(-6deg); background: var(--paper-2); }
.hero-art::after  { width: 56%; height: 70%; top: 18%; left: 28%; transform: rotate(4deg); background: var(--paper); border-top: 8px solid var(--accent); }

.btn {
  display: inline-block; padding: 12px 22px; border-radius: 8px;
  font-weight: 600; font-size: 14px; border: 1px solid transparent;
  font-family: var(--sans); cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); border-bottom-color: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; border-bottom-color: var(--ink); }
.btn-outline { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }

/* -------------------------------------------------- Sections */
.section { margin: 48px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-family: var(--serif); font-size: 28px; margin: 0;
  color: var(--ink); font-weight: 700; letter-spacing: -.01em;
}
.section-head a { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* -------------------------------------------------- With sidebar layout */
.with-sidebar {
  display: grid; grid-template-columns: 1fr 300px; gap: 36px;
}
.sidebar > * { margin-bottom: 22px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-family: var(--serif); margin: 0 0 12px; font-size: 18px;
  color: var(--ink); font-weight: 700;
}
.card ul { list-style: none; margin: 0; padding: 0; }
.card li {
  padding: 8px 0; border-bottom: 1px dotted var(--line);
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 14px;
}
.card li:last-child { border-bottom: 0; }
.card li a { color: var(--ink-2); border: 0; }
.card li a:hover { color: var(--accent-ink); }
.card .count { color: var(--ink-mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.card.pbn-card { background: var(--accent-soft); border-color: var(--accent); }
.card.pbn-card h3 { color: var(--accent-ink); }

/* -------------------------------------------------- Subject category cards (with thumbnails) */
.subject-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.subject-card {
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  border-bottom: 0;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.subject-card .thumb {
  aspect-ratio: 16/9; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
}
.subject-card .thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.subject-card .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(11,37,69,.85) 100%);
}
.subject-card .badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--accent); color: var(--ink);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 4px; z-index: 1;
}
.subject-card .body { padding: 18px 20px 22px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.subject-card h3 {
  font-family: var(--serif); font-size: 22px; margin: 0;
  color: var(--ink); font-weight: 700;
}
.subject-card p { font-size: 14px; color: var(--ink-soft); margin: 0; flex: 1; }
.subject-card .count { font-size: 13px; color: var(--accent-ink); font-weight: 700; margin-top: 8px; }

/* -------------------------------------------------- Deck grid */
.deck-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.deck-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.deck-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.deck-card .thumb {
  aspect-ratio: 4/3; background: var(--paper-2);
  background-image: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 3px solid var(--accent);
  position: relative;
}
.deck-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.deck-card .source-pill {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px; z-index: 2;
}
.deck-card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.deck-card h3 { margin: 0; font-size: 15px; line-height: 1.4; font-family: var(--sans); font-weight: 600; }
.deck-card h3 a { color: var(--ink); border: 0; }
.deck-card h3 a:hover { color: var(--accent-ink); }
.deck-card .meta { font-size: 12px; color: var(--ink-mute); margin-top: auto; font-variant-numeric: tabular-nums; }
.deck-card .tag {
  display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); margin-right: 4px;
  font-weight: 600;
}
.deck-card .tag.format { background: #e3ecf9; color: var(--ink-2); }

/* -------------------------------------------------- Detail page */
.detail-head {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px;
  margin-bottom: 24px; box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.detail-head .breadcrumbs { font-size: 12px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.detail-head .breadcrumbs a { color: var(--ink-soft); border: 0; }
.detail-head h1 {
  font-family: var(--serif); font-size: 36px; margin: 0 0 12px;
  color: var(--ink); font-weight: 700; line-height: 1.15; letter-spacing: -.01em;
}
.detail-head .meta { color: var(--ink-soft); font-size: 14px; }
.detail-head .meta a { color: var(--ink-2); }
.detail-head .tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.detail-head .tags .tag {
  display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.detail-head .tags .tag:hover { border-color: var(--accent); color: var(--accent-ink); }
.detail-head .download-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px;
  padding-top: 20px; border-top: 1px solid var(--line);
}

.viewer {
  background: var(--ink); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16/10; margin-bottom: 24px; box-shadow: var(--shadow-lg);
}
.viewer iframe, .viewer img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; }

.prose {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 36px 40px;
  box-shadow: var(--shadow);
  font-size: 17px; line-height: 1.75; color: var(--ink-2);
}
.prose h2 { font-family: var(--serif); font-size: 26px; margin: 36px 0 14px; color: var(--ink); font-weight: 700; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-family: var(--serif); font-size: 20px; margin-top: 24px; color: var(--ink); }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 18px; }
.prose li { margin: 8px 0; }
.prose blockquote {
  margin: 20px 0; padding: 14px 22px;
  background: var(--paper-2); border-left: 4px solid var(--accent);
  font-style: italic; color: var(--ink-2);
}
.prose .summary {
  background: var(--paper-2); border-left: 4px solid var(--accent);
  padding: 16px 22px; margin: 0 0 22px;
  font-family: var(--serif); font-size: 18px; color: var(--ink);
  font-style: italic;
}

/* -------------------------------------------------- Tile grids (subjects/grades catalog) */
.tile-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
  border-bottom: 0; border-bottom: 1px solid var(--line);
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.tile h3 { font-family: var(--serif); margin: 0; color: var(--ink); font-size: 20px; }
.tile p  { color: var(--ink-soft); font-size: 14px; margin: 0; flex: 1; }
.tile .count { font-size: 12px; color: var(--accent-ink); font-weight: 700; margin-top: 6px; text-transform: uppercase; letter-spacing: .06em; }

/* -------------------------------------------------- Pagination */
.pagination {
  display: flex; gap: 6px; justify-content: center; margin: 36px 0 12px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink-soft); font-size: 14px; font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.pagination a:hover { border-color: var(--ink); color: var(--ink); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* -------------------------------------------------- Ad slots */
.ad-slot {
  background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 8px, #ece4cf 8px, #ece4cf 16px);
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  text-align: center; color: var(--ink-mute); padding: 20px;
  font-size: 12px; margin: 22px 0; text-transform: uppercase; letter-spacing: .08em;
}

/* -------------------------------------------------- Editorial / PBN block (visible) */
.editorial-card {
  background: linear-gradient(180deg, #fff 0%, var(--paper-2) 100%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 18px 20px;
  font-size: 14px; color: var(--ink-2);
}
.editorial-card .label {
  font-size: 11px; color: var(--accent-ink); text-transform: uppercase;
  letter-spacing: .12em; font-weight: 700; margin-bottom: 8px;
}
.editorial-card a { font-weight: 600; }

/* -------------------------------------------------- Source-of-truth pill */
.source-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.source-pill-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line);
  font-weight: 600;
}
.source-pill-inline.ia       { background: #e8f1fb; color: #0e3a78; border-color: #b8d3f0; }
.source-pill-inline.openstax { background: #f7e8e7; color: #8a2d29; border-color: #ebc6c4; }
.source-pill-inline.commons  { background: #e9f5ec; color: #1f5d2f; border-color: #c4dfca; }
.source-pill-inline.mit      { background: #f4e7e6; color: #8b1a1a; border-color: #e8c8c6; }

/* -------------------------------------------------- Footer */
.site-footer {
  background: var(--ink); color: #d4dceb;
  margin-top: 80px; padding: 56px 0 22px;
  border-top: 4px solid var(--accent);
}
.site-footer a { color: #d4dceb; border: 0; }
.site-footer a:hover { color: var(--accent); }
.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px;
}
.footer-inner h4 {
  font-family: var(--serif); color: #fff; margin: 0 0 14px;
  font-size: 16px; text-transform: uppercase; letter-spacing: .08em;
}
.footer-inner ul { list-style: none; padding: 0; margin: 0; }
.footer-inner li { padding: 5px 0; }
.footer-inner p { color: #a9b6cd; font-size: 14px; line-height: 1.6; }
.footer-bottom {
  padding-top: 22px; margin-top: 32px;
  border-top: 1px solid #214a7a; color: #7a8db0; font-size: 13px;
}
.footer-pbn {
  background: #11305a; border-radius: 8px; padding: 14px 18px;
  margin-top: 18px; font-size: 13px; color: #c9d4ea;
}
.footer-pbn .label {
  font-size: 11px; color: var(--accent); text-transform: uppercase;
  letter-spacing: .12em; font-weight: 700; margin-bottom: 6px;
}

/* -------------------------------------------------- Responsive */
@media (max-width: 980px) {
  .container { padding: 0 18px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 200px; border-radius: 0 0 var(--radius) var(--radius); }
  .hero-copy { padding: 36px 26px 30px; }
  .hero-copy h1 { font-size: 34px; line-height: 1.1; }
  .hero-cta { flex-wrap: wrap; gap: 10px; }
  .hero-stats { gap: 22px; }
  .with-sidebar { grid-template-columns: 1fr; gap: 24px; }
  .sidebar { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .header-inner { grid-template-columns: auto 1fr; grid-template-areas: "brand brand" "nav nav" "search search"; gap: 12px; padding: 12px 18px; }
  .brand { grid-area: brand; }
  .primary-nav { grid-area: nav; justify-content: flex-start; gap: 16px; }
  .primary-nav a { font-size: 13px; }
  .search { grid-area: search; }
  .search input { min-width: 0; width: 100%; }
  .prose { padding: 26px 22px; }
  .subject-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .deck-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; }
  .detail-head h1 { font-size: 26px; line-height: 1.15; }
  .hero { margin: 16px 0 28px; }
  .hero-copy { padding: 28px 22px 24px; }
  .hero-copy h1 { font-size: 28px; }
  .hero-eyebrow { font-size: 11px; padding: 5px 10px; }
  .hero-copy p { font-size: 15px; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 18px; }
  .hero-stats .n { font-size: 22px; }
  .hero-stats .l { font-size: 11px; }
  .hero-cta .btn { flex: 1 1 auto; text-align: center; padding: 12px 14px; }
  .download-row { flex-direction: column; align-items: stretch; }
  .download-row .btn { text-align: center; }
  .source-row { gap: 6px; }
  .source-pill-inline { font-size: 11px; padding: 3px 8px; }
  .breadcrumbs { font-size: 12px; }
  .subject-grid { grid-template-columns: 1fr; }
  .deck-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 16px 18px; }
  .section-head h2 { font-size: 22px; }
  .primary-nav { gap: 12px; flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .deck-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-stats .stat:last-child { grid-column: 1 / -1; }
}
