/* ============================================================
   HARYANA GK MASTER NOTES — Shared Design System
   HSSC CET Group D | Haryana-themed: ochre/mustard + deep green
   All chapters + hub import this file. Vanilla CSS, offline-ready.
   ============================================================ */

:root {
  /* Palette — Haryana theme */
  --ochre: #b45309;
  --ochre-dark: #92400e;
  --mustard: #e7a614;
  --mustard-soft: #fbe8bd;
  --green: #14532d;
  --green-mid: #1b6b3d;
  --green-soft: #dcefe2;
  --cream: #faf6ee;
  --card: #ffffff;
  --ink: #2b2417;
  --ink-soft: #6b5f4b;
  --line: #e8dfc9;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --shadow: 0 2px 10px rgba(90, 64, 10, 0.10);
  --shadow-lg: 0 8px 28px rgba(90, 64, 10, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
}

[data-theme="dark"] {
  --cream: #191510;
  --card: #241f17;
  --ink: #f0e8d8;
  --ink-soft: #b3a68b;
  --line: #3c3425;
  --mustard-soft: #3a2f14;
  --green-soft: #16301f;
  --danger-soft: #3d1414;
  --ok-soft: #12301c;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; height: auto; }
b, strong { color: var(--ochre-dark); }
[data-theme="dark"] b, [data-theme="dark"] strong { color: var(--mustard); }

/* ---------- Wheat motif top border ---------- */
.motif-bar {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--mustard) 0 22px, var(--green-mid) 22px 26px);
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 55%, #2e7d4f 100%);
  color: #fff;
  padding: 22px 18px 26px;
  position: relative;
  overflow: hidden;
}
.site-header::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 88% 20%, rgba(231,166,20,.28), transparent 42%),
    radial-gradient(circle at 8% 90%, rgba(231,166,20,.16), transparent 38%);
  pointer-events: none;
}
.header-inner { max-width: 1120px; margin: 0 auto; position: relative; z-index: 1; }
.site-header .kicker {
  display: inline-block;
  background: var(--mustard);
  color: #3d2a00;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .6px;
  padding: 4px 12px;
  border-radius: 99px;
  text-transform: uppercase;
}
.site-header h1 { margin: 12px 0 6px; font-size: clamp(26px, 4.5vw, 40px); line-height: 1.15; }
.site-header .tagline { margin: 0; opacity: .93; font-size: clamp(15px, 2.4vw, 18px); }

/* ---------- Top nav (sticky) ---------- */
.topnav {
  position: sticky; top: 0; z-index: 60;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  box-shadow: var(--shadow);
}
.topnav-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
}
.topnav .brand {
  font-weight: 800; color: var(--green-mid);
  text-decoration: none; font-size: 15px; white-space: nowrap;
}
[data-theme="dark"] .topnav .brand { color: var(--mustard); }
.topnav .spacer { flex: 1; }

.btn {
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: transform .12s ease, background .2s;
}
.btn:hover { transform: translateY(-1px); background: var(--mustard-soft); }
.btn-solid { background: var(--green-mid); color: #fff; border-color: var(--green-mid); }
.btn-solid:hover { background: var(--green); }

/* Progress bar under nav */
.progress-track { height: 5px; background: var(--line); }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--mustard), var(--ochre));
  transition: width .15s linear;
}

/* ---------- Layout: sidebar + content ---------- */
.layout {
  max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: 250px 1fr;
  gap: 22px; padding: 22px 14px 60px;
}
.sidebar {
  position: sticky; top: 76px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.sidebar h3 {
  margin: 2px 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--ink-soft);
}
.sidebar nav a {
  display: block; padding: 9px 12px; margin: 3px 0;
  border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  font-size: 14.5px; font-weight: 600;
  border-left: 4px solid transparent;
}
.sidebar nav a:hover { background: var(--mustard-soft); }
.sidebar nav a.active {
  background: var(--green-soft);
  border-left-color: var(--green-mid);
  color: var(--green-mid);
}
[data-theme="dark"] .sidebar nav a.active { color: var(--mustard); border-left-color: var(--mustard); }

/* ---------- Search box ---------- */
.searchbox { position: relative; margin-bottom: 12px; }
.searchbox input {
  width: 100%; padding: 11px 14px 11px 38px;
  border: 2px solid var(--line); border-radius: 99px;
  background: var(--cream); color: var(--ink);
  font-size: 14.5px; font-family: var(--font);
}
.searchbox input:focus { outline: none; border-color: var(--mustard); }
.searchbox .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .55; font-size: 15px; }
.search-hit-count { font-size: 12.5px; color: var(--ink-soft); margin: 4px 2px 0; min-height: 18px; }
mark.search-hl { background: var(--mustard); color: #3d2a00; border-radius: 3px; padding: 0 2px; }

/* ---------- Chapter title bar ---------- */
.chapter-titlebar {
  background: linear-gradient(120deg, var(--green) 0%, var(--green-mid) 70%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 20px;
  display: flex; gap: 16px; align-items: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.chapter-titlebar::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(231,166,20,.22);
}
.ch-badge {
  flex-shrink: 0;
  width: 62px; height: 62px; border-radius: 18px;
  background: var(--mustard); color: #3d2a00;
  display: grid; place-items: center;
  font-weight: 900; box-shadow: var(--shadow);
  text-align: center; line-height: 1.05;
}
.ch-badge .num { font-size: 26px; display: block; }
.ch-badge .lbl { font-size: 10px; letter-spacing: .5px; }
.chapter-titlebar h1 { margin: 0 0 4px; font-size: clamp(21px, 3.6vw, 30px); line-height: 1.2; }
.chapter-titlebar .ch-tagline { margin: 0; font-size: 15px; opacity: .95; }

/* ---------- Accordion sections ---------- */
.acc {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.acc-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font); text-align: left;
  color: var(--ink);
  min-height: 56px;
}
.acc-head:hover { background: var(--mustard-soft); }
.acc-head .sec-ico {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  background: var(--green-soft);
}
.acc-head .sec-title { font-size: clamp(16.5px, 2.6vw, 19px); font-weight: 800; }
.acc-head .sec-sub { font-size: 13px; color: var(--ink-soft); font-weight: 500; display: block; }
.acc-head .chev { margin-left: auto; font-size: 18px; transition: transform .25s; color: var(--ink-soft); }
.acc.open .chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 4px 20px 22px; }
.acc.open .acc-body { display: block; animation: accIn .25s ease; }
@keyframes accIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.acc-body h3 {
  font-size: 18px; margin: 26px 0 8px;
  color: var(--green-mid);
  padding-bottom: 6px; border-bottom: 2px dashed var(--line);
}
[data-theme="dark"] .acc-body h3 { color: var(--mustard); }
.acc-body h4 { font-size: 16px; margin: 18px 0 6px; color: var(--ochre); }
.acc-body ul { padding-left: 22px; }
.acc-body li { margin: 7px 0; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 14px 0; border-radius: var(--radius-sm); border: 1.5px solid var(--line); }
table.gk { border-collapse: collapse; width: 100%; font-size: 15px; min-width: 460px; background: var(--card); }
table.gk th {
  background: var(--green-mid); color: #fff;
  padding: 10px 12px; text-align: left; font-size: 14px;
}
table.gk td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.gk tr:nth-child(even) td { background: color-mix(in srgb, var(--mustard-soft) 45%, var(--card)); }

/* ---------- Callout boxes ---------- */
.callout {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin: 14px 0;
  border-left: 5px solid var(--mustard);
  background: var(--mustard-soft);
  font-size: 15.5px;
}
.callout.green { border-left-color: var(--green-mid); background: var(--green-soft); }
.callout .co-title { font-weight: 800; display: block; margin-bottom: 3px; }

/* ---------- Trick box ---------- */
.trick-box {
  background: linear-gradient(120deg, var(--mustard-soft), var(--green-soft));
  border: 2px dashed var(--ochre);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 14px 0;
}
.trick-box .trick-word {
  display: inline-block;
  background: var(--ochre); color: #fff;
  font-weight: 900; font-size: 18px; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 99px; margin: 6px 0;
}

/* ---------- Flip cards (Yaad Rakhne Wale Points) ---------- */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px; margin: 14px 0;
}
.flip-card { perspective: 900px; min-height: 128px; cursor: pointer; }
.flip-inner {
  position: relative; width: 100%; height: 100%; min-height: 128px;
  transition: transform .5s; transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 14.5px;
}
.flip-front {
  background: var(--green-mid); color: #fff; font-weight: 700;
  box-shadow: var(--shadow);
}
.flip-front .tapnote { position: absolute; bottom: 7px; right: 12px; font-size: 11px; opacity: .75; font-weight: 500; }
.flip-back {
  background: var(--card); border: 2px solid var(--mustard);
  transform: rotateY(180deg); font-weight: 600;
}
.flip-tools { display: flex; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }

/* ---------- One-liner revision list ---------- */
ul.oneliners { list-style: none; padding: 0; counter-reset: pt; }
ul.oneliners li {
  counter-increment: pt;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 46px;
  margin: 8px 0;
  position: relative; font-size: 15.5px;
}
ul.oneliners li::before {
  content: counter(pt);
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--mustard); color: #3d2a00;
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
}

/* ---------- Quiz ---------- */
.quiz-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--green-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 6px 0 16px;
  font-weight: 700; font-size: 15px;
}
.quiz-meta .score-pill {
  background: var(--green-mid); color: #fff;
  border-radius: 99px; padding: 4px 14px;
}
.mcq {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.mcq .q-tag {
  display: inline-block; font-size: 11.5px; font-weight: 800;
  letter-spacing: .5px; text-transform: uppercase;
  border-radius: 99px; padding: 3px 10px; margin-bottom: 8px;
}
.q-tag.pyq { background: var(--ochre); color: #fff; }
.q-tag.practice { background: var(--green-soft); color: var(--green-mid); }
[data-theme="dark"] .q-tag.practice { color: var(--mustard); }
.mcq .q-text { font-weight: 700; font-size: 16px; margin: 0 0 12px; }
.mcq .opts { display: grid; gap: 8px; }
.mcq .opt {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: left;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--cream); color: var(--ink);
  padding: 11px 13px; font-size: 15px; font-family: var(--font);
  cursor: pointer; min-height: 46px;
  transition: border-color .15s, background .15s;
}
.mcq .opt:hover { border-color: var(--mustard); }
.mcq .opt .k {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--ink-soft);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}
.mcq .opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.mcq .opt.correct .k { border-color: var(--ok); background: var(--ok); color: #fff; }
.mcq .opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.mcq .opt.wrong .k { border-color: var(--danger); background: var(--danger); color: #fff; }
.mcq .opt:disabled { cursor: default; opacity: 1; }
.mcq .explain {
  display: none;
  margin-top: 11px; padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--mustard-soft);
  border-left: 4px solid var(--mustard);
  font-size: 14.5px;
}
.mcq.answered .explain, .mcq.revealed .explain { display: block; }
.mcq .show-ans {
  margin-top: 10px; background: none; border: none;
  color: var(--green-mid); font-weight: 700; font-size: 13.5px;
  cursor: pointer; text-decoration: underline; padding: 6px 2px;
  font-family: var(--font);
}
[data-theme="dark"] .mcq .show-ans { color: var(--mustard); }

/* ---------- Figures / images / placeholders ---------- */
figure.gk-fig {
  margin: 18px 0; padding: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
figure.gk-fig figcaption { font-size: 13.5px; color: var(--ink-soft); margin-top: 9px; }
.img-placeholder {
  border: 2px dashed var(--ochre);
  background: repeating-linear-gradient(45deg, var(--mustard-soft) 0 14px, var(--cream) 14px 28px);
  border-radius: var(--radius-sm);
  padding: 30px 16px;
  color: var(--ink-soft);
  font-size: 14px;
}
.img-placeholder .ph-ico { font-size: 30px; display: block; margin-bottom: 6px; }
.img-placeholder .ph-search { font-size: 12.5px; font-style: italic; }

/* Real chapter photo (shown when the image file exists in /images) */
.gk-img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--cream);
}
/* Graceful fallback shown only if the image file is missing (onerror) */
.img-fallback {
  display: none; /* toggled to flex by onerror */
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px dashed var(--ochre);
  background: repeating-linear-gradient(45deg, var(--mustard-soft) 0 14px, var(--cream) 14px 28px);
  border-radius: var(--radius-sm);
  padding: 26px 16px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.img-fallback .ph-ico { font-size: 30px; }
.img-fallback code {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12.5px;
}

/* ---------- Chapter footer nav + complete ---------- */
.chapter-footer {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-top: 26px; padding: 18px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chapter-footer .grow { flex: 1; }
.complete-btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- Hub (index) cards ---------- */
.hub-wrap { max-width: 1120px; margin: 0 auto; padding: 24px 14px 60px; }
.hub-stats {
  display: flex; gap: 12px; flex-wrap: wrap; margin: -34px auto 26px;
  position: relative; z-index: 2; max-width: 1120px; padding: 0 14px;
}
.stat-card {
  flex: 1; min-width: 150px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
}
.stat-card .n { font-size: 26px; font-weight: 900; color: var(--green-mid); }
[data-theme="dark"] .stat-card .n { color: var(--mustard); }
.stat-card .l { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px; margin-top: 16px;
}
.ch-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex; gap: 13px; align-items: flex-start;
  text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
a.ch-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--mustard); }
.ch-card .n-badge {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 17px;
  background: var(--green-soft); color: var(--green-mid);
}
[data-theme="dark"] .ch-card .n-badge { color: var(--mustard); }
.ch-card.built .n-badge { background: var(--mustard); color: #3d2a00; }
.ch-card h3 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.3; }
.ch-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.ch-card .pill {
  position: absolute; top: 10px; right: 12px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 99px; text-transform: uppercase;
}
.pill.ready { background: var(--ok-soft); color: var(--ok); }
.pill.soon { background: var(--line); color: var(--ink-soft); }
.pill.done-pill { background: var(--green-mid); color: #fff; }
.ch-card.soon-card { opacity: .72; }

.hub-section-title { margin: 30px 0 4px; font-size: 21px; color: var(--green-mid); }
[data-theme="dark"] .hub-section-title { color: var(--mustard); }

.facts-strip {
  background: var(--card); border: 1.5px solid var(--line);
  border-left: 6px solid var(--green-mid);
  border-radius: var(--radius); padding: 14px 18px; margin-top: 26px;
  font-size: 14.5px; box-shadow: var(--shadow);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; padding: 26px 14px 34px;
  color: var(--ink-soft); font-size: 13.5px;
  border-top: 2px solid var(--line); margin-top: 30px;
}

/* ---------- Utility ---------- */
.hidden-by-search { display: none !important; }
.small-note { font-size: 13px; color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding-top: 14px; }
  .sidebar {
    position: static; max-height: none; order: -1;
  }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .sidebar nav a { border-left: none; border: 1.5px solid var(--line); padding: 8px 12px; font-size: 13.5px; }
  .sidebar nav a.active { border-color: var(--green-mid); }
  body { font-size: 16px; }
  .flip-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .hub-stats { margin-top: -26px; }
}
@media (max-width: 460px) {
  .chapter-titlebar { flex-direction: column; align-items: flex-start; }
  .flip-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- free sample banner + locked links ---- */
.sample-banner{ background:linear-gradient(90deg,#0f4d34,#1c6f4a); color:#fff; border-radius:12px; padding:12px 16px; margin:0 0 16px; font-size:14.5px; display:flex; flex-wrap:wrap; align-items:center; gap:10px; box-shadow:0 4px 14px rgba(15,77,52,.25); }
.sample-banner b{ color:#f0c85a; }
.sb-btn{ margin-left:auto; background:#f0c85a; color:#0f4d34 !important; font-weight:800; padding:7px 16px; border-radius:30px; text-decoration:none; white-space:nowrap; }
.sidebar a.locked{ opacity:.6; }
