:root {
  --cream: #FAFAF7;
  --white: #FFFFFF;
  --sage: #5A8A6A;
  --sage-light: #EBF3EE;
  --sage-mid: #C4DDCA;
  --sage-dark: #3D6B4A;
  --warm-gray: #6B6860;
  --light-gray: #F0EEE9;
  --border: #E5E3DC;
  --text-primary: #1A1A17;
  --text-secondary: #5C5A54;
  --text-muted: #9B9890;
  --accent: #C4773B;
  --accent-light: #F5EDE3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-display: 'Lora', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
}

/* ─── NAV ─── */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--sage-dark);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--sage-dark); }

.nav-cta {
  background: var(--sage);
  color: var(--white) !important;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px !important;
}

.nav-cta:hover { background: var(--sage-dark); color: var(--white) !important; }

/* ─── SECTION ─── */
section {
  padding: 56px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.section-link {
  font-size: 13px;
  color: var(--sage);
  text-decoration: none;
  font-weight: 500;
}

/* ─── HOMEPAGE HERO ─── */
.hero {
  background: var(--white);
  padding: 72px 40px 64px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  display: inline-block;
  background: var(--sage-light);
  color: var(--sage-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
  max-width: 600px;
  margin: 0 auto 16px;
}

.hero h1 em {
  font-style: italic;
  color: var(--sage);
}

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

.search-bar {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 16px 56px 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(90,138,106,0.12);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--sage);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.search-tags {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-tags span {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  background: var(--light-gray);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-tags span:hover { background: var(--sage-light); color: var(--sage-dark); }

/* ─── CATEGORY PILLS ─── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.category-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
}

.category-card:hover {
  border-color: var(--sage-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 12px;
}

.cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cat-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── WORKSHEET CARDS ─── */
.worksheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.worksheet-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s;
  text-decoration: none;
  display: block;
}

.worksheet-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--sage-mid);
}

.ws-preview {
  aspect-ratio: 3/4;
  background: var(--light-gray);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-preview-inner {
  background: var(--white);
  width: 80%;
  height: 85%;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-line-title {
  height: 8px;
  background: var(--sage-mid);
  border-radius: 4px;
  width: 60%;
}

.ws-line { height: 6px; background: var(--border); border-radius: 4px; }
.ws-line.short { width: 70%; }
.ws-line.med { width: 85%; }

.ws-box-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.ws-box {
  flex: 1;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
}

.ws-dotted {
  height: 16px;
  background: repeating-linear-gradient(90deg, var(--border) 0, var(--border) 4px, transparent 4px, transparent 10px);
  border-radius: 2px;
}

.ws-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.badge-free { background: var(--sage-light); color: var(--sage-dark); }
.badge-new { background: var(--accent-light); color: var(--accent); }
.badge-popular { background: #FEF3C7; color: #92400E; }

.ws-info {
  padding: 14px 16px;
}

.ws-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.4;
}

.ws-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

.ws-grade {
  background: var(--light-gray);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ─── TRENDING ─── */
.trending-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 48px 40px;
}

.trending-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.trending-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.trending-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.trending-tag:hover {
  background: var(--sage-light);
  border-color: var(--sage-mid);
  color: var(--sage-dark);
}

.trending-tag .trend-num {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── FOOTER ─── */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 48px 40px 32px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.7;
  max-width: 260px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-col a:hover { color: var(--sage-dark); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── CATEGORY PAGE ─── */
.category-hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 48px 40px 40px;
}

.category-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  list-style: none;
}

.breadcrumb a {
  color: var(--sage);
  text-decoration: none;
}

.breadcrumb .sep { color: var(--border); }

.cat-hero-body {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.cat-icon-lg {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  background: var(--sage-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.cat-hero-text h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

.cat-hero-text p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.65;
  margin-bottom: 18px;
}

.cat-stats {
  display: flex;
  gap: 24px;
}

.cat-stat {
  font-size: 13px;
  color: var(--text-muted);
}

.cat-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── FILTERS ─── */
.filter-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--sage-light);
  border-color: var(--sage-mid);
  color: var(--sage-dark);
}

.filter-chip.active { font-weight: 600; }

/* ─── CAT PAGE LAYOUT ─── */
.cat-page-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 40px;
  align-items: start;
}

.cat-main-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

/* ─── SIDEBAR ─── */
.sidebar-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
}

.sidebar-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.related-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}

.related-cat-item:last-child { border-bottom: none; }

.related-cat-item:hover .related-cat-name { color: var(--sage); }

.related-cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.related-cat-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.15s;
}

.related-cat-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── PAGINATION ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
}

.page-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  transition: all 0.18s;
}

.page-btn.active {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

.page-btn:hover:not(.active) {
  border-color: var(--sage-mid);
  color: var(--sage-dark);
}

/* ─── SINGLE WORKSHEET PAGE ─── */
.ws-page-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}

.ws-preview-large {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.ws-preview-toolbar {
  background: var(--light-gray);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ws-preview-toolbar span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.ws-page-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ws-page-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.ws-page-dot.active { background: var(--sage); }

.ws-preview-area {
  aspect-ratio: 8.5/11;
  padding: 40px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 600px;
  overflow: hidden;
}

.ws-real-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--sage-mid);
}

.ws-instructions-preview {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--sage-light);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--sage);
}

.ws-exercise {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.ws-ex-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-ex-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--sage-dark);
  flex-shrink: 0;
}

.ws-ex-word {
  font-family: var(--font-display);
  font-size: 15px;
  min-width: 80px;
  color: var(--text-primary);
}

.ws-ex-blanks {
  display: flex;
  gap: 4px;
  flex: 1;
}

.ws-blank-box {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
}

/* ─── WS ACTION PANEL ─── */
.ws-action-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: sticky;
  top: 80px;
}

.ws-action-header {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.ws-action-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.ws-action-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ws-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--light-gray);
  color: var(--text-secondary);
}

.ws-actions {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--sage);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.btn-primary:hover { background: var(--sage-dark); }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--white);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--sage-mid);
  background: var(--sage-light);
}

.ws-details {
  padding: 18px 24px;
}

.ws-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.ws-detail-row:last-child { border-bottom: none; }

.ws-detail-label { color: var(--text-muted); }
.ws-detail-val { font-weight: 500; color: var(--text-primary); }

/* ─── WS DESCRIPTION ─── */
.ws-description {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.ws-description h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.ws-description p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}

.ws-skills-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.ws-skills-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ws-skills-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
}

/* ─── FAQ ─── */
.faq-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.faq-section h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  padding: 16px 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-q .faq-arrow { font-size: 18px; color: var(--text-muted); }

.faq-a {
  padding: 0 28px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── RELATED WORKSHEETS ─── */
.related-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  nav { padding: 0 20px; }
  .nav-links { display: none; }
  .hero { padding: 48px 20px 44px; }
  .hero h1 { font-size: 32px; }
  section { padding: 40px 20px; }
  .trending-section { padding: 40px 20px; }
  footer { padding: 40px 20px 24px; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 24px; }
  .category-hero { padding: 32px 20px; }
  .filter-bar { padding: 12px 20px; }
  .cat-page-layout { grid-template-columns: 1fr; padding: 28px 20px; }
  .ws-page-layout { grid-template-columns: 1fr; padding: 28px 20px; }
  .ws-action-panel { position: static; }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 26px; }
  .worksheet-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr; }
  .cat-hero-body { flex-direction: column; gap: 16px; }
  .cat-hero-text h1 { font-size: 26px; }
}

@media print {
  nav, .search-bar, .trending-section, footer, .ws-actions { display: none; }
}
