/* Base Structure CSS — Layout Only (no colors/decorations) */

/* ========================================
   Smooth scrolling
   ======================================== */
html {
  scroll-behavior: smooth;
}

/* ========================================
   Layout: Detail Page
   ======================================== */
.detail-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ========================================
   Layout: Page Header
   ======================================== */
.page-header {
  padding: 2.5rem 2.5rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.page-header h1 {
  margin: 0;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

/* ========================================
   Layout: Breadcrumb
   ======================================== */
.breadcrumb {
  margin-bottom: 1.5rem;
  padding: 0;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  position: relative;
}

.breadcrumb a {
  padding: 0;
  
  position: relative;
  text-decoration: none;
}

.breadcrumb li:last-child {
  padding: 0;
  
}

/* ========================================
   Layout: Set Switcher
   ======================================== */
.set-switcher {
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.set-switcher-label {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.set-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.set-btn {
  min-width: 50px;
  height: 50px;
  padding: 0 1rem;
  border: 2px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.set-btn > * {
  position: relative;
  z-index: 1;
}

/* ========================================
   Layout: Action Buttons
   ======================================== */
.actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.875rem 1.75rem;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.btn > * {
  position: relative;
  z-index: 1;
}

/* ========================================
   Layout: Worksheet Content
   ======================================== */
.worksheet-content {
  padding: 3rem 0;
  margin-bottom: 2rem;
  border: none;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.worksheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid transparent;
}

.worksheet-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.worksheet-meta {
  padding: 0.625rem 1.25rem;
  border-radius: 20px;
  border: 2px solid transparent;
}

/* ========================================
   Layout: Problems Grid
   ======================================== */
.problems-grid {
  column-count: 2;
  column-gap: 2rem;
  padding: 0.5rem 0;
}

.problem {
  break-inside: avoid;
  padding: 1.375rem 1.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border: 2px solid transparent;
  border-left: 5px solid transparent;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.problem .num {
  min-width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  position: relative;
  flex-shrink: 0;
}

.problem .num::after {
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  padding: 2px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
}

.problem .expression {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.problem .blank {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  min-width: 4.5rem;
  display: none;
  padding: 0.25rem 1rem;
  text-align: center;
  position: relative;
}

.problem .answer {
  display: none;
  border: none;
  min-width: 4.5rem;
  padding: 0.25rem 1rem;
  text-align: center;
  border-radius: 8px;
}

.show-answers .problem .answer {
  display: inline-block;
}

.show-answers .problem .blank {
  display: none;
}

/* ========================================
   Layout: Intro Section
   ======================================== */
.intro {
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  border: 2px solid transparent;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  max-width: 100% !important;
  width: 100%;
}

.intro p {
  margin: 0 0 1rem;
  position: relative;
  z-index: 1;
}

.intro p:last-child {
  margin-bottom: 0;
}

.intro strong {
  font-weight: 700;
}

.intro em {
  display: block;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid transparent;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* ========================================
   Layout: Body Content
   ======================================== */
.body-content {
  padding: 2.5rem 2.5rem;
  margin-top: 2rem;
  border: 1px solid transparent;
  border-radius: 8px;
  max-width: 100% !important;
  width: 100%;
}

.body-content h2 {
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.body-content h2:not(:first-child) {
  margin-top: 2.5rem;
}

.body-content p {
  margin: 0 0 1rem;
}

.body-content ul,
.body-content ol {
  margin: 0 0 1.25rem 1.5rem;
}

.body-content li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  padding-left: 0.5rem;
}

/* ========================================
   Layout: Collapsible Content
   ======================================== */
.body-content--collapsible {
  padding: 1.25rem 1.5rem;
}

.content-toggle {
  border: 1px solid transparent;
  border-radius: 10px;
  overflow: hidden;
}

.content-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.content-toggle > summary::-webkit-details-marker {
  display: none;
}

.content-toggle > summary::before {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-weight: 700;
}

.content-toggle[open] > summary::before {
}

.content-toggle-panel {
  padding: 0.4rem 1.1rem 1.1rem;
  border-top: 1px solid transparent;
}

/* ========================================
   Layout: SEO Components
   ======================================== */
.seo-components {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.seo-components--primary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.seo-components--secondary .content-toggle {
  margin-top: 0.5rem;
}

.seo-more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.seo-block {
  border: 1px solid transparent;
  border-top: 3px solid transparent;
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  position: relative;
}

.seo-card {
  position: relative;
  padding-top: 2.75rem;
  overflow: hidden;
  border-top: none;
}

.seo-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 10px 10px 0 0;
}

.seo-block h2,
.seo-block h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  border: 0;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.seo-block h2::before,
.seo-block h3::before {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1;
}

.seo-block p {
  margin: 0 0 0.75rem;
  line-height: 1.65;
}

.seo-block p:last-child {
  margin-bottom: 0;
}

.seo-block ul,
.seo-block ol {
  margin: 0.5rem 0 0.75rem 1.25rem;
}

.seo-block ul:last-child,
.seo-block ol:last-child {
  margin-bottom: 0;
}

.seo-block li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  padding-left: 0.25rem;
}

.seo-block li:last-child {
  margin-bottom: 0;
}

/* Homepage body content (seo.bodyHtml wrapper) */
.homepage > .content {
  padding: 2rem 2.5rem;
  margin-top: 2rem;
  border: 1px solid transparent;
  border-radius: 10px;
}

.homepage > .content h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid transparent;
}

.homepage > .content h2:not(:first-child) {
  margin-top: 2rem;
}

.homepage > .content p {
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

.homepage > .content ul,
.homepage > .content ol {
  margin: 0.5rem 0 1rem 1.25rem;
}

.homepage > .content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* ========================================
   Layout: Page Navigation
   ======================================== */
.page-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 2rem;
  padding: 2rem;
  border: 1px solid transparent;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.page-navigation::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-size: 200% 100%;
}

.btn-nav {
  padding: 0.875rem 1.75rem;
  border: 2px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-nav::before {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  transition: left 0.5s ease;
}

.btn-nav:hover::before {
  left: 100%;
}

.btn-nav:active {
  transform: translateY(0) scale(0.98);
}

.btn-nav.disabled {
  cursor: not-allowed;
  transform: none;
}

.btn-nav.disabled:hover::before {
  left: -100%;
}

/* ========================================
   Layout: Interactive Answer Input
   ======================================== */
.answer-input {
  width: 5rem;
  padding: 0.375rem 0.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  flex-shrink: 0;
}

.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.problem.is-correct .answer-input {
  border-color: transparent;
}

.problem.is-wrong .answer-input {
  border-color: transparent;
}

.problem.is-empty .answer-input {
  border-color: transparent;
}

.problem.is-correct {
  border-left-color: transparent !important;
}

.problem.is-wrong {
  border-left-color: transparent !important;
}

/* ========================================
   Layout: Score Panel
   ======================================== */
.score-panel {
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
}

.score-panel.score-visible {
  opacity: 1;
  transform: translateY(0);
}

.score-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 2rem;
  border: 2px solid transparent;
  border-radius: 12px;
}

.score-icon {
  font-size: 2.25rem;
  flex-shrink: 0;
}

.score-text {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.score-text strong {
  font-size: 1.75rem;
}

.score-label {
  margin-left: 0.25rem;
}

.score-pct {
  margin-left: auto;
  font-size: 2rem;
  font-weight: 700;
  background-clip: text;
}

.score-retry {
  border: 2px solid transparent;
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ========================================
   Layout: Utility Classes
   ======================================== */
.fade-in {
}

.slide-up {
}

/* ========================================
   Layout: Homepage
   ======================================== */
.homepage {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.hero {
  padding: 5rem 2rem 4rem;
  margin-bottom: 2rem;
  text-align: center;
  border-bottom: 2px solid transparent;
  position: relative;
}

.hero h1 {
  margin: 0 0 1rem;
  line-height: 1.2;
}

.hero .subtitle {
  margin-bottom: 2.5rem;
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 4rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 8px;
  border: 1.5px solid transparent;
  min-width: 140px;
}

.stat-number {
  display: block;
}

.stat-label {
  margin-top: 0.5rem;
}

/* ========================================
   Layout: Intro Section (Homepage)
   ======================================== */
.intro-section {
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  border: 1.5px solid transparent;
  border-radius: 8px;
  text-align: center;
}

.intro-section p {
  margin: 0 0 1rem;
}

.intro-section p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Layout: Categories Section
   ======================================== */
.categories-section {
  margin: 2rem 0;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  margin: 0 0 0.5rem;
}

.section-header p {
  margin: 0;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.category-card {
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  transform: scaleX(0);
}

.category-card:hover::before {
  transform: scaleX(1);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
  display: block;
}

.category-card h3 {
  margin: 0 0 0.625rem;
}

.category-card p {
  margin: 0 0 1.25rem;
}

.category-meta {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1.5px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.category-card:hover .category-meta {
  gap: 0.625rem;
}

/* ========================================
   Layout: Content Section
   ======================================== */
.content-section {
  padding: 2.5rem 2.5rem;
  margin-top: 2rem;
  border: 1px solid transparent;
  border-radius: 8px;
}

.content-section h2 {
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid transparent;
}

.content-section h2:not(:first-child) {
  margin-top: 2rem;
}

.content-section p {
  margin-bottom: 1rem;
}

/* ========================================
   Layout: List Page
   ======================================== */
.list-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.subcategories-section {
  margin: 2rem 0;
}

.subcategories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.subcategory-card {
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.subcategory-card::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transform: scaleX(0);
}

.subcategory-card:hover::before {
  transform: scaleX(1);
}

.subcategory-card h3 {
  margin: 0 0 0.625rem;
}

.subcategory-card p {
  margin: 0 0 1.25rem;
}

.subcategory-arrow {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.subcategory-card:hover .subcategory-arrow {
  gap: 0.625rem;
}

/* ========================================
   Layout: Worksheets Section
   ======================================== */
.worksheets-section {
  margin: 2rem 0;
}

.worksheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.worksheet-card {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
}

.worksheet-number {
  margin-bottom: 0.5rem;
}

.worksheet-card h3 {
  margin: 0;
}

.worksheet-problems {
  margin-top: 0.5rem;
}

/* ========================================
   Layout: Static Pages
   ======================================== */
.static-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.static-page .page-header {
  padding: 2.5rem 2.5rem 2rem;
}

.static-page .page-header::before {
  left: 0;
}

.static-page .content {
  padding: 2.5rem 2.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.static-page .content h2 {
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid transparent;
}

.static-page .content h2:first-child {
  margin-top: 0;
}

.static-page .content p {
  margin: 0 0 1rem;
}

.static-page .content ul {
  margin: 0 0 1.25rem 1.5rem;
}

.static-page .content li {
  margin-bottom: 0.75rem;
}

/* ========================================
   Responsive - Detail Pages
   ======================================== */
@media (max-width: 768px) {
  .detail-page {
    padding: 0 1rem;
  }

  .page-header {
    padding: 2rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
  }

  .page-header::after {
    right: 1rem;
    top: 1rem;
  }

  .page-header h1 {
    line-height: 1.25;
  }

  .set-switcher {
    padding: 1.5rem 1.5rem;
  }

  .set-buttons {
    gap: 0.5rem;
  }

  .set-btn {
    min-width: 44px;
    height: 44px;
  }

  .worksheet-content {
    padding: 2rem 1.5rem;
  }

  .worksheet-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .worksheet-title {
  }

  .worksheet-meta {
    align-self: stretch;
    text-align: center;
  }

  .problems-grid {
    column-count: 1;
    column-gap: 0;
  }

  .problem {
    padding: 1.125rem 1.25rem;
    gap: 1rem;
  }

  .problem .num {
    min-width: 2.25rem;
    height: 2.25rem;
  }

  .problem .blank,
  .problem .answer {
    min-width: 3.5rem;
  }

  .actions {
    gap: 0.75rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    width: 100%;
    justify-content: center;
  }

  .intro {
    padding: 1.5rem 1.5rem;
  }

  .intro::before {
    left: -0.75rem;
    width: 3rem;
    height: 3rem;
  }

  .body-content {
    padding: 2rem 1.5rem;
  }

  .body-content--collapsible {
    padding: 1rem;
  }

  .content-toggle > summary {
    padding: 0.85rem 0.95rem;
  }

  .content-toggle-panel {
    padding: 0.3rem 0.95rem 0.95rem;
  }

  .seo-components,
  .seo-components--primary,
  .seo-more-grid {
    grid-template-columns: 1fr;
  }

  .seo-block {
    padding: 1.25rem 1rem;
  }

  .homepage > .content {
    padding: 1.5rem 1.25rem;
  }

  .intro-section {
    padding: 1.5rem 1.5rem;
  }

  .content-section {
    padding: 2rem 1.5rem;
  }

  .page-navigation {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-nav {
    text-align: center;
    width: 100%;
  }

  /* Mobile breadcrumb */
  .breadcrumb {
  padding: 0;
  }

  .breadcrumb ol {
  }

  .breadcrumb li:first-child a::before {
    margin-right: 0.25rem;
  }

  /* Reduce animations on mobile */
  .problem:hover {
    transform: none;
  }
}

/* ========================================
   Responsive - Mobile Answer Input
   ======================================== */
@media (max-width: 768px) {
  .answer-input {
    width: 4rem;
    padding: 0.3rem 0.4rem;
  }

  .score-inner {
    padding: 1rem 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .score-icon {
    font-size: 1.75rem;
  }

  .score-text {
    flex-wrap: wrap;
  }

  .score-text strong {
    font-size: 1.35rem;
  }

  .score-pct {
    font-size: 1.5rem;
  }
}

/* ========================================
   Responsive - Homepage and List Pages
   ======================================== */
@media (max-width: 768px) {
  .homepage,
  .list-page,
  .static-page {
    padding: 0 1rem;
  }

  .hero h1 {
  }

  .hero .subtitle {
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .subcategories-grid,
  .worksheets-grid {
    grid-template-columns: 1fr;
  }

  .static-page .content {
    padding: 2rem 1.5rem;
  }
}
