/* ============================================================
   English Sentence Practice — Homepage redesign (Stage 5)
   W3Schools-style: dark green hero, white cards, green accent.
   Loaded only by index.php (after styles.css + lesson.css),
   so other pages stay untouched. No JavaScript needed.
   ============================================================ */

/* ---------- Hero banner ---------- */
.home-hero {
  background: linear-gradient(135deg, #14532d 0%, #1b7a3d 60%, #28a745 100%);
  border-radius: 0 0 18px 18px;
  margin: 0 -20px;
  padding: 54px 20px 46px;
}

.home-hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.home-hero-eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #bbf7d0;
  margin: 0 0 12px;
}

.home-hero h1 {
  color: #fff;
  font-size: 38px;
  line-height: 1.2;
  margin: 0 0 14px;
}

.home-hero-sub {
  color: #dcfce7;
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 24px;
}

/* Search bar */
.home-search {
  display: flex;
  max-width: 560px;
  margin: 0 auto 20px;
  background: #fff;
  border-radius: 999px;
  padding: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}

.home-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 10px 16px;
  color: #1e293b;
}

.home-search button {
  border: none;
  cursor: pointer;
  background: #28a745;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  padding: 11px 24px;
}

.home-search button:hover { background: #218838; }

/* Hero buttons */
.home-hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.home-hero-btn {
  display: inline-block;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.home-hero-btn:hover { background: rgba(255, 255, 255, .25); }

.home-hero-btn.primary {
  background: #fff;
  color: #14532d;
  border-color: #fff;
}

.home-hero-btn.primary:hover { background: #f0fdf4; }

/* ---------- Intro (old hero text, kept word-for-word) ---------- */
.home-intro {
  max-width: 760px;
  margin: 30px auto 0;
  text-align: center;
}

.home-intro p {
  color: #475569;
  font-size: 16px;
  line-height: 1.75;
  margin: 0 0 14px;
}

/* ---------- Start-learning cards ---------- */
.home-start { margin: 40px 0 10px; }

.home-start h2 {
  text-align: center;
  font-size: 26px;
  color: #1e293b;
  margin: 0 0 20px;
}

.home-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-start-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #28a745;
  border-radius: 12px;
  padding: 22px 20px;
  text-decoration: none;
  color: #1e293b;
  display: block;
}

.home-start-card:hover {
  border-color: #28a745;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.home-start-ico { font-size: 26px; display: block; margin-bottom: 10px; }

.home-start-card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

.home-start-card span:last-child {
  font-size: 14px;
  color: #64748b;
  line-height: 1.55;
  display: block;
}

/* ---------- Practice grid restyle (overrides styles.css blue cards) ---------- */
.practice-grid { gap: 14px; }

.practice-card {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  font-weight: 600;
  box-shadow: none;
}

.practice-card:hover {
  background: #f0fdf4;
  border-color: #28a745;
  color: #14532d;
  transform: translateY(-2px);
}

/* ---------- Section polish (keeps old content, cleaner cards) ---------- */
.cta, .about-tool, .seo-sections {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.page-image img { border-radius: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .home-hero { padding: 40px 16px 36px; border-radius: 0 0 14px 14px; }
  .home-hero h1 { font-size: 27px; }
  .home-hero-sub { font-size: 15px; }
  .home-search input { font-size: 15px; }
  .home-search button { padding: 10px 16px; }
  .home-start h2 { font-size: 22px; }
}

/* ---------- Level pills (replaces the old hero search box) ---------- */
.home-levels {
  margin-top: 22px;
  font-size: 14px;
  color: #bbf7d0;
}

.home-levels span { margin-right: 8px; font-weight: 600; }

.home-levels a {
  display: inline-block;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px;
  padding: 6px 16px;
  margin: 4px 4px 0;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.home-levels a:hover { background: #fff; color: #14532d; }

/* ============================================================
   Stage 7 — proper full-page homepage, no sidebar.
   The .container override below is homepage-only (home.css
   loads only on index.php), so other pages stay untouched.
   ============================================================ */

/* Full-page container: wider, no card box */
.container {
  max-width: 1120px;
  padding: 0 20px 40px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* ---------- How-it-works strip ---------- */
.home-steps { margin: 40px 0 10px; }

.home-steps h2 {
  text-align: center;
  font-size: 26px;
  color: #1e293b;
  margin: 0 0 20px;
}

.home-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-step {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: center;
}

.home-step-num {
  display: inline-block;
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 50%;
  background: #28a745;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.home-step strong { display: block; font-size: 17px; margin-bottom: 6px; }

.home-step span:last-child {
  font-size: 14px;
  color: #64748b;
  line-height: 1.55;
  display: block;
}

/* ---------- Practice band (full-bleed) ---------- */
.home-practice {
  background: #f1f5f9;
  margin: 40px -20px 0;
  padding: 44px 20px;
}

.home-practice .cta {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: 1080px;
  margin: 0 auto;
}

.home-practice-group {
  text-align: left;
  font-size: 19px;
  color: #14532d;
  margin: 28px 0 14px;
}

.home-practice-group:first-of-type { margin-top: 24px; }

/* ---------- Lessons band (full-bleed) ---------- */
.home-lessons {
  background: #f0fdf4;
  margin: 0 -20px;
  padding: 44px 20px;
}

.home-lessons h2,
.home-lessons p { max-width: 1080px; margin-left: auto; margin-right: auto; }

.home-lesson-grid { max-width: 1080px; margin-left: auto; margin-right: auto; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .home-steps h2 { font-size: 22px; }
  .home-practice,
  .home-lessons { padding: 32px 16px; }
}

/* ============================================================
   Stage 8 — two-column homepage: content left, ad sidebar right.
   AdSense sticky-ad rules applied (Google AdSense Help, Ad formats):
   - sticky ad max 300px wide, desktop ONLY (never sticky on
     tablet/mobile), only ONE sticky ad per viewport, never
     overlapping or too close to content/navigation.
   - the sidebar slot itself is managed from Admin Panel > Ad Slots
     (key: home_sidebar); paste a 300x250 or 300x600 unit only.
   ============================================================ */

.home-layout { display: grid; grid-template-columns: minmax(0, 1fr); }

.home-layout.has-sidebar {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
}

.home-main { min-width: 0; }

/* Bands inside the left column must not bleed into the sidebar. */
.home-main .home-practice,
.home-main .home-lessons { margin-left: 0; margin-right: 0; }

/* Sidebar: exactly 300px (AdSense sticky max width). The ad label is
   already printed by render_ad_slot ("Advertisement"). */
.home-sidebar { width: 300px; max-width: 100%; }

.home-sidebar .ad-slot-wrap { max-width: 300px; margin: 0; padding: 0; }

.home-sidebar .ad-slot-wrap ins.adsbygoogle { max-width: 300px; }

/* Sticky ONLY on desktop. */
@media (min-width: 1024px) {
  .home-sidebar { position: sticky; top: 24px; align-self: start; }
}

/* Mobile/tablet: single column, sidebar stacks below content, not sticky. */
@media (max-width: 1023px) {
  .home-layout.has-sidebar { grid-template-columns: minmax(0, 1fr); }

  .home-sidebar { width: 100%; margin-top: 32px; }

  .home-sidebar .ad-slot-wrap { margin: 0 auto; }
}

/* ============================================================
   Stage 9 — mobile hardening (2026-11-09).
   Live mobile check (PageSpeed Insights, Moto G Power 412px)
   found the intro paragraphs below the hero cut off on the
   right with sideways scrolling, while hero/navbar/pills fit.
   The audit found no single fixed-width rule in the current
   files, so every homepage section is made strictly fluid
   below, plus safety nets. Desktop is untouched: every rule
   below sits inside a max-width media query.
   Version bumped to 1.3.1 (see index.php) so phones fetch
   the new CSS instead of the cached old one.
   ============================================================ */

/* Safety nets: border-box sizing + never allow sideways scroll. */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; }
img, video, iframe, ins.adsbygoogle { max-width: 100%; }
img { height: auto; }

/* ---------- Mobile + tablet: everything strictly fluid ---------- */
@media (max-width: 768px) {
  .container { padding: 0 16px 32px; }

  /* Hero: no negative margins on mobile (was 0 -20px). */
  .home-hero { margin: 0; border-radius: 0 0 14px 14px; }

  /* Main column: drop the extra 20px padding from styles.css
     main rule (it doubled the container padding on mobile). */
  .home-main { padding: 0; min-width: 0; }

  /* The measured culprit: intro must be fluid, never wider
     than the screen, long words may break. */
  .home-intro { width: 100%; max-width: 100%; margin-top: 24px; overflow-wrap: break-word; }

  /* Full-bleed bands: no negative margins on mobile. */
  .home-practice,
  .home-lessons { margin: 32px 0 0; padding: 32px 16px; }
  .home-practice .cta,
  .home-lessons h2,
  .home-lessons p,
  .home-lesson-grid { max-width: 100%; }

  /* One column everywhere on mobile — no minmax() width risk. */
  .home-start-grid,
  .home-steps-grid,
  .home-lesson-grid,
  .practice-grid { grid-template-columns: 1fr; }

  /* Layout + sidebar: single column, sidebar below content. */
  .home-layout,
  .home-layout.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .home-sidebar { width: 100%; max-width: 300px; margin: 32px auto 0; }

  /* All remaining homepage sections: fluid, never wider than screen. */
  .cta, .about-tool, .seo-sections { width: 100%; max-width: 100%; }
  .page-image { margin: 20px 0; }

  /* Cookie banner: wrap text + buttons on small screens. */
  .cookie-banner { padding: 12px; }
  .cookie-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
}

/* ---------- Small phones (360px): stack hero buttons ---------- */
@media (max-width: 480px) {
  .home-hero { padding: 32px 16px 28px; }
  .home-hero h1 { font-size: 24px; }
  .home-hero-sub { font-size: 15px; }
  .home-hero-eyebrow { font-size: 11px; letter-spacing: .06em; }
  .home-hero-btns { flex-direction: column; align-items: stretch; }
  .home-hero-btn { text-align: center; }
  .home-levels a { padding: 6px 12px; font-size: 13px; }
  .home-start h2, .home-steps h2 { font-size: 20px; }
  .home-practice-group { font-size: 17px; }
}
