@charset "UTF-8";
/* Skin: Handwriting/Tracing — Sunshine Yellow + Sky Blue (Site 013) */

/* Base */
html { scroll-behavior: smooth; }
body {
  background: var(--gradient-body);
  background-attachment: fixed;
  color: var(--site-text);
  font-family: var(--font-body);
}

.detail-page { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-heading); }

.page-header h1 {
  font-size: 2rem;
  font-weight: 400;
  color: var(--site-primary-dark);
  line-height: 1.3;
  font-family: var(--font-heading);
}

/* Hero */
.page-header {
  background: linear-gradient(180deg, #ffffff 0%, var(--site-primary-light) 100%);
  border-bottom: 2px solid var(--site-primary-border);
  padding: 1.5rem 1.5rem 1rem;
}

.hero {
  background: linear-gradient(160deg, #fffbeb 0%, #ffffff 60%, #f0f9ff 100%);
  border-bottom: 3px solid var(--site-primary-border);
  padding: 3.5rem 2rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Pencil-stripe ruling decoration */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--site-primary) 0px, var(--site-primary) 8px, var(--site-accent) 8px, var(--site-accent) 16px);
  opacity: 0.35;
  pointer-events: none;
}

/* Warm blob decoration */
.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -80px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(251,191,36,0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 400;
  color: var(--site-primary-dark);
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--site-text-muted);
  margin-top: 0.75rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* Hero stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.stat-item {
  text-align: center;
  padding: 1rem 1.5rem;
  background: var(--gradient-stat-badge);
  border: 1.5px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  min-width: 120px;
  transition: transform var(--dur-normal) var(--ease);
}
.stat-item:hover { transform: translateY(-2px); }
.stat-number { display: block; font-size: 1.7rem; font-weight: 400; color: var(--site-primary-dark); font-family: var(--font-heading); }
.stat-label  { display: block; font-size: 0.8rem; color: var(--site-text-muted); margin-top: 0.2rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* Breadcrumb */
.breadcrumb {
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
}
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin: 0; font-size: 0.875rem; color: var(--site-text-muted); }
.breadcrumb a { color: var(--site-primary-dark); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--site-primary-hover); text-decoration: underline; }
.breadcrumb li:not(:last-child)::after { content: '›'; color: var(--site-primary-hover); font-weight: 700; margin-left: 0.3rem; }
.breadcrumb li:last-child { color: var(--site-text); font-weight: 700; }

/* Grade level badges */
.variant-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  color: var(--site-accent-dark);
  background: #e0f2fe;
  border: 1.5px solid #bae6fd;
  letter-spacing: 0.03em;
}

/* Set Switcher */
.set-switcher { background: var(--site-surface); border: 1.5px solid var(--site-primary-border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
.set-switcher-label { font-size: 1rem; font-weight: 700; color: var(--site-text); font-family: var(--font-heading); }
.set-btn {
  background: #ffffff;
  border: 2px solid var(--site-border);
  border-radius: var(--radius-button);
  color: var(--site-text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-heading);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.set-btn:hover  { border-color: var(--site-primary); background: var(--site-primary-light); box-shadow: 0 0 0 3px rgba(251,191,36,0.15); }
.set-btn.active { background: var(--site-primary); color: var(--site-primary-dark); border-color: var(--site-primary-hover); box-shadow: var(--shadow-btn-brand); }

/* Buttons */
.btn {
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-button);
  background: #ffffff;
  color: var(--site-text);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-heading);
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  min-height: 44px;
}
.btn:hover  { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.97); box-shadow: var(--shadow-btn-active); }
.btn:focus-visible { outline: 3px solid var(--site-primary); outline-offset: 3px; }

.btn-primary { background: var(--site-primary); color: var(--site-primary-dark); border-color: var(--site-primary-hover); box-shadow: var(--shadow-btn-brand); }
.btn-primary:hover { background: var(--site-primary-hover); color: #ffffff; box-shadow: var(--shadow-card-hover); }

.btn-success, .btn-answers, .btn-check { background: var(--site-accent); color: #ffffff; border-color: var(--site-accent-hover); }
.btn-success:hover, .btn-answers:hover, .btn-check:hover { background: var(--site-accent-hover); }

/* Body Content */
.body-content { background: #ffffff; border-radius: 0 0 var(--radius-card) var(--radius-card); border: 1.5px solid var(--site-primary-border); border-top: none; }
.problems-grid { border-top: 3px solid var(--ruling-line-color); }
.problem { border-bottom: 1.5px solid var(--ruling-line-mid); font-size: 1.125rem; color: var(--site-text); }

/* Intro Section */
.intro, .intro-section {
  background: linear-gradient(135deg, var(--site-primary-light) 0%, #f0f9ff 100%);
  border: 1.5px solid var(--site-primary-border);
  border-left: 4px solid var(--site-primary);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}
.intro h3, .intro-section h3 { font-weight: 400; color: var(--site-primary-dark); font-family: var(--font-heading); }
.intro p,  .intro-section p  { color: var(--site-text-muted); line-height: 1.7; }

/* Page Navigation */
.page-nav, .page-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--site-surface);
  border: 1.5px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}
.page-nav a, .btn-nav { display: inline-flex; align-items: center; padding: 0.5rem 1.25rem; border-radius: var(--radius-button); color: var(--site-primary-dark); text-decoration: none; font-weight: 700; font-size: 0.95rem; font-family: var(--font-heading); transition: background var(--dur-fast) var(--ease); }
.page-nav a:hover, .btn-nav:hover { background: var(--site-primary-light); }
.btn-nav.disabled { color: var(--site-text-light); cursor: not-allowed; }

/* Section Headers */
.section-header { margin: 1.5rem 0 1rem; }
.section-header h2 { font-size: 1.6rem; font-weight: 400; color: var(--site-text); font-family: var(--font-heading); }
.section-header p { color: var(--site-text-muted); margin-top: 0.25rem; }
.section-header h2::after { content: ''; display: block; width: 56px; height: 3px; background: linear-gradient(90deg, var(--site-primary), var(--site-accent)); margin-top: 0.4rem; border-radius: 2px; }

/* Category Cards */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; margin: 1rem 0; }

.category-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.75rem 1.5rem;
  background: #ffffff;
  border: 1.5px solid var(--site-primary-border);
  border-top: 4px solid var(--site-primary);
  border-radius: var(--radius-card-lg);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease), box-shadow var(--dur-normal) var(--ease), border-top-color var(--dur-normal) var(--ease);
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); border-top-color: var(--site-accent); }
.category-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--site-primary), var(--site-accent)); transform: scaleX(0); transition: transform var(--dur-normal) var(--ease); border-radius: 0 0 var(--radius-card-lg) var(--radius-card-lg); }
.category-card:hover::after { transform: scaleX(1); }

.category-icon { font-size: 2.4rem; line-height: 1; flex-shrink: 0; }
.category-card h3 { font-weight: 400; font-size: 1.1rem; color: var(--site-text); margin: 0 0 0.25rem; font-family: var(--font-heading); }
.category-card p  { font-size: 0.875rem; color: var(--site-text-muted); line-height: 1.5; margin: 0; }
.category-meta { font-size: 0.82rem; font-weight: 700; color: var(--site-accent-dark); margin-top: 0.5rem; background: #e0f2fe; border-radius: var(--radius-pill); padding: 0.2rem 0.6rem; display: inline-block; }

/* Subcategory Cards */
.subcategories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.subcategory-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem 1rem;
  background: #ffffff;
  border: 1.5px solid var(--site-primary-border);
  border-top: 3px solid var(--site-primary);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: inherit;
  transition: border-top-color var(--dur-normal) var(--ease), box-shadow var(--dur-normal) var(--ease), transform var(--dur-normal) var(--ease);
}
.subcategory-card:hover { border-top-color: var(--site-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.subcategory-card h3 { font-weight: 400; color: var(--site-text); font-family: var(--font-heading); }
.subcategory-card p  { font-size: 0.875rem; color: var(--site-text-muted); }
.subcategory-arrow   { font-size: 0.85rem; font-weight: 700; color: var(--site-primary-dark); margin-top: auto; font-family: var(--font-heading); }

/* Worksheet Cards */
.worksheets-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.worksheet-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #ffffff;
  border: 1.5px solid var(--site-primary-border);
  border-radius: var(--radius-button);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.worksheet-card:hover { background: var(--site-primary-light); border-color: var(--site-primary); box-shadow: var(--shadow-sm); }
.worksheet-number { font-weight: 700; font-size: 1rem; color: var(--site-primary-dark); min-width: 60px; font-family: var(--font-heading); }
.worksheet-card h3 { font-size: 0.9rem; margin: 0; flex: 1; }
.worksheet-problems { font-size: 0.8rem; color: var(--site-text-light); }

/* Tracing Tool Overrides */
.tr-tool-btn.is-active { border-color: var(--site-primary); background: var(--site-primary-light); }
.tr-tool-btn:focus-visible { outline: 2px solid var(--site-primary); outline-offset: 2px; }
.tr-letter-btn:hover     { border-color: var(--site-primary); }
.tr-letter-btn.is-active { border-color: var(--site-primary); background: var(--site-primary-light); color: var(--site-primary-dark); }
.tr-streak { background: linear-gradient(135deg, var(--site-primary), var(--site-accent)); color: var(--site-primary-dark); }

/* SEO Components */
.seo-components { border-top: 2px solid var(--site-primary-border); padding-top: 1rem; margin: 1.5rem 0; }
.seo-components--primary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.seo-more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }

.seo-block {
  background: #ffffff;
  border: 1.5px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-normal) var(--ease), transform var(--dur-normal) var(--ease);
}
.seo-block:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.seo-card { background: var(--site-background); border-color: var(--site-border); border-top: none; }
.seo-card::before { background: linear-gradient(90deg, var(--site-primary) 0%, var(--site-accent) 100%); }
.seo-card:hover   { box-shadow: 0 0 0 3px rgba(251,191,36,0.18); }

.seo-card.features::before      { background: linear-gradient(90deg, var(--site-primary), var(--site-accent)); }
.seo-card.benefits::before      { background: var(--site-accent); }
.seo-card.faq::before           { background: var(--site-primary-hover); }
.seo-card.tips::before          { background: var(--site-primary); }
.seo-card.steps::before         { background: var(--site-accent-hover); }
.seo-card.tutorial::before      { background: var(--site-accent); }
.seo-card.examples::before      { background: #06b6d4; }
.seo-card.use-cases::before     { background: #a78bfa; }
.seo-card.common-mistakes::before { background: #ef4444; }
.seo-card.practice::before      { background: var(--site-primary); }
.seo-card.requirements::before  { background: #6366f1; }
.seo-card.resources::before     { background: #14b8a6; }
.seo-card.next-steps::before    { background: var(--site-primary-hover); }
.seo-card.summary::before       { background: #64748b; }
.seo-card.related::before       { background: var(--site-accent); }

.seo-block h2, .seo-block h3 { font-weight: 400; color: var(--site-text); font-family: var(--font-heading); }
.seo-block p, .seo-block li  { font-size: 0.9375rem; color: var(--site-text-muted); line-height: 1.65; }
.seo-block a                 { color: var(--site-primary-dark); text-decoration: none; font-weight: 600; }
.seo-block a:hover           { text-decoration: underline; }

/* Animations */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-in  { animation: fadeIn  300ms ease-out both; }
.slide-up { animation: slideUp 300ms ease-out both; }
.category-card { animation: fadeInUp 0.45s ease both; }
.category-card:nth-child(1) { animation-delay: 0s; }
.category-card:nth-child(2) { animation-delay: 0.07s; }
.category-card:nth-child(3) { animation-delay: 0.14s; }
.category-card:nth-child(4) { animation-delay: 0.21s; }
.category-card:nth-child(5) { animation-delay: 0.28s; }
.category-card:nth-child(6) { animation-delay: 0.35s; }

/* Responsive */
@media (max-width: 768px) {
  .detail-page            { padding: 0 1rem; }
  .hero h1                { font-size: 1.9rem; }
  .hero .subtitle         { max-width: 100%; }
  .hero-stats             { gap: 1rem; }
  .stat-number            { font-size: 1.3rem; }
  .categories-grid        { grid-template-columns: 1fr; }
  .subcategories-grid     { grid-template-columns: 1fr; }
  .seo-components--primary { grid-template-columns: 1fr; }
  .seo-more-grid          { grid-template-columns: 1fr; }
  .page-navigation        { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 480px) {
  .detail-page { padding: 0 0.75rem; }
  .hero        { padding: 2rem 1rem 1.5rem; }
  .hero h1     { font-size: 1.6rem; }
  .hero-stats  { flex-direction: column; gap: 0.75rem; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: rgba(251,191,36,0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(251,191,36,0.55); }

/* Selection & Focus */
::selection { background: rgba(251,191,36,0.25); }
:focus-visible { outline: 2.5px solid var(--site-primary); outline-offset: 2px; border-radius: 2px; }

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --site-background:     #110d00;
    --site-background-alt: #1a1200;
    --site-surface:        #1e1600;
    --site-text:           #fef3c7;
    --site-text-muted:     #d6c898;
    --site-text-light:     #a89a72;
    --site-border:         #3a2e00;
    --site-border-dark:    #4a3c00;
    --site-primary-light:  rgba(251,191,36,0.12);
    --site-primary-border: rgba(251,191,36,0.22);
    --ruling-line-color:   rgba(56,189,248,0.18);
    --ruling-line-mid:     rgba(56,189,248,0.08);
    --gradient-body:       linear-gradient(160deg, #110d00 0%, #0f0e00 50%, #001220 100%);
    --gradient-stat-badge: linear-gradient(135deg, rgba(251,191,36,0.10), rgba(56,189,248,0.08));
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.6);
    --shadow-card:       0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
    --shadow-card-hover: 0 12px 28px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.4);
    --shadow-btn-hover:  0 4px 14px rgba(251,191,36,0.25);
    --shadow-btn-active: 0 1px 4px rgba(0,0,0,0.4);
  }

  body { background: var(--gradient-body); background-attachment: fixed; color: var(--site-text); }
  .hero { background: linear-gradient(160deg, #1e1600 0%, #110d00 60%, #001220 100%); border-bottom-color: var(--site-border); }
  .hero h1 { color: var(--site-primary); }
  .hero .subtitle { color: var(--site-text-muted); }
  .hero::before { background: radial-gradient(circle, rgba(251,191,36,0.10), transparent 70%); }
  .stat-item { background: var(--gradient-stat-badge); border-color: var(--site-border); }
  .stat-number { color: var(--site-primary); }
  .page-header { background: linear-gradient(180deg, var(--site-surface) 0%, var(--site-background) 100%); border-bottom-color: var(--site-border); }
  .page-header h1 { color: var(--site-primary); }
  .breadcrumb { }
  .breadcrumb a { color: var(--site-primary); }
  .breadcrumb li:last-child { color: var(--site-text); }
  .category-card { background: var(--site-surface); border-color: var(--site-border); border-top-color: var(--site-primary); }
  .category-card h3 { color: var(--site-text); }
  .subcategory-card { background: var(--site-surface); border-color: var(--site-border); border-top-color: var(--site-primary); }
  .subcategory-card h3 { color: var(--site-text); }
  .worksheet-card { background: var(--site-surface); border-color: var(--site-border); }
  .worksheet-card:hover { background: rgba(251,191,36,0.07); }
  .body-content { background: var(--site-surface); border-color: var(--site-border); }
  .intro, .intro-section { background: linear-gradient(135deg, rgba(251,191,36,0.07) 0%, rgba(56,189,248,0.05) 100%); border-color: var(--site-border); }
  .set-switcher { background: var(--site-surface); border-color: var(--site-border); }
  .set-btn { background: var(--site-surface); border-color: var(--site-border); color: var(--site-text); }
  .set-btn:hover { background: rgba(251,191,36,0.10); }
  .set-btn.active { background: var(--site-primary); color: var(--site-primary-dark); }
  .page-nav, .page-navigation { background: var(--site-surface); border-color: var(--site-border); }
  .seo-block { background: var(--site-surface); border-color: var(--site-border); }
  .seo-block h2, .seo-block h3 { color: var(--site-text); }
  .seo-block p, .seo-block li  { color: var(--site-text-muted); }
  .seo-card { background: var(--site-background); }
  .section-header h2 { color: var(--site-text); }
  .btn { background: var(--site-surface); color: var(--site-text); border-color: var(--site-border); }
  .btn-primary { background: var(--site-primary); color: var(--site-primary-dark); border-color: var(--site-primary-hover); }
  .variant-chip { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.25); color: #7dd3fc; }
  .problem { color: var(--site-text); }
  ::-webkit-scrollbar-track { background: var(--site-background); }
  ::-webkit-scrollbar-thumb { background: rgba(251,191,36,0.25); }
}

/* Reduced Motion */
@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;
  }
}

/* Print */
@media print {
  body { background: #ffffff !important; color: #000000 !important; }
  * { box-shadow: none !important; text-shadow: none !important; }
  a { color: #000000 !important; text-decoration: underline !important; }
  .hero::before, .hero::after { display: none !important; }
  .page-header, .hero, .breadcrumb, .btn, .set-switcher,
  .page-nav, .page-navigation, .seo-components,
  .tr-toolbar, .tr-score, .tr-letter-nav, .tr-streak, .tr-guide-layer,
  .categories-section, .worksheets-section, .subcategories-section { display: none !important; }
  .body-content { border: 1pt solid #ccc !important; border-radius: 0 !important; }
  .category-card, .subcategory-card, .worksheet-card { break-inside: avoid; }
  .category-card::after, .subcategory-card::after { display: none !important; }
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
