/* TutorNest marketing site — shared styles
   Design system mirrors the app: calm, premium, trustworthy. */

:root {
  --primary: #1A56A0;
  --primary-dark: #154880;
  --primary-light: #EBF3FB;
  --background: #F8F8F6;
  --surface: #FFFFFF;
  --surface-secondary: #F2F2EF;
  --border: #E5E5E0;
  --border-strong: #CCCCC5;
  --text-primary: #1A1A18;
  --text-secondary: #6B6B65;
  --text-tertiary: #9E9E97;
  --success: #1D9E75;
  --warning: #BA7517;
  --danger: #E24B4A;

  --radius-card: 12px;
  --radius-button: 10px;

  --maxw: 1080px;

  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-xxl: 48px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-dark); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 248, 246, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}
.brand:hover { color: var(--text-primary); }

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.nav-links {
  display: flex;
  gap: var(--sp-lg);
  align-items: center;
}
.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
}
.nav-links a:hover { color: var(--text-primary); }

/* ---------- Language toggle ---------- */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  height: 50px;
  padding: 0 22px;
  border-radius: var(--radius-button);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* App Store badge button */
.appstore-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 20px;
  border-radius: var(--radius-button);
  background: #000;
  color: #fff;
  transition: background 0.15s ease, transform 0.05s ease;
}
.appstore-btn:hover { background: #1a1a1a; color: #fff; }
.appstore-btn:active { transform: translateY(1px); }
.appstore-btn svg { width: 26px; height: 26px; flex-shrink: 0; }
.appstore-btn .as-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.appstore-btn .as-small { font-size: 11px; font-weight: 400; opacity: 0.9; }
.appstore-btn .as-big { font-size: 19px; font-weight: 600; }

/* ---------- Sections ---------- */
section { padding: var(--sp-xxl) 0; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: var(--sp-md);
}

h1, h2, h3 { color: var(--text-primary); margin: 0; letter-spacing: -0.02em; }

.section-head { max-width: 640px; margin: 0 auto var(--sp-xl); text-align: center; }
.section-head h2 { font-size: 34px; font-weight: 700; margin-bottom: var(--sp-sm); }
.section-head p { font-size: 18px; color: var(--text-secondary); margin: 0; }

/* ---------- Hero ---------- */
.hero {
  padding: var(--sp-xxl) 0 var(--sp-xxl);
  text-align: center;
}
.hero h1 {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.08;
  margin: 0 auto var(--sp-md);
  max-width: 760px;
}
.hero .subhead {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--sp-xl);
}
.hero-actions {
  display: flex;
  gap: var(--sp-md);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.hero-note {
  margin-top: var(--sp-md);
  font-size: 14px;
  color: var(--text-tertiary);
}

/* Phone mockup */
.hero-visual {
  margin: var(--sp-xxl) auto 0;
  max-width: 320px;
}
.phone {
  border: 10px solid #1A1A18;
  border-radius: 40px;
  background: var(--surface);
  padding: var(--sp-lg) var(--sp-md);
  overflow: hidden;
}
.phone-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-md);
  background: var(--surface);
  margin-bottom: var(--sp-md);
  text-align: left;
}
.phone-card:last-child { margin-bottom: 0; }
.phone .student-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.phone .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: grid; place-items: center; font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.phone .student-name { font-weight: 600; font-size: 15px; }
.phone .student-sub { font-size: 13px; color: var(--text-secondary); }
.phone .balance-num {
  font-size: 44px; font-weight: 700; color: var(--success); line-height: 1;
}
.phone .balance-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.phone .pill {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px;
}
.pill-paid { background: #E6F5EF; color: var(--success); }
.pill-unpaid { background: #FCEBEB; color: var(--danger); }

/* ---------- Problem / Solution ---------- */
.problem {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.problem .container { max-width: 760px; text-align: center; }
.problem h2 { font-size: 30px; font-weight: 700; margin-bottom: var(--sp-md); }
.problem p { font-size: 19px; color: var(--text-secondary); margin: 0; }

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-lg);
  transition: border-color 0.15s ease;
}
.feature-card:hover { border-color: var(--border-strong); }
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: grid; place-items: center;
  margin-bottom: var(--sp-md);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.feature-card p { font-size: 15px; color: var(--text-secondary); margin: 0; }

/* ---------- Parent portal highlight ---------- */
.portal { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xxl);
  align-items: center;
}
.portal-grid h2 { font-size: 32px; font-weight: 700; margin-bottom: var(--sp-md); }
.portal-grid > div > p { font-size: 18px; color: var(--text-secondary); }
.portal-steps { list-style: none; padding: 0; margin: var(--sp-lg) 0 0; }
.portal-steps li {
  display: flex; gap: var(--sp-md); align-items: flex-start;
  margin-bottom: var(--sp-md);
}
.portal-steps .step-num {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 600;
}
.portal-steps .step-text { font-size: 16px; color: var(--text-primary); padding-top: 2px; }
.portal-steps .step-text { display: block; }
.portal-steps .step-text strong { display: block; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.portal-steps .step-text > span[data-en],
.portal-steps .step-text > span[data-zh] { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
html:not([lang="zh"]) .portal-steps .step-text > span[data-en] { display: block; }
html[lang="zh"] .portal-steps .step-text > span[data-zh] { display: block; }

.portal-visual {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--background);
  padding: var(--sp-lg);
}
.portal-visual .pv-head { font-size: 14px; color: var(--text-secondary); margin-bottom: var(--sp-md); }
.portal-visual .pv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: var(--sp-md); margin-bottom: var(--sp-md);
}
.portal-visual .pv-card:last-child { margin-bottom: 0; }
.portal-visual .pv-balance { font-size: 36px; font-weight: 700; color: var(--success); line-height: 1; }
.portal-visual .pv-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.portal-visual .pv-row { display: flex; justify-content: space-between; font-size: 15px; padding: 6px 0; }
.portal-visual .pv-due { color: var(--danger); font-weight: 600; }

/* ---------- Pricing ---------- */
.pricing .container { max-width: 520px; }
.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-xl);
  text-align: center;
}
.price-trial {
  display: inline-block;
  font-size: 14px; font-weight: 600;
  color: var(--success); background: #E6F5EF;
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: var(--sp-lg);
}
.price-amount { font-size: 48px; font-weight: 700; line-height: 1; }
.price-amount .per { font-size: 18px; font-weight: 500; color: var(--text-secondary); }
.price-alt { font-size: 15px; color: var(--text-secondary); margin-top: var(--sp-sm); }
.price-features { list-style: none; padding: 0; margin: var(--sp-lg) 0; text-align: left; }
.price-features li {
  display: flex; gap: var(--sp-sm); align-items: flex-start;
  padding: 8px 0; font-size: 15px; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.price-features li:last-child { border-bottom: 0; }
.price-features .check { color: var(--success); flex-shrink: 0; margin-top: 2px; }
.price-card .btn { width: 100%; margin-top: var(--sp-sm); }

/* ---------- Privacy band ---------- */
.privacy-band { background: var(--primary-light); }
.privacy-band .container { max-width: 760px; text-align: center; }
.privacy-band .feature-icon {
  margin: 0 auto var(--sp-md);
  background: var(--surface);
}
.privacy-band h2 { font-size: 28px; font-weight: 700; margin-bottom: var(--sp-md); }
.privacy-band p { font-size: 18px; color: var(--text-secondary); margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--sp-xl) 0;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-md);
}
.footer-links { display: flex; gap: var(--sp-lg); flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); font-size: 15px; }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy { font-size: 14px; color: var(--text-tertiary); }

/* ---------- Legal pages ---------- */
.legal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-xl);
  margin: var(--sp-xl) auto;
  max-width: 800px;
}
.legal h1 { font-size: 34px; font-weight: 700; margin-bottom: var(--sp-sm); }
.legal .updated { color: var(--text-tertiary); font-size: 14px; margin-bottom: var(--sp-xl); }
.legal h2 { font-size: 22px; font-weight: 600; margin: var(--sp-xl) 0 var(--sp-sm); }
.legal h3 { font-size: 17px; font-weight: 600; margin: var(--sp-lg) 0 var(--sp-xs); }
.legal p, .legal li { font-size: 16px; color: var(--text-secondary); }
.legal ul { padding-left: var(--sp-lg); }
.legal li { margin-bottom: var(--sp-xs); }
.legal strong { color: var(--text-primary); font-weight: 600; }

/* ---------- Language visibility ----------
   Visibility is driven entirely by html[lang]. All toggled nodes carry
   either data-en or data-zh. Default (no/other lang) shows English. */

/* Hide the inactive language. These selectors all share the same
   specificity (0,1,1) so source order does not cause conflicts. */
html[lang="en"] [data-zh] { display: none; }
html[lang="zh"] [data-en] { display: none; }
/* Fallback: if lang is missing or something else, behave like English. */
html:not([lang="zh"]) [data-zh] { display: none; }

/* Inline spans render inline; block wrappers (legal divs, portal sub-lines)
   set their own display in their component rules above. */
span[data-en], span[data-zh] { display: inline; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-grid { grid-template-columns: 1fr; gap: var(--sp-xl); }
  .hero h1 { font-size: 44px; }
  .nav-links { display: none; }
}

@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .hero .subhead { font-size: 18px; }
  .section-head h2 { font-size: 28px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn, .hero-actions .appstore-btn { width: 100%; }
  .container { padding: 0 var(--sp-md); }
  .legal { padding: var(--sp-lg); }
  .site-footer .container { flex-direction: column; align-items: flex-start; }
}
