/* =========================================================
   Grade Textbooks Layout (Roboto + Poppins)
   NOTE: Fonts are referenced but NOT linked/imported here.
   ========================================================= */

/* ---------- Root + Resets ---------- */
:root{
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17,24,39,.10);
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --shadowHover: 0 14px 40px rgba(17,24,39,.12);

  --primary: #2563eb;

  --radius: 14px;
  --gap: 18px;

  --container: 1180px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);

  /* Use Roboto for body, Poppins for headings */
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }

/* ---------- Page Header ---------- */
header{
  max-width: var(--container);
  margin: 24px auto 10px;
  padding: 0 16px;
}

header h1{
  margin: 0 0 8px;
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(22px, 2.1vw, 32px);
}

header p{
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- Main Container ---------- */
.container{
  max-width: var(--container);
  margin: 16px auto 40px;
  padding: 0 16px;
}

/* ---------- Letter Headings ---------- */
.letter-header{
  margin: 26px 0 10px;
  padding-top: 10px;

  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.6rem;
  color: var(--primary);

  border-top: 1px solid var(--border);
}

/* ---------- Grid Layout ---------- */
.card-grid{
  display: grid;
  gap: var(--gap);

  /* Fixed-ish card width, responsive count */
  grid-template-columns: repeat(auto-fill, minmax(220px, 220px));

  /* Center rows with few items */
  justify-content: center;

  align-items: stretch;
}
/* ---------- Card ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(17,24,39,.04);

  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadowHover);
  border-color: rgba(37,99,235,.22);
}

/* ---------- Cover Image (A4-ish) ---------- */
/* A4 ratio is ~1 : 1.414 (width : height). We set an aspect ratio so grid stays neat. */
.card-image{
  position: relative;
  width: 100%;
  background: #eef2ff; /* subtle background behind covers */
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
}

/* Covers are converted from PDFs; most look best with "contain" so nothing is cropped. */
.card-image img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;               /* breathing room around the cover */
  filter: drop-shadow(0 6px 18px rgba(17,24,39,.14));
  transform: translateZ(0);
}

/* If you prefer full-bleed covers, switch to this:
.card-image img { object-fit: cover; padding: 0; filter: none; }
*/

/* Grade badge on cover */
.grade-badge{
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;

  background: rgba(37,99,235,.92);
  color: #fff;
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;

  padding: 6px 10px;
  border-radius: 999px;

  box-shadow: 0 10px 20px rgba(37,99,235,.20);
  backdrop-filter: blur(6px);
}

/* Optional small “PDF” tag (if you ever want it)
.pdf-badge{
  position:absolute; top:10px; right:10px;
  background: rgba(17,24,39,.72);
  color:#fff;
  font-size:12px; font-weight:600;
  padding:6px 10px; border-radius:999px;
  backdrop-filter: blur(6px);
}
*/

/* ---------- Card Content ---------- */
.card-content{
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title,
.card-content h3{
  margin: 0;

  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 650;
  letter-spacing: -0.01em;

  /* Keep titles tidy */
  font-size: 0.95rem;
  line-height: 1.25
}

/* ---------- Meta Row ---------- */
.card-meta{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;

  font-size: 0.78rem;
  color: var(--muted);
}

.meta-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.meta-separator{
  opacity: .55;
  color: #2563eb;
}

/* Page count pill (optional look, applies if you wrap pages in .page-count) */
.page-count{
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Upload date (if you use .upload-date span) */
.upload-date{
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Empty state ---------- */
.container > p{
  margin: 16px 0 0;
  color: var(--muted);
}
@media (max-width: 520px){
  .card-grid{
    grid-template-columns: repeat(auto-fill, minmax(170px, 170px));
    justify-content: center;
    gap: 14px;
  }
}

@media (min-width: 1200px){
  .card-grid{
    grid-template-columns: repeat(auto-fill, minmax(230px, 230px));
  }
}
