:root {
  --bg: #0a0a0d;
  --bg-raised: #131317;
  --bg-card: #17171c;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #eef0f3;
  --text-dim: #9a9fa8;
  --text-dimmer: #6b6f78;
  --accent: #ff5e1a;
  --accent-2: #ffb020;
  --accent-gradient: linear-gradient(90deg, #ff5e1a, #ffb020);
  --overview: #ff5e1a;
  --teachings: #ffb020;
  --frameworks: #4fc3f7;
  --stories: #b189f5;
  --exercises: #4ade80;
  --quotes: #ff6b9d;
  --radius: 14px;
  --max-width: 1180px;
  --font-display: 'Anton', sans-serif;
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
}

:root[data-theme="light"] {
  --bg: #fbf9f6;
  --bg-raised: #f1efe9;
  --bg-card: #ffffff;
  --border: rgba(20,20,20,0.08);
  --border-strong: rgba(20,20,20,0.16);
  --text: #1a1a1d;
  --text-dim: #5c5e64;
  --text-dimmer: #8b8d93;
  --accent: #e0530f;
  --accent-2: #c97e00;
  --accent-gradient: linear-gradient(90deg, #e0530f, #c97e00);
  --overview: #e0530f;
  --teachings: #c97e00;
  --frameworks: #0f83b0;
  --stories: #8b4fd9;
  --exercises: #1f9d54;
  --quotes: #d43d76;
}

:root[data-theme="light"] .hub-hero h1 {
  background: linear-gradient(180deg, #1a1a1d, #3f4046);
  -webkit-background-clip: text;
  background-clip: text;
}

:root[data-theme="light"] .callout-quote,
:root[data-theme="light"] .day-card,
:root[data-theme="light"] .section {
  box-shadow: 0 1px 3px rgba(20,20,20,0.04);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection { background: var(--accent); color: #0a0a0d; }

a { color: inherit; text-decoration: none; }

/* Progress bar */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent-gradient);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,13,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-home {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.5px;
  margin-right: 14px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-day {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: 8px;
  transition: all 0.15s;
}

.nav-day:hover { color: var(--text); background: var(--bg-raised); }
.nav-day.active { color: #0a0a0d; background: var(--accent-gradient); }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin-left: auto;
}

.search-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dimmer); }

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 200;
}

.search-results.open { display: block; }

.search-result {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.selected { background: var(--bg-raised); }

.search-result-icon { font-size: 18px; flex-shrink: 0; }
.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.search-result-snippet { font-size: 12.5px; color: var(--text-dim); line-height: 1.4; }
.search-result-day {
  font-family: var(--font-heading);
  font-size: 10px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.search-result mark { background: var(--accent); color: #0a0a0d; border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 20px; text-align: center; color: var(--text-dimmer); font-size: 13px; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.theme-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: inline; }

/* Hub page */
.hub-page { max-width: var(--max-width); margin: 0 auto; padding: 60px 24px 100px; }

.hub-hero { text-align: center; margin-bottom: 64px; }

.hub-hero-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--accent-2);
  background: rgba(255,176,32,0.1);
  border: 1px solid rgba(255,176,32,0.3);
  padding: 6px 16px;
  border-radius: 30px;
  margin-bottom: 24px;
}

.hub-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.05;
  margin: 0 0 20px;
  background: linear-gradient(180deg, #ffffff, #b8bcc4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 1px;
}

.hub-hero-sub {
  max-width: 620px;
  margin: 0 auto 40px;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1.6;
}

.hub-hero-stats { display: flex; justify-content: center; gap: 56px; }
.stat-num {
  font-family: var(--font-display);
  font-size: 40px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

.day-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.day-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.day-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.day-card-number {
  font-family: var(--font-display);
  font-size: 44px;
  color: var(--accent);
  opacity: 0.9;
  flex-shrink: 0;
}

.day-card-body { flex: 1; }
.day-card-body h2 { font-family: var(--font-heading); margin: 0 0 4px; font-size: 22px; }
.day-card-tagline { color: var(--text-dim); font-size: 14.5px; margin: 0 0 10px; }
.day-card-meta { font-size: 12px; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.5px; }
.day-card-arrow { font-size: 22px; color: var(--text-dimmer); transition: transform 0.2s, color 0.2s; }
.day-card:hover .day-card-arrow { transform: translateX(4px); color: var(--accent); }

/* Day page */
.day-page { max-width: var(--max-width); margin: 0 auto; padding: 0 24px 80px; }

.day-hero {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.day-hero-number {
  font-family: var(--font-display);
  font-size: 88px;
  line-height: 1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.day-hero-text h1 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 4vw, 38px);
  margin: 0 0 10px;
  font-weight: 600;
}

.day-hero-tagline { color: var(--text-dim); font-size: 17px; margin: 0 0 14px; }

.day-hero-meta { display: flex; gap: 10px; font-size: 13px; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.5px; }
.day-hero-meta .dot { opacity: 0.5; }

.day-layout { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }

.day-sidebar { position: relative; }
.sidebar-sticky { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; }

.toc-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dimmer); margin-bottom: 14px; font-weight: 600; }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list > li { margin-bottom: 4px; }

.toc-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.15s;
}
.toc-main:hover { background: var(--bg-raised); color: var(--text); }
.toc-icon { font-size: 14px; }

.toc-sublist { list-style: none; margin: 2px 0 8px 30px; padding: 0; border-left: 1px solid var(--border); }
.toc-sublist li { margin: 0; }
.toc-sub {
  display: block;
  padding: 5px 0 5px 12px;
  font-size: 12.5px;
  color: var(--text-dimmer);
  line-height: 1.4;
  transition: color 0.15s;
}
.toc-sub:hover { color: var(--accent-2); }

.day-content { min-width: 0; }

/* Toggle sections */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.section > summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  user-select: none;
  border-bottom: 1px solid transparent;
}
.section[open] > summary { border-bottom-color: var(--border); }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after {
  content: '\002B';
  margin-left: auto;
  font-size: 20px;
  color: var(--text-dimmer);
  transition: transform 0.2s;
}
.section[open] > summary::after { content: '\2212'; }

.section-icon { font-size: 20px; }
.section-toggle-hint { display: none; }

.section-overview > summary { border-left: 3px solid var(--overview); }
.section-teachings > summary { border-left: 3px solid var(--teachings); }
.section-frameworks > summary { border-left: 3px solid var(--frameworks); }
.section-stories > summary { border-left: 3px solid var(--stories); }
.section-exercises > summary { border-left: 3px solid var(--exercises); }
.section-quotes > summary { border-left: 3px solid var(--quotes); }

.section-body { padding: 8px 24px 28px; }

.section-intro {
  background: linear-gradient(135deg, rgba(255,94,26,0.08), rgba(255,176,32,0.04));
  border: 1px solid rgba(255,176,32,0.15);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 12px 0 20px;
  font-size: 16px;
}
.section-intro p:first-child { margin-top: 0; }
.section-intro p:last-child { margin-bottom: 0; }

.subsection { padding: 22px 0; border-top: 1px solid var(--border); }
.subsection:first-child { border-top: none; padding-top: 8px; }

.subsection h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
}

.subsection p { margin: 0 0 14px; color: #d4d6da; }
.subsection p:last-child { margin-bottom: 0; }
.subsection ul, .subsection ol { margin: 0 0 14px; padding-left: 22px; color: #d4d6da; }
.subsection li { margin-bottom: 6px; }
.subsection strong { color: var(--accent-2); font-weight: 600; }

/* Quote callouts */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.callout-quote {
  margin: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--quotes);
  border-radius: 10px;
  padding: 20px 20px 18px;
  position: relative;
}

.quote-mark {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--quotes);
  opacity: 0.35;
  line-height: 0.5;
  margin-bottom: 8px;
}

.quote-text { font-size: 15.5px; font-weight: 600; font-style: italic; margin: 0 0 10px; color: var(--text); }
.quote-context { font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.5; }
.quote-context strong { color: var(--accent-2); }

/* Day nav footer */
.day-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.day-nav-link {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.day-nav-link:hover { color: var(--text); border-color: var(--accent); }
.day-nav-link.disabled { opacity: 0.3; border-color: transparent; }
.day-nav-link.home { color: var(--accent-2); }

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); border-color: var(--accent); }

/* Responsive */
@media (max-width: 860px) {
  .day-layout { grid-template-columns: 1fr; }
  .day-sidebar {
    position: fixed;
    top: 0; left: -300px;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-strong);
    padding: 80px 20px 20px;
    z-index: 150;
    transition: left 0.25s;
    overflow-y: auto;
  }
  .day-sidebar.open { left: 0; }
  .sidebar-sticky { position: static; max-height: none; }
  .menu-toggle { display: block; }
  .main-nav { display: none; }
  .search-wrap { max-width: none; }
  .day-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .day-hero-number { font-size: 56px; }
  .day-card-grid { grid-template-columns: 1fr; }
  .hub-hero-stats { gap: 32px; }
}

@media print {
  .site-header, .back-to-top, .day-sidebar, .day-nav-footer, .progress-bar { display: none; }
  .section { break-inside: avoid; border: none; }
  body { background: #fff; color: #000; }
}
