/* ===========================================================================
   FreshWorksheets unified cross-site chrome (sc-* prefixed).

   The block below (down to "MAIN-SITE ADDITIONS") is a BYTE-IDENTICAL copy of
   the Worksheet Studio's app/layout/site-chrome.css, so the main site's header,
   footer and leaderboard-ad shell render pixel-for-pixel the same as the Studio.
   Source of truth: C:/xampp/htdocs/worksheets_free_studio/app/layout/site-chrome.css
   Do not diverge the shared core; main-site-only rules live in the ADDITIONS
   section at the very bottom (text brand, green Studio pill, subject mega-menus,
   mobile hamburger reveal, and the Main-Home hero + category tiles).
   =========================================================================== */

/* Runtime site-chrome styles (sc-* prefixed) for the unified cross-site design.
   Implements the "Studio Home / Worksheet Page" surfaces of cross-site-mockup.html.
   These selectors override catalog.css's generic header{}, nav{}, .brand{}, footer{}
   via higher specificity ([data-site-chrome] / .sc-* classes). catalog.css is NOT
   touched. The leaderboard ad slot is filled by house-ads.js. */

:root {
  --sc-green: #177a4f;
  --sc-green-700: #12643f;
  --sc-green-800: #0e4e31;
  --sc-green-050: #e9f6ef;
  --sc-green-100: #d4ebe0;
  --sc-orange: #e8743b;
  --sc-orange-050: #fdeee3;
  --sc-ink: #13241c;
  --sc-muted: #5d6f66;
  --sc-line: #e4ece8;
  --sc-font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* Hide a chrome placeholder that is still truly empty (builder emitted no static
   fallback and JS has not filled it yet) so no blank bar flashes. A placeholder
   carrying fallback links is NOT :empty, so it still shows if JS fails. */
header[data-site-chrome]:empty,
footer[data-site-chrome]:empty,
[data-site-chrome="xsite"]:empty { display: none; }

/* ===== HEADER shell — neutralize catalog.css header{} ===== */
header[data-site-chrome] {
  display: block;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 20;
  font-family: var(--sc-font);
  -webkit-font-smoothing: antialiased;
}

/* ---- utility bar ---- */
.sc-util { background: var(--sc-green-800); color: #d4efe2; font-size: 12.5px; font-weight: 600; }
.sc-util-in {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 16px; min-height: 36px; flex-wrap: wrap;
}
.sc-util .sc-chip { white-space: nowrap; }
.sc-util-right { margin-left: auto; display: flex; gap: 18px; }
.sc-util a { text-decoration: none; color: #eafaf2; opacity: .92; }
.sc-util a:hover { opacity: 1; text-decoration: underline; }

/* ---- header row ---- */
.sc-headband { background: #fff; border-bottom: 1px solid var(--sc-line); }
.sc-head {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 14px; min-height: 76px; flex-wrap: nowrap;
}
.sc-brand { display: flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.sc-brand img { height: 40px; width: auto; display: block; }

/* ---- subject nav ---- */
.sc-nav { display: flex; align-items: center; gap: 1px; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; }
.sc-navlink {
  text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--sc-ink);
  padding: 9px 10px; border-radius: 9px; white-space: nowrap; cursor: pointer;
}
.sc-navlink:hover { background: var(--sc-green-050); color: var(--sc-green-700); }
.sc-navlink.current { background: var(--sc-green-050); color: var(--sc-green-700); font-weight: 800; }

/* ---- "More" dropdown (native <details>) ---- */
.sc-more { position: relative; }
.sc-more > summary { list-style: none; display: inline-flex; align-items: center; }
.sc-more > summary::-webkit-details-marker { display: none; }
.sc-more-sum::after { content: " \25BE"; color: #9fb3aa; font-size: 10px; margin-left: 3px; }
.sc-more[open] > summary { background: var(--sc-green-050); color: var(--sc-green-700); }
.sc-more-panel {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 214px;
  background: #fff; border: 1px solid var(--sc-line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(14, 78, 49, .16); padding: 8px;
  display: flex; flex-direction: column; gap: 2px; z-index: 40;
}
.sc-more-panel .sc-navlink { display: block; }

/* ---- divider + Printables cross-link ---- */
.sc-nav-div { align-self: stretch; width: 1px; background: var(--sc-line); margin: 10px 7px; }
.sc-printables {
  text-decoration: none; color: #b4521f; background: var(--sc-orange-050);
  font-weight: 700; font-size: 14.5px; padding: 9px 13px; border-radius: 999px;
  border: 1px solid #f6d6c3; white-space: nowrap;
}
.sc-printables:hover { background: #fbe0d1; color: #9a4417; }

/* ---- search + CTA ---- */
.sc-search {
  margin-left: auto; width: 42px; height: 42px; border-radius: 50%;
  background: #f3f7f5; border: 1px solid var(--sc-line);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; text-decoration: none; color: var(--sc-muted); flex: 0 0 auto;
}
.sc-search:hover { background: var(--sc-green-050); border-color: var(--sc-green-100); }
.sc-cta {
  background: var(--sc-green); color: #fff; text-decoration: none;
  font-weight: 800; font-size: 15px; padding: 12px 18px; border-radius: 11px;
  white-space: nowrap; box-shadow: 0 6px 16px rgba(23, 122, 79, .28); flex: 0 0 auto;
}
.sc-cta:hover { background: var(--sc-green-700); }

/* ===== cross-site leaderboard house-ad ===== */
[data-site-chrome="xsite"] { display: block; margin: 0; padding: 0; border: 0; }
.sc-adwrap { max-width: 1200px; margin: 0 auto; padding: 14px 24px 2px; font-family: var(--sc-font); }
.sc-adlabel {
  font-size: 9.5px; letter-spacing: 1.6px; color: #a9b8b1; font-weight: 800;
  text-align: center; margin-bottom: 6px;
}
/* the .houad leaderboard brings its own max-width:1200/margin:auto from house-ads.css */

/* ===== FOOTER — override catalog.css footer{} ===== */
footer[data-site-chrome] {
  background: #0d1b14; color: #9fc3b2; border: 0;
  margin-top: 26px; padding: 0; text-align: left;
  font-family: var(--sc-font); -webkit-font-smoothing: antialiased;
}
.sc-foot { max-width: 1200px; margin: 0 auto; padding: 46px 24px 0; }
.sc-footgrid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.15fr; gap: 36px; padding-bottom: 32px;
}
.sc-footbrand .sc-fb { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sc-mk {
  width: 40px; height: 40px; border-radius: 11px; font-size: 15px;
  background: linear-gradient(145deg, var(--sc-green), var(--sc-green-700));
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.sc-wd { font-size: 20px; font-weight: 800; color: #fff; }
.sc-wd span { color: var(--sc-orange); }
.sc-footbrand p { font-size: 14px; max-width: 300px; line-height: 1.65; color: #8bb3a1; margin: 0; }
.sc-footchips { display: flex; gap: 14px; margin-top: 14px; font-size: 12.5px; color: #7fa893; flex-wrap: wrap; font-weight: 600; }
.sc-footcol b { color: #fff; display: block; margin-bottom: 12px; font-size: 14px; letter-spacing: .3px; }
.sc-footcol a { color: #9fc3b2; text-decoration: none; display: block; font-size: 14px; padding: 4px 0; }
.sc-footcol a:hover { color: #fff; }
.sc-footbar {
  border-top: 1px solid #1d3327; padding: 17px 0; margin-top: 0;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: #6f9583;
}
.sc-footbar a { color: #6f9583; text-decoration: none; }
.sc-footbar a:hover { color: #9fc3b2; }
.sc-attr { margin-left: auto; }

/* ===== responsive ===== */
/* Below ~1180px the full subject row no longer fits beside brand + search + CTA,
   so collapse it (matches the mockup, which hides the nav on narrow screens). */
@media (max-width: 1180px) {
  .sc-nav, .sc-search { display: none; }
}
@media (max-width: 860px) {
  .sc-footgrid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 560px) {
  .sc-util-right { display: none; }
  .sc-head { gap: 10px; }
  .sc-footgrid { grid-template-columns: 1fr; }
  .sc-attr { margin-left: 0; width: 100%; }
}

/* ===== print — hide all injected chrome (catalog.css also hides header/footer) ===== */
@media print {
  header[data-site-chrome],
  footer[data-site-chrome],
  [data-site-chrome="xsite"],
  .sc-adwrap { display: none !important; }
}

/* ===========================================================================
   ░░░ MAIN-SITE ADDITIONS ░░░
   Rules below exist only on the main FreshWorksheets site (not in the Studio
   copy). They DO NOT alter the shared chrome look above — they add the pieces
   the main-site Main-Home surface needs: a text brand, the green "Worksheet
   Studio" pill, the restyled subject/Topics mega-menus, the mobile hamburger
   reveal, and the home hero + category tiles. Namespaced sc-* (chrome) / fwh-*
   (home) to avoid any collision with the legacy style.css classes.
   =========================================================================== */

/* ---- header / footer wrappers (static PHP, not the JS-filled placeholders) ---- */
.sc-site { position: relative; z-index: 40; font-family: var(--sc-font); -webkit-font-smoothing: antialiased; }
.sc-sitefoot {
  background: #0d1b14; color: #9fc3b2; border: 0; margin-top: 26px; padding: 0;
  text-align: left; font-family: var(--sc-font); -webkit-font-smoothing: antialiased;
}
@media print { .sc-site, .sc-sitefoot, .sc-adwrap { display: none !important; } }

/* ---- header: give the band a positioning context for the mobile nav panel ---- */
.sc-headband { position: relative; }

/* ---- text brand (matches the approved mockup's FW mark + wordmark) ---- */
.sc-brand { gap: 11px; }
.sc-bmark {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(145deg, var(--sc-green), var(--sc-green-700));
  color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(18, 100, 63, .25); flex: 0 0 auto;
}
.sc-bword { font-size: 23px; font-weight: 800; letter-spacing: -.4px; color: var(--sc-green); }
.sc-bword span { color: var(--sc-orange); }

/* ---- green "★ Worksheet Studio" cross-link pill ---- */
.sc-studio {
  text-decoration: none; color: var(--sc-green-700); background: var(--sc-green-050);
  font-weight: 700; font-size: 14.5px; padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--sc-green-100); white-space: nowrap; margin-left: 6px;
}
.sc-studio::before { content: "\2605 "; color: var(--sc-orange); }
.sc-studio:hover { background: var(--sc-green-100); color: var(--sc-green-800); }

/* ---- subject / Topics mega-menu (hover + focus, native, no JS needed) ---- */
.sc-navitem { position: relative; display: flex; align-items: center; }
.sc-caret::after { content: " \25BE"; color: #9fb3aa; font-size: 10px; margin-left: 3px; }
.sc-navitem:hover > .sc-navlink,
.sc-navitem:focus-within > .sc-navlink { background: var(--sc-green-050); color: var(--sc-green-700); }
.sc-mega {
  position: absolute; left: 0; top: calc(100% + 8px); display: none; z-index: 60;
  background: #fff; border: 1px solid var(--sc-line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(14, 78, 49, .18); padding: 16px;
}
.sc-mega::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.sc-navitem:hover > .sc-mega, .sc-navitem:focus-within > .sc-mega { display: block; }
.sc-mega-all {
  display: block; font-size: 13px; font-weight: 800; color: var(--sc-green-700);
  text-decoration: none; padding: 4px 8px 10px; border-bottom: 1px solid var(--sc-line); margin-bottom: 8px;
}
.sc-mega-subjects { display: flex; gap: 26px; }
.sc-mega-col { min-width: 148px; }
.sc-mega-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--sc-muted); margin: 0 0 8px; }
.sc-mega-col h4 a { color: var(--sc-green-700); text-decoration: none; font-weight: 800; }
.sc-mega-link {
  display: block; padding: 6px 8px; border-radius: 8px; font-size: 14px;
  font-weight: 600; color: var(--sc-ink); text-decoration: none; white-space: nowrap;
}
.sc-mega-link:hover { background: var(--sc-green-050); color: var(--sc-green-700); }
/* Topics mega — tidy 3-column list, right-aligned so it never overflows the viewport */
.sc-mega.sc-mega-topics { left: auto; right: 0; width: min(680px, 92vw); }
.sc-mega-topicsgrid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 14px;
  max-height: 66vh; overflow-y: auto; overflow-x: hidden;
}
.sc-mega-topicsgrid a {
  display: block; padding: 7px 8px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--sc-ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sc-mega-topicsgrid a:hover { background: var(--sc-green-050); color: var(--sc-green-700); }

/* ---- mobile hamburger (shown once the sc-nav collapses) ---- */
.sc-burger {
  display: none; margin-left: auto; width: 44px; height: 44px; flex: 0 0 auto;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--sc-line); border-radius: 10px; background: #fff; cursor: pointer;
}
.sc-burger span { width: 20px; height: 2px; background: var(--sc-ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
body.nav-open .sc-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .sc-burger span:nth-child(2) { opacity: 0; }
body.nav-open .sc-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1180px) {
  .sc-burger { display: flex; }
  /* reveal the collapsed nav as a full-width dropdown panel below the header band */
  body.nav-open .sc-nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; left: 0; right: 0; top: 100%; z-index: 55;
    background: #fff; border-bottom: 1px solid var(--sc-line);
    box-shadow: 0 20px 44px rgba(14, 78, 49, .16); padding: 10px 16px 16px;
    max-height: calc(100vh - 112px); overflow-y: auto;
  }
  body.nav-open .sc-navitem { display: block; }
  body.nav-open .sc-navlink { font-size: 16px; padding: 11px 12px; }
  body.nav-open .sc-mega {
    position: static; display: block; box-shadow: none; border: 0;
    width: auto; padding: 2px 8px 10px; margin: 0;
  }
  body.nav-open .sc-mega::before { display: none; }
  body.nav-open .sc-mega.sc-mega-topics { width: auto; }
  body.nav-open .sc-mega-subjects { flex-direction: column; gap: 12px; }
  body.nav-open .sc-mega-topicsgrid { grid-template-columns: 1fr 1fr; max-height: none; overflow: visible; }
  body.nav-open .sc-nav-div { display: none; }
  body.nav-open .sc-studio { margin: 6px 0 0; text-align: center; }
}
@media (max-width: 560px) {
  .sc-bmark { width: 40px; height: 40px; font-size: 16px; border-radius: 11px; }
  .sc-bword { font-size: 19px; }
  .sc-cta { padding: 10px 12px; font-size: 13px; }
  .sc-burger { width: 40px; height: 40px; }
}
@media (max-width: 430px) {
  .sc-bword { display: none; }
}

/* ===========================================================================
   MAIN HOME surface — hero + rich category tiles (namespaced fwh-*).
   Mirrors the approved mockup's "Main Home". Fixed light colors so the band
   renders identically in light and dark mode (matches the Studio home).
   =========================================================================== */
.fwh { font-family: var(--sc-font); color: var(--sc-ink); }
.fwh-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.fwh-tag {
  display: inline-block; background: var(--sc-green-050); color: var(--sc-green-700);
  font-weight: 800; font-size: 11.5px; letter-spacing: 1.3px; text-transform: uppercase;
  padding: 7px 14px; border-radius: 999px;
}
.fwh-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 44px 0 34px; }
.fwh-hero h1 { font-size: 46px; line-height: 1.06; letter-spacing: -1.4px; margin: 16px 0 14px; color: var(--sc-ink); }
.fwh-lead { font-size: 19px; color: var(--sc-muted); max-width: 520px; margin: 0; }
.fwh-herobtns { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.fwh-btn {
  background: var(--sc-green); color: #fff; text-decoration: none; font-weight: 800; font-size: 15px;
  padding: 13px 20px; border-radius: 11px; white-space: nowrap; box-shadow: 0 6px 16px rgba(23, 122, 79, .28);
}
.fwh-btn:hover { background: var(--sc-green-700); color: #fff; }
.fwh-btn.ghost { background: #fff; color: var(--sc-green-700); border: 1.5px solid var(--sc-line); box-shadow: none; }
.fwh-btn.ghost:hover { background: var(--sc-green-050); color: var(--sc-green-700); }
.fwh-heroart {
  background: linear-gradient(150deg, var(--sc-green-050), #fff); border: 1px solid var(--sc-line);
  border-radius: 22px; height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.fwh-heroart svg { width: 78%; filter: drop-shadow(0 20px 30px rgba(18, 100, 63, .14)); }
.fwh-sec { padding: 12px 0 50px; }
.fwh-sec h2 { font-size: 14px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--sc-muted); margin: 30px 0 14px; }
.fwh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.fwh-tile {
  position: relative; background: #fff; border: 1px solid var(--sc-line); border-radius: 18px;
  overflow: hidden; text-decoration: none; color: inherit; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.fwh-tile:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(18, 100, 63, .13); border-color: color-mix(in srgb, var(--c) 32%, #fff); }
.fwh-thumb {
  height: 140px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 26%, #fff), color-mix(in srgb, var(--c) 7%, #fff));
}
.fwh-blob { position: absolute; width: 160px; height: 160px; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, #fff); top: -58px; right: -48px; }
.fwh-blob2 { position: absolute; width: 70px; height: 70px; border-radius: 50%; background: color-mix(in srgb, var(--c) 20%, #fff); bottom: -26px; left: 14px; }
.fwh-sheetlet {
  position: absolute; z-index: 1; width: 62px; height: 80px; background: #fff; border-radius: 9px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .12); transform: rotate(-9deg); margin-left: -30px; padding: 10px 9px;
}
.fwh-sheetlet i { display: block; height: 4.5px; border-radius: 3px; background: var(--c); margin-bottom: 6px; opacity: .9; }
.fwh-sheetlet i.s { width: 56%; background: #dde8e2; opacity: 1; }
.fwh-chip {
  position: relative; z-index: 2; width: 74px; height: 74px; border-radius: 22px; background: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .16); display: flex; align-items: center; justify-content: center;
  font-size: 37px; margin-left: 16px; transform: rotate(3deg);
}
.fwh-pill {
  position: absolute; top: 12px; left: 12px; z-index: 3; font-size: 9.5px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: #fff; background: var(--c); padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 40%, transparent);
}
.fwh-body { padding: 15px 18px 17px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fwh-body h4 { font-size: 17px; line-height: 1.2; margin: 0; color: var(--sc-ink); }
.fwh-meta { display: block; font-weight: 700; font-size: 12.5px; margin-top: 3px; color: color-mix(in srgb, var(--c) 70%, #2a3b33); }
.fwh-arrow { font-size: 20px; font-weight: 800; color: var(--c); opacity: 0; transform: translateX(-5px); transition: .14s; flex: 0 0 auto; }
.fwh-tile:hover .fwh-arrow { opacity: 1; transform: translateX(0); }

@media (max-width: 860px) {
  .fwh-hero { grid-template-columns: 1fr; }
  .fwh-heroart { display: none; }
  .fwh-hero h1 { font-size: 34px; }
  .fwh-grid { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .fwh-hero, .fwh-sec { display: none !important; }
}
