/* ========================================
   NOCTUALIA — Global Stylesheet
   ======================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=Noto+Sans+Arabic:wght@400;500;700&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Sans+KR:wght@400;500;700&family=Noto+Sans+Thai:wght@400;500;700&display=swap');

/* --- Design Tokens --- */
:root {
  --color-primary: #0f1118;
  --color-secondary: #1a1d2e;
  --color-accent: #c4a035;
  --color-accent-hover: #d4b045;
  --color-surface: #f6f2eb;
  --color-surface-alt: #ece6da;
  --color-text: #2a2a2a;
  --color-text-light: #71706c;
  --color-text-inv: #f0ede7;
  --color-border: #d6d0c4;
  --color-card-bg: #ffffff;
  --color-overlay: rgba(15, 17, 24, 0.65);

  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'DM Sans', sans-serif;
  --font-japanese: 'Noto Sans JP', 'DM Sans', sans-serif;
  --font-korean: 'Noto Sans KR', 'DM Sans', sans-serif;
  --font-thai: 'Noto Sans Thai', 'DM Sans', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 16px rgba(0,0,0,.07);
  --shadow-card-hover: 0 8px 32px rgba(0,0,0,.12);
  --shadow-nav: 0 1px 8px rgba(0,0,0,.08);
  --transition: .3s cubic-bezier(.4,0,.2,1);
  --max-width: 1200px;
  --nav-height: 72px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-surface);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* RTL */
html[dir="rtl"] body { font-family: var(--font-arabic); }
html[lang="ja"] body { font-family: var(--font-japanese); }
html[lang="ko"] body { font-family: var(--font-korean); }
html[lang="th"] body { font-family: var(--font-thai); }
html[dir="rtl"] { font-size: 17px; }

/* --- Typography --- */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
h4 { font-size: 1.15rem; }
p { margin-bottom: 1rem; }
.text-accent { color: var(--color-accent); }
.text-light { color: var(--color-text-light); }
.text-inv { color: var(--color-text-inv); }
.italic { font-style: italic; }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-dark { background: var(--color-primary); color: var(--color-text-inv); }
.section-alt { background: var(--color-surface-alt); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem;
  transition: var(--transition); letter-spacing: .02em;
  text-transform: uppercase; font-size: .85rem;
}
.btn-primary {
  background: var(--color-accent); color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-2px); }
.btn-outline {
  border: 2px solid rgba(255,255,255,.5); color: #fff;
}
.btn-outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }
.btn-dark {
  background: var(--color-primary); color: var(--color-text-inv);
}
.btn-dark:hover { background: var(--color-secondary); transform: translateY(-2px); }

/* --- Navigation --- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  transition: var(--transition);
}
.nav.scrolled {
  background: rgba(15,17,24,.97);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-nav);
}
.nav-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700;
  color: #fff; letter-spacing: .03em;
}
.nav-logo span { color: var(--color-accent); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a {
  color: rgba(255,255,255,.8); font-size: .88rem; font-weight: 500;
  letter-spacing: .03em; text-transform: uppercase;
  transition: var(--transition); position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 2px; background: var(--color-accent);
  transition: var(--transition);
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: #fff; }

/* Language Switcher */
.lang-switch {
  display: flex; gap: 4px; margin-left: 20px;
  border-left: 1px solid rgba(255,255,255,.2); padding-left: 20px;
}
html[dir="rtl"] .lang-switch { margin-left: 0; margin-right: 20px; border-left: none; border-right: 1px solid rgba(255,255,255,.2); padding-left: 0; padding-right: 20px; }
.lang-switch a {
  padding: 4px 10px; border-radius: 4px; font-size: .78rem; font-weight: 600;
  color: rgba(255,255,255,.5); letter-spacing: .04em; text-transform: uppercase;
}
.lang-switch a:hover { color: rgba(255,255,255,.8); }
.lang-switch a.active { background: var(--color-accent); color: var(--color-primary); }

/* Mobile Menu */
.nav-toggle { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; }
.nav-toggle span { width: 24px; height: 2px; background: #fff; transition: var(--transition); border-radius: 2px; }
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- Hero --- */
.hero {
  position: relative; min-height: 100vh; display: flex; align-items: center;
  justify-content: center; text-align: center; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(.45);
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,17,24,.3) 0%, rgba(15,17,24,.7) 100%);
}
.hero-content {
  position: relative; z-index: 2; max-width: 800px; padding: 0 24px;
}
.hero h1 { color: #fff; margin-bottom: 20px; }
.hero h1 em { font-style: italic; color: var(--color-accent); }
.hero-subtitle {
  color: rgba(255,255,255,.78); font-size: 1.12rem; line-height: 1.7;
  max-width: 600px; margin: 0 auto 36px;
}
.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Scroll indicator */
.hero-scroll {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: rgba(255,255,255,.5); font-size: .72rem; text-transform: uppercase; letter-spacing: .15em;
}
.hero-scroll-line { width: 1px; height: 40px; background: linear-gradient(to bottom, rgba(255,255,255,.4), transparent); animation: scrollPulse 2s ease-in-out infinite; }
@keyframes scrollPulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

/* --- Stats Banner --- */
.stats {
  background: var(--color-secondary);
  padding: 48px 0;
  border-top: 1px solid rgba(196,160,53,.2);
  border-bottom: 1px solid rgba(196,160,53,.2);
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 32px; text-align: center;
}
.stat-item { position: relative; }
.stat-item:not(:last-child)::after {
  content: ''; position: absolute; right: -16px; top: 10%; height: 80%;
  width: 1px; background: rgba(255,255,255,.1);
}
html[dir="rtl"] .stat-item:not(:last-child)::after { right: auto; left: -16px; }
.stat-number {
  font-family: var(--font-heading); font-size: 2.2rem; font-weight: 700;
  color: var(--color-accent); margin-bottom: 4px;
}
.stat-label { color: rgba(255,255,255,.65); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }

/* --- Species Cards --- */
.species-card {
  background: var(--color-card-bg); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: var(--transition); display: flex; flex-direction: column;
}
.species-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card-hover); }
.species-card-img {
  position: relative; overflow: hidden; aspect-ratio: 4/3;
  background: var(--color-surface-alt);
}
.species-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.species-card:hover .species-card-img img { transform: scale(1.06); }
.species-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 4px 12px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
html[dir="rtl"] .species-badge { right: auto; left: 12px; }
.badge-cites-i { background: #c0392b; color: #fff; }
.badge-cites-ii { background: rgba(15,17,24,.75); color: var(--color-accent); backdrop-filter: blur(4px); }
.badge-available { background: #27ae60; color: #fff; }
.badge-coming { background: var(--color-accent); color: var(--color-primary); }
.badge-enquire { background: rgba(15,17,24,.75); color: #fff; backdrop-filter: blur(4px); }
.species-card-body { padding: 20px 24px 24px; flex: 1; display: flex; flex-direction: column; }
.species-card-name {
  font-family: var(--font-heading); font-size: 1.3rem; font-weight: 600;
  margin-bottom: 2px;
}
.species-card-latin { font-style: italic; color: var(--color-text-light); font-size: .9rem; margin-bottom: 12px; }
.species-card-excerpt { font-size: .88rem; color: var(--color-text-light); line-height: 1.6; flex: 1; }
.species-card-footer {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.species-card-link {
  font-size: .82rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--color-accent);
  transition: var(--transition);
}
.species-card-link:hover { color: var(--color-accent-hover); }

/* Filter tabs */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 40px; flex-wrap: wrap; }
.filter-tab {
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; letter-spacing: .03em;
  background: var(--color-card-bg); color: var(--color-text-light);
  border: 1px solid var(--color-border); transition: var(--transition); cursor: pointer;
}
.filter-tab:hover { border-color: var(--color-accent); color: var(--color-text); }
.filter-tab.active { background: var(--color-primary); color: var(--color-text-inv); border-color: var(--color-primary); }

/* --- Why Section (Features) --- */
.features-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
.feature-item {
  padding: 32px; border-radius: var(--radius-md);
  background: var(--color-card-bg); border: 1px solid var(--color-border);
  transition: var(--transition);
}
.feature-item:hover { border-color: var(--color-accent); box-shadow: var(--shadow-card); }
.feature-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: rgba(196,160,53,.1); display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px; color: var(--color-accent); font-size: 1.4rem;
}
.feature-item h4 { margin-bottom: 10px; }
.feature-item p { color: var(--color-text-light); font-size: .92rem; margin: 0; }

/* --- CTA Section --- */
.cta-section {
  background: var(--color-primary); color: var(--color-text-inv);
  text-align: center; padding: 80px 0;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(196,160,53,.08) 0%, transparent 70%);
}
.cta-section h2 { margin-bottom: 16px; }
.cta-section p { color: rgba(255,255,255,.7); max-width: 520px; margin: 0 auto 32px; }

/* --- Export Process Steps --- */
.steps { counter-reset: step; }
.step-item {
  display: flex; gap: 28px; padding: 28px 0;
  border-bottom: 1px solid var(--color-border);
}
.step-item:last-child { border-bottom: none; }
.step-number {
  counter-increment: step;
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%;
  background: var(--color-primary); color: var(--color-accent);
  font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-number::before { content: counter(step); }
.step-content h4 { margin-bottom: 8px; }
.step-content p { color: var(--color-text-light); margin: 0; font-size: .92rem; }

/* --- Partners / Programs --- */
.program-card {
  padding: 32px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-card-bg);
  transition: var(--transition);
}
.program-card:hover { border-color: var(--color-accent); transform: translateY(-4px); box-shadow: var(--shadow-card); }
.program-card h4 { margin-bottom: 12px; color: var(--color-accent); }
.program-card p { color: var(--color-text-light); font-size: .92rem; margin: 0; }

/* --- Gallery --- */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery-item {
  border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4/3;
  background: var(--color-surface-alt); cursor: pointer; position: relative;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(15,17,24,0); transition: var(--transition);
}
.gallery-item:hover::after { background: rgba(15,17,24,.2); }

/* --- Contact Form --- */
.contact-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 60px; }
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 6px; font-size: .85rem;
  font-weight: 600; color: var(--color-text); letter-spacing: .02em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-card-bg);
  font-family: inherit; font-size: .95rem; color: var(--color-text);
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(196,160,53,.15);
}
.form-textarea { min-height: 140px; resize: vertical; }
.contact-info { display: flex; flex-direction: column; gap: 28px; }
.contact-info-item { display: flex; gap: 16px; align-items: flex-start; }
.contact-info-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: rgba(196,160,53,.1); color: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.1rem;
}
.contact-info-text h4 { font-family: var(--font-body); font-size: .95rem; margin-bottom: 4px; }
.contact-info-text p { color: var(--color-text-light); font-size: .9rem; margin: 0; }

/* --- Docs List --- */
.docs-list { display: flex; flex-direction: column; gap: 12px; }
.docs-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--color-card-bg);
  border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  font-size: .92rem;
}
.docs-list li::before {
  content: '✓'; color: var(--color-accent); font-weight: 700;
  flex-shrink: 0;
}

/* --- Footer --- */
.footer {
  background: var(--color-primary); color: rgba(255,255,255,.6);
  padding: 60px 0 0;
}
.footer-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 48px;
  padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-brand h3 { color: #fff; font-size: 1.5rem; margin-bottom: 12px; }
.footer-brand h3 span { color: var(--color-accent); }
.footer-brand p { font-size: .88rem; line-height: 1.7; max-width: 320px; }
.footer-col h4 {
  color: var(--color-accent); font-family: var(--font-body);
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; margin-bottom: 20px;
}
.footer-col a { display: block; padding: 5px 0; font-size: .88rem; transition: var(--transition); }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  padding: 24px 0; text-align: center; font-size: .8rem;
  color: rgba(255,255,255,.35);
}

/* --- Section Headers --- */
.section-header { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-header h2 { margin-bottom: 16px; }
.section-header p { color: var(--color-text-light); font-size: 1rem; }
.section-header.left { text-align: left; margin: 0 0 48px; max-width: none; }
html[dir="rtl"] .section-header.left { text-align: right; }

/* --- Page Header (internal pages) --- */
.page-header {
  background: var(--color-primary); color: #fff; padding: 140px 0 60px;
  text-align: center;
  background-image: radial-gradient(ellipse at 50% 100%, rgba(196,160,53,.06) 0%, transparent 60%);
}
.page-header h1 { margin-bottom: 12px; }
.page-header p { color: rgba(255,255,255,.65); max-width: 560px; margin: 0 auto; }
.breadcrumb {
  font-size: .82rem; margin-bottom: 20px; color: rgba(255,255,255,.4);
}
.breadcrumb a { color: rgba(255,255,255,.5); transition: var(--transition); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb span { margin: 0 8px; }

/* --- Species Detail --- */
.species-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.species-detail-img {
  border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4/3;
  background: var(--color-surface-alt);
}
.species-detail-img img { width: 100%; height: 100%; object-fit: cover; }
.species-meta { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.species-meta-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--color-border); font-size: .9rem;
}
.species-meta-label { color: var(--color-text-light); font-weight: 500; }
.species-meta-value { font-weight: 600; }

/* --- Animations --- */
.fade-up {
  opacity: 0; transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }
.stagger-1 { transition-delay: .1s; }
.stagger-2 { transition-delay: .2s; }
.stagger-3 { transition-delay: .3s; }
.stagger-4 { transition-delay: .4s; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; gap: 32px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 24px; }
  .stat-item:nth-child(3)::after { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; gap: 40px; }
  .species-detail { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { 
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,17,24,.98); flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    backdrop-filter: blur(16px);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1.2rem; }
  .lang-switch { border: none; margin: 0; padding: 0; margin-top: 16px; }
  .nav-toggle { display: flex; }
  .grid-3 { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .section { padding: 56px 0; }
  .hero-subtitle { font-size: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-item::after { display: none !important; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .btn { width: 100%; justify-content: center; }
  .grid-4 { grid-template-columns: 1fr; }
}

/* --- Placeholder images for species --- */
.placeholder-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; opacity: .15;
  background: linear-gradient(135deg, var(--color-surface-alt) 0%, var(--color-border) 100%);
}
