@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,500;0,600;0,700;1,500&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #1c2a3a;
  --ink-soft: #445064;
  --paper: #f7f4ee;
  --paper-raised: #fffefb;
  --rule: #d8d2c4;
  --gold: #a3833b;
  --pass: #2f6b4f;
  --fail: #a13a3a;
  --shadow: 0 1px 2px rgba(28,42,58,0.06), 0 8px 24px rgba(28,42,58,0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Nav ---------- */
.site-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px clamp(20px, 5vw, 56px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand .tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 2px 6px;
  border-radius: 100px;
}

.nav-links {
  display: flex;
  gap: 22px;
  font-size: 13px;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* ---------- Layout ---------- */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 44px clamp(20px, 5vw, 56px) 90px;
}

.page-head {
  margin-bottom: 32px;
}

.page-head .eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}

.page-head h1 {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: clamp(26px, 3.6vw, 36px);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.page-head p.lede {
  font-size: 14.5px;
  color: var(--ink-soft);
  max-width: 620px;
  line-height: 1.65;
  margin: 0;
}

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

footer {
  border-top: 1px solid var(--rule);
  padding: 26px clamp(20px, 5vw, 56px) 40px;
}

footer .footer-inner {
  max-width: 980px;
  margin: 0 auto;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* ---------- Search / lookup ---------- */
.lookup-card {
  padding: 30px 28px;
}

.lookup-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--ink);
}
input[type="text"]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

button.primary {
  padding: 12px 22px;
  border: none;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper-raised);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
button.primary:hover { background: var(--ink-soft); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

.lookup-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.lookup-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: #f3dedb;
  color: var(--fail);
  border-radius: 8px;
  font-size: 13px;
  display: none;
}

/* ---------- Result detail ---------- */
#resultArea { margin-top: 26px; display: none; }

.detail-header {
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.detail-header h2 {
  font-family: 'Source Serif 4', serif;
  font-size: 22px;
  margin: 0 0 6px;
}

.meta-line {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.8;
}
.meta-line span.k {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin-right: 6px;
}

.overall-gp { text-align: right; flex-shrink: 0; }
.overall-gp .num {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
}
.overall-gp .lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-top: 4px;
}

.note {
  padding: 12px 28px;
  background: #f1ede2;
  font-size: 11.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  line-height: 1.6;
}

.semester { padding: 22px 28px; border-bottom: 1px solid var(--rule); }
.semester:last-child { border-bottom: none; }

.semester-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.semester-head h3 {
  font-family: 'Source Serif 4', serif;
  font-size: 15.5px;
  font-weight: 600;
  margin: 0;
}
.semester-head .sem-avg {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--gold);
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
td { padding: 8px; border-bottom: 1px solid #ece7d9; vertical-align: top; }
td.course-code { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
td.marks, td.grade, td.gp { text-align: right; font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }

.grade-pill {
  display: inline-block;
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}
.grade-pass { background: #e2ede7; color: var(--pass); }
.grade-fail { background: #f3dedb; color: var(--fail); }
.grade-na { background: #eee; color: var(--ink-soft); }

/* ---------- Generic content pages (grading / faq / about) ---------- */
.content-block { padding: 26px 28px; }
.content-block + .content-block { border-top: 1px solid var(--rule); }
.content-block h2 {
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  margin: 0 0 12px;
}
.content-block p { font-size: 13.5px; line-height: 1.75; color: var(--ink-soft); margin: 0 0 12px; }
.content-block table { margin-top: 8px; }
.content-block th, .content-block td { padding: 7px 10px; }
.content-block td:not(:first-child) { text-align: right; font-family: 'IBM Plex Mono', monospace; }

.formula {
  font-family: 'IBM Plex Mono', monospace;
  background: #f1ede2;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  margin: 12px 0;
  overflow-x: auto;
}

.faq-item { padding: 20px 28px; border-bottom: 1px solid var(--rule); }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 {
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  margin: 0 0 8px;
}
.faq-item p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
