/*
Theme Name: Mandarin Hanhe
Theme URI: https://mandarinhanhe.com
Author: Mandarin Hanhe
Description: Custom theme for Mandarin Hanhe language school.
Version: 0.2.0
Text Domain: mandarin-hanhe
*/

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.12);
  --primary: #111111;
  --primary-contrast: #ffffff;
  --accent: #f3f4f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

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

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

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

.container {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.nav-primary ul {
  display: flex;
  gap: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav-primary a:hover {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-pill {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
}

.lang-dropdown {
  position: relative;
}

.lang-dropdown summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.lang-dropdown summary::-webkit-details-marker {
  display: none;
}

.lang-dropdown[open] summary {
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.12);
}

.lang-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.14);
  display: grid;
  gap: 6px;
  z-index: 30;
}

.lang-options a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}

.lang-options a.current,
.lang-options a:hover {
  background: var(--accent);
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.35) 60%, rgba(255, 255, 255, 0.9) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 110px 0 80px;
}

.hero-title {
  color: #fff;
  font-size: clamp(2.6rem, 4vw, 4.5rem);
  margin: 0 0 14px;
}

.hero-subtitle {
  color: #f3f4f6;
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto 24px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.12);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
}

.btn-outline {
  border-color: var(--line);
  background: #fff;
}

.section {
  padding: 70px 0;
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0;
}

.section-title.centered {
  text-align: center;
  margin-bottom: 40px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.link-arrow {
  font-weight: 600;
  color: var(--muted);
}

.link-arrow:hover {
  color: var(--ink);
}

.muted {
  background: #f6f7f9;
}

.grid-3 {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-4 {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--card);
  border-radius: 22px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.16);
}

.card-media {
  position: relative;
  height: 190px;
  overflow: hidden;
  background: #e5e7eb;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.card-body {
  padding: 18px 20px 22px;
}

.card-body h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.card-body p {
  margin: 0 0 16px;
  color: var(--muted);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
}

.card-meta.centered {
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.rating {
  color: #f59e0b;
  font-weight: 600;
}

.feature-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.feature-icon svg {
  width: 22px;
  height: 22px;
  fill: #111827;
}

.teacher .teacher-header {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  padding: 20px 0 16px;
  display: grid;
  place-items: center;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
  overflow: hidden;
}

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

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

.resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.download-icon {
  font-weight: 700;
  color: var(--muted);
}

.contact {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-family: inherit;
}

.form-grid .hp {
  position: absolute;
  left: -9999px;
  height: 1px;
  width: 1px;
  opacity: 0;
}

.form-feedback {
  margin: 0 0 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
}

.form-feedback-success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.form-feedback-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.site-footer {
  padding: 50px 0 30px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.footer-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.footer-grid h4,
.footer-grid h3 {
  margin-top: 0;
}

.footer-grid a {
  color: var(--muted);
}

.footer-bottom {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-bottom a {
  margin-left: 12px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal.is-open {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.test-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.test-options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.test-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
}

.test-option input {
  margin-top: 4px;
}

@media (max-width: 900px) {
  .nav-primary ul {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 680px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-meta {
    flex-direction: column;
    gap: 6px;
  }
}
