/* 基础样式 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f7;
  --bg-alt: #ffffff;
  --text: #222222;
  --text-muted: #666666;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e4e4e7;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.07);
  --radius-lg: 14px;
  --radius-xl: 22px;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: linear-gradient(180deg, #f8fafc, #f4f4f5);
  color: var(--text);
}

/* 容器 */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

/* 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.nav a {
  margin-left: 1rem;
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.nav a:hover {
  color: var(--accent);
}

/* Hero 区 */
.hero {
  padding: 3rem 0 2rem;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.hero-text {
  max-width: 640px;
  background: var(--bg-alt);
  padding: 2rem 1.8rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.hero h1 {
  font-size: 2.2rem;
  margin: 0 0 0.4rem;
}

.hero-subtitle {
  margin: 0.4rem 0;
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-subtitle-cn {
  margin-top: 0.6rem;
}

.hero-button {
  display: inline-block;
  margin-top: 1.2rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.hero-button:hover {
  filter: brightness(1.05);
}

/* Section 通用 */
.section {
  padding: 2.2rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section h2 {
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
}

.section-subtitle {
  margin: 0.3rem 0 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.section-note,
.section-note-cn {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.section-divider {
  margin: 1.4rem 0 0.8rem;
  border: none;
  border-top: 1px dashed var(--border);
}

/* Week Placeholder (Garmin 区) */
.week-placeholder {
  margin-top: 1.3rem;
  padding: 1.2rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--accent-soft);
}

.week-figure {
  margin: 0.8rem 0;
}

.week-img {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

.week-caption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}



/* Training Log 卡片 */
.log-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr;
  gap: 1.2rem;
  margin-top: 1rem;
}

.log-card {
  padding: 1.1rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.log-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.log-meta {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.log-list {
  margin: 0 0 0.7rem 1.1rem;
  padding: 0;
  font-size: 0.95rem;
}

.log-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 页脚 */
.site-footer {
  margin: 0.1rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-sub {
  font-size: 0.8rem;
}

/* 响应式 */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    margin-top: 0.3rem;
  }

  .hero-inner {
    justify-content: center;
  }

  .hero-text {
    padding: 1.6rem 1.4rem;
  }

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

/* --- Current week page --- */

.week-hero h1 {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
}

.week-meta-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.meta-pill {
  display: inline-flex;
  flex-direction: column;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  font-size: 0.85rem;
}

.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.meta-value {
  font-weight: 500;
}

/* 规划部分布局：左右两列 */
.week-planning-grid {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: 1.4fr 1.2fr;
  gap: 1.5rem;
}

.week-subtitle {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.week-subtitle-margin {
  margin-top: 1.1rem;
}

/* 周目标卡片 */
.week-goal-card,
.week-context-card {
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.week-goal-main {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.week-goal-list,
.week-context-list {
  margin: 0.2rem 0 0 1.1rem;
  padding: 0;
  font-size: 0.9rem;
}

/* 周计划表格 */
.week-table-block {
  margin-top: 1.6rem;
}

.week-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.week-table th,
.week-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

.week-table thead th {
  background: #f3f4f6;
  font-weight: 600;
}

.week-table tbody tr:last-child td {
  border-bottom: none;
}

.week-table.small th,
.week-table.small td {
  font-size: 0.78rem;
  padding: 0.3rem 0.5rem;
}

/* 执行总结：小卡片指标 */
.week-summary-metrics {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-card {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.metric-label {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.week-execution-grid {
  display: block;
}

.week-reflection-card {
  padding: 0.9rem 0.95rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  font-size: 0.9rem;
}

.week-reflection-card h4 {
  margin: 0.2rem 0 0.15rem;
  font-size: 0.95rem;
}

.week-reflection-card p {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
}

/* 小屏幕适配 */
@media (max-width: 900px) {
  .week-planning-grid,
  .week-execution-grid {
    grid-template-columns: 1fr;
  }

  .week-summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .week-summary-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .meta-pill {
    width: 100%;
  }
}

/* Month calendar on index */
#month-calendar {
  margin-top: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0.8rem;
  box-shadow: var(--shadow-soft);
  font-size: 0.85rem;
}

.month-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.month-cal-title {
  font-weight: 600;
}

.month-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.month-cal-cell {
  min-height: 3rem;
  border-radius: 8px;
  padding: 0.2rem 0.3rem;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.month-cal-cell-header {
  font-size: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-cal-daynum {
  font-weight: 600;
}

.month-cal-weekday {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.month-cal-events {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* highlight today */
.month-cal-cell.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* days with planned training */
.month-cal-cell.has-events {
  background: #eef2ff;
  border-color: #e0e7ff;
}

/* Weekly planning calendar (inside week page) */
.week-calendar-block {
  margin-top: 1.5rem;
}

.week-cal-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.week-cal-cell {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0.4rem 0.45rem;
  min-height: 3.2rem;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
}

.week-cal-cell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.week-cal-dayname {
  font-weight: 600;
}

.week-cal-daydate {
  color: var(--text-muted);
}

.week-cal-events {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.week-cal-cell.has-events {
  background: #eef2ff;
  border-color: #e0e7ff;
}

.week-cal-empty {
  font-style: italic;
  opacity: 0.7;
}

@media (max-width: 900px) {
  .week-cal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .week-cal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.week-cal-total {
  font-weight: 600;
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
}

.week-subtitle-margin-small {
  margin-top: 1rem;
}

/* Week executed sessions: alternate background color by day group */
.week-table tbody tr.day-group-even {
  background-color: #ffffff;
}

.week-table tbody tr.day-group-odd {
  background-color: #eef2ff;
}

/* Executed sessions comment column width */
.week-table.small td:nth-child(8),
.week-table.small th:nth-child(8) {
  width: 15%;
  max-width: 25%;
  white-space: normal;
  word-break: break-word;
}
/* --- Collapsible comment styles --- */
.comment-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.comment-text {
  max-width: 100%;
  white-space: pre-wrap;
  font-size: 0.78rem;
  line-height: 1.25rem;
}

.comment-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comment-toggle {
  align-self: flex-start;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fafafa;
  cursor: pointer;
}

.comment-toggle:hover {
  background: #f0f0f0;
}