/* ── Design tokens ── */
:root {
  --color-primary: #E8650A;
  --color-primary-light: #F5A05A;
  --color-primary-bg: #FFF3E8;
  --color-primary-border: #F5C49A;

  --color-green: #1E5C3A;
  --color-navbar: #4A8B63;
  --color-green-light: #A8D5BA;
  --color-green-bg: #EEF7F0;
  --color-green-border: #A8D5BA;

  --color-bg: #FDFAF5;
  --color-text: #2C2018;
  --color-text-muted: #7A6650;
  --color-surface: #FFFFFF;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 15px;
  line-height: 1.6;
}

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

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

h1, h2, h3 { line-height: 1.2; margin: 0; }

/* ── Container ── */
.page {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

/* ── Navbar ── */
.navbar {
  background: var(--color-navbar);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 58px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.nav-logo-image {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.nav-logo-text {
  display: inline-block;
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: color 150ms, background 150ms;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
}

.hamburger span {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 200ms, opacity 200ms;
}

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

/* ── Hero ── */
.hero {
  background: var(--color-bg);
  padding: 26px 0 56px;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.eyebrow {
  display: inline-block;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.hero-desc {
  color: var(--color-text-muted);
  font-size: 17px;
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ── Buttons ── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 150ms, transform 150ms;
}

.button:hover { opacity: 0.88; transform: translateY(-1px); }

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

.button-secondary {
  background: transparent;
  color: var(--color-green);
  border: 1.5px solid var(--color-green);
}

.button-secondary:hover { background: var(--color-green-bg); }

/* ── Search section ── */
.search-section {
  padding: 20px 0 8px;
}

.search-panel {
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  max-width: 480px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--color-primary-border);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232, 101, 10, 0.12);
}

/* ── Sections ── */
.section {
  padding: 28px 0 16px;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 6px;
}

.section-header p {
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0;
  line-height: 1.65;
}

.tool-group {
  margin-top: 20px;
}

.tool-group:first-child { margin-top: 0; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

/* ── Tool cards ── */
.tool-card {
  background: var(--color-surface);
  border: 1.5px solid #E8E0D4;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #C8C0B4;
  box-shadow: 0 14px 30px rgba(122, 102, 80, 0.1);
}

.tool-card.is-hidden { display: none; }

/* Category colors */
.tool-card[data-category="vocab"] {
  background: var(--color-primary-bg);
  border-color: var(--color-primary-border);
}

.tool-card[data-category="vocab"]:hover {
  border-color: var(--color-primary-light);
}

.tool-card[data-category="sentence"] {
  background: var(--color-green-bg);
  border-color: var(--color-green-border);
}

.tool-card[data-category="sentence"]:hover {
  border-color: var(--color-green-light);
}

/* Restore worksheet thumbnails while keeping the warm palette */
.tool-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(255, 247, 238, 0.98)),
    var(--color-surface);
  border: 1px solid rgba(232, 101, 10, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  margin-left: -8px;
  margin-right: -8px;
  margin-top: -4px;
}

.tool-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(180deg, rgba(253, 250, 245, 0), rgba(253, 250, 245, 0.26));
  pointer-events: none;
}

.tool-thumb svg,
.tool-thumb img {
  width: 100%;
  display: block;
}

.tool-thumb svg {
  height: auto;
  transform: scale(1.08);
  transform-origin: center;
}

/* ── Card content ── */
.tool-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  align-items: center;
  text-align: center;
  width: 100%;
}

.tool-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(0,0,0,0.06);
  color: var(--color-text-muted);
  align-self: flex-start;
}

.tool-card[data-category="vocab"] .tool-badge {
  background: rgba(232, 101, 10, 0.12);
  color: var(--color-primary);
}

.tool-card[data-category="sentence"] .tool-badge {
  background: rgba(30, 92, 58, 0.12);
  color: var(--color-green);
}

.tool-copy h3 {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  width: 100%;
  text-align: center;
  justify-self: center;
  align-self: center;
}

.tool-copy p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0;
  display: none;
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-meta span {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,0.05);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Card actions */
.tool-card .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.tool-card .button-primary {
  width: auto;
  min-width: 0;
  padding: 6px 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  text-shadow: none;
}

.tool-card .button-primary::before {
  content: "▶";
  font-size: 14px;
  line-height: 1;
  color: var(--color-green);
  display: inline-block;
  margin-right: 6px;
  vertical-align: baseline;
}

.tool-card .button-primary::after {
  content: "开始制作";
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-green);
  display: inline-block;
  vertical-align: baseline;
}

.tool-card .tool-meta {
  display: none;
}

.tool-card .hero-actions {
  margin-top: auto;
}

/* Classroom link (moved from tool-thumb) */
.card-classroom-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-green);
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  transition: color 150ms, transform 150ms;
}

.card-classroom-link:hover {
  background: transparent;
  color: #2c7a4a;
  transform: translateY(-1px);
}

/* ── Section intro panel ── */
.section-intro {
  margin-bottom: 16px;
}

.section-panel {
  background: var(--color-surface);
  border: 1.5px solid #E8E0D4;
  border-radius: 12px;
  padding: 20px 22px;
}

.section-panel .tool-badge {
  display: inline-flex;
  margin-bottom: 8px;
}

.section-panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-panel p {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 10px;
  line-height: 1.65;
}

.section-panel .tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Contact ── */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.contact-card {
  background: var(--color-surface);
  border: 1.5px solid #E8E0D4;
  border-radius: 12px;
  padding: 22px 24px;
}

.contact-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.contact-card p {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 12px;
}

.contact-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ── Footer ── */
.footer {
  background: var(--color-green);
  margin-top: 40px;
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.footer-link {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  transition: color 150ms;
}

.footer-link:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .hamburger { display: flex; }

  .navbar-inner { height: 68px; }

  .nav-logo {
    gap: 10px;
    font-size: 15px;
  }

  .nav-logo-image { height: 36px; }

  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--color-navbar);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
  }

  .nav-links.is-open { display: flex; }

  .nav-links a {
    padding: 10px 20px;
    border-radius: 0;
  }

  .navbar { position: relative; }

  .hero { padding: 44px 0 40px; }

  .hero h1 { font-size: 26px; }

  .hero-desc { font-size: 15px; }

  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .contact-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* ── Overrides for old inline <style> cascade ── */
.hero { display: block; }

/* Reset negative margin from old hero overlap layout */
.section#tools { margin-top: 0 !important; position: static !important; z-index: auto !important; }
#worksheets, #writing-tools, #interactive-tools { position: static; z-index: auto; }
.tool-group#worksheets { margin-top: 0; }

/* Reset old staggered card transforms in worksheets group */
.tool-group#worksheets .tool-card:nth-child(1),
.tool-group#worksheets .tool-card:nth-child(2),
.tool-group#worksheets .tool-card:nth-child(3),
.tool-group#worksheets .tool-card:nth-child(4),
.tool-group#worksheets .tool-card:nth-child(5),
.tool-group#worksheets .tool-card:nth-child(6) { transform: none; }

.tool-group#worksheets .tool-card:nth-child(1):hover,
.tool-group#worksheets .tool-card:nth-child(2):hover,
.tool-group#worksheets .tool-card:nth-child(3):hover,
.tool-group#worksheets .tool-card:nth-child(4):hover,
.tool-group#worksheets .tool-card:nth-child(5):hover,
.tool-group#worksheets .tool-card:nth-child(6):hover { transform: translateY(-2px); }

/* Remove old glass-morphism effects */
.tool-card,
.section-panel,
.contact-card {
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ── Print ── */
@media print {
  .navbar,
  .footer,
  .hero,
  .search-section,
  .section-intro,
  .button,
  .card-classroom-link,
  .hero-actions {
    display: none !important;
  }

  body { background: white; }

  .tool-card {
    break-inside: avoid;
    border: 1px solid #ccc;
  }
}
