/* ========================================================================
   IvyBridge Education · 青藤教育
   Design tokens + base components
   ======================================================================== */

/* ========== Tokens ========== */
:root {
  --ivy: #0E5A3C;
  --ivy-deep: #08402a;
  --ivy-soft: #1c6b4d;
  --leaf: #6BAA5B;
  --leaf-soft: #a3c899;
  --paper: #faf5e6;
  --paper-2: #f3ead0;
  --cream: #e9dfbe;
  --ink: #1a1714;
  --ink-2: #3a342c;
  --muted: #756b5b;
  --line: #d9cea7;
  --line-soft: #e6dcb9;
  --gold: #D4A64A;
  --gold-soft: #e8c272;
  --burgundy: #6b1f2a;

  --serif-display: "Cormorant Garamond", "Noto Serif SC", "Songti SC", "STSong", serif;
  --serif-body: "Source Serif 4", "Cormorant Garamond", "Noto Serif SC", serif;
  --sans: "Source Sans 3", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;

  --pad-x: clamp(24px, 6vw, 96px);
  --maxw: 1320px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ========== Type ========== */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}
.eyebrow.ink { color: var(--ink-2); }
.eyebrow.cream { color: var(--cream); }

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(48px, 7vw, 104px); font-weight: 400; }
h2 { font-size: clamp(36px, 4.4vw, 64px); }
h3 { font-size: clamp(22px, 2vw, 30px); }
h4 { font-size: 20px; }

.serif { font-family: var(--serif-display); }
.lede { font-size: clamp(18px, 1.4vw, 22px); line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.cap-sm { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; }
.italic { font-style: italic; }
.zh { font-family: "Noto Serif SC", var(--serif-display); }

/* ========== Layout ========== */
.container { max-width: var(--maxw); margin: 0 auto; padding-left: var(--pad-x); padding-right: var(--pad-x); }
.row { display: flex; align-items: center; gap: 20px; }
.col { display: flex; flex-direction: column; }
.grid { display: grid; gap: 24px; }
.hairline { height: 1px; background: var(--line); width: 100%; }
.gold-line { height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent); }
.divider-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); display: inline-block; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  height: 50px; padding: 0 26px;
  font-family: var(--serif-display);
  font-size: 18px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  transition: all .2s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--ivy); color: var(--paper); }
.btn-primary:hover { background: var(--ivy-deep); }
.btn-ghost { background: transparent; color: var(--ivy); border-color: var(--ivy); }
.btn-ghost:hover { background: var(--ivy); color: var(--paper); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 15px; }
.btn-link { background: none; border: none; color: var(--ivy); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; padding: 0; cursor: pointer; }
.btn[disabled], .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ========== Tags & Pills ========== */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255,255,255,0.5);
}
.tag.ivy { color: var(--paper); background: var(--ivy); border-color: var(--ivy); }
.tag.gold { color: var(--ivy-deep); background: var(--cream); border-color: var(--gold-soft); }
.tag.burgundy { color: var(--paper); background: var(--burgundy); border-color: var(--burgundy); }
.tag.outline { background: transparent; }

/* ========== Cards ========== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.card.cream { background: var(--paper-2); }
.card.ivy { background: var(--ivy); color: var(--paper); border-color: var(--ivy-deep); }

/* ========== Brand mark (cropped from brand-sheet.png) ========== */
/* Brand sheet is 1254×1254. The icon mark sits in src region roughly
   x 410..820 (w 410), y 20..420 (h 400). The full lockup with text sits
   in src region x 250..1010 (w 760), y 20..680 (h 660). */

.brand-mark {
  --bh: 44px;
  display: inline-block;
  height: var(--bh);
  width: calc(var(--bh) * 410 / 400);
  background-image: url('assets/brand-sheet.png');
  background-repeat: no-repeat;
  background-size: calc(var(--bh) * 1254 / 400) calc(var(--bh) * 1254 / 400);
  background-position: calc(var(--bh) * -410 / 400) calc(var(--bh) * -20 / 400);
}

.brand-lockup {
  --bh: 100px;
  display: inline-block;
  height: var(--bh);
  width: calc(var(--bh) * 760 / 660);
  background-image: url('assets/brand-sheet.png');
  background-repeat: no-repeat;
  background-size: calc(var(--bh) * 1254 / 660) calc(var(--bh) * 1254 / 660);
  background-position: calc(var(--bh) * -250 / 660) calc(var(--bh) * -20 / 660);
}

/* ========== Nav ========== */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 245, 230, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px;
  max-width: var(--maxw); margin: 0 auto;
  padding-left: var(--pad-x); padding-right: var(--pad-x);
}
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-link {
  font-family: var(--serif-display);
  font-size: 17px;
  color: var(--ink-2);
  position: relative;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ivy); }
.nav-link.active { color: var(--ivy); }
.nav-link.active::after {
  content:""; position:absolute; left:0; right:0; bottom:-26px;
  height: 2px; background: var(--gold);
}
.nav-right { display: flex; gap: 12px; align-items: center; }
.nav-login {
  font-family: var(--serif-display);
  font-size: 16px;
  color: var(--ink-2);
}
.nav-login:hover { color: var(--ivy); }

/* Wordmark */
.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1; }
.wordmark-zh {
  font-family: "Noto Serif SC", var(--serif-display);
  font-size: 19px; font-weight: 600; color: var(--ivy-deep);
  letter-spacing: 0.04em;
}
.wordmark-en {
  font-family: var(--serif-display);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

/* ========== Section header ========== */
.sec-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 40px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 28px;
}
.sec-head-left { max-width: 720px; }
.sec-head-num {
  font-family: var(--mono); font-size: 11px; color: var(--gold);
  letter-spacing: 0.2em; margin-bottom: 16px;
}
.sec-head h2 { margin-bottom: 12px; }
.sec-head .lede { color: var(--ink-2); font-size: 18px; }

/* ========== Form ========== */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  font: 16px var(--serif-body);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ivy); }

/* ========== Striped placeholder ========== */
.placeholder {
  background:
    repeating-linear-gradient(45deg,
      rgba(29,64,50,0.05) 0 8px,
      rgba(29,64,50,0.02) 8px 16px);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
}

/* ========== Utility ========== */
.center { text-align: center; }
.muted { color: var(--muted); }
.ivy-text { color: var(--ivy); }
.gold-text { color: var(--gold); }
.uppercase { text-transform: uppercase; letter-spacing: 0.14em; }
.numerals { font-family: var(--serif-display); font-feature-settings: "lnum" 1; }
.tabular { font-variant-numeric: tabular-nums; }

/* ========== Scroll fade in ========== */
.fade-up { opacity: 0; transform: translateY(12px); transition: opacity .8s ease, transform .8s ease; }
.fade-up.in { opacity: 1; transform: none; }

/* density */
section.section { padding-top: 128px; padding-bottom: 128px; }

/* ========== Avatar ========== */
.avatar {
  display: grid; place-items: center;
  background: var(--ivy);
  color: var(--paper);
  border-radius: 4px;
  border: 1px solid var(--line);
  font-family: var(--serif-display);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 4px, transparent 4px 12px);
}
.avatar > span { position: relative; z-index: 1; }
.avatar.gold { background: var(--paper-2); color: var(--ivy); }
.avatar-sm { width: 40px; height: 40px; font-size: 16px; }
.avatar-md { width: 64px; height: 64px; font-size: 26px; }
.avatar-lg { width: 72px; height: 72px; font-size: 30px; }
.avatar-xl { width: 120px; height: 120px; font-size: 50px; }
.avatar-xxl { width: 200px; height: 200px; font-size: 84px; }

/* ========== Crest (IvyCrest) ========== */
.crest {
  display: grid; place-items: center;
  position: relative;
}
.crest::before {
  content: ""; position: absolute; inset: 0;
  border: 1px dashed var(--gold-soft);
  border-radius: 50%;
}
.crest .brand-mark { position: relative; }

/* ========== Stepper (used by Booking + Diagnostic) ========== */
.stepper {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 40px;
}
.stepper-step {
  display: flex; align-items: center; gap: 12px;
  flex: 1;
  position: relative;
}
.stepper-step:not(:last-child)::after {
  content: ""; position: absolute;
  left: calc(36px + 12px); right: 0;
  top: 18px; height: 1px;
  background: var(--line);
}
.stepper-step.is-done:not(:last-child)::after { background: var(--gold); }
.stepper-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.stepper-step.is-active .stepper-num {
  background: var(--ivy); color: var(--paper); border-color: var(--ivy);
}
.stepper-step.is-done .stepper-num {
  background: var(--gold); color: var(--ivy-deep); border-color: var(--gold);
}
.stepper-label {
  font-family: var(--serif-display);
  font-size: 16px;
  color: var(--ink-2);
}
.stepper-step.is-active .stepper-label { color: var(--ivy); font-style: italic; }

/* ========== Drawer (used by Teachers) ========== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(8,32,22,0.4);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(640px, 92vw);
  background: var(--paper);
  z-index: 100;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.22,.61,.36,1);
  overflow-y: auto;
  display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.2);
}
.drawer.is-open { transform: translateX(0); }
.drawer-close {
  position: absolute; top: 16px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--serif-display);
  font-size: 20px;
  color: var(--ink-2);
  z-index: 5;
}

/* ========== KPI card (used across pages) ========== */
.kpi-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232,194,114,0.3);
  padding: 24px;
  border-radius: var(--r-md);
}
.kpi-card.light {
  background: #fff;
  border-color: var(--line);
}
.kpi-card .eyebrow { margin-bottom: 8px; opacity: 0.7; }
.kpi-card-num {
  font-family: var(--serif-display);
  font-size: 56px;
  line-height: 1;
  color: var(--ivy);
  font-style: italic;
}
.kpi-card-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}

/* ========== Filter bar (used by Teachers + Stories) ========== */
.filter-bar {
  position: sticky; top: 76px; z-index: 40;
  background: rgba(250, 245, 230, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  display: flex; gap: 32px; align-items: center; flex-wrap: wrap;
}
.filter-group {
  display: flex; gap: 8px; align-items: center;
}
.filter-group-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 8px;
}
.filter-btn {
  font-family: var(--serif-display);
  font-size: 15px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--ivy); color: var(--ivy); }
.filter-btn.is-active {
  background: var(--ivy);
  border-color: var(--ivy);
  color: var(--paper);
}

/* ========== Footer (shared) ========== */
.footer {
  background: var(--ivy-deep);
  color: var(--paper-2);
}
.footer-inner {
  padding-top: 96px;
  padding-bottom: 56px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer-tag {
  background: rgba(255,255,255,0.06);
  color: var(--paper-2);
  border-color: rgba(255,255,255,0.16);
}
.footer-col-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  text-transform: uppercase;
  margin-bottom: 20px;
}
.footer-col ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.footer-col a {
  color: var(--paper-2);
  font-size: 15px;
  opacity: 0.85;
}
.footer-col a:hover { opacity: 1; color: var(--gold-soft); }
.footer-bottom {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid rgba(168,124,52,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--cream);
  opacity: 0.7;
}
.footer-quote {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 16px;
  color: var(--gold-soft);
}

/* ========== Animations ========== */
@keyframes ripple-pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes ring-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}
@keyframes drawer-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== Responsive ========== */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  section.section { padding-top: 72px; padding-bottom: 72px; }
}
