/* ===========================
   Daily Dose of GHCP — Styles
   GitHub-inspired dark sidebar
   =========================== */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --sidebar-bg: #0d1117;
  --sidebar-text: #c9d1d9;
  --sidebar-muted: #8b949e;
  --sidebar-active: #ffffff;
  --sidebar-hover: #161b22;
  --border: #d0d7de;
  --text: #24292f;
  --text-muted: #57606a;
  --accent: #6e40c9;
  --accent-light: #f0eafb;
  --accent-hover: #5a32a3;
  --link: #0969da;
  --sidebar-active-bg: #21262d;
  --accent-soft: #a371f7;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  --radius: 8px;
  --sidebar-width: 260px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--sidebar-active-bg);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sidebar-logo svg {
  flex-shrink: 0;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-active);
  line-height: 1.3;
}

.sidebar-tagline {
  font-size: 11px;
  color: var(--sidebar-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.sidebar-section {
  padding: 16px 20px 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-muted);
  margin-bottom: 8px;
}

.section-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.section-toggle:hover {
  color: var(--sidebar-active);
}

.section-toggle .chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--sidebar-muted);
}

.section-toggle.is-collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar-section .sidebar-nav {
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}

.sidebar-section.is-collapsed .sidebar-nav {
  max-height: 0;
  opacity: 0;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
  text-decoration: none;
}

.sidebar-nav li a.active {
  font-weight: 600;
  background: var(--sidebar-active-bg);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-active-bg);
  font-size: 11px;
  color: var(--sidebar-muted);
}

/* ── Training Sidebar (Right) ── */
.training-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  border-left: 1px solid var(--sidebar-active-bg);
}

.training-sidebar .sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--sidebar-active-bg);
}

.training-sidebar .sidebar-section {
  padding: 16px 20px 8px;
}

.training-sidebar .sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.training-sidebar .sidebar-nav li a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
  text-decoration: none;
}

.training-sidebar .sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-active-bg);
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-nav a.filter-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
  text-decoration: none;
}

/* ── Main content ── */
.main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.page-header p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 640px;
}

/* ── Welcome banner ── */
.welcome-banner {
  background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #16213e 100%);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a371f7, #79c0ff);
}

.welcome-banner h2 {
  font-size: 20px;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.welcome-banner p {
  font-size: 14px;
  color: var(--sidebar-muted);
  line-height: 1.7;
  max-width: 620px;
}

.welcome-banner p + p {
  margin-top: 8px;
}

/* ── Section heading ── */
.section-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Post cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  text-decoration: none;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.card-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  text-decoration: none;
}

.card-link:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.card-link .arrow {
  transition: transform 0.15s;
}

.card:hover .card-link .arrow {
  transform: translateX(3px);
}

/* ── Post page ── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  margin-bottom: 28px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-back:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--accent-soft);
  text-decoration: none;
}

.post-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-meta .date-badge {
  font-size: 12px;
  font-weight: 600;
  background: #ddf4ff;
  color: #0550ae;
  padding: 2px 10px;
  border-radius: 20px;
}

.post-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

/* ── Post body typography ── */
.post-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.post-body h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.post-body p {
  margin-bottom: 14px;
}

.post-body strong {
  font-weight: 600;
  color: #1f2328;
}

.post-body ul, .post-body ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

.post-body li {
  margin-bottom: 6px;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: #eef1f5;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.post-body pre {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 18px;
}

.post-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--sidebar-text);
  line-height: 1.6;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--accent-hover);
}

.post-body blockquote strong {
  color: var(--accent);
}

.post-body a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.post-body a:hover {
  border-color: var(--link);
  text-decoration: none;
}

/* ── Table ── */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-body th {
  background: #f6f8fa;
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

.post-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.post-body tr:last-child td {
  border-bottom: none;
}

.post-body tr:nth-child(even) td {
  background: #f6f8fa;
}

/* ── Burger menu button (mobile only) ── */
.burger-btn {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #161b22;
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 100%;
  justify-content: center;
}

.burger-btn:hover,
.burger-btn[aria-expanded="true"] {
  background: var(--sidebar-active-bg);
  border-color: var(--accent);
  color: var(--sidebar-active);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .burger-btn {
    display: flex;
  }

  .sidebar-section:not(:first-of-type) {
    display: none;
  }

  .sidebar.nav-open .sidebar-section:not(:first-of-type) {
    display: block;
  }

  .sidebar-title { font-size: 14px; }

  .main {
    padding: 24px 20px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .post-title {
    font-size: 22px;
  }

  .post-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
