@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* ========== Reset & Base ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071c9;
  --accent-hover: #0077d5;
  --bg: #f5f5f7;
  --white: #ffffff;
  --text: #1d1d1f;
  --text-light: #6e6e73;
  --text-muted: #86868b;
  --border: #d2d2d7;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 40px rgba(0,0,0,0.10);
  --radius: 18px;
  --radius-sm: 12px;
  --header-height: 48px;
  --sidebar-width: 260px;
  --frontend-color: #0071c9;
  --java-color: #e34c26;
  --python-color: #2d7d46;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Noto Sans SC", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Noto Sans SC", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Helvetica Neue", sans-serif;
  font-weight: 600;
}

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

ul, ol {
  list-style: none;
}

/* ========== Header (Apple glass bar) ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(251,251,253,0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 0.5px solid rgba(0,0,0,0.12);
}

.logo {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.021em;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0071c9, #34c759);
  border-radius: 7px;
  font-size: 15px;
  color: white;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  border-radius: 980px;
  transition: all 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
  background: rgba(0,0,0,0.04);
}

.nav-link.active {
  color: var(--white);
  background: var(--accent);
  font-weight: 500;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ========== Main Container ========== */
.main {
  margin-top: var(--header-height);
  flex: 1 0 auto;
}

/* ========== Homepage Hero ========== */
.home-hero {
  background: var(--white);
  color: var(--primary);
  text-align: center;
  padding: 69px 24px 22px;
  position: relative;
  overflow: hidden;
  border-bottom: 0.5px solid var(--border);
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(ellipse at center, rgba(0,113,201,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero h1 {
  font-size: 48px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  position: relative;
}

.home-hero p {
  font-size: 19px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 400;
  position: relative;
}

/* ========== Homepage Courses ========== */
.home-courses {
  padding: 80px 24px 96px;
  background: var(--bg);
}

.home-courses-inner {
  max-width: 980px;
  margin: 0 auto;
}

.section-title {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  text-align: center;
  color: var(--primary);
}

.section-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 48px;
  line-height: 1.5;
}

/* ========== Category Cards ========== */
.categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.category-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 48px 32px 40px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow);
}

.category-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-hover);
}

.category-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: block;
}

.category-card h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  color: var(--card-color, var(--primary));
}

.category-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.category-card .day-count {
  display: inline-block;
  margin-top: 20px;
  padding: 6px 18px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  background: var(--card-color, var(--accent));
  letter-spacing: -0.01em;
}

/* ========== Category Page Layout ========== */
.category-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  gap: 20px;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow);
  padding: 0;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 0;
}

.sidebar-header h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.sidebar-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

.sidebar-list {
  padding: 0;
}

.sidebar-item {
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  border-left: 3px solid transparent;
  display: block;
  line-height: 1.42859;
  color: var(--text);
}

.sidebar-item:hover {
  background: var(--bg);
}

.sidebar-item.active {
  background: rgba(0,113,201,0.08);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-item .day-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-item.active .day-label {
  color: var(--accent);
}

.content {
  flex: 1;
  min-width: 0;
}

/* ========== Article Page ========== */
.article-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 48px;
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow);
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 0.5px solid var(--border);
}

.article-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 400;
}

.article-breadcrumb a {
  color: var(--accent);
}

.article-breadcrumb a:hover {
  text-decoration: underline;
}

.article-breadcrumb .sep {
  margin: 0 6px;
}

.article-title {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  color: var(--primary);
}

.article-day-tag {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.article-body h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 16px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--primary);
}

.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px;
  letter-spacing: 0.02em;
  color: var(--primary);
}

.article-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.article-body ul, .article-body ol {
  margin: 12px 0 16px 20px;
}

.article-body ul {
  list-style: disc;
}

.article-body ol {
  list-style: decimal;
}

.article-body li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.article-body code {
  background: rgba(0,0,0,0.04);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  color: #d73a49;
  font-weight: 500;
}

.article-body pre {
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.71429;
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.article-body .tip-box {
  background: #f0f6ff;
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0;
}

.article-body .tip-box p {
  color: var(--text);
  margin-bottom: 0;
}

.article-body .tip-box strong {
  color: var(--accent);
}

/* ========== Article Nav ========== */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 0.5px solid var(--border);
}

.article-nav a {
  padding: 12px 24px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-nav a:hover {
  background: var(--bg);
}

/* ========== Day Grid ========== */
.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.day-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 24px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-left: 3px solid var(--accent);
}

.day-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow);
}

.day-card .day-num {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  color: var(--accent);
}

.day-card h4 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.022em;
  color: var(--primary);
}

.day-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.42859;
}

/* ========== Pagination ========== */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  color: var(--white);
  background: var(--accent);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.page-btn:hover {
  background: var(--accent-hover);
}

.page-btn.disabled {
  color: var(--text-muted);
  background: var(--bg);
  cursor: not-allowed;
}

.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-num:hover {
  background: var(--bg);
  color: var(--primary);
}

.page-num.active {
  color: var(--white);
  background: var(--accent);
  cursor: default;
}

/* ========== Footer ========== */
.footer {
  background: var(--bg);
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  font-size: 13px;
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}

/* ========== Search ========== */
.search-box {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 0;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  outline: none;
  transition: all 0.3s ease;
  color: var(--text);
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,113,201,0.15);
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .categories {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }

  .home-hero h1 {
    font-size: 32px;
  }

  .home-hero {
    padding: 72px 24px 56px;
  }

  .home-courses {
    padding: 60px 24px 68px;
  }

  .section-title {
    font-size: 28px;
  }

  .category-layout {
    flex-direction: column;
    padding: 16px;
  }

  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }

  .article-container {
    padding: 28px;
  }

  .article-title {
    font-size: 24px;
  }

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

@media (max-width: 600px) {
  .nav {
    display: none;
  }

  .nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(251,251,253,0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 12px;
    border-bottom: 0.5px solid rgba(0,0,0,0.12);
  }

  .mobile-toggle {
    display: block;
  }

  .home-hero {
    padding: 48px 20px 40px;
  }

  .home-hero h1 {
    font-size: 32px;
  }

  .home-hero p {
    font-size: 17px;
  }

  .home-courses {
    padding: 48px 16px 56px;
  }

  .section-title {
    font-size: 28px;
  }

  .section-subtitle {
    font-size: 17px;
    margin-bottom: 36px;
  }

  .category-card {
    padding: 32px 24px;
  }

  .category-card h3 {
    font-size: 22px;
  }

  .article-container {
    padding: 24px 20px;
  }

  .article-title {
    font-size: 24px;
  }

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

  .pagination {
    gap: 4px;
  }

  .page-num {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .page-btn {
    padding: 6px 16px;
    font-size: 14px;
  }
}