/* Dark mode (default) */
:root {
  --bg: #1c1c1e;
  --card: #2c2c2e;
  --text: #f5f5f7;
  --muted: #98989d;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --border: #38383a;
  --excerpt: #c7c7cc;
}

/* Light mode */
[data-theme="light"] {
  --bg: #f5f5f7;
  --card: #fff;
  --text: #1d1d1f;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: #e8e8ed;
  --excerpt: #515154;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
@media (min-width: 900px) {
  .container { padding: 0 64px; }
}

/* Header */
header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
header .container { display: flex; align-items: center; justify-content: space-between; height: 56px; }
header h1 { font-size: 20px; font-weight: 700; }
header h1 a { text-decoration: none; color: var(--text); cursor: pointer; }
nav { display: flex; gap: 4px; }
nav a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; transition: all 0.2s; cursor: pointer; }
nav a:hover { color: var(--text); background: var(--bg); }
nav a.active { color: var(--accent); background: rgba(0,113,227,0.08); }
.theme-btn { font-size: 16px; padding: 8px 10px !important; line-height: 1; }

/* Responsive nav */
@media (max-width: 600px) {
  nav { gap: 2px; }
  nav a { padding: 6px 10px; font-size: 13px; }
}

/* Main */
main { padding: 40px 0 80px; }

/* Home page background */
.page-home {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 40%);
}
[data-theme="light"] .page-home {
  background: linear-gradient(180deg, rgba(0,0,0,0.03) 0%, transparent 40%);
}
.page-home::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://img.harematis.com/marisa.avif') center top / cover no-repeat;
  opacity: 0.08;
  pointer-events: none;
  z-index: -1;
}
[data-theme="light"] .page-home::before {
  opacity: 0.15;
}

/* Section */
.section-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; }
.section { margin-bottom: 48px; }

/* Card grid */
.card-grid { display: grid; gap: 16px; }
.card-grid.cols-2 { grid-template-columns: 1fr 1fr; }

/* Portrait: 2列 → 窄屏1列 */
@media (orientation: portrait) and (max-width: 640px) {
  .card-grid.cols-2 { grid-template-columns: 1fr; }
}

/* Landscape 宽屏: 2列 → 3列，卡片更精致 */
@media (orientation: landscape) and (min-width: 900px) {
  .card-grid.cols-2 { grid-template-columns: repeat(3, 1fr); }
}

/* Card */
.card { background: var(--card); border-radius: 14px; padding: 24px; border: 1px solid var(--border); }
.card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.card .meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.card .meta span { margin-right: 16px; }
.card .excerpt { font-size: 14px; color: var(--excerpt); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .tag { display: inline-block; font-size: 11px; background: rgba(0,113,227,0.08); color: var(--accent); padding: 3px 10px; border-radius: 4px; margin-right: 6px; }
.card .project-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.card .project-link:hover { text-decoration: underline; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header .badge { font-size: 12px; color: var(--muted); background: var(--bg); padding: 3px 12px; border-radius: 10px; }

/* States */
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }
.loading { text-align: center; padding: 40px; color: var(--muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Project detail */
.project-meta { font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.project-url { margin: 12px 0 14px; font-size: 14px; }
.project-url a { color: var(--accent); text-decoration: none; word-break: break-all; }
.project-url a:hover { text-decoration: underline; }
