/* =========================================================
   SMART TEACHER TOOLS — global styles
   Palette: white · green · yellow · orange
   ========================================================= */
:root {
  /* Base */
  --white: #FFFFFF;
  --off-white: #FAFBF7;

  /* Green — primary brand */
  --green: #1E9E5A;
  --green-dark: #13733F;
  --green-light: #E6F6EC;

  /* Yellow — highlights */
  --yellow: #FFC928;
  --yellow-dark: #E5AE00;
  --yellow-light: #FFF6D6;

  /* Orange — actions */
  --orange: #FF8A1F;
  --orange-dark: #E0700A;
  --orange-light: #FFEEDD;

  /* Text + lines */
  --text: #1F2A22;
  --text-muted: #5B6B60;
  --line: #E3E9E2;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(31, 42, 34, .06), 0 2px 8px rgba(31, 42, 34, .05);
  --shadow: 0 2px 4px rgba(31, 42, 34, .05), 0 10px 28px rgba(31, 42, 34, .08);
  --shadow-lg: 0 6px 12px rgba(31, 42, 34, .06), 0 22px 48px rgba(31, 42, 34, .12);

  --font: "Segoe UI", "Nunito", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--green-dark); }
kbd {
  font: inherit; font-size: .85em; font-weight: 700;
  background: var(--off-white); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 0 .4em;
}
.muted { color: var(--text-muted); }
.lead { font-size: 1.2rem; color: var(--text-muted); }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .container { padding: 0 16px; } body { font-size: 17px; } }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--green); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header::after { /* thin tri-colour brand stripe */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(90deg, var(--green) 0 60%, var(--yellow) 60% 80%, var(--orange) 80% 100%);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo__mark { width: 40px; height: 40px; flex: none; }
.logo__text { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.logo__text b { color: var(--green); }
.header__actions { display: flex; align-items: center; gap: 10px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none;
  color: var(--green-dark); padding: 8px 12px; border-radius: 999px;
}
.back-link:hover { background: var(--green-light); }
.back-link[hidden] { display: none; }
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .logo__text { font-size: 1.02rem; }
  .header__actions [data-classroom-toggle] { display: none; } /* classroom mode is for projectors */
  .back-link { padding: 8px 6px; }
}

/* ---------- breadcrumbs ---------- */
.breadcrumbs { font-size: .95rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 14px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumbs li { display: flex; align-items: center; gap: 4px; color: var(--text-muted); }
.breadcrumbs li + li::before { content: "›"; color: var(--yellow-dark); font-weight: 800; margin-right: 2px; }
.breadcrumbs a { color: var(--green-dark); text-decoration: none; font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 700; }
.breadcrumbs:empty { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; line-height: 1.1; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 999px;
  padding: 12px 22px; min-height: 48px;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background-color .15s, border-color .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--orange { background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-dark); }
.btn--orange:hover { background: var(--orange-dark); box-shadow: 0 6px 0 #b85a05; }
.btn--green { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn--green:hover { background: var(--green-dark); box-shadow: 0 6px 0 #0c5530; }
.btn--yellow { background: var(--yellow); color: var(--text); box-shadow: 0 4px 0 var(--yellow-dark); }
.btn--outline { background: var(--white); color: var(--green-dark); border-color: var(--green); }
.btn--outline:hover { background: var(--green-light); }
.btn--ghost { background: var(--green-light); color: var(--green-dark); }
.btn--ghost:hover { background: #d4efdf; }
.btn--ghost[aria-pressed="true"] { background: var(--green); color: #fff; }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: .95rem; }
.btn--lg { min-height: 56px; padding: 14px 26px; font-size: 1.1rem; }
.btn--xl { min-height: 68px; padding: 18px 40px; font-size: 1.35rem; }
.btn--block { width: 100%; }

/* ---------- badges, chips, cards ---------- */
.badge {
  display: inline-block; font-size: .85rem; font-weight: 800; letter-spacing: .02em;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 12px;
}
.badge--green { background: var(--green-light); color: var(--green-dark); }
.badge--yellow { background: var(--yellow); color: var(--text); }
.badge--orange { background: var(--orange-light); color: var(--orange-dark); }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.chip {
  font: inherit; font-weight: 800; cursor: pointer;
  min-width: 64px; min-height: 52px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--white); color: var(--text);
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--green); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- sections ---------- */
.section { padding: 36px 0; }
.section--tight { padding-top: 0; }
.section__title { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.section__title::before {
  content: ""; width: 10px; height: 30px; border-radius: 6px;
  background: linear-gradient(var(--yellow), var(--orange));
}
.page { padding-bottom: 48px; }

/* ---------- notices + loading ---------- */
.notice {
  text-align: center; padding: 48px 24px; margin: 24px 0;
  background: var(--off-white); border: 2px dashed var(--line); border-radius: var(--radius-lg);
}
.notice__icon { font-size: 3rem; margin-bottom: 8px; }
.notice__text { font-size: 1.25rem; font-weight: 700; max-width: 560px; margin: 0 auto 20px; }
.loading { padding: 80px 0; text-align: center; color: var(--text-muted); font-weight: 700; }

/* ---------- images ---------- */
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, var(--green-light) 0 12px, #eef9f2 12px 24px);
  color: var(--green); width: 100%; height: 100%; min-height: 120px;
}

/* ---------- footer ---------- */
.site-footer { background: var(--off-white); border-top: 1px solid var(--line); padding: 26px 0; margin-top: 24px; font-size: .95rem; }
.footer__inner p { margin: 0 0 4px; }

/* ---------- entrance animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
[style*="--i"] { animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i) * 60ms); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- classroom mode (shared bits) ---------- */
.classroom-exit {
  display: none; position: fixed; top: 12px; right: 12px; z-index: 50;
  font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
  background: var(--white); color: var(--text); border: 2px solid var(--line);
  border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow-sm); opacity: .75;
}
.classroom-exit:hover { opacity: 1; }
body.classroom .classroom-exit { display: block; }
body.classroom .site-header,
body.classroom .site-footer,
body.classroom .breadcrumbs { display: none; }

/* ---------- v3 additions ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mainnav { display: flex; align-items: center; gap: 4px; }
.mainnav .header__link { font-weight: 700; text-decoration: none; color: var(--green-dark); padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.mainnav .header__link:hover { background: var(--yellow-light); }
.mainnav .header__link[aria-current="page"] { background: var(--green-light); }
.btn--disabled { background: var(--off-white); color: var(--text-muted); border: 2px dashed var(--line); cursor: default; }
.btn--disabled:hover { transform: none; }
.chip--sm { min-height: 40px; min-width: 48px; padding: 6px 12px; font-size: .95rem; border-radius: 12px; }
.img-placeholder__emoji { font-size: 4rem; filter: saturate(1.2); }
kbd { white-space: nowrap; }
@media (max-width: 560px) {
  .mainnav .header__link { padding: 8px 8px; }
  .header__actions [data-classroom-toggle] { display: none; }
}
@media (max-width: 560px) {
  .logo__text { display: none; }
  .header__actions { gap: 2px; }
  .back-link { padding: 8px 4px; }
}
/* tablets in portrait: keep the menu on one line (icons only) */
@media (max-width: 960px) {
  .header__actions .hide-sm { display: none; }
  .header__actions { gap: 4px; }
}

/* =========================================================
   v6 — main navigation (sticky; hidden in Classroom mode)
   Home · Common Core · 1st Bac · 2nd Bac · Worksheets ▾ · Premium Resources
   ========================================================= */
.site-header { position: sticky; top: 0; z-index: 40; }
.header__inner { gap: 10px; }
.mainnav { flex: 1 1 auto; justify-content: center; flex-wrap: nowrap; }
.mainnav .header__link { font-size: .98rem; }
.header__link--premium { color: var(--orange-dark) !important; }
.header__link--premium:hover { background: var(--orange-light) !important; }
.navdrop { position: relative; }
.navdrop__menu {
  position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); z-index: 50; min-width: 190px;
  display: none; flex-direction: column; padding: 8px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.navdrop__menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.navdrop:hover .navdrop__menu, .navdrop:focus-within .navdrop__menu { display: flex; }
.navdrop__menu a { padding: 9px 14px; border-radius: 10px; font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
.navdrop__menu a:hover { background: var(--green-light); color: var(--green-dark); }
.menu-toggle { display: none; font: inherit; font-size: 1.35rem; font-weight: 900; width: 46px; height: 46px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--white); color: var(--green-dark); cursor: pointer; flex: none; }
.menu-toggle:hover { border-color: var(--green); }
body.classroom .site-header { display: none !important; }

@media (max-width: 1240px) {
  .menu-toggle { display: grid; place-items: center; }
  .mainnav { display: none; }
  body.nav-open .mainnav {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; left: 0; right: 0; top: 100%; padding: 10px 16px 16px;
    background: var(--white); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
  }
  body.nav-open .mainnav .header__link { padding: 12px 14px; font-size: 1.05rem; }
  .navdrop__menu { position: static; transform: none; display: flex; box-shadow: none; border: 0; padding: 0 0 0 18px; min-width: 0; }
  .header__actions { margin-left: auto; }
}
@media (max-width: 560px) {
  .header__actions [data-classroom-toggle] { display: none; }
}
/* wide screens: the breadcrumbs already show the way back */
@media (min-width: 1241px) { .header__actions .back-link { display: none; } }
@media (max-width: 1500px) and (min-width: 1241px) {
  .header__actions [data-classroom-toggle] .hide-sm { display: none; }
  .mainnav .header__link { padding: 8px 10px; }
}
[data-classroom-toggle] { white-space: nowrap; }
