/* ===========================================================
   portal.css — self-contained styling for the CBSE portal pages
   (index.html, classes.html, experiment.html). Dark scientific
   theme, responsive cards, smooth animations.
   =========================================================== */

:root {
  --bg:        #0c1118;
  --bg-2:      #10151d;
  --panel:     #171d28;
  --card:      #1b2434;
  --card-2:    #222c3c;
  --card-hover:#27344b;
  --border:    #28324360;
  --border-2:  #34425a;
  --accent:    #2196f3;
  --accent-2:  #64b5f6;
  --accent-dim:#1565c0;
  --text:      #e7edf5;
  --text-dim:  #9aa7b8;
  --text-mute: #69748699;
  --good:      #4caf50;
  --warn:      #ffb300;
  --danger:    #ef5350;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 34px rgba(0,0,0,.45);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.3);
  --maxw:      1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Display", Roboto, system-ui, sans-serif;
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(33,150,243,.12), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(124,77,255,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); background-clip: padding-box; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------- Top nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12,17,24,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  height: 62px; padding: 0 22px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.brand .logo { font-size: 24px; filter: drop-shadow(0 0 8px rgba(33,150,243,.6)); }
.brand .accent { background: linear-gradient(90deg, var(--accent-2), #fff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-spacer { flex: 1 1 auto; }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 14px; border-radius: 9px; font-size: 14px; color: var(--text-dim); font-weight: 500; transition: .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--card); }
.breadcrumb { font-size: 13px; color: var(--text-mute); display: flex; align-items: center; gap: 7px; }
.breadcrumb a:hover { color: var(--accent-2); }
.breadcrumb .sep { opacity: .5; }

/* ---------------- Hero ---------------- */
.hero { padding: 56px 0 30px; text-align: center; }
.hero h1 { font-size: 42px; margin: 0 0 12px; line-height: 1.1; letter-spacing: -.5px; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent-2), #b388ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 16px; color: var(--text-dim); max-width: 640px; margin: 0 auto 26px; line-height: 1.6; }
.hero-stats { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.hero-stat { text-align: center; }
.hero-stat b { display: block; font-size: 26px; color: var(--accent-2); }
.hero-stat span { font-size: 12.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .6px; }

/* ---------------- Search ---------------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 6px 8px 6px 18px;
  box-shadow: var(--shadow-sm);
}
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(33,150,243,.16); }
.searchbar .ic { font-size: 17px; color: var(--text-mute); }
.searchbar input { flex: 1 1 auto; background: none; border: none; outline: none; color: var(--text); font-size: 15px; padding: 9px 0; }
.searchbar input::placeholder { color: var(--text-mute); }
.searchbar .clear { width: 30px; height: 30px; border-radius: 50%; color: var(--text-mute); font-size: 16px; }
.searchbar .clear:hover { background: var(--card-2); color: var(--text); }

.search-results { max-width: 760px; margin: 14px auto 0; }
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border); margin-bottom: 8px;
  transition: .15s;
}
.sr-item:hover { background: var(--card-hover); transform: translateX(3px); }
.sr-emoji { font-size: 22px; }
.sr-meta { flex: 1 1 auto; }
.sr-title { font-size: 14px; font-weight: 600; }
.sr-sub { font-size: 12px; color: var(--text-mute); }
.sr-tag { font-size: 11px; padding: 2px 9px; border-radius: 20px; background: var(--card-2); color: var(--text-dim); }

/* ---------------- Section heading ---------------- */
.section { padding: 30px 0 50px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 24px; margin: 0; }
.section-head p { margin: 4px 0 0; font-size: 14px; color: var(--text-mute); }

/* ---------------- Class cards ---------------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.class-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: .2s; cursor: pointer;
  animation: rise .4s ease both;
}
.class-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow); }
.class-card .glow { position: absolute; top: -40px; right: -40px; width: 140px; height: 140px; border-radius: 50%; opacity: .22; filter: blur(8px); }
.class-card .cc-icon { font-size: 38px; margin-bottom: 14px; }
.class-card h3 { margin: 0 0 6px; font-size: 21px; }
.class-card .cc-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; min-height: 60px; }
.class-card .cc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.class-card .cc-count { font-size: 12.5px; color: var(--text-mute); }
.class-card .cc-count b { color: var(--accent-2); font-size: 15px; }
.cc-open {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  transition: .15s;
}
.class-card:hover .cc-open { box-shadow: 0 4px 14px rgba(33,150,243,.45); }

/* ---------------- Experiment cards ---------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-chip {
  padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); border: 1px solid var(--border-2); color: var(--text-dim); transition: .15s;
}
.filter-chip:hover { color: var(--text); border-color: var(--accent-dim); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: transparent; }

.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.exp-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: .2s; cursor: pointer; display: flex; flex-direction: column;
  animation: rise .4s ease both;
}
.exp-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow); }
.exp-thumb {
  height: 128px; display: flex; align-items: center; justify-content: center;
  font-size: 54px; position: relative;
}
.exp-thumb .badge-diff {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; padding: 3px 10px; border-radius: 20px;
  background: rgba(0,0,0,.45); color: #fff; font-weight: 600; backdrop-filter: blur(4px);
}
.exp-body { padding: 15px 16px 17px; display: flex; flex-direction: column; flex: 1 1 auto; }
.exp-body h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; }
.exp-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.exp-meta .m { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: var(--card-2); color: var(--text-dim); display: inline-flex; gap: 4px; align-items: center; }
.exp-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.exp-open {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.exp-foot .subj { font-size: 12px; color: var(--text-mute); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-mute); }
.empty-state .big { font-size: 50px; opacity: .4; margin-bottom: 10px; }

/* ---------------- Difficulty colours ---------------- */
.diff-Beginner { color: #6fe09a; }
.diff-Intermediate { color: #ffcf5c; }
.diff-Advanced { color: #ff8a8a; }

/* ===========================================================
   EXPERIMENT DETAILS PAGE
   =========================================================== */
.exp-hero {
  border-radius: var(--radius); overflow: hidden;
  margin: 22px 0 26px; border: 1px solid var(--border);
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
}
.exp-hero-art {
  flex: 0 0 200px; display: flex; align-items: center; justify-content: center; font-size: 84px;
}
.exp-hero-info { flex: 1 1 360px; padding: 24px 26px; background: var(--panel); }
.exp-hero-info h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.15; }
.exp-hero-tags { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.exp-hero-tags .t { font-size: 12.5px; padding: 4px 12px; border-radius: 20px; background: var(--card-2); color: var(--text-dim); display: inline-flex; gap: 5px; align-items: center; }
.exp-hero-aim { font-size: 14.5px; color: var(--text-dim); line-height: 1.6; }
.start-btn {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 18px; padding: 13px 24px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #1769d8); color: #fff;
  font-size: 15px; font-weight: 700; box-shadow: 0 6px 20px rgba(33,150,243,.4);
  transition: .15s;
}
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(33,150,243,.55); }
.start-btn .ic { font-size: 18px; }

.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
@media (max-width: 920px) { .detail-grid { grid-template-columns: 1fr; } }

.panel-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
}
.panel-card h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 9px; }
.panel-card h2 .ic { font-size: 19px; }
.panel-card p { line-height: 1.65; color: var(--text-dim); font-size: 14.5px; margin: 0 0 10px; }
.panel-card ul, .panel-card ol { margin: 0; padding-left: 20px; color: var(--text-dim); }
.panel-card li { line-height: 1.6; font-size: 14px; margin-bottom: 6px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.formula-box, .equation-box {
  font-family: "SF Mono", ui-monospace, monospace; font-size: 14px;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 8px; color: var(--accent-2); overflow-x: auto;
}
.equation-box { color: #b6f0c4; border-left: 3px solid var(--good); }

/* apparatus / chemical card grids */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.mini-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 10px; text-align: center; transition: .15s;
}
.mini-card:hover { border-color: var(--accent-dim); transform: translateY(-3px); }
.mini-card .mc-icon { font-size: 30px; margin-bottom: 6px; }
.mini-card .mc-name { font-size: 12.5px; font-weight: 600; }
.mini-card .mc-sub { font-size: 11px; color: var(--text-mute); margin-top: 3px; }

.chem-card { text-align: left; display: flex; flex-direction: column; gap: 4px; }
.chem-card .cc-top { display: flex; align-items: center; gap: 8px; }
.chem-card .swatch { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(255,255,255,.3); flex: 0 0 auto; }
.chem-card .cc-name { font-size: 13px; font-weight: 600; }
.chem-card .cc-formula { font-family: "SF Mono", monospace; font-size: 12.5px; color: var(--accent-2); }
.chem-card .cc-row { font-size: 11.5px; color: var(--text-mute); }
.hazard { font-size: 11px; padding: 2px 8px; border-radius: 20px; display: inline-block; margin-top: 4px; }
.hazard.low { background: rgba(76,175,80,.16); color: #7fe0a0; }
.hazard.medium { background: rgba(255,179,0,.16); color: #ffcf5c; }
.hazard.high { background: rgba(239,83,80,.16); color: #ff9a9a; }

/* procedure steps */
.proc-step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.proc-step:last-child { border-bottom: none; }
.proc-no {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.proc-content { flex: 1 1 auto; }
.proc-desc { font-size: 14.5px; line-height: 1.55; }
.proc-obs { font-size: 13px; color: var(--good); margin-top: 6px; }
.proc-warn { font-size: 13px; color: var(--warn); margin-top: 4px; }

/* observation table */
.obs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.obs-table th, .obs-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.obs-table th { background: var(--bg-2); color: var(--text-dim); font-weight: 600; }
.obs-table td { color: var(--text-dim); }
.result-block { margin-top: 14px; padding: 12px 16px; border-radius: 8px; background: var(--bg-2); border-left: 3px solid var(--good); font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.result-block.concl { border-left-color: var(--accent); margin-top: 10px; }

/* MCQ + viva */
.mcq { padding: 14px 0; border-bottom: 1px solid var(--border); }
.mcq:last-child { border-bottom: none; }
.mcq-q { font-size: 14.5px; font-weight: 600; margin-bottom: 10px; }
.mcq-q .num { color: var(--accent-2); margin-right: 6px; }
.mcq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .mcq-opts { grid-template-columns: 1fr; } }
.mcq-opt {
  text-align: left; padding: 9px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text-dim);
  font-size: 13.5px; transition: .12s;
}
.mcq-opt:hover { border-color: var(--accent-dim); color: var(--text); }
.mcq-opt.correct { background: rgba(76,175,80,.18); border-color: var(--good); color: #cfeedd; }
.mcq-opt.wrong { background: rgba(239,83,80,.16); border-color: var(--danger); color: #ffd0d0; }
.mcq-opt .key { font-weight: 700; margin-right: 8px; color: var(--accent-2); }

.viva-item { border-bottom: 1px solid var(--border); }
.viva-item:last-child { border-bottom: none; }
.viva-q {
  width: 100%; text-align: left; padding: 13px 0; font-size: 14.5px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.viva-q .chev { color: var(--text-mute); transition: transform .15s; }
.viva-item.open .viva-q .chev { transform: rotate(90deg); }
.viva-a { font-size: 14px; color: var(--text-dim); line-height: 1.6; padding: 0 0 14px; display: none; }
.viva-item.open .viva-a { display: block; }

/* sidebar quick facts */
.facts-card .fact { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.facts-card .fact:last-child { border-bottom: none; }
.facts-card .fact .k { color: var(--text-mute); }
.facts-card .fact .v { color: var(--text); font-weight: 600; text-align: right; }
.sticky { position: sticky; top: 80px; }

.toc { display: flex; flex-direction: column; gap: 2px; }
.toc a { padding: 7px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-dim); }
.toc a:hover { background: var(--card-2); color: var(--text); }

/* footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 26px;
  margin-top: 36px;
  background: linear-gradient(180deg, transparent, rgba(33,150,243,.05));
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 24px;
}
.footer-col { min-width: 240px; }
.footer-brand { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 800; letter-spacing: .3px; }
.footer-brand .logo { font-size: 22px; filter: drop-shadow(0 0 7px rgba(33,150,243,.55)); }
.footer-brand .accent { background: linear-gradient(90deg, var(--accent-2), #fff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.footer-tag { font-size: 13px; color: var(--text-mute); margin-top: 7px; }
.footer-copy { font-size: 13px; color: var(--text-dim); margin-top: 10px; }
.footer-copy b { color: var(--accent-2); }

.footer-contact { max-width: 420px; }
.footer-cta { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; margin-bottom: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.footer-links a { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text); font-weight: 600; }
.footer-links a:hover { color: var(--accent-2); }
.footer-links a .ic { font-size: 15px; }

.footer-social { display: flex; gap: 10px; }
.soc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--card); border: 1px solid var(--border-2);
  transition: .16s; color: var(--text-dim);
}
.soc svg { width: 20px; height: 20px; display: block; }
.soc:hover { transform: translateY(-3px); color: #fff; box-shadow: var(--shadow-sm); }
.soc.yt:hover { background: #ff0033; border-color: #ff0033; }
.soc.ig:hover { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); border-color: transparent; }
.soc.wa:hover { background: #25d366; border-color: #25d366; }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; }
}

/* animations */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* responsive */
@media (max-width: 720px) {
  .hero h1 { font-size: 32px; }
  .nav-links { display: none; }
  .exp-hero-art { flex-basis: 100%; height: 120px; font-size: 64px; }
}
