/* =========================================================
   Madras Mathematics Department – Course page styles
   Plain CSS so these pages can be edited in Dreamweaver.
   ========================================================= */
:root {
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --ink: #0b1b33;
  --ink-2: #334155;
  --muted: #64748b;
  --line: rgba(14, 165, 233, 0.16);
  --glass: rgba(255, 255, 255, 0.72);
  --radius: 20px;
  --shadow: 0 1px 2px rgba(11, 27, 51, 0.04), 0 8px 24px -8px rgba(2, 132, 199, 0.18);
  --shadow-lg: 0 2px 4px rgba(11, 27, 51, 0.04), 0 24px 48px -16px rgba(2, 132, 199, 0.3);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .display { font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--sky-400); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; transition: top .2s; }
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .container { padding: 0 32px; } }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: radial-gradient(1200px 600px at 80% -10%, var(--sky-100), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, #eef7ff, transparent 60%), #fff; }
.ambient .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.ambient .b1 { width: 420px; height: 420px; background: var(--sky-200); top: -120px; right: -80px; }
.ambient .b2 { width: 360px; height: 360px; background: #dbeafe; top: 40%; left: -140px; animation-delay: -6s; }
.ambient .grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(14,165,233,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(14,165,233,.06) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, #000, transparent 70%); -webkit-mask-image: linear-gradient(to bottom, #000, transparent 70%); }
@keyframes drift { to { transform: translate3d(40px, 60px, 0) scale(1.08); } }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; transition: background .3s, box-shadow .3s, border-color .3s; border-bottom: 1px solid transparent; }
.site-header.scrolled { background: rgba(255,255,255,.78); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-color: var(--line); box-shadow: 0 6px 24px -18px rgba(2,132,199,.45); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand img { width: 40px; height: 40px; border-radius: 12px; object-fit: contain; background: #fff; box-shadow: var(--shadow); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; line-height: 1.2; }
.brand span { font-family: "Plus Jakarta Sans", sans-serif; font-size: 15px; line-height: 1.2; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.course-switch { position: relative; display: none; }
@media (min-width: 720px) { .course-switch { display: block; } }
.course-switch select { appearance: none; -webkit-appearance: none; font: inherit; font-size: 14px; color: var(--ink); padding: 10px 40px 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%230284c7' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center; cursor: pointer; max-width: 280px; transition: border-color .2s, box-shadow .2s; }
.course-switch select:hover { border-color: var(--sky-300); box-shadow: 0 0 0 4px rgba(56,189,248,.12); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, color .25s, border-color .25s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: linear-gradient(135deg, var(--sky-500), var(--sky-600)); color: #fff; box-shadow: 0 8px 20px -8px rgba(2,132,199,.7), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(2,132,199,.75), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-ghost { background: rgba(255,255,255,.7); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--sky-300); color: var(--sky-700); transform: translateY(-2px); }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 24px; }
@media (min-width: 768px) { .hero { padding: 64px 0 32px; } }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--sky-700); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sky-700); background: rgba(224,242,254,.8); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sky-500); box-shadow: 0 0 0 4px rgba(14,165,233,.2); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(14,165,233,0); } }
.hero h1 { font-size: clamp(32px, 6vw, 56px); margin: 16px 0 14px; font-weight: 800; }
.hero h1 .grad { background: linear-gradient(120deg, var(--sky-600), var(--sky-400) 60%, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); max-width: 720px; margin: 0; }
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.chip { font-size: 13px; font-weight: 500; color: var(--ink-2); background: rgba(255,255,255,.8); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }

/* Prominent assessment banner */
.assess-banner { position: relative; margin-top: 28px; display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 24px; color: #fff; overflow: hidden; background: linear-gradient(135deg, #0284c7, #0ea5e9 55%, #38bdf8); box-shadow: var(--shadow-lg); }
@media (min-width: 768px) { .assess-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 26px 30px; } }
.assess-banner::before { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 160px at 90% 0%, rgba(255,255,255,.35), transparent 70%); pointer-events: none; }
.assess-banner::after { content: ""; position: absolute; top: 0; left: -40%; width: 30%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-20deg); animation: shine 5s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -40%; } 100% { left: 140%; } }
.assess-banner h2 { font-size: clamp(18px, 2.4vw, 24px); font-weight: 800; position: relative; }
.assess-banner p { margin: 6px 0 0; opacity: .9; font-size: 14px; position: relative; }
.assess-banner .btn { background: #fff; color: var(--sky-700); position: relative; box-shadow: 0 10px 24px -10px rgba(0,0,0,.35); }
.assess-banner .btn:hover { transform: translateY(-2px) scale(1.02); }

/* Jump nav */
.jump-nav { position: sticky; top: 72px; z-index: 40; margin: 8px 0 0; padding: 10px 0; }
.jump-nav .inner { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 6px; border-radius: 16px; background: rgba(255,255,255,.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.jump-nav .inner::-webkit-scrollbar { display: none; }
.jump-nav a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background .2s, color .2s; }
.jump-nav a:hover { background: var(--sky-50); color: var(--sky-700); }
.jump-nav a.active { background: var(--sky-500); color: #fff; }
.jump-nav a .count { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--sky-100); color: var(--sky-700); }
.jump-nav a.active .count { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- Layout ---------- */
.layout { display: grid; gap: 28px; padding: 24px 0 80px; }
@media (min-width: 1024px) { .layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.aside { display: grid; gap: 20px; }
@media (min-width: 1024px) { .aside { position: sticky; top: 160px; } }

.panel { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 24px; margin-bottom: 28px; }
@media (min-width: 768px) { .section { padding: 32px; } }
.section-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.section-title { display: flex; align-items: center; gap: 14px; }
.section-title .icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sky-100), #fff); border: 1px solid var(--line); color: var(--sky-600); flex-shrink: 0; }
.section-title .icon svg { width: 22px; height: 22px; }
.section-title h2 { font-size: clamp(20px, 2.6vw, 26px); font-weight: 800; }
.section-title p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }

.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search input { width: 100%; font: inherit; font-size: 14px; padding: 10px 14px 10px 38px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.9); color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.search input:focus { outline: none; border-color: var(--sky-400); box-shadow: 0 0 0 4px rgba(56,189,248,.18); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }

/* Resource cards */
.res-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .res-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.res { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; position: relative; overflow: hidden; }
.res::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent, rgba(186,230,253,.35), transparent); transform: translateX(-100%); transition: transform .6s var(--ease); }
.res:hover { transform: translateY(-3px); border-color: var(--sky-300); box-shadow: var(--shadow-lg); }
.res:hover::before { transform: translateX(100%); }
.res .pdf { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--sky-50); color: var(--sky-600); font-size: 10px; font-weight: 800; letter-spacing: .04em; border: 1px solid var(--line); transition: background .3s, color .3s; }
.res:hover .pdf { background: var(--sky-500); color: #fff; }
.res .txt { min-width: 0; flex: 1; position: relative; }
.res .txt strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .txt span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .arrow { width: 18px; height: 18px; color: var(--sky-500); flex-shrink: 0; transition: transform .3s var(--ease); position: relative; }
.res:hover .arrow { transform: translate(3px, -3px); }

/* Past paper rows */
.paper-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 900px) { .paper-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.paper { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); transition: border-color .25s, box-shadow .25s, transform .25s var(--ease); }
.paper:hover { border-color: var(--sky-300); box-shadow: var(--shadow); transform: translateY(-2px); }
.paper .num { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 13px; color: var(--sky-600); background: var(--sky-50); border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; }
.paper .name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.paper .name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.paper .acts { display: flex; gap: 6px; flex-shrink: 0; }
.mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--sky-700); transition: all .2s; }
.mini svg { width: 14px; height: 14px; }
.mini:hover { background: var(--sky-50); border-color: var(--sky-300); }
.mini.solid { background: var(--sky-500); color: #fff; border-color: var(--sky-500); }
.mini.solid:hover { background: var(--sky-600); }

/* Table (Higher Apps) */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
table.papers { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 14px; }
table.papers th { text-align: left; font-family: "Plus Jakarta Sans", sans-serif; font-size: 13px; letter-spacing: .02em; color: var(--sky-700); background: linear-gradient(180deg, var(--sky-50), #fff); padding: 14px 16px; border-bottom: 1px solid var(--line); }
table.papers td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.papers tr:last-child td { border-bottom: 0; }
table.papers tbody tr { transition: background .2s; }
table.papers tbody tr:hover { background: var(--sky-50); }
table.papers td.year { font-weight: 800; font-family: "Plus Jakarta Sans", sans-serif; }

/* Sub-grouped revision materials */
.sub-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 8px; }
.sub-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); transition: all .2s; }
.sub-chip span { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--sky-100); color: var(--sky-700); }
.sub-chip:hover { border-color: var(--sky-300); color: var(--sky-700); background: var(--sky-50); transform: translateY(-1px); }
.sub-group { padding-top: 24px; margin-top: 24px; border-top: 1px dashed var(--line); scroll-margin-top: 150px; }
.sub-group[hidden] { display: none; }
.sub-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sub-head h3 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.sub-head h3::before { content: ""; width: 6px; height: 22px; border-radius: 3px; background: linear-gradient(180deg, var(--sky-400), var(--sky-600)); }
.sub-count { font-size: 12px; font-weight: 600; color: var(--sky-700); background: var(--sky-50); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.sub-desc { margin: 4px 0 14px 16px; font-size: 14px; color: var(--muted); }

.empty { display: none; text-align: center; padding: 24px; color: var(--muted); font-size: 14px; }
.empty.show { display: block; }

.load-more { margin-top: 16px; display: flex; justify-content: center; }

/* Aside cards */
.card { padding: 22px; }
.card h3 { font-size: 17px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card h3 svg { width: 20px; height: 20px; color: var(--sky-600); }
.dates { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dates li { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.dates .cal { width: 46px; flex-shrink: 0; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.dates .cal b { display: block; background: var(--sky-500); color: #fff; font-size: 10px; letter-spacing: .08em; padding: 2px 0; }
.dates .cal i { display: block; font-style: normal; font-weight: 800; font-size: 15px; padding: 3px 0; font-family: "Plus Jakarta Sans", sans-serif; }
.dates strong { display: block; font-size: 14px; }
.dates span { font-size: 12px; color: var(--muted); }
.card .note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.tips { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 8px; }
.help-card { background: linear-gradient(160deg, var(--sky-50), #fff); }
.help-card p { font-size: 14px; color: var(--ink-2); margin: 0 0 14px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; background: rgba(255,255,255,.7); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.footer-inner a { color: var(--sky-700); font-weight: 500; }

.to-top { position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.85); backdrop-filter: blur(10px); color: var(--sky-600); display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: all .3s var(--ease); z-index: 60; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--sky-500); color: #fff; }
.to-top svg { width: 20px; height: 20px; }

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .site-header, .jump-nav, .aside, .to-top, .ambient, .assess-banner .btn, .search { display: none !important; }
  .panel { box-shadow: none; backdrop-filter: none; }
}
