/* ═════════════════════════════════════════════════════════════
   NARTON ATLAS — SHARED UI (homepage .hp + browse pages .ap)
   Tokens, group palette, entrance/reveal motion, section heads,
   and the course card used on section & topic pages.
═════════════════════════════════════════════════════════════ */

.hp, .ap {
  --c1: #1a4ed8;  --c1-soft: #e8eefb;   /* STEM                 */
  --c2: #7c3aed;  --c2-soft: #f1eafe;   /* Engineering & Comp.  */
  --c3: #d9480f;  --c3-soft: #fff0e6;   /* Humanities           */
  --c4: #0f8a6a;  --c4-soft: #e3f6f0;   /* Creative & Practical */
  --c: var(--c1); --c-soft: var(--c1-soft);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 2px 8px rgba(15,23,42,.04);
  --shadow-lg: 0 18px 50px -12px rgba(26,78,216,.25);
  background: var(--bg);
  overflow-x: clip;
}

.hp-c1, .ap-c1 { --c: var(--c1); --c-soft: var(--c1-soft); }
.hp-c2, .ap-c2 { --c: var(--c2); --c-soft: var(--c2-soft); }
.hp-c3, .ap-c3 { --c: var(--c3); --c-soft: var(--c3-soft); }
.hp-c4, .ap-c4 { --c: var(--c4); --c-soft: var(--c4-soft); }

/* ── Entrance + scroll-reveal ──────────────────────────────── */
@keyframes hpIn {
  from { opacity: 0; transform: translateY(22px); filter: blur(4px); }
  to   { opacity: 1; transform: none;             filter: none; }
}
.hp-in { animation: hpIn .9s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 110ms + 80ms); }

/* Uses `translate` (not `transform`) so hover transforms still work.
   atlas.js removes .reveal once the entrance has finished. */
html.js .reveal {
  opacity: 0;
  translate: 0 26px;
  transition: opacity .8s var(--ease-out), translate .8s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 70ms);
}
html.js .reveal.is-visible { opacity: 1; translate: none; }

@keyframes hpSpin { to { transform: rotate(360deg); } }
@keyframes hpFloat {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-40px, 30px) scale(1.08); }
  100% { transform: translate(30px, -20px) scale(.95); }
}

/* ── Section heads ─────────────────────────────────────────── */
.hp-head { margin-bottom: 2.25rem; }
.hp-head--row {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.25rem;
}
.hp-kicker {
  font-size: .74rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue); margin-bottom: .55rem;
}
.ap .hp-kicker { color: var(--c); }
.hp-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); margin: 0;
}

/* ═════════════════ COURSE CARD (.ac-card) ═════════════════ */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.15rem;
}
.ac-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  color: var(--ink) !important;
  transition: transform .4s var(--ease-out), box-shadow .35s, border-color .3s, opacity .3s;
}
.ac-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--c) 35%, transparent);
  box-shadow: 0 22px 44px -20px color-mix(in srgb, var(--c) 50%, transparent);
}
.ac-thumb {
  position: relative; display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--c-soft);
}
.ac-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s var(--ease-out);
}
.ac-card:hover .ac-thumb img { transform: scale(1.06); }

.ac-ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #a855f7));
  transition: transform .7s var(--ease-out);
}
.ac-card:nth-child(3n+2) .ac-ph { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 80%, #000), var(--c)); }
.ac-card:nth-child(3n+3) .ac-ph { background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 50%, #0ea5e9)); }
.ac-ph::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.18) 1.2px, transparent 1.2px);
  background-size: 16px 16px;
}
.ac-ph span {
  position: relative;
  font-family: var(--font-display); font-weight: 700;
  font-size: 3.2rem; color: rgba(255,255,255,.95);
  text-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.ac-card:hover .ac-ph { transform: scale(1.06); }

.ac-badges {
  position: absolute; left: .7rem; top: .7rem; right: .7rem;
  display: flex; justify-content: space-between; gap: .4rem;
}
.ac-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 600;
  color: var(--ink);
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(6px);
  padding: .25rem .6rem; border-radius: 50px;
}
.ac-badge .bi-youtube { color: #e11d48; }
.ac-badge .bi-globe2  { color: var(--blue); }
.ac-badge--pick { background: #fef3c7; color: #92400e; }
.ac-badge--topic { color: var(--c); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

.ac-body { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.2rem 1.1rem; }
.ac-by { font-size: .75rem; font-weight: 600; color: var(--c); margin-bottom: .3rem; }
.ac-card h3 {
  font-family: var(--font-display); font-size: 1.06rem; font-weight: 700;
  line-height: 1.3; margin: 0 0 .45rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ac-desc { font-size: .84rem; color: var(--muted); line-height: 1.55; margin: 0 0 .9rem; }
.ac-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.ac-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--border);
  padding: .2rem .55rem; border-radius: 6px;
}
.ac-tag i { color: var(--muted); }
.ac-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .9rem; padding-top: .8rem;
  border-top: 1px solid var(--border);
  font-size: .78rem; color: var(--muted);
}
.ac-stars { display: inline-flex; align-items: center; gap: .35rem; }
.ac-stars i { color: #f59e0b; }
.ac-stars b { color: var(--ink); font-weight: 600; }
.ac-go {
  display: inline-flex; align-items: center; gap: .3rem;
  font-weight: 600; color: var(--c);
}
.ac-go i { transition: transform .3s var(--ease-out); }
.ac-card:hover .ac-go i { transform: translateX(4px); }

@media (max-width: 575.98px) {
  .ac-grid { grid-template-columns: 1fr; }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hp *, .hp *::before, .hp *::after,
  .ap *, .ap *::before, .ap *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.js .reveal { opacity: 1; translate: none; }
}
