/* Layout concept: one centered white card on a soft grey ground with a faint green glow — form on top, answer and stat tiles underneath. */
:root {
  --ground: #f0f1f0;
  --surface: #ffffff;
  --tile: #f2f4f3;
  --ink: #111614;
  --muted: #5f6b66;
  --line: #e2e6e4;
  --accent: #22b893;
  --accent-hover: #1ba483;
  --accent-ink: #ffffff;
  --answer: #0e5b47;
  --logo-baba: #3fd8b0;
  --accent-soft: #e3f5ef;
  --glow: rgba(34, 184, 147, 0.10);
  --good: #16794a;
  --bad: #c0362c;
  --font-display: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  --radius-lg: 26px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17, 22, 20, 0.04), 0 8px 30px rgba(17, 22, 20, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0e1211; --surface: #171d1b; --tile: #1f2724; --ink: #edf2f0; --muted: #9dabA5; --line: #2a3431;
    --accent: #2fcaa2; --accent-hover: #3fd8b0; --accent-ink: #062019; --answer: #6fe0bf; --accent-soft: #163029; --logo-baba: #0e5b47;
    --glow: rgba(47, 202, 162, 0.08); --good: #5fd08a; --bad: #ff8a80;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0e1211; --surface: #171d1b; --tile: #1f2724; --ink: #edf2f0; --muted: #9dabA5; --line: #2a3431;
  --accent: #2fcaa2; --accent-hover: #3fd8b0; --accent-ink: #062019; --answer: #6fe0bf; --accent-soft: #163029; --logo-baba: #0e5b47;
  --glow: rgba(47, 202, 162, 0.08); --good: #5fd08a; --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.65;
  background:
    radial-gradient(900px 600px at 15% 70%, var(--glow), transparent 70%),
    radial-gradient(900px 600px at 85% 55%, var(--glow), transparent 70%),
    var(--ground);
  background-attachment: fixed;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--answer); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.wrap { max-width: 1100px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 700px) { .wrap { padding-inline: 28px; } }

/* Header */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 10px; padding-block: 12px; }
@media (min-width: 760px) { .site-head .wrap { grid-template-columns: 1fr auto 1fr; justify-items: start; } }
.brand { text-decoration: none; color: var(--ink); display: inline-flex; line-height: 0; }
.logo { display: block; height: 39px; width: auto; font-family: var(--font-display); }
.logo-sm { height: 32px; }
.logo-baba { fill: var(--logo-baba); }
.logo-star { fill: var(--accent); }
.site-nav { display: flex; gap: 4px 22px; flex-wrap: wrap; justify-content: center; font-size: 0.93rem; font-weight: 500; }
.site-nav a { color: var(--ink); text-decoration: none; opacity: 0.8; }
.site-nav a:hover, .site-nav a[aria-current="page"] { opacity: 1; color: var(--answer); }

/* Page head */
.crumbs { font-size: 0.82rem; color: var(--muted); padding-block: 16px 0; text-align: center; }
.crumbs a { color: var(--muted); }
.page-head { padding-block: 34px 34px; max-width: 640px; margin-inline: auto; text-align: center; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.8rem); line-height: 1.1; margin: 0 0 14px; text-wrap: balance;
}
.page-head p { margin: 0; color: var(--ink); opacity: 0.85; font-size: 1.02rem; }

/* The tool card: form on top, result below, one white card */
.tool {
  max-width: 680px; margin-inline: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 26px 20px 24px; display: grid; gap: 8px;
}
@media (min-width: 600px) { .tool { padding: 30px 40px 34px; } }
.panel { min-width: 0; }
.panel h2 { display: none; }
.fields { display: grid; gap: 14px; }
.row2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .label { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.field small, .note { color: var(--muted); font-size: 0.82rem; }
input, select {
  font: inherit; font-size: 1.02rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; width: 100%; min-width: 0;
  font-variant-numeric: tabular-nums;
}
input[type="date"] { font-size: 1.1rem; }
input:hover, select:hover { border-color: #c9d0cd; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: center; font-size: 0.95rem; }
.check input { width: auto; accent-color: var(--accent); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns > button[type="submit"] { flex: 1 1 100%; }
button, .btn {
  font: inherit; font-weight: 700; font-size: 1rem; border-radius: 10px; padding: 12px 20px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none;
  display: inline-block; text-align: center; transition: background .15s;
}
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost, .btn.ghost { background: transparent; color: var(--answer); border-color: var(--line); flex: 1 1 auto; }
button.ghost:hover, .btn.ghost:hover { background: var(--tile); }
button.small { padding: 8px 14px; font-size: 0.9rem; }

/* Segmented control — grey track, white active pill */
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button {
  flex: 1 1 auto; background: transparent; border: 1px solid transparent; color: var(--muted);
  font-weight: 600; font-size: 0.93rem; padding: 10px 12px; border-radius: 9px;
}
.seg button:hover { background: transparent; color: var(--ink); border-color: transparent; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* Result */
.receipt { text-align: center; padding-top: 18px; }
.receipt > .label { font-size: 1.1rem; font-weight: 700; }
.receipt .headline {
  font-family: var(--font-display); font-weight: 800; color: var(--answer); letter-spacing: -0.02em;
  font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.05rem); line-height: 1.25; margin: 6px 0 4px; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.receipt .headline small { color: var(--muted); }
.receipt .sub { color: var(--muted); margin: 0 0 18px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lines li {
  background: var(--tile); border-radius: 12px; padding: 14px 10px; display: flex; flex-direction: column-reverse;
  align-items: center; justify-content: center; gap: 2px; min-width: 0; text-align: center;
}
.lines li span:first-child { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.lines li span:last-child { font-weight: 800; font-size: 1.12rem; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lines li.total { background: var(--accent-soft); }
.lines li.total span:last-child { color: var(--answer); }
.lines li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.verdict { display: inline-block; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 6px 16px; border-radius: 999px; }
.verdict.ok { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.verdict.no { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.note { margin: 14px 0 0; }
.error { color: var(--bad); font-size: 1.1rem; }
.table-scroll { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 0.78rem; color: var(--muted); font-weight: 700; background: var(--tile); }

/* Course rows (CGPA) */
.course { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.course .x { background: transparent; color: var(--muted); border-color: var(--line); padding: 11px 13px; }
.course .x:hover { background: var(--tile); }
@media (max-width: 460px) { .course { grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; } .course .cname { grid-column: 1 / -1; } }

/* Article + FAQ */
.article { max-width: 680px; margin-inline: auto; padding-block: 56px 10px; }
.article h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.02em; margin: 36px 0 10px; text-wrap: balance; }
.article h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.article .formula { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 0.95rem; font-weight: 600; }
.faq { display: grid; gap: 10px; }
.faq h2 { margin-bottom: 6px; }
.faq details { background: var(--surface); border-radius: 20px; padding: 0 18px 0 22px; box-shadow: var(--shadow); }
.faq summary {
  cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding-block: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 500; line-height: 1;
}
.faq details[open] summary::after { content: "×"; }
.faq details p { margin: 0; padding: 0 0 18px; color: var(--muted); }

/* Related + home grid */
.related { padding-block: 30px 50px; max-width: 900px; }
.related h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; margin: 0 0 14px; text-align: center; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  display: grid; gap: 4px; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; text-decoration: none; color: var(--ink); min-width: 0; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .tag { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.card strong { font-family: var(--font-display); font-size: 1.08rem; font-weight: 800; }
.card span:last-child { color: var(--muted); font-size: 0.92rem; }

.hero { padding-block: 60px 30px; text-align: center; max-width: 760px; margin-inline: auto; display: grid; gap: 26px; justify-items: center; }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.5rem); line-height: 1.06; letter-spacing: -0.04em; margin: 0; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 14px auto 0; max-width: 580px; }
.quick { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); width: 100%; max-width: 560px; text-align: left; }
.quick .btns > * { flex: 1 1 auto; }
.search { margin: 6px 0 14px; }
.section-label { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 34px 0 12px; }

/* Urdu */
.rtl { direction: rtl; }
.rtl, .urdu { font-family: var(--font-urdu); line-height: 2.1; }
.rtl .field label, .rtl .label { font-size: 0.98rem; }
.rtl input { direction: ltr; text-align: right; }
.rtl .faq summary { font-weight: 600; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 50px; }
.site-foot .wrap { padding-block: 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--muted); text-align: center; }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.site-foot a { color: var(--muted); }

.ad-slot:empty { display: none; }
.prose { max-width: 680px; margin-inline: auto; padding-block: 0 40px; }
.prose .page-head { padding-bottom: 20px; }
.prose h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin: 28px 0 8px; }

@media (max-width: 420px) { .lines { grid-template-columns: minmax(0, 1fr); } .lines li:last-child:nth-child(odd) { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .site-head, .site-foot, .related, .ad-slot { display: none; } body { background: #fff; } }
