/* ==========================================================================
   Simplify Radicals Theme: Main Layout & Typography Stylesheet
   ========================================================================== */

/* Container Layout */
.site-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 600px) {
  .site-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 360px) {
  .site-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Global Responsive Typography Safety */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

p, li, td, th {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.narrow-container {
  max-width: var(--container-narrow-width);
}

.section-py {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

/* ==========================================================================
   1. Top Utility Bar (Coral Reference)
   ========================================================================== */
.site-topbar {
  background-color: var(--clr-primary-coral);
  color: var(--clr-pure-white);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.topbar-formula {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-badge {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  opacity: 0.95;
}

.topbar-code {
  background: rgba(0, 0, 0, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-math);
  font-size: 0.85rem;
}

.site-language-select {
  background: rgba(255, 255, 255, 0.15);
  color: var(--clr-pure-white);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.site-language-select option {
  color: var(--clr-dark-teal);
  background: var(--clr-pure-white);
}

/* ==========================================================================
   2. Site Header & Navigation (Mint Wash Reference)
   ========================================================================== */
.site-header {
  background-color: var(--clr-mint-bg);
  border-bottom: 1px solid var(--clr-mint-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(42, 111, 120, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.site-branding {
  display: flex;
  align-items: center;
}

.custom-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.logo-radical-symbol {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--clr-primary-coral);
  line-height: 1;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-family-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--clr-secondary-teal);
  line-height: 1.1;
}

.logo-accent {
  color: var(--clr-primary-coral);
}

.logo-tagline {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-slate-muted);
  font-weight: 600;
}

/* Navigation Links */
.main-navigation {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 1.5rem;
}

.nav-menu a {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--clr-secondary-teal);
  position: relative;
  padding: 0.5rem 0;
  white-space: nowrap; /* Design fix 2026-11-21: no two-line menu items */
}

/* Design fix 2026-11-21: keep the logo from touching the first menu item. */
.site-branding {
  flex-shrink: 0;
  margin-right: 1.5rem;
}

@media (max-width: 1280px) {
  .main-navigation {
    gap: 1.25rem;
  }

  .nav-menu {
    gap: 1.1rem;
  }
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
  color: var(--clr-primary-coral);
}

/* Mobile Menu Controls */
.header-mobile-controls {
  display: none;
}

.header-tools-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  background-color: var(--clr-pure-white);
  border: 1.5px solid var(--clr-secondary-teal);
  border-radius: var(--radius-pill);
  color: var(--clr-secondary-teal);
  font-family: var(--font-family-display);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
}

.header-tools-btn:hover,
.header-tools-btn:active {
  background-color: var(--clr-secondary-teal);
  color: var(--clr-pure-white);
}

.header-tools-btn:focus-visible {
  outline: 3px solid var(--clr-primary-coral);
  outline-offset: 2px;
}

.header-tools-icon {
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-icon-bar {
  display: block;
  width: 24px;
  height: 2.5px;
  background-color: var(--clr-secondary-teal);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform var(--transition-fast);
}

/* ==========================================================================
   3. Hero Section (Split Layout with Mint Wash)
   ========================================================================== */
.section-hero {
  background-color: var(--clr-mint-bg);
  padding: 1.5rem 0 28px;
  border-bottom: 1px solid var(--clr-mint-border);
}

.hero-container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  /* Audit fix (CLS): top-align columns so the hero copy does not re-center
     when the calculator mounts and its result panel grows (desktop CLS 0.25). */
  align-items: start;
  gap: 2.5rem;
}

/* Audit fix (CLS): reserve the mounted calculator height on two-column layouts
   until the plugin marks the widget as mounted (data-plugin-mounted is set
   synchronously together with the first calculation, so no intermediate paint).
   Gated on scripting so visitors without JavaScript never see reserved blank space. */
@media (min-width: 993px) and (scripting: enabled) {
  .hero-calculator-card .sr-calc-widget:not([data-plugin-mounted]) {
    min-height: 1084px;
  }
}

.hero-eyebrow {
  margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--font-family-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.12;
  color: var(--clr-secondary-teal);
  margin-bottom: 0.75rem;
}

.hero-title-highlight {
  color: var(--clr-primary-coral);
  display: inline;
}

.hero-description {
  font-size: 0.95rem;
  color: var(--clr-slate-muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.hero-ratings {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rating-stars {
  color: var(--clr-primary-coral);
  font-size: 1.25rem;
  letter-spacing: 2px;
}

.rating-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-dark-teal);
}

/* ==========================================================================
   4. Organic Wave Divider
   ========================================================================== */
.wave-transition-wrapper {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin-top: -1px;
}

.wave-divider {
  width: 100%;
  height: 60px;
  object-fit: cover;
}

/* ==========================================================================
   5. Site Footer
   ========================================================================== */
.site-footer {
  background-color: var(--clr-pure-white);
  border-top: 1px solid var(--clr-border-light);
}

.footer-top {
  padding: 4.5rem 0 3.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.footer-description {
  color: var(--clr-slate-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.footer-badges {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.badge-math-std {
  font-size: 0.8125rem;
  color: var(--clr-secondary-teal);
  font-weight: 600;
}

.footer-heading {
  font-family: var(--font-family-display);
  font-size: 1.125rem;
  color: var(--clr-dark-teal);
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.footer-menu, .footer-examples-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-menu a, .footer-examples-list a {
  color: #354c52;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-menu a:hover, .footer-examples-list a:hover {
  color: var(--clr-primary-coral);
}

.footer-bottom {
  background-color: var(--clr-dark-teal);
  color: var(--clr-pure-white);
  padding: 1.25rem 0;
  font-size: 0.875rem;
}

.footer-bottom .copyright-text {
  color: #e8f6f3;
  margin: 0;
  font-size: 0.875rem;
}

.footer-bottom .footer-legal-nav {
  color: #c8e8e1;
  font-size: 0.8125rem;
  margin-top: 0.35rem;
}

.footer-bottom .footer-legal-nav a {
  color: #e8f6f3;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-bottom .footer-legal-nav a:hover {
  color: #ffffff;
}

.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.back-to-top {
  color: var(--clr-pure-white);
  font-weight: 600;
}

.back-to-top:hover {
  color: var(--clr-primary-coral);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1220px) {
  .header-mobile-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .menu-toggle {
    display: block;
  }

  /* Anchored to the bottom of the sticky header (its containing block) instead of a
     fixed 80px from the viewport top, which covered the header whenever the
     announcement bar above it was still on screen. */
  .main-navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100vh - 80px);
    height: calc(100dvh - 80px);
    overflow-y: auto;
    background-color: var(--clr-pure-white);
    flex-direction: column;
    padding: 2rem;
    display: none;
    box-shadow: var(--shadow-lg);
  }

  .main-navigation.is-open {
    display: flex;
  }

  .nav-menu {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 1rem;
  }
}

@media (max-width: 992px) {
  .section-hero {
    padding: 1rem 0 28px;
  }

  .hero-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-eyebrow {
    margin-bottom: 0.35rem;
  }

  .hero-title {
    font-size: 1.75rem;
    line-height: 1.15;
    margin-bottom: 0.5rem;
  }

  .hero-title-highlight {
    display: block;
  }

  .hero-description {
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 0.6rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 480px) {
  .header-inner {
    height: 70px;
  }

  .logo-title {
    font-size: 1.15rem;
  }

  .logo-tagline {
    font-size: 0.625rem;
  }
}

/* Accessible Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* AIEO Phase 37 (2026-11-30): at 320–374px the logo (which may not shrink) plus the Tools
   shortcut and menu button were 34px wider than the screen, pushing the menu button partly
   off-screen on every page. Tighten spacing only on these narrow phones; larger screens are unchanged. */
@media (max-width: 374px) {
  .site-branding {
    margin-right: 0.5rem;
  }

  .header-mobile-controls {
    gap: 0.35rem;
  }

  .header-tools-btn {
    padding: 0.35rem 0.6rem;
  }

  .menu-toggle {
    padding: 0.5rem 0.25rem;
  }

  .logo-title {
    font-size: 1.05rem;
  }
}
