:root {
  --library-navy: #10213f;
  --library-navy-soft: #1b3158;
  --library-gold: #bd963e;
  --library-ink: #172033;
  --library-muted: #6e7686;
  --library-line: #e4e6ea;
  --library-paper: #fffdf9;
  --library-bg: #f5f3ee;
  --library-blue: #3157d5;
}

body { background: var(--library-bg); color: var(--library-ink); }
body.resources-checking .resources-shell { visibility: hidden; }
.resources-shell { min-height: 100vh; padding: 108px 1.25rem 5rem; }
.resources-inner { width: min(1040px, 100%); margin: 0 auto; }
.resources-back {
  display: inline-flex; align-items: center; gap: .48rem;
  color: #646c7a; font-size: .76rem; font-weight: 700; text-decoration: none;
  transition: color .18s ease;
}
.resources-back:hover { color: var(--library-navy); }

.resources-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end;
  padding: 2.15rem 0 1.7rem;
}
.resources-kicker {
  margin: 0 0 .58rem; color: var(--library-gold); font-size: .66rem;
  font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
}
.resources-header h1 {
  margin: 0; color: var(--library-navy); font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.02;
}
.resources-header p { max-width: 620px; margin: .72rem 0 0; color: var(--library-muted); font-size: .88rem; line-height: 1.7; }
.resources-summary { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
.resources-summary span {
  display: inline-flex; align-items: center; gap: .38rem; padding: .42rem .65rem;
  border: 1px solid #ddd9cf; border-radius: 999px; background: rgba(255,255,255,.55);
  color: #667080; font-size: .67rem; font-weight: 700; white-space: nowrap;
}
.resources-summary i { color: var(--library-gold); }

.resources-subject-nav {
  display: grid; grid-template-columns: 1fr 1fr; padding: 5px; margin-bottom: 2.25rem;
  border: 1px solid #dedbd3; border-radius: 13px; background: #ebe8e1;
}
.resources-subject-link {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 44px; border-radius: 9px; color: #717783; font-size: .77rem;
  font-weight: 750; text-decoration: none; transition: .18s ease;
}
.resources-subject-link:hover { color: var(--library-navy); }
.resources-subject-link.active { background: #fff; color: var(--library-navy); box-shadow: 0 3px 12px rgba(17,30,55,.08); }
.resources-subject-link.active i { color: var(--library-gold); }

.resources-section { margin-top: 2rem; }
.resources-section + .resources-section { padding-top: .6rem; }
.resources-section--divided { margin-top: 2.8rem; padding-top: 2rem !important; border-top: 1px solid #dcd8cf; }
.resources-section-head { display: flex; align-items: end; gap: 1rem; margin-bottom: .9rem; }
.resources-section-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .72rem; }
.resources-category-icon {
  width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px;
  border-radius: 10px; background: #e9edf9; color: var(--library-blue); font-size: .88rem;
}
.resources-category-icon--resources { background: #f5ecda; color: #98701f; }
.resources-section h2 { margin: 0; color: var(--library-navy); font: 700 1.12rem/1.2 'Playfair Display', Georgia, serif; }
.resources-section-title p { margin: .28rem 0 0; color: #858b96; font-size: .71rem; line-height: 1.5; }
.resources-section-count { color: #8c919a; font-size: .66rem; font-weight: 700; white-space: nowrap; }
.resources-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.resources-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.resources-grid.four-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.resources-grid.single { grid-template-columns: minmax(0, 510px); }

.resource-card {
  --task-color: #3157d5; --task-soft: #eef2ff;
  position: relative; display: flex; flex-direction: column; min-height: 218px;
  padding: 1.15rem; border: 1px solid var(--library-line); border-radius: 14px;
  background: var(--library-paper); box-shadow: 0 3px 15px rgba(17,30,55,.035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.resource-card:hover { transform: translateY(-2px); border-color: #ccd2dd; box-shadow: 0 10px 26px rgba(17,30,55,.07); }
.resource-card.task-1 { --task-color: #27618a; --task-soft: #eaf5fa; }
.resource-card.task-2 { --task-color: #a46c11; --task-soft: #fff5df; }
.resource-card.task-3 { --task-color: #76539f; --task-soft: #f3edfb; }
.resource-card.writing { --task-color: #3157d5; --task-soft: #edf1ff; }
.resource-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.resource-icon {
  width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 40px;
  border-radius: 11px; background: var(--task-soft); color: var(--task-color); font-size: 1rem;
}
.resource-badge {
  display: inline-flex; padding: .25rem .48rem; border-radius: 999px;
  background: var(--task-soft); color: var(--task-color); font-size: .6rem;
  font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.resource-card h3 { margin: .9rem 0 .42rem; color: var(--library-ink); font-size: .92rem; line-height: 1.38; }
.resource-card p { margin: 0; color: #777e8b; font-size: .73rem; line-height: 1.6; }
.resource-meta { display: flex; align-items: center; gap: .45rem; margin-top: .7rem; color: #9297a1; font-size: .62rem; font-weight: 650; }
.resource-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #bbbfc7; }
.resource-card-foot { display: flex; align-items: center; gap: .75rem; margin-top: auto; padding-top: 1rem; }
.resource-format { color: #8b909b; font-size: .64rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.resource-open {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center; gap: .42rem;
  min-height: 35px; padding: .45rem .7rem; border: 0; border-radius: 8px;
  background: var(--library-navy); color: #fff; font: inherit; font-size: .66rem;
  font-weight: 750; cursor: pointer; transition: background .16s ease, transform .16s ease;
}
.resource-open:hover { background: var(--library-navy-soft); }
.resource-open:active { transform: scale(.98); }
.resource-open:disabled { cursor: wait; opacity: .62; }
.resources-note {
  display: flex; align-items: flex-start; gap: .72rem; margin-top: 2.2rem; padding: .85rem 1rem;
  border: 1px solid #dedbd3; border-radius: 11px; background: rgba(255,255,255,.48);
  color: #737a87; font-size: .7rem; line-height: 1.55;
}
.resources-note i { color: var(--library-gold); margin-top: .12rem; }
.resource-alert { margin-top: 1rem; padding: .75rem .85rem; border: 1px solid #fecaca; border-radius: 8px; background: #fff7f7; color: #b42318; font-size: .78rem; }

@media (max-width: 820px) {
  .resources-header { grid-template-columns: 1fr; gap: 1rem; }
  .resources-summary { justify-content: flex-start; }
  .resources-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .resources-shell { padding: 91px .9rem 3.5rem; }
  .resources-header { padding-top: 1.55rem; }
  .resources-header h1 { font-size: 2.15rem; }
  .resources-header p { font-size: .8rem; }
  .resources-summary { display: none; }
  .resources-subject-nav { margin-bottom: 1.7rem; }
  .resources-grid, .resources-grid.two-up, .resources-grid.four-up, .resources-grid.single { grid-template-columns: 1fr; }
  .resource-card { min-height: 194px; }
  .resources-section-head { align-items: center; }
  .resources-section--divided { margin-top: 2.25rem; padding-top: 1.6rem !important; }
}
