/* ====== RESET ====== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ====== TOKENS ====== */
:root {
  --blue:        #1a5fa8;
  --blue-dark:   #0f3d6e;
  --blue-light:  #e8f0fb;
  --orange:      #e07b3a;
  --orange-dark: #b85e22;
  --text:        #2a2a2a;
  --text-muted:  #666;
  --text-light:  #999;
  --border:      #e2e2e2;
  --bg:          #f5f6f8;
  --white:       #fff;
  --max:         1100px;
  --radius:      8px;
  --radius-sm:   4px;
}

/* ====== BASE ====== */
body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5 { line-height: 1.3; }

/* ====== LAYOUT ====== */
.site-wrap { display: flex; flex-direction: column; min-height: 100vh; }
.site-main  { flex: 1; max-width: var(--max); width: 100%; margin: 0 auto; padding: 0 20px 60px; }

/* ====== HEADER ====== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: center;
}
.site-logo { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; flex-shrink: 0; }
.site-logo:hover { text-decoration: none; }
.logo-ebook  { color: var(--blue); }
.logo-sphere { color: var(--orange); }

.site-nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.site-nav a { font-size: 13px; color: var(--text-muted); transition: color 0.15s; }
.site-nav a:hover { color: var(--blue); text-decoration: none; }
.site-nav .nav-craft { color: var(--orange); font-weight: 600; }

/* ====== BUTTONS ====== */
.btn-primary {
  background: var(--blue);
  color: var(--white) !important;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; }

.btn-buy {
  display: block;
  background: var(--orange);
  color: var(--white) !important;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s;
  margin-top: 10px;
}
.btn-buy:hover { background: var(--orange-dark); text-decoration: none; }
.btn-buy--large { font-size: 17px; padding: 16px 28px; }

/* ====== HERO ====== */
.hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
  padding: 52px 20px 48px;
  text-align: center;
  margin: 0 -20px 40px;
}
.hero-inner { max-width: 620px; margin: 0 auto; }
.hero-eyebrow { color: rgba(255,255,255,0.75); font-size: 13px; letter-spacing: 0.5px; margin-bottom: 12px; }
.hero-headline { color: #fff; font-size: 30px; font-weight: 700; margin-bottom: 10px; }
.hero-sub { color: rgba(255,255,255,0.8); font-size: 15px; margin-bottom: 28px; }
.hero-search { display: flex; gap: 8px; max-width: 440px; margin: 0 auto; }
.hero-search input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.hero-search button {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.hero-search button:hover { background: var(--orange-dark); }

/* ====== CRAFT CALLOUT ====== */
.craft-callout {
  background: linear-gradient(135deg, #1a6b4a 0%, #2db37e 100%);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 40px;
}
.craft-inner { display: flex; align-items: center; gap: 32px; }
.craft-text { flex: 1; }
.craft-label {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.craft-text h2 { color: #fff; font-size: 22px; margin-bottom: 6px; }
.craft-text p  { color: rgba(255,255,255,0.85); font-size: 14px; margin-bottom: 14px; }
.craft-price   { color: #fff; font-size: 26px; font-weight: 700; margin-bottom: 16px; }
.craft-image { display: flex; justify-content: center; align-items: center; }
.craft-image img { max-width: 600px; width: 100%; border-radius: var(--radius-sm); }

/* ====== CATALOG SECTION ====== */
.catalog-section { }
.catalog-heading { font-size: 22px; color: var(--blue); margin-bottom: 20px; }

/* Category rows on homepage */
.cat-row { margin-bottom: 48px; }
.cat-row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--blue-light);
  padding-bottom: 8px;
}
.cat-row-title { font-size: 18px; color: var(--blue-dark); font-weight: 700; }
.cat-row-more  { font-size: 13px; color: var(--blue); white-space: nowrap; }
.cat-row-more:hover { text-decoration: underline; }
.cat-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }

.cat-pill {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--white);
  transition: all 0.15s;
  cursor: pointer;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--blue-light);
  border-color: #b0c8ee;
  color: var(--blue);
  text-decoration: none;
}

.cat-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* ====== BOOK GRID ====== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.book-grid--related { grid-template-columns: repeat(4, 1fr); }

.book-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.book-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.book-cover-link { display: block; }
.book-cover { width: 100%; height: auto; display: block; }
.book-cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(145deg, var(--blue-dark), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 40px;
  font-weight: 700;
}

.book-info { padding: 12px; }
.book-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.book-title a { color: var(--text); }
.book-title a:hover { color: var(--blue); text-decoration: none; }
.book-tagline { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.4; }
.book-meta { font-size: 11px; color: var(--text-light); display: flex; gap: 8px; margin-bottom: 6px; }
.book-price { font-size: 15px; font-weight: 700; color: var(--blue); margin-bottom: 6px; }
.book-tags  { display: flex; flex-wrap: wrap; gap: 4px; }
.book-tags .tag-pill { font-size: 11px; padding: 2px 8px; }

.empty-catalog { color: var(--text-muted); padding: 40px 0; }

/* ====== EBOOK PAGE ====== */
.ebook-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  margin-top: 24px;
}

.ebook-sidebar { }
.ebook-cover {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.ebook-cover-placeholder {
  width: 100%;
  height: 280px;
  background: linear-gradient(145deg, var(--blue-dark), var(--blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 60px;
  font-weight: 700;
  margin-bottom: 20px;
}

.price-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 20px;
}
.price-tag  { font-size: 28px; font-weight: 700; color: var(--blue); }
.price-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; margin-bottom: 4px; }

.ebook-meta-list { list-style: none; }
.ebook-meta-list dt { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.ebook-meta-list dd { font-size: 13px; color: var(--text); font-weight: 600; }

/* Ebook main content */
.ebook-main h1.ebook-title { font-size: 24px; color: var(--text); margin-bottom: 8px; }
.ebook-tagline { font-size: 15px; color: var(--text-muted); margin-bottom: 14px; }

.learn-list { margin: 12px 0 20px 0; padding-left: 0; list-style: none; }
.learn-list li {
  padding: 5px 0 5px 20px;
  position: relative;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.learn-list li::before { content: "→"; position: absolute; left: 0; color: var(--blue); }

.ebook-body { margin-top: 24px; }
.ebook-body p   { margin-bottom: 14px; line-height: 1.7; }
.ebook-body h2  { font-size: 18px; color: var(--blue-dark); margin: 24px 0 10px; }
.ebook-body h3  { font-size: 16px; color: var(--text); margin: 18px 0 8px; }
.ebook-body ul,
.ebook-body ol  { margin: 12px 0 12px 24px; }
.ebook-body li  { margin-bottom: 6px; line-height: 1.6; }

.buy-cta {
  background: var(--blue-light);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-top: 32px;
}
.buy-cta-price { font-size: 28px; font-weight: 700; color: var(--blue); display: block; margin-bottom: 8px; }
.buy-cta-note  { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* ====== RELATED SECTION ====== */
.related-section { margin-top: 48px; }
.related-section h3 { font-size: 18px; margin-bottom: 20px; color: var(--text); }

/* ====== CRAFT PAGE ====== */
.craft-page-hero {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.craft-page-cover { max-width: 260px; border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.craft-page-text h1 { font-size: 28px; margin: 12px 0 8px; }
.craft-page-tagline { font-size: 16px; color: var(--text-muted); margin-bottom: 20px; }
.craft-page-price { font-size: 32px; font-weight: 700; color: var(--blue); margin-bottom: 20px; }
.craft-page-body { max-width: 720px; }
.craft-page-body p  { margin-bottom: 16px; line-height: 1.7; }
.craft-page-body h2 { font-size: 20px; color: var(--blue-dark); margin: 28px 0 12px; }

/* ====== STATIC PAGES ====== */
.page-content { max-width: 720px; margin-top: 24px; }
.page-content h1 { font-size: 26px; margin-bottom: 20px; color: var(--blue-dark); }
.page-content p  { margin-bottom: 16px; line-height: 1.7; }
.page-content h2 { font-size: 20px; margin: 24px 0 10px; }
.page-content ul,
.page-content ol { margin: 12px 0 12px 24px; }

/* ====== BREADCRUMBS ====== */
.breadcrumbs { font-size: 12px; color: var(--text-muted); margin: 16px 0 8px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--blue); }

/* ====== FAQ ====== */
.faq-section { margin: 24px 0; }
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-question { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.faq-answer   { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ====== TABLE ====== */
table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
tr:nth-child(even) { background: #fafafa; }

/* ====== ERROR PAGE ====== */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 28px; margin-bottom: 16px; }
.error-page p  { color: var(--text-muted); margin-bottom: 24px; }

/* ====== FOOTER ====== */
.site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.8);
  margin-top: 60px;
  padding: 40px 20px;
}
.footer-inner { max-width: var(--max); margin: 0 auto; text-align: center; }
.footer-brand { margin-bottom: 20px; }
.footer-brand .logo-ebook  { color: #fff; font-size: 18px; font-weight: 700; }
.footer-brand .logo-sphere { color: var(--orange); font-size: 18px; font-weight: 700; }
.footer-brand p { font-size: 13px; margin-top: 8px; color: rgba(255,255,255,0.6); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; justify-content: center; }
.footer-links a { font-size: 13px; color: rgba(255,255,255,0.7); }
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.45); }

/* ====== RESPONSIVE ====== */
@media (max-width: 800px) {
  .ebook-layout { grid-template-columns: 1fr; }
  .ebook-sidebar { display: flex; gap: 20px; align-items: flex-start; }
  .ebook-cover, .ebook-cover-placeholder { width: 140px; flex-shrink: 0; }
  .craft-inner { flex-direction: column; }
  .craft-page-hero { flex-direction: column; }
  .craft-page-cover { max-width: 200px; }
}

@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; }
  .site-nav { display: none; }
  .hero-headline { font-size: 22px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .ebook-sidebar { flex-direction: column; }
  .ebook-cover, .ebook-cover-placeholder { width: 100%; }
}