/* =====================================================
   蜂維雅 APIVITA TAIWAN - Global Theme
   Language: modern apothecary, editorial
   Palette:  forest ink + botanical paper (single accent: pine)
   Radius rule: interactive = pill / surfaces & media = 18px / inputs = 12px
   ===================================================== */

:root {
  /* Brand greens */
  --pine: #2B5540;
  --pine-strong: #224434;
  --pine-deep: #1D3829;
  --pine-ink: #14271C;

  /* Botanical neutrals */
  --paper: #F5F4ED;
  --surface: #FCFBF6;
  --tint: #EAEDDF;
  --border: #DDE0D0;
  --hairline: #E4E6D8;

  /* Text */
  --ink: #1F2A21;
  --muted: #5C675C;
  --text-light: #F6F5EE;
  --on-dark-muted: rgba(240, 242, 230, 0.72);

  /* Type */
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", sans-serif;

  /* Layout */
  --section-padding: 104px;
  --container-max: 1560px;
  --container-pad: 24px;
  --grid-gap: 32px;
  --nav-height: 72px;

  /* Shape */
  --radius: 18px;
  --radius-input: 12px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: all 0.35s var(--ease);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  overflow-x: clip;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

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

ul {
  list-style: none;
}

::selection {
  background: var(--pine);
  color: var(--text-light);
}

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 3px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.35;
  font-weight: 600;
}

/* ===== Container ===== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  background: var(--pine);
  color: var(--text-light);
  padding: 15px 36px;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
  border: 1px solid var(--pine);
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--pine-strong);
  border-color: var(--pine-strong);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--pine);
  padding: 13px 32px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--text-light);
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* Text link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.link-arrow i {
  font-size: 13px;
  transition: transform 0.35s var(--ease);
}

.link-arrow:hover {
  color: var(--pine);
  border-bottom-color: var(--pine);
}

.link-arrow:hover i {
  transform: translateX(5px);
}

/* ===== Section Header (left-aligned, editorial) ===== */
.section-header {
  max-width: 620px;
  margin-bottom: 56px;
}

.section-header h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 14px;
}

.section-header p {
  font-size: 16px;
  color: var(--muted);
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(245, 244, 237, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  z-index: 1000;
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease),
    -webkit-backdrop-filter 0.35s var(--ease), backdrop-filter 0.35s var(--ease);
}

.navbar.scrolled {
  border-bottom-color: var(--hairline);
  background: rgba(245, 244, 237, 0.94);
}

/* Homepage: the hero photo runs under the nav. The bar itself is fully
   transparent at the top — the hero's own paper veil (home.css) keeps the
   text legible — so header and hero read as one surface. The paper tint
   and blur return on scroll. blur(0) instead of none keeps it animatable. */
body.home .navbar:not(.scrolled) {
  background: transparent;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  /* width matches the footer: capped at --container-max and centered
     via the base .container rule (max-width + margin auto + padding) */
}

.brand {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.14em;
}

.brand:hover {
  color: var(--pine);
}

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

.nav-links a {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--pine);
  transition: width 0.35s var(--ease);
}

.nav-links a:hover {
  color: var(--pine);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--pine);
}

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--ink);
  transition: var(--transition);
}

/* Mobile nav drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--pine-deep);
  z-index: 1001;
  padding: 96px 36px 36px;
  transition: right 0.4s var(--ease);
}

.mobile-drawer.open {
  right: 0;
}

.mobile-drawer a {
  display: block;
  color: var(--text-light);
  padding: 16px 0;
  font-size: 17px;
  font-family: var(--serif);
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(240, 242, 230, 0.12);
}

.mobile-drawer a.active {
  color: #B9CFA9;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 39, 28, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.open {
  display: block;
  opacity: 1;
}

/* ===== Footer ===== */
.footer {
  background: var(--pine-ink);
  color: var(--text-light);
  padding: 80px 0 36px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 48px;
  margin-bottom: 56px;
}

.footer-brand h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}

.footer-tagline {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--on-dark-muted);
  margin-bottom: 18px;
}

.footer-brand p {
  font-size: 14px;
  color: var(--on-dark-muted);
  line-height: 1.9;
  margin-bottom: 22px;
  max-width: 320px;
}

.footer h4 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  color: var(--text-light);
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--on-dark-muted);
  font-size: 14px;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--text-light);
}

.footer-contact p {
  font-size: 14px;
  color: var(--on-dark-muted);
  margin-bottom: 12px;
}

.footer-contact i {
  margin-right: 10px;
  color: rgba(185, 207, 169, 0.85);
  width: 16px;
}

.footer-bottom {
  border-top: 1px solid rgba(240, 242, 230, 0.14);
  padding-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-bottom p {
  font-size: 13px;
  color: rgba(240, 242, 230, 0.5);
}

.footer-bottom a {
  font-size: 13px;
  color: rgba(240, 242, 230, 0.5);
  margin-left: 16px;
}

.footer-bottom a:hover {
  color: var(--text-light);
}

/* ===== Scroll Animations =====
   Hidden states engage only when <html> carries .reveal-ready — added by
   main.js right before it starts observing — and only for users who accept
   motion. Without JS (crawlers, print, previews) everything ships visible.
   The observer flips .visible once per element and lets go. */
@media screen and (prefers-reduced-motion: no-preference) {
  html.reveal-ready .animate-on-scroll {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }

  html.reveal-ready .animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
  }

  html.reveal-ready .stagger-1 { transition-delay: 0.08s; }
  html.reveal-ready .stagger-2 { transition-delay: 0.16s; }
  html.reveal-ready .stagger-3 { transition-delay: 0.24s; }
  html.reveal-ready .stagger-4 { transition-delay: 0.32s; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
