/* CS336 Chinese Course - Style */
:root {
  --stanford-red: #8C1515;
  --stanford-dark: #2e2d29;
  --bg-primary: #fafaf8;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #888;
  --border-light: #e8e5e0;
  --accent-blue: #0070c9;
  --accent-green: #2d8a56;
  --code-bg: #f5f2ee;
  --sidebar-width: 260px;
  --header-height: 60px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.8;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--stanford-red);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-header .logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  color: #fff;
}

.site-header .logo span {
  font-weight: 300;
  opacity: 0.9;
  margin-left: 8px;
  font-size: 0.9rem;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 20px;
}

.site-header nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.site-header nav a:hover {
  color: #fff;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 16px;
}

.sidebar-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 8px;
}

.sidebar a {
  display: block;
  padding: 6px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.5;
}

.sidebar a:hover {
  background: #f5f2ee;
  color: var(--text-primary);
}

.sidebar a.active {
  background: #fef0f0;
  color: var(--stanford-red);
  font-weight: 600;
}

.sidebar .lecture-num {
  display: inline-block;
  width: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 40px 48px 80px;
  max-width: 900px;
}

/* Hero section (index page) */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--stanford-red);
  margin-bottom: 12px;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hero .meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Content typography */
.content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--stanford-red);
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--stanford-dark);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 12px;
}

.content p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.content ul,
.content ol {
  margin: 12px 0 16px 24px;
}

.content li {
  margin-bottom: 6px;
}

.content strong {
  font-weight: 600;
}

/* Code blocks */
.content code {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

.content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  border-color: var(--stanford-red);
  box-shadow: 0 4px 12px rgba(140, 21, 21, 0.08);
  transform: translateY(-2px);
}

.card .card-tag {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-weight: 600;
}

.card .card-tag.basics, .tag.basics { background: #e8f5e9; color: #2e7d32; }
.card .card-tag.systems, .tag.systems { background: #e3f2fd; color: #1565c0; }
.card .card-tag.scaling, .tag.scaling { background: #fff3e0; color: #e65100; }
.card .card-tag.data, .tag.data { background: #f3e5f5; color: #7b1fa2; }
.card .card-tag.alignment, .tag.alignment { background: #fce4ec; color: #c62828; }

.card h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Info box */
.info-box {
  background: #fef9ef;
  border-left: 4px solid #f0a500;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}

.info-box.tip {
  background: #f0faf5;
  border-left-color: var(--accent-green);
}

.info-box.important {
  background: #fef0f0;
  border-left-color: var(--stanford-red);
}

.info-box p {
  margin: 0;
  font-size: 0.92rem;
}

.info-box p:first-child {
  font-weight: 600;
  margin-bottom: 4px;
}

/* Math formula style */
.formula {
  background: var(--code-bg);
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  margin: 16px 0;
  font-family: "Times New Roman", serif;
  font-size: 1.1rem;
  overflow-x: auto;
}

/* Table */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.92rem;
}

.content th {
  background: var(--code-bg);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-light);
}

.content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}

.content tr:hover {
  background: #faf9f7;
}

/* Navigation between lectures */
.lecture-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.lecture-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--stanford-red);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: all 0.2s;
}

.lecture-nav a:hover {
  border-color: var(--stanford-red);
  background: #fef0f0;
}

/* Assignment card specific */
.assignment-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

.assignment-card h3 {
  color: var(--stanford-red);
  margin-bottom: 12px;
}

.assignment-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.assignment-tasks li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  font-size: 0.92rem;
}

.assignment-tasks li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--accent-green);
  font-weight: bold;
}

/* Footer */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 24px 48px;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.site-footer a {
  color: var(--stanford-red);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .main-content,
  .site-footer {
    margin-left: 0;
  }
  .main-content {
    padding: 24px 20px 60px;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
}

/* Mobile hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  margin-right: 12px;
}

@media (max-width: 900px) {
  .menu-toggle {
    display: block;
  }
  .sidebar.open {
    display: block;
    z-index: 500;
  }
}

/* Progress indicator for lecture pages */
.lecture-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.lecture-progress .tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
