/* Independent stylesheet copied from styles.css */
/* ==========================================================================
   SuperMathWorksheets — shared stylesheet
   ========================================================================== */

/* ---- Offline Font Implementation (Google Fonts removed) ---- */

:root{
  --color-blue:        #2F5FEE;
  --color-blue-dark:   #1E46C4;
  --color-blue-light:  #EAF0FF;
  --color-ink:         #1B2237;
  --color-ink-soft:    #5B6478;
  --color-body-bg:     #FFFFFF;
  --color-panel:       #EFF4FC;
  --color-border:      #E4E9F2;

  --color-green:       #17A673;
  --color-green-soft:  #E4F7EE;
  --color-purple:      #7C5CFB;
  --color-purple-soft: #EFEAFE;
  --color-yellow:      #F5A623;
  --color-yellow-soft: #FEF3DF;
  --color-pink:        #F0508A;
  --color-pink-soft:   #FDE9F0;
  --color-teal:        #1FB6C9;
  --color-teal-soft:   #E1F7FA;
  --color-orange:      #FF8A3D;
  --color-orange-soft: #FFEEE0;
  --color-gray-soft:   #EEF1F6;

  --color-brand-math:   #F5A623;
  --color-brand-sheets: #4FB6F7;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .06);
  --shadow-card-hover: 0 4px 10px rgba(20, 30, 60, .06), 0 16px 32px rgba(20, 30, 60, .10);
  --shadow-header: 0 1px 0 rgba(20, 30, 60, .06);

  --font-display: var(--smw-font-stack);
  --font-body: var(--smw-font-stack);

  --header-h: 76px;
  --header-pad: 8px;
  --header-total-h: calc(var(--header-h) + var(--header-pad));
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  /* margin intentionally NOT reset: every other page keeps the default 8px body margin,
     which sits on top of the 84px header spacer. Resetting it here made this page 8px tighter. */
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color:var(--color-ink);
  background:var(--color-body-bg);
  -webkit-font-smoothing:antialiased;
  display:flex;
  flex-direction:column;
  min-height:100vh;
  min-height:100dvh;
}

html:root, html:root > body{
  overflow-x:clip;
  overflow-y:visible;
}
body > .site-header{ flex:0 0 auto; }
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }
h1,h2,h3,h4{ font-family:ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin:0; }
ul{ margin:0; padding:0; list-style:none; }

.wrap{
  max-width:1400px;
  margin:0 auto;
  padding:0 44px;
  box-sizing: border-box;
}

/* ============================================================
   PAGE LAYOUT — full-width main content (sidebar removed)
   ============================================================ */
.page-layout{
  display:block; /* Changed from grid to block for full-width main content */
  padding-top:0;
  padding-bottom:24px;
  flex:1 0 auto;
  min-height:calc(100vh - var(--header-total-h));
  min-height:calc(100dvh - var(--header-total-h));
}

/* <=992px: header_navigation.css makes the header in-flow and zeroes its spacer.
   Sidebar pages get a 10px gap from layout.css, which this page does not load. */
@media (max-width: 992px){
  .site-header + .page-layout{ margin-top:10px; }
}

.main-content{
  width:100%;
  max-width:100%;
  background:#ffffff;
  border:2px solid var(--color-border);
  border-radius:0;
  margin-top:10px;
  /* margin-left: 10px; */
  margin-bottom:24px;
  padding:16px 24px 40px;
  box-sizing:border-box;
}

/* focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible{
  outline:3px solid var(--color-blue);
  outline-offset:2px;
  border-radius:6px;
}

/* ---------------- Header ---------------- */
@media (min-width: 993px){
  body.page-home .site-header .brand-text .name{
    font-size:32px;
  }
}

/* ---------------- Hero v2 ---------------- */
.hero-v2{
  position:relative;
  background:#fff;
  padding:8px 0 28px;
  margin-bottom:20px;
}
.hero-v2-grid{
  display:grid;
  grid-template-columns:1.05fr .95fr;
  gap:32px;
  align-items:center;
  margin-bottom:28px;
}
.hero-v2-title{
  font-size:42px;
  line-height:1.16;
  letter-spacing:-0.01em;
  font-weight:800;
  color:var(--color-ink);
  margin-bottom:16px;
  display:flex;
  flex-direction:column;
  max-width:480px;
}
.hero-v2-title .title-line-1 {
  color: var(--color-ink);
}
.hero-v2-title .title-line-2,
.hero-v2-title .title-line-3 {
  color: var(--color-blue);
}
.hero-v2-desc{
  font-size:15.5px;
  line-height:1.6;
  color:var(--color-ink-soft);
  max-width:500px;
  margin-bottom:20px;
}
.hero-v2-features{
  width:100%;
  max-width:480px;
  height:auto;
  margin-top:0;
  margin-bottom:20px;
  display:block;
}
.btn-explore{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:var(--color-blue);
  color:#fff;
  font-weight:700;
  font-size:15px;
  border:none;
  padding:12px 24px;
  border-radius:12px;
  white-space:nowrap;
  text-decoration:none;
  transition:background 0.15s ease;
}
.btn-explore:hover{ background:var(--color-blue-dark); }
.hero-v2-art{
  display:flex;
  justify-content:center;
  align-items:center;
}
.hero-v2-art img{
  width:100%;
  max-width:480px !important;
  height:auto;
  object-fit:contain;
}

.stat-cards-wrapper{
  width:100%;
  margin-top:8px;
}
.stat-cards-row{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:14px;
  align-items:stretch;
}
.stat-cards-row img{
  width:100%;
  height:auto;
  display:block;
}

/* ---------------- Section Shell ---------------- */
.section{
  padding:24px 0;
  margin-bottom:16px;
}
.section--tight-bottom{ padding-bottom:12px; }
.section--tight-top{ padding-top:12px; }
.section-head{
  display:flex; align-items:baseline; justify-content:space-between;
  margin-bottom:18px;
}
.section-title{ font-size:26px; font-weight:800; color:var(--color-ink); }
.section-link{
  font-size:14.5px; font-weight:700; color:var(--color-blue);
  display:flex; align-items:center; gap:6px;
}
.section-link:hover{ text-decoration:underline; }

/* Center Popular Worksheets Header Title */
#popular .section-head{
  justify-content:center;
}

/* ---------------- Browse by Topic Grid ---------------- */
#topics .topic-grid,
#topics .topic-grid--6{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:16px;
  align-items:stretch;
  justify-content:center;
}

#topics .topic-card{
  display:flex;
  flex-direction:column;
  align-items:center;
  width:100%;
  padding:18px 12px 16px;
  background:var(--topic-bg, var(--color-panel));
  border:none;
  border-radius:var(--radius-lg);
  overflow:hidden;
  text-align:center;
  transition:transform .15s ease, box-shadow .15s ease;
  text-decoration:none;
}
#topics .topic-card:hover{
  transform:translateY(-4px);
  box-shadow:var(--shadow-card-hover);
}

/* One square icon box per card. --topic-icon-size is the ceiling; width:100%
   lets the box shrink if a card's content area is ever narrower than that, so
   the icon can never overflow. The <img> fills the box and is letterboxed with
   object-fit:contain, so SVG/WebP/PNG icons with different intrinsic ratios
   all occupy an identical footprint. */
#topics .topic-grid{ --topic-icon-size:100px; }
#topics .topic-icon{
  flex:none;
  width:100%;
  max-width:var(--topic-icon-size);
  aspect-ratio:1 / 1;
  margin:0 0 12px;
  padding:0;
  border:0;
  background:transparent;
  display:flex;
  align-items:center;
  justify-content:center;
}
#topics .topic-icon img{
  width:100%;
  height:100%;
  max-width:100%;
  object-fit:contain;
  background:transparent;
  display:block;
}

#topics .topic-card .label{
  font-family:var(--smw-font-stack);
  font-weight:700;
  font-size:18px; 
  line-height:1.25;
  color:var(--color-ink);
}

#topics .topic-card--purple{ --topic-bg: var(--color-purple-soft); }
#topics .topic-card--blue{   --topic-bg: var(--color-blue-light); }
#topics .topic-card--green{  --topic-bg: var(--color-green-soft); }
#topics .topic-card--orange{ --topic-bg: var(--color-orange-soft); }
#topics .topic-card--pink{   --topic-bg: var(--color-pink-soft); }
#topics .topic-card--yellow{ --topic-bg: var(--color-yellow-soft); }

/* ---------------- Popular Worksheets Rail ---------------- */
.popular-rail-wrap{
  display:flex;
  align-items:center;
  gap:14px;
}
.worksheet-rail{
  /* Card styling tokens. Radius stays square (existing design); it is a
     variable so the focus ring below can match it exactly. */
  --ws-card-radius:0px;
  --ws-border:#CBD3E3;
  --ws-border-hover:#AAB4CB;
  --ws-shadow:0 1px 2px rgba(20, 30, 60, .08), 0 3px 8px rgba(20, 30, 60, .07);
  --ws-shadow-hover:0 2px 4px rgba(20, 30, 60, .08), 0 8px 16px rgba(20, 30, 60, .11);
  --ws-pad-x:8px;

  flex:1;
  min-width:0;               /* lets the rail shrink inside the flex row instead of widening the page */
  display:flex;
  gap:20px;
  overflow-x:auto;           /* NOTE: this forces overflow-y to auto too, so the rail clips anything */
  scroll-behavior:smooth;    /*       outside its padding box. The padding below is the room that   */
  scroll-snap-type:x mandatory; /*    keeps borders, shadows, the -4px hover lift and the focus ring */
  scroll-padding-inline:var(--ws-pad-x); /* from being cut off. Snap offset matches the padding.   */
  padding:12px var(--ws-pad-x) 20px;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
.worksheet-rail::-webkit-scrollbar{ display:none; height:0; width:0; }

.worksheet-rail .worksheet-card--simple{
  flex:0 0 auto;
  width:calc((100% - 3 * 20px) / 4);
  scroll-snap-align:start;
  background:#fff;
  border:1px solid var(--ws-border);
  border-radius:var(--ws-card-radius);
  overflow:hidden;
  box-shadow:var(--ws-shadow);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  text-decoration:none;
}
.worksheet-rail .worksheet-card--simple:hover{
  transform:translateY(-4px);
  border-color:var(--ws-border-hover);
  box-shadow:var(--ws-shadow-hover);
}
/* The global a:focus-visible rule sets border-radius:6px, which would
   re-round this square card only while focused. Keep the card's own radius. */
.worksheet-rail .worksheet-card--simple:focus-visible{
  border-radius:var(--ws-card-radius);
  border-color:var(--ws-border-hover);
  box-shadow:var(--ws-shadow-hover);
}
.worksheet-rail .worksheet-thumb--mini{
  width:100%;
  aspect-ratio:4 / 5;
  padding:6px;
  background:#fff;
  overflow:hidden;
}
.worksheet-rail .worksheet-thumb--mini img{
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  border:0;
  display:block;
}

.rail-arrow{
  width:38px; height:38px; border-radius:50%;
  border:1px solid var(--color-border);
  background:#fff;
  display:grid; place-items:center;
  color:var(--color-ink);
  flex:none;
}
.rail-arrow:hover:not(:disabled){ background:var(--color-panel); }
.rail-arrow:disabled{ opacity:.35; cursor:default; }

/* ---------------- Why Section ---------------- */
.why-section{
  padding:24px 0 16px;
}
.why-section-title{
  text-align:center;
  font-size:26px;
  font-weight:800;
  color:var(--color-blue);
  margin-bottom:24px;
}
.why-icons-row{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:12px;
  align-items:stretch;
  justify-content:center;
}
.why-icon-card,
.why-icon-card--wide{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.why-icon-card img{
  width:100%;
  height:auto;
  object-fit:contain;
  max-width:220px;
  max-height:220px;
}

/* ---------------- CTA Banner ---------------- */
.cta-section{
  padding:16px 0 24px;
}
.cta-banner-link{
  display:block;
  position:relative;
  width:100%;
  border-radius:var(--radius-lg);
  overflow:hidden;
}
.cta-banner-link img{
  width:100%;
  height:auto;
  object-fit:cover;
  object-position:center;
  display:block;
}
.cta-banner-link .cta-action{
  position:absolute;
  left:50%;
  bottom:12%;
  transform:translateX(-50%);
}
.cta-banner-link .explore-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  appearance:none;
  border:none;
  background:var(--color-blue-dark);
  color:#fff;
  font-family:var(--smw-font-stack);
  font-weight:700;
  font-size:14px;
  line-height:1.2;
  padding:10px 20px;
  border-radius:8px;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.cta-banner-link .explore-btn-arrow{
  display:inline-block;
  flex:none;
  width:16px;
  height:16px;
  transition:transform .15s ease;
}
.cta-banner-link .explore-btn:hover{
  background:var(--color-blue);
}
/* .cta-banner-link .explore-btn:hover .explore-btn-arrow{
  transform:translateX(3px);
} */
/* Phones (<=520px): the banner image contains the headline text, so it is hidden
   and only the Explore button remains (see the 520px media query below). */

/* ---------------- Responsive Rules ---------------- */
@media (max-width: 1100px){
  .page-layout{ /* Grid properties removed, only block layout remains */ }
  #topics .topic-grid,
  #topics .topic-grid--6{ grid-template-columns:repeat(5, minmax(0, 1fr)); gap:14px; }
  .worksheet-rail .worksheet-card--simple{ width:calc((100% - 2 * 20px) / 3); }
  #topics .topic-grid{ --topic-icon-size:92px; }
}

@media (max-width: 992px){
  .hero-v2-title{ font-size:34px; }
  .hero-v2-grid{ gap:20px; }
  .why-icons-row{ grid-template-columns:repeat(3, 1fr); gap:14px; }
  .worksheet-rail .worksheet-card--simple{
    flex:0 0 calc((100% - 2 * 20px) / 3);
    width:auto;
  }
}

@media (max-width: 768px){
  .page-layout{
    display:block;
    width:100%;
    max-width:100%;
    min-width:0;
  }
  .main-content{
    width:100%;
    max-width:100%;
    padding:14px 14px 24px;
    border:none;
    margin-top:0;
    margin-bottom:0;
    overflow-x:clip;
  }
  .hero-v2{ padding:16px 0 24px; }
  .hero-v2-grid{ grid-template-columns:1fr; gap:24px; }
  .hero-v2-title{ font-size:28px; max-width:none; }
  .hero-v2-desc{ font-size:14.5px; max-width:none; }
  .hero-v2-art img{ max-width:360px !important; }
  #topics .topic-grid,
  #topics .topic-grid--6{ grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; }
  #topics .topic-card .label{ font-size:15px; }
  .stat-cards-row{ grid-template-columns:repeat(3, 1fr); gap:10px; }
  .why-icons-row{ grid-template-columns:repeat(2, 1fr); gap:12px; }
  .worksheet-rail{ gap:16px; }
  .worksheet-rail .worksheet-card--simple{
    flex:0 0 calc((100% - 16px) / 2);
    width:auto;
  }
  #topics .topic-grid{ --topic-icon-size:84px; }
  .popular-rail-wrap{ gap:8px; }
  .cta-banner-link .explore-btn{ padding:8px 16px; font-size:13px; }
}

@media (max-width: 768px) and (min-width: 481px) {
  .hero-v2-art img{ max-width: 420px !important; }
  .hero-v2-title{ font-size: 34px; }
  .stat-cards-row{ grid-template-columns: repeat(4, 1fr); gap: 10px; }
  #topics .topic-grid,
  #topics .topic-grid--6{ grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .why-icons-row{ grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

@media (max-width: 520px){
  .hero-v2-title{ font-size:24px; }
  #topics .topic-grid,
  #topics .topic-grid--6{ grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
  .stat-cards-row{ grid-template-columns:repeat(2, 1fr); gap:8px; }
  .why-icons-row{ grid-template-columns:repeat(2, 1fr); gap:10px; }
  /* Phones: one full card per view. Icon size scales with the viewport
     (60px at 320 -> 72px from ~375 up) so 2-up cards stay balanced. */
  #topics .topic-grid{ --topic-icon-size:clamp(60px, 19vw, 72px); }
  #topics .topic-card{ padding:14px 8px 12px; }
  #topics .topic-icon{ margin-bottom:10px; }
  .worksheet-rail .worksheet-card--simple{
    flex:0 0 100%;
    max-width:none;
  }
  .cta-section{ padding:8px 0 16px; }
  .cta-banner-link img{ display:none; }
  .cta-banner-link .cta-action{
    position:static;
    transform:none;
    display:flex;
    justify-content:center;
  }
  .cta-banner-link .explore-btn{ padding:12px 22px; font-size:14px; min-height:44px; }
}