/* ============================================
   TIECEC Second Home — Design System
   Target: Overseas users, Western aesthetic
   Server: Hong Kong (no ICP required)
   ============================================ */

/* ---------- CSS Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Design Tokens ---------- */
:root {
  /* Palette */
  --bg: #FAFAF7;
  --bg2: #FFFFFF;
  --bg3: #F3F1EC;
  --ink: #1A1A1A;
  --muted: #6B6B6B;
  --muted-light: #9A9A95;
  --rule: #E5E5E0;
  --accent: #C8553D;
  --accent-hover: #B0452F;
  --accent-light: #F4E8E4;
  --accent2: #2C6E6B;
  --accent2-hover: #235A58;
  --accent2-light: #E8F0EF;
  --success: #5A8F5A;
  --warn: #D4943A;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 760px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h4 { font-size: 1.15rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--accent2);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--accent2-hover); }

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

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.5rem; }

strong { font-weight: 600; }

mark.key {
  background: none;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Layout Utilities ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding: var(--space-xl) 0;
}

.section-sm {
  padding: var(--space-lg) 0;
}

.section-bg2 { background: var(--bg2); }
.section-bg3 { background: var(--bg3); }
.section-accent { background: var(--accent); color: #fff; }
.section-accent2 { background: var(--accent2); color: #fff; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.eyebrow-light {
  color: rgba(255,255,255,0.8);
}

.lead {
  font-size: 1.18rem;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.text-center { text-align: center; }
.text-muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--accent2);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--accent2-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn-outline:hover {
  background: var(--ink);
  color: #fff;
}

.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
}

.btn-outline-light:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: #fff;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  transition: all var(--transition);
}

.nav.scrolled {
  background: rgba(250, 250, 247, 0.98);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

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

.nav-logo-img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 4px;
}

.nav-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-body);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-cta {
  margin-left: 0.5rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all var(--transition);
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 70px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26,26,26,0.75) 0%, rgba(26,26,26,0.4) 50%, rgba(26,26,26,0.2) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: var(--space-lg) 0;
}

.hero h1 {
  color: #fff;
  margin-bottom: var(--space-sm);
}

.hero .lead {
  color: rgba(255,255,255,0.88);
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: var(--space-md);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
  font-size: 1.4rem;
}

.card-icon-accent {
  background: var(--accent-light);
  color: var(--accent);
}

.card-icon-accent2 {
  background: var(--accent2-light);
  color: var(--accent2);
}

.card h4 {
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* ---------- Grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

/* ---------- Split Layout ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: center;
}

.split-image {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.split-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  text-align: center;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  counter-reset: step;
}

.step {
  position: relative;
  padding: var(--space-md);
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.step h4 { margin-bottom: 0.4rem; }
.step p { font-size: 0.92rem; color: var(--muted); margin-bottom: 0; }

/* ---------- Testimonial ---------- */
.testimonial {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

.testimonial-quote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: var(--space-md);
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.testimonial-author-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.testimonial-author-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Pricing ---------- */
.pricing-card {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: all var(--transition);
}

.pricing-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.pricing-card.featured {
  border-color: var(--accent);
  border-width: 2px;
  position: relative;
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-full);
}

.pricing-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.pricing-price {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.pricing-period {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.pricing-features {
  list-style: none;
  padding: 0;
  text-align: left;
  margin-bottom: var(--space-md);
}

.pricing-features li {
  font-size: 0.9rem;
  color: var(--muted);
  padding-left: 1.5rem;
  position: relative;
}

.pricing-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent2);
  font-weight: 700;
}

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid var(--rule);
  padding: var(--space-sm) 0;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  padding: 0.5rem 0;
  transition: color var(--transition);
}

.faq-question:hover { color: var(--accent); }

.faq-question .faq-icon {
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.open .faq-icon { transform: rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  color: var(--muted);
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0.5rem 0 1rem;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-sm);
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.form-label .required { color: var(--accent); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg2);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.form-success {
  background: #E8F5E9;
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  color: #2E5C2E;
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
  display: none;
}

.form-success.show { display: block; }

.form-error {
  color: var(--accent);
  font-size: 0.82rem;
  margin-top: 0.3rem;
  display: none;
}

.form-error.show { display: block; }

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,0.7);
  padding: var(--space-xl) 0 var(--space-md);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-sm);
}

.footer-about {
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.6);
  margin-bottom: var(--space-sm);
}

.footer h5 {
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer ul li { margin-bottom: 0.5rem; }

.footer ul a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: color var(--transition);
}

.footer ul a:hover { color: #fff; }

.footer-contact-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.5rem;
}

.footer-contact-item strong {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  min-width: 70px;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
}

.footer-bottom a {
  color: rgba(255,255,255,0.45);
}

.footer-bottom a:hover { color: rgba(255,255,255,0.8); }

/* ---------- Badge / Tag ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-accent2 {
  background: var(--accent2-light);
  color: var(--accent2);
}

/* ---------- Divider ---------- */
.divider {
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: var(--space-sm);
}

.divider-center {
  margin-left: auto;
  margin-right: auto;
}

/* ---------- CTA Section ---------- */
.cta-section {
  background: linear-gradient(135deg, var(--accent2) 0%, #1d504e 100%);
  color: #fff;
  text-align: center;
  padding: var(--space-xl) 0;
}

.cta-section h2 { color: #fff; }
.cta-section p { color: rgba(255,255,255,0.85); font-size: 1.1rem; max-width: 560px; margin: 0 auto var(--space-md); }

/* ---------- Page Hero (interior pages) ---------- */
.page-hero {
  background: var(--bg3);
  padding: calc(70px + var(--space-xl)) 0 var(--space-lg);
  text-align: center;
}

.page-hero h1 { margin-bottom: var(--space-sm); }
.page-hero .lead { max-width: 620px; margin: 0 auto; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--muted-light); }

/* ---------- Animation ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--bg2);
    flex-direction: column;
    padding: var(--space-md);
    gap: 0;
    border-bottom: 1px solid var(--rule);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
  }

  .nav-toggle { display: flex; }
  .nav-cta { display: none; }

  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  :root {
    --space-xl: 4rem;
    --space-lg: 2.5rem;
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
