/* BrightStudy — academic design system */
:root {
  --ink: #1c2430;
  --ink-soft: #45506b;
  --paper: #f7f4ec;
  --paper-2: #fffdf8;
  --navy: #1d3557;
  --navy-2: #16304f;
  --teal: #2a9d8f;
  --gold: #e9c46a;
  --rust: #e76f51;
  --line: #ddd6c7;
  --shadow: 0 6px 24px rgba(29, 53, 87, .10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
}
h1, h2, h3, h4 { font-family: "Lora", Georgia, serif; line-height: 1.2; color: var(--navy); }
img { max-width: 100%; }
a { color: var(--navy); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 99; border-radius: 8px; }

/* ---------- nav ---------- */
.site-nav { background: var(--navy); color: #f3eee8; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.nav-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 11px; color: #f3eee8; text-decoration: none; font-weight: 800; font-size: 1.15rem; }
.brand small { display: block; font-weight: 500; font-size: .68rem; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.brand .logo { width: 42px; height: 42px; flex: none; }
.nav-toggle { margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; font-size: 1.2rem; border-radius: 8px; padding: 4px 12px; display: none; cursor: pointer; }
.nav-links { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a { color: #e8e2d4; text-decoration: none; padding: 7px 13px; border-radius: 8px; font-size: .93rem; font-weight: 600; }
.nav-links a:hover { background: rgba(255,255,255,.12); }
.nav-links a.active { background: var(--teal); color: #fff; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; padding: 8px 0 14px; }
  .nav-links.open { display: flex; }
  .nav-inner { flex-wrap: wrap; }
}

/* ---------- hero ---------- */
.hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #27496d 100%); color: #f3eee8; padding: 70px 0 60px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 82% 20%, rgba(233,196,106,.16), transparent 45%); pointer-events: none; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.2rem); margin: 0 0 14px; }
.hero p.lede { font-size: 1.13rem; max-width: 640px; color: #d9d4c6; margin: 0 0 26px; }
.hero .accent { color: var(--gold); }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .75rem; font-weight: 700; color: var(--teal); margin-bottom: 10px; }
.hero .eyebrow { color: var(--gold); }

/* ---------- buttons ---------- */
.btn { display: inline-block; background: var(--teal); color: #fff; border: none; padding: 11px 22px; border-radius: 10px; font-weight: 700; text-decoration: none; cursor: pointer; font-size: .95rem; font-family: inherit; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(42,157,143,.35); }
.btn.ghost { background: transparent; border: 2px solid rgba(255,255,255,.55); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.small { padding: 7px 14px; font-size: .85rem; }
.btn.alt { background: var(--navy); }

/* ---------- sections & cards ---------- */
.section { padding: 58px 0; }
.section.tinted { background: var(--paper-2); border-block: 1px solid var(--line); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head h2 { font-size: 2rem; margin: 0 0 10px; }
.section-head p { color: var(--ink-soft); margin: 0; }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card p { color: var(--ink-soft); }
.card-link { display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.card-link:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(29,53,87,.16); }
.card-icon { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; font-size: 1.35rem; margin-bottom: 14px; background: #eef4f2; }
.tag { display: inline-block; background: #eef4f2; color: var(--navy); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; margin-bottom: 10px; }

/* ---------- lesson blocks ---------- */
.lesson { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; overflow: hidden; }
.lesson summary { cursor: pointer; padding: 18px 24px; font-weight: 700; font-family: "Lora", serif; font-size: 1.15rem; color: var(--navy); list-style: none; display: flex; align-items: center; gap: 12px; }
.lesson summary::before { content: "+"; font-family: "Inter", sans-serif; font-weight: 800; color: var(--teal); font-size: 1.3rem; width: 22px; }
.lesson[open] summary::before { content: "–"; }
.lesson-body { padding: 0 24px 24px 58px; }
.lesson-body h4 { margin: 18px 0 6px; }
.example { background: #f4f8f7; border-left: 4px solid var(--teal); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.formula { font-family: "Cambria Math", Georgia, serif; font-size: 1.1rem; background: #fdf6e3; border: 1px solid #ecd9a0; padding: 10px 16px; border-radius: 8px; display: inline-block; margin: 8px 0; }
.keypoint { background: #fbf0ea; border-left: 4px solid var(--rust); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 12px 0; }

/* ---------- tools / widgets ---------- */
.widget { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 26px; }
.widget h3 { margin-top: 0; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
input[type=text], input[type=number], select, textarea {
  font-family: inherit; font-size: 1rem; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); color: var(--ink); min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.result { margin-top: 14px; font-weight: 700; color: var(--navy); min-height: 1.4em; }
.result .sub { display: block; font-weight: 500; font-size: .85rem; color: var(--ink-soft); }

/* calculator */
.calc { max-width: 340px; }
.calc-display { width: 100%; font-size: 1.5rem; text-align: right; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: #f8f6ef; font-family: "Consolas", monospace; margin-bottom: 10px; min-height: 56px; overflow-x: auto; white-space: nowrap; }
.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.calc-grid button { font-family: inherit; font-size: .95rem; font-weight: 600; padding: 12px 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.calc-grid button:hover { background: #f0ede2; }
.calc-grid button.op { background: #eef4f2; color: var(--navy); }
.calc-grid button.eq { background: var(--teal); color: #fff; grid-column: span 2; }
.calc-grid button.clr { background: #fbe9e4; color: var(--rust); }

/* periodic table */
.ptable { display: grid; grid-template-columns: repeat(18, minmax(34px, 1fr)); gap: 3px; font-size: .6rem; overflow-x: auto; }
.pt { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; padding: 1px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: inherit; min-width: 34px; }
.pt .num { font-size: .55em; opacity: .7; }
.pt .sym { font-weight: 800; font-size: 1.5em; color: var(--navy); }
.pt:hover { outline: 2px solid var(--teal); }
.pt.spacer { visibility: hidden; }
.pt.cat-alkali { background: #ffd9c7; } .pt.cat-alkaline { background: #ffeec7; }
.pt.cat-transition { background: #d6e6f5; } .pt.cat-post { background: #d9ead3; }
.pt.cat-metalloid { background: #cfe8df; } .pt.cat-nonmetal { background: #d3f0ea; }
.pt.cat-halogen { background: #e3d9f0; } .pt.cat-noble { background: #e6d3ec; }
.pt.cat-lanth { background: #f5d9e0; } .pt.cat-act { background: #f0d9e8; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0; font-size: .8rem; }
.pt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pt-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.element-detail { background: #f4f8f7; border-radius: 10px; padding: 16px 20px; margin-top: 16px; }
.element-detail h4 { margin: 0 0 6px; font-size: 1.3rem; }
.element-detail dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 18px; margin: 0; }
.element-detail dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 700; }
.element-detail dd { margin: 0 0 6px; font-weight: 600; }

/* flashcards */
.flashcard { perspective: 900px; max-width: 460px; margin: 0 auto; cursor: pointer; }
.flashcard-inner { position: relative; min-height: 230px; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; padding: 26px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 1.25rem; text-align: center; background: #fff; box-shadow: var(--shadow); }
.flash-face.back { transform: rotateY(180deg); background: var(--navy); color: #f3eee8; }
.flash-controls { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.flash-progress { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-top: 10px; }

/* quiz */
.quiz-opt { display: block; width: 100%; text-align: left; padding: 12px 16px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-family: inherit; font-size: 1rem; }
.quiz-opt:hover { border-color: var(--teal); background: #f4faf9; }
.quiz-opt.correct { background: #dff3e4; border-color: #58b06e; }
.quiz-opt.wrong { background: #fbe4dd; border-color: var(--rust); }
.quiz-opt:disabled { cursor: default; }
.quiz-bar { height: 8px; background: #ece7d8; border-radius: 99px; overflow: hidden; margin: 14px 0; }
.quiz-bar i { display: block; height: 100%; background: var(--teal); transition: width .3s; }
.quiz-explain { background: #f4f8f7; border-left: 4px solid var(--teal); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: .92rem; }

/* timeline */
.timeline { position: relative; margin: 30px 0; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 3px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: 20px; }
.tl-item::before { content: ""; position: absolute; left: -29px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--teal); border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--teal); }
.tl-year { font-weight: 800; color: var(--rust); font-family: "Lora", serif; }
.tl-item h4 { margin: 2px 0 4px; }
.tl-item p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* tables */
table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
table.data th { background: #f0ede2; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); }
table.data tr:hover td { background: #faf7ef; }

/* pomodoro */
.pomo { text-align: center; }
.pomo-time { font-family: "Lora", serif; font-size: 4rem; font-weight: 700; color: var(--navy); margin: 10px 0; font-variant-numeric: tabular-nums; }
.pomo-mode { display: inline-block; margin-bottom: 8px; }

/* misc */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.stat-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; text-align: center; }
@media (max-width: 700px) { .stat-band { grid-template-columns: repeat(2, 1fr); } }
.stat-band .num { font-family: "Lora", serif; font-size: 2.2rem; font-weight: 700; color: var(--teal); }
.stat-band .lbl { font-size: .85rem; color: var(--ink-soft); }
.fact-box { background: var(--navy); color: #e8e2d4; border-radius: var(--radius); padding: 26px 30px; font-size: 1.1rem; }
.fact-box strong { color: var(--gold); display: block; font-size: .8rem; letter-spacing: .15em; text-transform: uppercase; margin-bottom: 8px; }
.footer { background: var(--navy-2); color: #b9b2a2; padding: 40px 0 30px; margin-top: 60px; font-size: .9rem; }
.footer a { color: #d9d4c6; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; margin-bottom: 26px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h4 { color: #fff; margin-top: 0; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 7px; }
.footer .fine { border-top: 1px solid rgba(255,255,255,.14); padding-top: 18px; font-size: .8rem; }
.notice { background: #fdf6e3; border: 1px solid #ecd9a0; padding: 14px 18px; border-radius: 10px; margin: 16px 0; font-size: .92rem; }
.word-list { columns: 2; gap: 30px; }
@media (max-width: 600px) { .word-list { columns: 1; } }
.word-list li { break-inside: avoid; margin-bottom: 10px; }
.word-list b { color: var(--navy); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill-row button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 14px; cursor: pointer; font-family: inherit; font-size: .85rem; font-weight: 600; }
.pill-row button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* images */
.card-img { width: 100%; height: 130px; object-fit: cover; border-radius: 9px; margin-bottom: 12px; border: 1px solid var(--line); }
.lesson-fig { float: right; width: 240px; max-width: 45%; margin: 0 0 14px 18px; }
.lesson-fig img { width: 100%; border-radius: 9px; border: 1px solid var(--line); }
.lesson-fig figcaption { font-size: .75rem; color: var(--ink-soft); margin-top: 5px; line-height: 1.4; }
.page-fig { margin: 18px 0 26px; }
.page-fig img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.page-fig figcaption { font-size: .8rem; color: var(--ink-soft); margin-top: 6px; }
.lesson-body::after { content: ""; display: table; clear: both; }
.diagram { max-width: 280px; display: block; margin: 12px 0; }
