/* ============================================================
   Radiant Beauty Medical Centre - Design System
   Palette: Charcoal + Rose Gold + Cream
   Fonts: Outfit (headings) + Noto Sans TC (body)
   Framework: Bootstrap 5.3
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Light mode */
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-hover: #f5f2ed;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #b8867c;
  --accent-hover: #a07066;
  --accent-light: #d4b5b0;
  --accent-glow: rgba(184, 134, 124, 0.15);
  --border: #e8e3dc;
  --border-light: #f0ece6;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --nav-height: 72px;
  --transition-base: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #1e1e1e;
  --surface-hover: #282828;
  --text: #f0ede8;
  --text-secondary: #b0aca5;
  --text-muted: #707070;
  --accent: #c9a09a;
  --accent-hover: #d4b5b0;
  --accent-light: #8a6560;
  --accent-glow: rgba(201, 160, 154, 0.12);
  --border: #2d2d2d;
  --border-light: #252525;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.4);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-base);
}
a:hover { color: var(--accent-hover); }

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

/* --- Noise overlay --- */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* --- Mesh gradient background --- */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, var(--accent-glow) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(120,120,120,0.04) 0%, transparent 60%);
}

[data-theme="dark"] .mesh-bg {
  opacity: 0.2;
}

/* --- Navigation --- */
.navbar {
  height: var(--nav-height);
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-base), border-color var(--transition-base);
  z-index: 1000;
}

[data-theme="dark"] .navbar {
  background: rgba(20, 20, 20, 0.85);
}

.navbar-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text) !important;
}

.navbar-brand .brand-accent {
  color: var(--accent);
}

.nav-link {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary) !important;
  padding: 0.5rem 1.25rem !important;
  transition: color var(--transition-base);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent) !important;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 2px;
  background: var(--accent);
  transition: transform var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition-base);
  margin-left: 0.75rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Buttons --- */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  text-transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* --- Section spacing --- */
.section {
  padding: 6rem 0;
}

.section-sm { padding: 4rem 0; }
.section-lg { padding: 8rem 0; }

.section-header {
  margin-bottom: 4rem;
}

.section-header h2 {
  margin-bottom: 0.75rem;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 56ch;
}

/* --- Cards --- */
.card-custom {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card-custom:hover {
  transform: scale(0.97) translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-custom .card-img {
  aspect-ratio: 16/10;
  object-fit: cover;
  width: 100%;
}

.card-custom .card-body {
  padding: 1.75rem;
}

.card-custom .card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.card-custom .card-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- Service cards (larger, feature-focused) --- */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.service-card:hover {
  transform: scale(0.97) translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card .service-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--accent);
  font-size: 1.4rem;
}

/* --- Team card --- */
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.team-card:hover {
  transform: scale(0.97) translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.team-card .team-img {
  aspect-ratio: 3/4;
  object-fit: cover;
  width: 100%;
}

.team-card .team-body {
  padding: 1.5rem;
  text-align: left;
}

.team-card .team-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
}

.team-card .team-role {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.team-card .team-bio {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Blog card --- */
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.blog-card:hover {
  transform: scale(0.97) translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.blog-card .blog-img-wrap {
  position: relative;
  overflow: hidden;
}

.blog-card .blog-img {
  aspect-ratio: 16/10;
  object-fit: cover;
  width: 100%;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover .blog-img {
  transform: scale(1.03);
}

.blog-card .blog-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
}

.blog-card .blog-body {
  padding: 1.75rem;
}

.blog-card .blog-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.blog-card .blog-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.blog-card .blog-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Testimonial --- */
.testimonial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  transition: all var(--transition-base);
}

.testimonial-card:hover {
  transform: scale(0.97) translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.testimonial-card .quote-mark {
  font-family: 'Outfit', serif;
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

.testimonial-card .quote-text {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.testimonial-card .quote-author {
  font-weight: 600;
  font-size: 0.95rem;
}

.testimonial-card .quote-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- CTA Banner --- */
.cta-banner {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 5rem 0;
}

.cta-banner h2 {
  margin-bottom: 0.75rem;
}

.cta-banner p {
  color: var(--text-secondary);
  max-width: 52ch;
  margin: 0 auto 2rem;
}

/* --- Contact section --- */
.contact-info-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.contact-info-item .contact-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1.2rem;
}

.contact-info-item h4 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.contact-info-item p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.form-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

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

.form-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

/* --- Map placeholder --- */
.map-placeholder {
  aspect-ratio: 16/9;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Footer --- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
}

.footer-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.footer-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 40ch;
}

.footer-heading {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.footer-link {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.3rem 0;
  transition: color var(--transition-base);
}

.footer-link:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Stat number --- */
.stat-number {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* --- Gallery carousel (blog page) --- */
.gallery-img {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-img:hover {
  transform: scale(1.03);
}

/* --- Animations --- */

/* Page fade in */
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-content {
  animation: pageFadeIn 0.5s ease-out;
}

/* Typography stagger slide-up */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Scroll-driven stagger via view-timeline - progressive enhancement */
/* Default: elements are visible with no initial opacity hiding */
.reveal-on-scroll,
.reveal-stagger > * {
  opacity: 1;
  transform: none;
}

/* Only apply scroll-driven animations when supported */
@supports (animation-timeline: view()) {
  .reveal-on-scroll {
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 10% cover 30%;
  }

  .reveal-stagger > * {
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 5% cover 25%;
  }

  .reveal-stagger > *:nth-child(1) { animation-delay: 0s; }
  .reveal-stagger > *:nth-child(2) { animation-delay: 0.1s; }
  .reveal-stagger > *:nth-child(3) { animation-delay: 0.2s; }
  .reveal-stagger > *:nth-child(4) { animation-delay: 0.3s; }
  .reveal-stagger > *:nth-child(5) { animation-delay: 0.4s; }
  .reveal-stagger > *:nth-child(6) { animation-delay: 0.5s; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card-custom:hover,
  .service-card:hover,
  .team-card:hover,
  .blog-card:hover,
  .testimonial-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }

  .blog-card:hover .blog-img {
    transform: none;
  }

  .reveal-on-scroll,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* --- Responsive --- */
@media (max-width: 767.98px) {
  .section { padding: 3.5rem 0; }
  .section-lg { padding: 5rem 0; }

  .navbar-collapse {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.5rem;
  }
}

/* --- Utilities --- */
.text-accent { color: var(--accent) !important; }
.bg-accent-glow { background: var(--accent-glow); }
.rounded-custom { border-radius: var(--radius-md); }
.border-custom { border-color: var(--border) !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
