/* ============================================================
   HeyHao Homepage — Apple-inspired minimal design system
   ============================================================ */

:root {
  /* Page & surfaces */
  --page-bg: #f5f5f7;
  --surface: #ffffff;
  --surface-brief: #eef2f6;
  --surface-blue: #f0f4f7;
  --surface-purple: #f5f2f7;
  --surface-green: #f1f5f1;

  /* Text */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  /* Lines & shadows */
  --line-subtle: rgba(0, 0, 0, 0.06);
  --line-footer: rgba(0, 0, 0, 0.045);
  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 8px 28px rgba(0, 0, 0, 0.045);
  --shadow-card-hover:
    0 2px 4px rgba(0, 0, 0, 0.025),
    0 16px 42px rgba(0, 0, 0, 0.07);

  /* Radii & layout */
  --radius-card: 24px;
  --radius-visual: 18px;
  --content-width: 1460px;

  /* Backward-compatible aliases (auth.css references) */
  --bg: var(--page-bg);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --soft: var(--text-tertiary);
  --line: var(--line-subtle);
  --shadow: var(--shadow-card);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family:
    -apple-system, BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC", "Microsoft YaHei",
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.shell {
  width: min(calc(100% - 56px), var(--content-width));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 99;
  top: 10px; left: 12px;
  transform: translateY(-160%);
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--text-primary);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Header ---------- */
.site-header { flex: 0 0 auto; }

.header-inner {
  height: 76px;
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  border-radius: 8px;
}
.brand img {
  display: block;
  width: 130px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
  object-position: left center;
}

/* ---------- Main ---------- */
.site-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.content-stack {
  margin-block: auto;
  padding-block: 24px 28px;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 4px 0 36px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(52px, 4.6vw, 72px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Hero subtitle with decorative separators */
.hero-subtitle {
  margin: 18px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
}
.hero-subtitle::before,
.hero-subtitle::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: linear-gradient(
    to var(--dir, right),
    transparent,
    rgba(0, 0, 0, 0.18)
  );
}
.hero-subtitle::after {
  --dir: left;
}
.hero-subtitle .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
}

/* ---------- Cards grid ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.tool-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 14px 20px;
  border-radius: var(--radius-card);
  background: var(--surface);
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition:
    transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

/* Bottom-left circular arrow accent */
.card-arrow {
  position: absolute;
  left: 20px;
  bottom: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.tool-card:hover .card-arrow {
  opacity: 0.85;
  transform: translateX(3px);
}
.card-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}
.tool-card--assets .card-arrow {
  background: rgba(120, 144, 160, 0.10);
  color: #7a94a8;
}
.tool-card--creative .card-arrow {
  background: rgba(119, 103, 216, 0.10);
  color: #7767d8;
}
.tool-card--investment .card-arrow {
  background: rgba(85, 116, 94, 0.10);
  color: #55745e;
}
.tool-card--brief .card-arrow {
  background: rgba(122, 138, 154, 0.12);
  color: #7a8a9a;
}

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

.tool-card:focus-visible,
.brand:focus-visible,
.filings a:focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.12);
  outline-offset: 4px;
}

/* ---------- Card visual ---------- */
.tool-visual {
  position: relative;
  height: 160px;
  border-radius: var(--radius-visual);
  overflow: hidden;
  flex-shrink: 0;
}
.tool-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tool-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-card--brief .tool-visual { background: var(--surface-brief); }
.tool-card--assets .tool-visual { background: var(--surface-blue); }
.tool-card--creative .tool-visual { background: var(--surface-purple); }
.tool-card--investment .tool-visual { background: var(--surface-green); }

/* ---------- Card copy ---------- */
.card-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 2px 32px;
}
.card-copy h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 650;
  color: var(--text-primary);
}
.tool-cn {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.tool-description {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
}

/* ---------- Footer ---------- */
.site-footer { flex: 0 0 auto; }

.footer-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--text-tertiary);
  font-size: 12px;
  border-top: 1px solid var(--line-footer);
}
.footer-inner p { margin: 0; }

.filings {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.filings a {
  color: inherit;
  text-decoration: none;
  border-radius: 4px;
  transition: color .2s ease;
}
.filings a:hover { color: var(--text-secondary); }

.public-security-record {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.public-security-record img {
  width: 18px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Compact desktop / short viewport */
@media (max-height: 820px) and (min-width: 1024px) {
  .header-inner { height: 64px; }
  .brand img { width: 118px; max-height: 30px; }
  .content-stack { padding-block: 16px 20px; }
  .hero { padding: 0 0 26px; }
  .hero h1 { font-size: clamp(44px, 3.8vw, 56px); }
  .hero-subtitle { margin-top: 14px; font-size: 13px; }
  .tool-card { padding: 12px 12px 16px; gap: 12px; }
  .tool-visual { height: 148px; }
  .card-copy { padding-bottom: 30px; }
  .card-copy h3 { font-size: 16px; }
  .tool-description { font-size: 13px; line-height: 1.5; }
  .card-arrow { width: 28px; height: 28px; left: 18px; bottom: 14px; }
  .card-arrow svg { width: 14px; height: 14px; }
  .footer-inner { min-height: 52px; }
}

/* Tablet / narrow desktop: 2 columns */
@media (max-width: 1279px) and (min-width: 640px) {
  .shell { width: min(calc(100% - 48px), var(--content-width)); }
  .site-main { display: block; }
  .content-stack { padding-block: 36px 44px; }
  .hero { padding-bottom: 32px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-visual { height: 200px; }
}

/* Mobile: 1 column */
@media (max-width: 639px) {
  .shell { width: min(calc(100% - 32px), var(--content-width)); }
  .header-inner { height: 60px; }
  .brand img { width: 112px; max-height: 29px; }
  .site-main { display: block; }
  .content-stack { padding-block: 28px 36px; }
  .hero { padding: 4px 0 28px; }
  .hero h1 { font-size: clamp(40px, 11vw, 52px); letter-spacing: -0.02em; }
  .hero-subtitle { font-size: 12px; letter-spacing: 0.14em; gap: 10px; }
  .hero-subtitle::before,
  .hero-subtitle::after { width: 24px; }
  .tool-grid { grid-template-columns: 1fr; gap: 14px; }
  .tool-card { padding: 14px 14px 18px; gap: 14px; }
  .tool-visual { height: 170px; }
  .card-copy { padding-bottom: 32px; }
  .card-copy h3 { font-size: 19px; }
  .card-arrow { width: 28px; height: 28px; left: 16px; bottom: 14px; }
  .card-arrow svg { width: 14px; height: 14px; }
  .footer-inner {
    min-height: 0;
    padding-block: 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .filings { justify-content: flex-start; gap: 10px 14px; }
}

/* ============================================================
   Accessibility: reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .tool-card { will-change: auto; }
  .tool-card:hover { transform: none; }
}
