/* ===========================
   MUDRA SITE — style.css
   =========================== */

:root {
  --cream: #FBF8F1;
  --warm-white: #FFFDF9;
  --gold: #C49A2A;
  --gold-light: #F0D080;
  --terracotta: #C1440E;
  --terracotta-light: #E8927A;
  --brown: #5C3D2E;
  --brown-light: #8B6552;
  --green: #2D6A4F;
  --green-light: #74C69D;
  --text-dark: #2C1810;
  --text-mid: #5C4033;
  --text-light: #8B7060;
  --border: #E8DDD0;
  --shadow: rgba(92, 61, 46, 0.12);
  --shadow-hover: rgba(92, 61, 46, 0.22);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.7;
  font-size: 16px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===========================
   HEADER
   =========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 248, 241, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brown);
}
.logo-sanskrit { font-size: 1.5rem; }
.logo-text em { color: var(--terracotta); font-style: normal; }

.nav-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-link {
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-mid);
  transition: var(--transition);
}
.nav-link:hover {
  background: var(--gold-light);
  color: var(--brown);
}

/* ===========================
   HERO
   =========================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 20px 100px;
  background: linear-gradient(135deg, #3D1C0A 0%, #6B3520 40%, #A05030 100%);
  color: white;
  text-align: center;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
}

.hero-sanskrit {
  font-size: 3rem;
  opacity: 0.4;
  letter-spacing: 6px;
  margin-bottom: 12px;
  font-family: serif;
}

.hero-title {
  font-family: 'Noto Serif TC', serif;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero-title span {
  display: block;
  font-size: 0.55em;
  opacity: 0.7;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.hero-sub {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-bottom: 32px;
  line-height: 1.8;
}

.btn-primary {
  display: inline-block;
  background: var(--gold);
  color: white;
  text-decoration: none;
  padding: 14px 36px;
  border-radius: 30px;
  font-weight: 500;
  font-size: 1rem;
  transition: var(--transition);
  letter-spacing: 1px;
}
.btn-primary:hover {
  background: #B8881F;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.hero-decoration {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
}
.c1 { width: 400px; height: 400px; top: -200px; right: -100px; }
.c2 { width: 280px; height: 280px; bottom: -140px; left: -60px; }
.c3 { width: 180px; height: 180px; top: 50%; left: -40px; border-color: rgba(196,154,42,0.2); }

/* ===========================
   ABOUT SECTION
   =========================== */
.about-section {
  padding: 80px 20px;
  background: var(--warm-white);
}

.section-title {
  font-family: 'Noto Serif TC', serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--brown);
  text-align: center;
  margin-bottom: 8px;
}
.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--gold);
  margin: 12px auto 0;
  border-radius: 2px;
}

.section-sub {
  text-align: center;
  color: var(--text-light);
  margin-top: 10px;
  margin-bottom: 36px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.about-card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.about-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px var(--shadow);
}
.about-icon { font-size: 2rem; margin-bottom: 12px; }
.about-card h3 {
  font-family: 'Noto Serif TC', serif;
  font-size: 1rem;
  color: var(--brown);
  margin-bottom: 8px;
}
.about-card p { font-size: 0.9rem; color: var(--text-mid); line-height: 1.7; }

/* ===========================
   ELEMENTS SECTION
   =========================== */
.elements-section {
  padding: 60px 20px;
  background: var(--cream);
}

.fingers-diagram {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 36px;
}

.finger-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 90px;
}

.finger-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.finger-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
}
.finger-element {
  font-size: 0.8rem;
  color: var(--text-mid);
}
.finger-sanskrit {
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
}

/* ===========================
   MUDRAS SECTION
   =========================== */
.mudras-section {
  padding: 80px 20px;
  background: var(--warm-white);
}

.search-bar {
  margin-top: 32px;
  margin-bottom: 20px;
}
.search-bar input {
  width: 100%;
  max-width: 480px;
  display: block;
  margin: 0 auto;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: 30px;
  font-size: 0.95rem;
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  outline: none;
  transition: var(--transition);
}
.search-bar input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,154,42,0.15);
}

.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ── View Toggle ── */
.view-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}
.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 0.82rem;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--text-mid);
  cursor: pointer;
  transition: var(--transition);
}
.view-btn:hover { border-color: var(--gold); color: var(--brown); }
.view-btn.active {
  background: var(--brown);
  border-color: var(--brown);
  color: white;
}
.filter-btn {
  padding: 8px 18px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 0.85rem;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--text-mid);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { border-color: var(--gold); color: var(--brown); }
.filter-btn.active {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: white;
}

/* ===========================
   MUDRA GRID
   =========================== */
.mudra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.mudra-card {
  background: var(--cream);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px var(--shadow);
}
.mudra-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px var(--shadow-hover);
  border-color: var(--gold);
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #F0EAE0;
  position: relative;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Placeholder when image not yet generated */
.card-img-wrap.img-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5EFE6 0%, #EDE3D5 100%);
}
.card-img-wrap.img-missing img {
  display: none;
}
.card-img-wrap.img-missing::after {
  content: attr(data-icon);
  font-size: 3.5rem;
  opacity: 0.6;
}
.img-placeholder-hero {
  display: none;
}
.mudra-card:hover .card-img-wrap img {
  transform: scale(1.05);
}

.card-element-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.9);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brown);
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 20px 22px 24px;
}
.card-sanskrit {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 4px;
}
.card-name {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 6px;
}
.card-tagline {
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 14px;
  line-height: 1.5;
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-tag {
  padding: 3px 10px;
  background: var(--gold-light);
  color: var(--brown);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}
.card-cta {
  display: block;
  margin-top: 14px;
  text-align: center;
  padding: 10px;
  border: 1.5px solid var(--terracotta);
  border-radius: var(--radius-sm);
  color: var(--terracotta);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}
.mudra-card:hover .card-cta {
  background: var(--terracotta);
  color: white;
}

.no-results {
  text-align: center;
  color: var(--text-light);
  padding: 60px 20px;
  grid-column: 1/-1;
  font-size: 1rem;
}

/* ===========================
   LIST VIEW
   =========================== */
.mudra-list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.mudra-list thead tr {
  background: transparent;
}
.mudra-list thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
}
.mudra-list thead th.sortable {
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
}
.mudra-list thead th.sortable:hover {
  color: var(--terracotta);
}
.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  margin-left: 4px;
  font-size: 0.78rem;
  color: var(--terracotta);
}
.sort-none {
  color: var(--text-light);
  opacity: 0.55;
}
.mudra-list thead th:first-child { padding-left: 8px; }
.mudra-list tbody tr {
  background: var(--cream);
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(193,68,14,0.15);
  transition: var(--transition);
}
.mudra-list tbody tr:active {
  background: #EAD9C8;
}
.mudra-list tbody tr:hover {
  background: #F0E8DC;
  transform: translateX(3px);
}
.mudra-list td {
  padding: 14px 16px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mudra-list td:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding-left: 16px;
  width: 48px;
  text-align: center;
}
.mudra-list td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.list-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  min-width: 28px;
}
.list-icon {
  font-size: 1.5rem;
  min-width: 44px;
}
.list-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
  display: block;
}
.list-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #F5EFE6 0%, #EDE3D5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.list-name-block {
  min-width: 140px;
}
.list-zh {
  font-family: 'Noto Serif TC', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brown);
  display: block;
}
.list-en {
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
}
.list-tagline {
  font-size: 0.85rem;
  color: var(--text-mid);
  max-width: 300px;
  line-height: 1.4;
}
.list-element {
  font-size: 0.8rem;
  color: var(--text-mid);
  white-space: nowrap;
}
.list-tags-wrap {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.list-tag {
  padding: 2px 8px;
  background: var(--gold-light);
  border-radius: 10px;
  font-size: 0.72rem;
  color: var(--brown);
  white-space: nowrap;
}
.list-cta {
  font-size: 0.8rem;
  color: var(--terracotta);
  font-weight: 600;
  white-space: nowrap;
}

/* List view empty state */
.mudra-list-wrap {
  overflow-x: auto;
}

/* Responsive: hide tagline on small screens */
@media (max-width: 600px) {
  .list-tagline, .list-tags-wrap, .list-element { display: none; }
  .mudra-list thead th.col-tagline,
  .mudra-list thead th.col-element,
  .mudra-list thead th.col-tags { display: none; }
}

/* ===========================
   TIPS SECTION
   =========================== */
.tips-section {
  padding: 80px 20px;
  background: var(--cream);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.tip-card {
  background: var(--warm-white);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.tip-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}
.tip-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  opacity: 0.5;
  line-height: 1;
  margin-bottom: 10px;
}
.tip-card h3 {
  font-family: 'Noto Serif TC', serif;
  font-size: 1rem;
  color: var(--brown);
  margin-bottom: 8px;
}
.tip-card p { font-size: 0.88rem; color: var(--text-mid); line-height: 1.7; }

/* ===========================
   FOOTER
   =========================== */
.site-footer {
  background: var(--brown);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 48px 20px;
}
.footer-sanskrit {
  font-size: 2rem;
  margin-bottom: 8px;
}
.footer-text {
  font-size: 1rem;
  margin-bottom: 16px;
  color: rgba(255,255,255,0.8);
}
.footer-copy { font-size: 0.8rem; opacity: 0.5; }

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 24, 16, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--warm-white);
  border-radius: 20px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
  box-shadow: 0 32px 80px rgba(0,0,0,0.3);
}
.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(92,61,46,0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-dark);
  transition: var(--transition);
}
.modal-close:hover { background: var(--terracotta); color: white; }

.modal-hero-img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 20px 20px 0 0;
}

.modal-body {
  padding: 28px 32px 36px;
}
.modal-sanskrit {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 4px;
}
.modal-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 6px;
}
.modal-tagline {
  color: var(--text-mid);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.modal-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.modal-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-element {
  background: var(--gold-light);
  color: var(--brown);
}
.badge-category {
  background: rgba(193, 68, 14, 0.1);
  color: var(--terracotta);
}

.modal-section {
  margin-bottom: 24px;
}
.modal-section-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--gold);
  border-radius: 2px;
}

.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.6;
}
.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--terracotta);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.benefits-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.benefits-list li {
  font-size: 0.88rem;
  color: var(--text-mid);
  padding: 8px 12px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green-light);
}
.benefits-list li::before { content: '✓  '; color: var(--green); font-weight: 700; }

.caution-box {
  background: rgba(193, 68, 14, 0.06);
  border: 1px solid rgba(193, 68, 14, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .hero { padding: 60px 20px 80px; }
  .hero-sanskrit { font-size: 2rem; }

  .about-grid { grid-template-columns: 1fr; }
  .tips-grid { grid-template-columns: 1fr; }

  .nav-pills { display: none; }

  .modal-body { padding: 20px 20px 28px; }
  .modal-title { font-size: 1.4rem; }
  .benefits-list { grid-template-columns: 1fr; }

  .fingers-diagram { gap: 8px; }
  .finger-item { min-width: 64px; }
  .finger-icon { width: 44px; height: 44px; font-size: 1.1rem; }
  .finger-name { font-size: 0.8rem; }
  .finger-element { font-size: 0.7rem; }
}

@media (max-width: 480px) {
  .mudra-grid { grid-template-columns: 1fr; }
  .filter-tabs { gap: 6px; }
  .filter-btn { padding: 7px 14px; font-size: 0.8rem; }
}

/* Scrollbar styling */
.modal-box::-webkit-scrollbar { width: 6px; }
.modal-box::-webkit-scrollbar-track { background: transparent; }
.modal-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
