/* 护苗计划 · 兴趣启航篇 — Design System */

:root {
  --ink: #0E1F3A;
  --ink-2: #1B2E4F;
  --ink-3: #2A3E63;
  --paper: #FBF7F1;
  --paper-2: #F2EBDE;
  --paper-3: #E8DFCE;
  --line: rgba(14,31,58,0.12);
  --line-strong: rgba(14,31,58,0.24);
  --accent: #E86A3C;       /* coral */
  --accent-dim: #C9542A;
  --accent-2: #F2B04A;     /* amber */
  --accent-2-dim: #D6932C;
  --leaf: #5E8A5A;
  --muted: #6B7A92;
  --ok: #2E7D5B;
  --danger: #B23A2F;
  --shadow-sm: 0 1px 2px rgba(14,31,58,0.06), 0 1px 1px rgba(14,31,58,0.04);
  --shadow-md: 0 4px 16px rgba(14,31,58,0.08), 0 1px 3px rgba(14,31,58,0.05);
  --shadow-lg: 0 20px 50px rgba(14,31,58,0.12), 0 4px 12px rgba(14,31,58,0.06);
  --radius: 8px;
  --radius-lg: 14px;
  --charm-bg: none;
}

/* ===== THEME: Charming (garden / storybook) ===== */
:root[data-theme="charm"] {
  --ink: #3B2A3F;          /* deep plum ink */
  --ink-2: #5A4561;
  --ink-3: #77627E;
  --paper: #FBF4E8;        /* warm ivory */
  --paper-2: #F5E8D4;      /* butter */
  --paper-3: #EBD9BC;
  --line: rgba(59,42,63,0.14);
  --line-strong: rgba(59,42,63,0.28);
  --accent: #D97757;       /* terracotta */
  --accent-dim: #B55A3D;
  --accent-2: #E8B4B8;     /* dusty rose */
  --accent-2-dim: #C98E93;
  --leaf: #7A9B6E;         /* sage */
  --muted: #9A8592;
  --ok: #5A8A6E;
  --danger: #B23A2F;
  --shadow-sm: 0 1px 2px rgba(59,42,63,0.06), 0 1px 1px rgba(59,42,63,0.04);
  --shadow-md: 0 6px 20px rgba(59,42,63,0.08), 0 2px 4px rgba(59,42,63,0.05);
  --shadow-lg: 0 24px 56px rgba(59,42,63,0.14), 0 6px 16px rgba(59,42,63,0.08);
  --radius: 12px;
  --radius-lg: 22px;
  --charm-bg:
    radial-gradient(circle at 10% 12%, rgba(232,180,184,0.22) 0, transparent 38%),
    radial-gradient(circle at 92% 8%, rgba(122,155,110,0.16) 0, transparent 40%),
    radial-gradient(circle at 88% 96%, rgba(217,119,87,0.14) 0, transparent 42%),
    radial-gradient(circle at 6% 92%, rgba(232,176,74,0.18) 0, transparent 44%);
}
:root[data-theme="charm"] body {
  background: var(--paper);
  background-image: var(--charm-bg);
  background-attachment: fixed;
}
/* Sprinkled dots pattern on section dividers */
:root[data-theme="charm"] .section { border-top: 1px dashed var(--line-strong); }
:root[data-theme="charm"] .card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
:root[data-theme="charm"] .card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
:root[data-theme="charm"] .topbar {
  background: rgba(251,244,232,0.9);
}
:root[data-theme="charm"] .cta {
  border-radius: 999px;
  padding: 11px 22px;
  box-shadow: 0 2px 0 rgba(59,42,63,0.18);
}
:root[data-theme="charm"] .cta:hover { transform: translateY(-2px); box-shadow: 0 4px 0 rgba(59,42,63,0.22); }
:root[data-theme="charm"] .cta:active { transform: translateY(0); box-shadow: 0 1px 0 rgba(59,42,63,0.18); }
:root[data-theme="charm"] .nav button { border-radius: 999px; }
:root[data-theme="charm"] .nav button.active { background: rgba(217,119,87,0.12); }
:root[data-theme="charm"] .tag {
  border-radius: 999px;
  background: rgba(217,119,87,0.14);
  padding: 6px 14px;
}
:root[data-theme="charm"] .chip { border-radius: 999px; padding: 5px 12px; }
:root[data-theme="charm"] .input,
:root[data-theme="charm"] .select,
:root[data-theme="charm"] .textarea {
  border-radius: 12px;
  background: #FFFBF3;
}
:root[data-theme="charm"] .h-display {
  font-weight: 700;
}
:root[data-theme="charm"] .lang-pill { border-radius: 999px; background: rgba(59,42,63,0.04); }
:root[data-theme="charm"] .dotted {
  background-image: radial-gradient(circle, var(--accent-2) 1.5px, transparent 2px);
  background-size: 14px 14px;
}
:root[data-theme="charm"] .sprout-ink { color: var(--ink); }
:root[data-theme="charm"] .sprout-accent { color: var(--leaf); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}
.zh { font-family: 'Noto Serif SC', 'Songti SC', serif; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ===== Top Bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,247,241,0.88);
  backdrop-filter: saturate(1.1) blur(14px);
  -webkit-backdrop-filter: saturate(1.1) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-divider { width: 1px; height: 32px; background: rgba(251,247,241,0.25); flex-shrink: 0; }
.brand-logo { width: 40px; height: 40px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text .zh { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.brand-text .en { font-size: 9.5px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; font-weight: 600; margin-top: 3px; }
.nav { display: flex; gap: 4px; }
.nav button {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  color: var(--ink-2); border-radius: 6px;
  transition: all .15s ease;
}
.nav button:hover { color: var(--ink); background: rgba(14,31,58,0.04); }
.nav button.active { color: var(--accent); background: rgba(232,106,60,0.08); }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.lang-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-family: 'JetBrains Mono', monospace; }
.cta {
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 6px;
  font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s ease;
}
.cta:hover { background: var(--ink-2); transform: translateY(-1px); }
.cta.accent { background: var(--accent); }
.cta.accent:hover { background: var(--accent-dim); }
.cta.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.cta.ghost:hover { background: rgba(14,31,58,0.04); }

/* ===== Page wrapper ===== */
.page { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.page-full { width: 100%; }

/* ===== Utilities ===== */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; letter-spacing: 0.14em;
  font-weight: 600; text-transform: uppercase;
  color: var(--accent);
  padding: 5px 10px;
  background: rgba(232,106,60,0.08);
  border-radius: 4px;
}
.tag.dark { background: var(--ink); color: var(--paper); }
.tag.muted { background: rgba(14,31,58,0.06); color: var(--ink-2); }

.h-display {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.h1 { font-family: 'Noto Serif SC', serif; font-weight: 700; font-size: 40px; line-height: 1.12; letter-spacing: -0.01em; }
.h2 { font-family: 'Noto Serif SC', serif; font-weight: 700; font-size: 30px; line-height: 1.2; letter-spacing: -0.005em; }
.h3 { font-family: 'Noto Serif SC', serif; font-weight: 600; font-size: 22px; line-height: 1.3; }
.eyebrow { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.16em; color: var(--accent); text-transform: uppercase; font-weight: 600; }
.lede { font-size: 17px; line-height: 1.6; color: var(--ink-2); max-width: 640px; }

/* ===== Section ===== */
.section { padding: 96px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 48px; }
.section-head .title-col { max-width: 640px; }
.section-head .h2 { margin: 12px 0 0; }
.section-head .desc { margin-top: 14px; font-size: 15px; color: var(--ink-2); line-height: 1.6; }

/* ===== Cards ===== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all .18s ease;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.card-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card-cream { background: var(--paper-2); border-color: var(--paper-3); }

/* ===== Dotted rule ===== */
.dotted {
  background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1.5px);
  background-size: 8px 8px;
  background-repeat: repeat-x;
  background-position: center;
  height: 8px;
}

/* ===== Form ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
.field label .req { color: var(--accent); margin-left: 3px; }
.input, .select, .textarea {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  transition: all .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,106,60,0.15);
}
.textarea { min-height: 88px; resize: vertical; font-family: inherit; }

/* ===== Chips ===== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  font-size: 11px; font-weight: 600;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}
.chip-all { background: rgba(14,31,58,0.06); color: var(--ink-2); }
.chip-grade { background: rgba(94,138,90,0.12); color: var(--leaf); }
.course-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 14px 14px 0 0; }
.course-card-placeholder {
  width: 100%; aspect-ratio: 4/3; border-radius: 14px 14px 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; opacity: 0.5;
}
.chip-am  { background: rgba(242,176,74,0.15); color: var(--accent-2-dim); }
.chip-pm  { background: rgba(232,106,60,0.12); color: var(--accent-dim); }
.chip-both { background: rgba(94,138,90,0.15); color: var(--leaf); }

/* ===== Scrollbar soft ===== */
.soft-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.soft-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

/* ===== Sapling svg color control ===== */
.sprout-ink { color: var(--ink); }
.sprout-accent { color: var(--accent); }

/* ===== Tweaks panel ===== */
.tweaks {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  background: var(--ink); color: var(--paper);
  border-radius: 14px;
  padding: 18px;
  width: 280px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: none;
}
.tweaks.open { display: block; }
.tweaks h4 { font-family: 'Noto Serif SC', serif; font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.tweaks .swatch-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tweaks .swatch { aspect-ratio: 1; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.tweaks .swatch.active { border-color: var(--paper); box-shadow: 0 0 0 2px rgba(0,0,0,0.3) inset; }
.tweaks .label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; font-family: 'JetBrains Mono', monospace; margin-bottom: 8px; }
.tweaks .close { position: absolute; top: 10px; right: 12px; color: var(--paper); opacity: 0.6; }
.tweaks .close:hover { opacity: 1; }

/* ============================================== */
/* ===== MOBILE RESPONSIVE (≤ 860px) ============ */
/* ============================================== */
@media (max-width: 860px) {
  /* Page padding */
  .page { padding: 0 18px; }

  /* Topbar — compact single row */
  .topbar-inner { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .brand-text .zh { font-size: 12px; }
  .brand-text .en { font-size: 8px; letter-spacing: 0.12em; margin-top: 2px; }
  .brand-logo { width: 32px; height: 32px; }
  .nav {
    order: 3; width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px; padding: 6px 16px;
    border-top: 1px solid var(--line);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { padding: 7px 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .topbar .right { gap: 8px; }
  .lang-pill { display: none; }
  .cta { padding: 8px 14px; font-size: 12px; }

  /* Sections — tighter padding */
  .section { padding: 56px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
  .section-head .title-col { max-width: none; }

  /* Typography */
  .h-display { font-size: clamp(36px, 9vw, 52px); line-height: 1.05; }
  .h1 { font-size: 30px; }
  .h2 { font-size: 24px; }
  .h3 { font-size: 18px; }
  .lede { font-size: 15px; }

  /* Cards */
  .card { padding: 18px; border-radius: 12px; }

  /* Inputs full width */
  .input, .select, .textarea { width: 100%; font-size: 16px; /* prevents iOS zoom */ }

  /* ==== Override inline grid templates ==== */
  /* 5/6 col grids → 2 col */
  [style*="repeat(5, 1fr)"],
  [style*="repeat(6, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* 4 col grids → 2 col */
  [style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* 3 col grids → 1 col */
  [style*="repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* 2 col grids → 1 col (but keep ones we need 2-col for dates, etc.) */
  [style*="repeat(2, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Hero main grid (1.15fr 1fr) → stack */
  [style*="1.15fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
  /* Form rows */
  [style*="2fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Footer (1.4fr 1fr 1fr 1fr) → 2 col */
  [style*="1.4fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
  }

  /* Register layout (1fr 340px) → stack */
  [style*="1fr 340px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Bank detail table */
  [style*="140px 1fr"] {
    grid-template-columns: 100px 1fr !important;
    font-size: 12px !important;
  }

  /* Timetable dynamic grid — hide and show mobile fallback */
  [style*="180px repeat"] {
    grid-template-columns: 120px repeat(3, minmax(90px, 1fr)) !important;
    font-size: 12px !important;
  }

  /* Hero visual — shrink */
  [style*="aspectRatio"][style*="1 / 1.05"],
  [style*="aspectRatio: '1 / 1.05'"] {
    max-width: 360px;
    margin: 0 auto;
  }

  /* Step progress — show only active labels compactly */
  .step-label-full { display: none; }

  /* Price heading 44px → smaller */
  /* handled via class overrides would be cleaner; keep CSS grid simple */

  /* Large paddings inside hero/section divs */
  [style*="paddingTop: 80"] { padding-top: 40px !important; }
  [style*="paddingBottom: 80"] { padding-bottom: 40px !important; }
  [style*="padding: '40px 32px 80px'"],
  [style*="padding:'40px 32px 80px'"] { padding: 24px 18px 56px !important; }
  [style*="padding: '24px 32px'"],
  [style*="padding:'24px 32px'"] { padding: 16px 18px !important; }

  /* Tweaks panel — compact */
  .tweaks { right: 12px; bottom: 12px; width: calc(100vw - 24px); max-width: 320px; padding: 14px; }

  /* Big display numbers scale */
  [style*="fontSize: 44"] { font-size: 32px !important; }
  [style*="fontSize: 28"] { font-size: 22px !important; }

  /* Reduce section-head font-size inline uses */
  [style*="fontSize: 22"] { font-size: 18px !important; }
}

/* ===== Extra-small phones (≤ 440px) ===== */
@media (max-width: 440px) {
  .brand-text { display: none; }
  [style*="repeat(4, 1fr)"] { grid-template-columns: 1fr !important; }
  [style*="180px repeat"] {
    grid-template-columns: 90px repeat(3, 1fr) !important;
    font-size: 11px !important;
  }
  .h-display { font-size: 34px; }
}
