/* Canonical reading base lives in /book-base.css (home/book-base.css). */
@import url("/book-base.css");

/* Stoic Philosophy Book Stylesheet */
:root {
  color-scheme: light;
  --bg-primary: #fdf6e9;
  --bg-surface: #fffaf0;
  --bg-hover: #f5ebd9;
  --bg-accent: #ead9bf;
  --text-primary: #2c221a;
  --text-secondary: #6e5e50;
  --text-muted: #8b7363;
  --accent: #b5451d;
  --accent-hover: #8a3414;
  --accent-soft: rgba(181, 69, 29, 0.08);
  --border: rgba(44, 34, 26, 0.14);
  --border-light: rgba(44, 34, 26, 0.08);
  --shadow-sm: 0 2px 6px rgba(44, 34, 26, 0.04);
  --shadow-md: 0 6px 18px rgba(44, 34, 26, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #1c1612;
  --bg-surface: #2a221c;
  --bg-hover: #342a22;
  --bg-accent: #3a2e26;
  --text-primary: #f3e6d4;
  --text-secondary: #bdafa3;
  --text-muted: #a69280;
  --accent: #f0b089;
  --accent-hover: #ffd0a8;
  --accent-soft: rgba(240, 176, 137, 0.12);
  --border: rgba(243, 230, 212, 0.18);
  --border-light: rgba(243, 230, 212, 0.10);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--site-font-sans, "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: 1rem;
  line-height: 1.62;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: #b5451d; font-weight: 600; }
a:hover, a:focus-visible { color: #8a3414; }
html[data-theme="dark"] a { color: #f0b089; }
html[data-theme="dark"] a:hover, html[data-theme="dark"] a:focus-visible { color: #ffd0a8; }

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.6rem 1.25rem 4.5rem;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-primary);
}

h2 {
  margin: 2.3rem 0 0.65rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  scroll-margin-top: 5rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.35rem;
}

h3 {
  margin: 1.4rem 0 0.45rem;
  font-size: 1.18rem;
  scroll-margin-top: 5rem;
  color: var(--text-primary);
}

p, li { font-size: 1.05rem; }
p { margin: 0 0 0.95rem; }
.lead {
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.deva, .greek {
  font-weight: 400;
  font-synthesis: none;
}
.greek {
  font-style: italic;
  font-family: "Palatino Linotype", "Times New Roman", Times, Georgia, serif;
}

ol, ul { margin: 0 0 1rem; padding: 0 0 0 1.25rem; }
li { margin: 0 0 0.55rem; }

.where {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.where a { text-decoration: none; color: inherit; }
.where a:hover { color: var(--accent); }
.where .sep { color: var(--text-muted); padding: 0 0.25rem; }

.step {
  display: flex;
  gap: 1rem;
  margin: 0.3rem 0 1.2rem;
  font-size: 0.95rem;
}
.step a {
  text-decoration: none;
  font-weight: 650;
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.step a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.step-next { margin-left: auto; }

/* Table of Contents */
.toc {
  margin: 0 0 1.3rem;
  padding: 0.85rem 1rem 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.toc strong { display: block; margin-bottom: 0.4rem; color: var(--text-primary); }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: 0 0 0.25rem; font-size: 0.96rem; }
.toc a { text-decoration: none; color: var(--text-primary); }
.toc a:hover { color: var(--accent); }

/* Feature Portal Grid */
.portal {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 1.2rem 0 1.8rem;
}

@media (min-width: 680px) {
  .portal { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .portal.portal-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.15rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--site-radius-md, 12px);
  text-decoration: none;
  color: inherit;
  font-weight: 450;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover, .card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card:hover::before { opacity: 1; }

.card .kicker {
  color: var(--accent);
  font-weight: 750;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card strong {
  font-size: 1.22rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

.card .desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 0.15rem;
}

/* Callout Boxes */
.callout {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border-radius: 0 var(--site-radius-md, 12px) var(--site-radius-md, 12px) 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}

.callout-title {
  font-weight: 750;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.callout-quote {
  font-style: italic;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 1.1rem 1.3rem;
  border-radius: 0 var(--site-radius-md, 12px) var(--site-radius-md, 12px) 0;
  margin: 1.5rem 0;
}
.callout-quote p:last-child { margin-bottom: 0; }
.callout-quote .author {
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent);
  margin-top: 0.45rem;
}

/* Concentric Circles Visualizer */
.circles-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.4rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.circle-track {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.circle-ring {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  gap: 0.8rem;
  font-size: 0.96rem;
  transition: transform 0.15s;
}

.circle-ring:hover {
  transform: translateX(4px);
  border-color: var(--accent);
}

.circle-num {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--bg-accent);
  color: #8a3414;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
html[data-theme="dark"] .circle-num { color: #f4b084; }

.circle-name { font-weight: 700; min-width: 8rem; color: var(--text-primary); }
.circle-desc { color: var(--text-secondary); font-size: 0.92rem; }

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin: 1.2rem 0 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  background: var(--bg-surface);
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

th {
  font-weight: 750;
  background: var(--bg-accent);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
}

/* Language Toggle */
.lang-toggle-wrap { display: none; }
html:not([data-lang="ne"]) body:not(.show-nepali) .lang-ne { display: none; }
html[data-lang="ne"] .lang-en,
body.show-nepali .lang-en { display: none; }

/* Interactive Exercise Components */
.exercise-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  padding: 1.2rem;
  margin: 1.2rem 0;
  box-shadow: var(--shadow-sm);
}

.exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.exercise-badge {
  font-size: 0.78rem;
  font-weight: 750;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.tag {
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* Filter bar for Enchiridion / Readers */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.filter-btn {
  padding: 0.28rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
