/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* ── Design tokens ── */
:root {
  color-scheme: light;
  --ink: #172026;
  --heading: #25353c;
  --muted: #5c6c76;
  --paper: #f8f4ec;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(23, 32, 38, 0.14);
  --green: #1f7a62;
  --blue: #246b9f;
  --coral: #c9543f;
  --gold: #d89a2b;
  --shadow: 0 22px 60px rgba(23, 32, 38, 0.16);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(36, 107, 159, 0.18), transparent 24rem),
    radial-gradient(circle at 88% 18%, rgba(216, 154, 43, 0.2), transparent 28rem),
    linear-gradient(145deg, #fbf8ef 0%, #eef4f1 52%, #e9eef4 100%);
  font-family:
    Outfit, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-feature-settings: "kern";
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ── Entrance animations ── */
.nav,
.hero-text,
.hero-canvas-wrap,
.product-card {
  opacity: 0;
  transform: translateY(20px);
}

.nav { animation: reveal 0.6s var(--ease-out) 0.05s forwards; }
.hero-text { animation: reveal 0.6s var(--spring) 0.15s forwards; }
.hero-canvas-wrap { animation: reveal 0.7s var(--spring) 0.25s forwards; }

/* Staggered product cards */
.product-card:nth-child(1) { animation: reveal 0.6s var(--spring) 0.35s forwards; }
.product-card:nth-child(2) { animation: reveal 0.6s var(--spring) 0.43s forwards; }
.product-card:nth-child(3) { animation: reveal 0.6s var(--spring) 0.51s forwards; }
.product-card:nth-child(4) { animation: reveal 0.6s var(--spring) 0.59s forwards; }

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Scroll reveal ── */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--spring);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 780;
}

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

.nav-item {
  position: relative;
}

.nav-item > a,
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 680;
  cursor: pointer;
  transition: color 160ms ease;
}

.nav-item > a:hover,
.nav-dropdown-trigger:hover,
.nav-item:hover > .nav-dropdown-trigger {
  color: var(--ink);
}

.nav-dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 200ms ease;
}

.nav-item:hover .nav-dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: -0.75rem;
  min-width: 14rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 36px rgba(23, 32, 38, 0.12);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  z-index: 10;
}

.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.4rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 640;
  transition: background 120ms ease;
}

.nav-dropdown-item:hover {
  background: rgba(23, 32, 38, 0.05);
}

.nav-dropdown-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.35rem;
  color: white;
  font-size: 0.8rem;
  font-weight: 820;
  flex-shrink: 0;
}

.nav-dropdown-text {
  display: flex;
  flex-direction: column;
}

.nav-dropdown-name {
  font-weight: 720;
}

.nav-dropdown-tag {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 580;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 0.55rem;
  background: linear-gradient(135deg, rgba(31, 122, 98, 0.9), rgba(36, 107, 159, 0.9)), #1f7a62;
  color: white;
  font-weight: 820;
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.08);
  backdrop-filter: blur(18px);
}

.language-switcher button {
  min-width: 2.45rem;
  height: 1.95rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 740;
  transition: background 200ms ease, color 200ms ease, transform 200ms var(--spring);
}

.language-switcher button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.language-switcher button:active {
  transform: scale(0.95);
}

/* ── Hero (asymmetric split) ── */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 60vh;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 3rem);
  gap: 2rem;
  overflow: hidden;
}

.hero-text {
  position: relative;
  z-index: 1;
}

.hero-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.hero-title .icon-token {
  display: inline-grid;
  width: 1.15em;
  height: 1.15em;
  place-items: center;
  border-radius: 0.2em;
  color: white;
  font-size: 0.55em;
  font-weight: 820;
  vertical-align: -0.12em;
  margin: 0 0.1em;
}

.hero-subtitle {
  max-width: 32rem;
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.7;
}

/* ── Products (bento grid) ── */
.products {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) 3rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(23, 32, 38, 0.08);
  backdrop-filter: blur(18px);
  transition: transform 260ms var(--spring), border-color 180ms ease, box-shadow 260ms ease;
  will-change: transform;
}

.product-card.featured {
  grid-column: span 2;
}

.product-card.featured-end {
  grid-column: 2 / span 2;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: rgba(31, 122, 98, 0.4);
  box-shadow: 0 22px 56px rgba(23, 32, 38, 0.14);
}

.product-card:active {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(23, 32, 38, 0.10);
  transition-duration: 80ms;
}

.product-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 0.55rem;
  color: white;
  font-size: 1.4rem;
  font-weight: 820;
}

.product-icon.stock { background: var(--coral); }
.product-icon.accountbook { background: var(--blue); }
.product-icon.whiteboard { background: var(--green); }
.product-icon.babyprep { background: #d4619a; }

.product-name {
  margin: 1rem 0 0;
  font-size: 1.25rem;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.product-desc {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 38rem;
}

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  color: var(--green);
  font-weight: 740;
  font-size: 0.92rem;
  transition: gap 200ms var(--spring);
}

.product-link:hover {
  text-decoration: underline;
  gap: 0.6rem;
}

/* ── Badge with shimmer ── */
.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.2rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
  position: relative;
  overflow: hidden;
}

.product-badge::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: badge-shimmer 3s ease-in-out infinite;
}

@keyframes badge-shimmer {
  0%, 70%, 100% { left: -100%; }
  40% { left: 150%; }
}

/* ── About (editorial style) ── */
.about {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) 3rem;
}

.about-content {
  border-top: 2px solid var(--ink);
  padding: clamp(1.5rem, 4vw, 2.5rem) 0;
}

.about-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.about-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 42rem;
}

.about-text + .about-text {
  margin-top: 0.8rem;
}

.about-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 2;
  max-width: 42rem;
}

/* ── Footer ── */
.site-footer {
  padding: 2rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.site-footer-icp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-footer a:hover {
  color: var(--ink);
}

/* ── Responsive ── */
@media (max-width: 760px) {
  .nav-links {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 1rem;
    padding-bottom: 0;
    gap: 1rem;
  }

  .hero-canvas-wrap {
    min-height: 200px;
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card.featured,
  .product-card.featured-end {
    grid-column: span 1;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-card.featured,
  .product-card.featured-end {
    grid-column: span 2;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .nav,
  .hero-text,
  .hero-canvas-wrap,
  .product-card {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .product-badge::after {
    animation: none;
  }

  .product-card {
    transition: border-color 180ms ease;
  }

  .product-card:hover {
    transform: none;
  }
}
