/* ============================================================
   匠心裝修工程 — Industrial / Craft Design System
   Raw concrete + warm wood · Industrial orange accent · Bold typography
   Aesthetic: Brutalist dark-first with craft warmth
   Fonts: Noto Serif TC (display) + Noto Sans TC (body)
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700;900&family=Noto+Serif+TC:wght@600;700;900&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors — Industrial Dark palette (concrete + wood + orange) */
  --color-primary:       #ff6600;   /* Industrial orange — safety/work accent */
  --color-primary-light: #ff9940;   /* Light orange — highlights/glow */
  --color-primary-dark:  #cc5200;   /* Dark orange — hover/active */
  --color-primary-pale:  rgba(255,102,0,0.12); /* Orange tint */

  --color-accent:        #c4943a;   /* Warm wood/gold */
  --color-accent-light:  #d4a853;   /* Light gold */

  --color-concrete:      #8a8580;   /* Concrete gray */
  --color-concrete-light:#b0aba6;   /* Light concrete */
  --color-concrete-dark: #5c5854;   /* Dark concrete */

  --color-surface:       #0d0d0d;   /* Near-black main bg */
  --color-surface-alt:   #141414;   /* Alt section bg */
  --color-surface-card:  #1c1c1c;   /* Card surface */
  --color-surface-dark:  #080808;   /* Darkest surface */
  --color-surface-light: #222222;   /* Lighter surface */

  --color-text:          #e8e4dd;   /* Warm off-white */
  --color-text-muted:    #999590;   /* Muted warm gray */
  --color-text-dim:      #6b6762;   /* Dimmer text */
  --color-text-inverse:  #0d0d0d;   /* Dark on light */

  --color-border:        #2a2a2a;   /* Subtle border */
  --color-border-strong: #444444;   /* Strong border */

  --color-success:       #3a9d6a;   /* Green */

  /* Accent glow */
  --accent-glow:         rgba(255,102,0,0.25);

  /* Typography */
  --font-display:        'Noto Serif TC', serif;
  --font-heading:        'Noto Sans TC', sans-serif;
  --font-body:           'Noto Sans TC', sans-serif;

  --text-scale-ratio: 1.25;
  --text-xs:    clamp(0.64rem, 0.06vw + 0.63rem, 0.70rem);
  --text-sm:    clamp(0.80rem, 0.08vw + 0.78rem, 0.88rem);
  --text-base:  clamp(1.00rem, 0.10vw + 0.98rem, 1.10rem);
  --text-md:    clamp(1.25rem, 0.12vw + 1.22rem, 1.37rem);
  --text-lg:    clamp(1.56rem, 0.15vw + 1.53rem, 1.71rem);
  --text-xl:    clamp(1.95rem, 0.19vw + 1.91rem, 2.14rem);
  --text-2xl:   clamp(2.44rem, 0.24vw + 2.38rem, 2.68rem);
  --text-3xl:   clamp(3.05rem, 0.30vw + 2.98rem, 3.35rem);
  --text-4xl:   clamp(3.81rem, 0.38vw + 3.72rem, 4.19rem);

  /* Spacing — 8px base grid */
  --space-1:  0.5rem;
  --space-2:  1rem;
  --space-3:  1.5rem;
  --space-4:  2rem;
  --space-5:  3rem;
  --space-6:  4rem;
  --space-7:  6rem;
  --space-8:  8rem;

  /* Layout */
  --max-width:        1280px;
  --content-width:    65ch;
  --header-height:    5rem;

  /* Borders & Radii — sharp/industrial, minimal radius */
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;
  --radius-xl:  12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);
  --shadow-xl:  0 16px 60px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --shadow-block: 6px 6px 0 var(--color-primary);

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast:   150ms;
  --duration-normal: 300ms;
  --duration-slow:   500ms;

  /* Grain */
  --grain-opacity: 0.035;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-surface);
  overflow-x: hidden;
}

body.page-transition {
  animation: pageIn 0.4s ease-out;
}

@keyframes pageIn {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}

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

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

a {
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.25;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

.display {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.section-label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
  display: block;
}

.gradient-text {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.section {
  padding-block: var(--space-7);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.875rem 2rem;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-block);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--color-primary);
}

.btn-pulse {
  position: relative;
}

.btn-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  z-index: -1;
  opacity: 0;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0; filter: blur(12px); }
  50%      { opacity: 0.4; filter: blur(8px); }
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.nav.scrolled {
  background: rgba(8,8,8,0.96);
  border-bottom-color: var(--color-border-strong);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 900;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.nav-brand span {
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
}

.nav-links a {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  transition: color var(--duration-fast);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
}

.nav-cta {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1.5rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.nav-cta:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--color-primary-dark);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--space-1);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: all var(--duration-fast);
}

/* --- Scroll Reveal --- */
.reveal {
  animation: slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

@supports not (animation-timeline: view()) {
  .reveal {
    animation: slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-timeline: auto;
  }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(48px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-stagger-1 { animation-delay: 0s; }
.reveal-stagger-2 { animation-delay: 0.12s; }
.reveal-stagger-3 { animation-delay: 0.24s; }
.reveal-stagger-4 { animation-delay: 0.36s; }

/* --- Section Title --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 900;
  margin-bottom: var(--space-2);
}

.section-header p {
  color: var(--color-text-muted);
  max-width: 55ch;
  margin-inline: auto;
  font-size: var(--text-base);
  line-height: 1.8;
}

/* --- Card base --- */
.card {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.card:hover {
  border-color: var(--color-primary);
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--color-primary);
}

/* --- Stats Bar --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.stat-item {
  text-align: center;
  padding: var(--space-3);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
}

.stat-number {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 900;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* --- Footer --- */
.footer {
  background: var(--color-surface-dark);
  border-top: 3px solid var(--color-primary);
  padding-block: var(--space-6);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: var(--space-5);
}

.footer-brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.footer-brand span {
  color: var(--color-primary);
}

.footer-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-3);
}

.footer h5 {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  letter-spacing: 0.04em;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-1);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

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

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer-contact-item svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.footer-bottom {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-dim);
}

.footer-bottom a {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

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

/* --- Mesh Glow (Pattern #7) --- */
.mesh-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.07;
}

.mesh-glow--top-right {
  top: -200px;
  right: -200px;
  background: radial-gradient(circle, var(--color-primary), var(--color-accent) 60%, transparent);
  animation: meshPulse 8s ease-in-out infinite;
}

.mesh-glow--bottom-left {
  bottom: -200px;
  left: -200px;
  background: radial-gradient(circle, var(--color-accent), var(--color-primary) 60%, transparent);
  animation: meshPulse 8s ease-in-out 4s infinite;
}

@keyframes meshPulse {
  0%, 100% { opacity: 0.05; transform: scale(1); }
  50%      { opacity: 0.10; transform: scale(1.15); }
}

/* --- Gallery Zoom (Pattern #9) --- */
.gallery-img {
  overflow: hidden;
}

.gallery-img img {
  transition: transform 0.5s ease-out;
}

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

/* --- Word Cascade (Pattern #3) --- */
.hero-heading .word {
  display: inline-block;
  animation: wordCascade 0.7s ease-out both;
}

.hero-heading .word:nth-child(1) { animation-delay: 0s; }
.hero-heading .word:nth-child(2) { animation-delay: 0.1s; }
.hero-heading .word:nth-child(3) { animation-delay: 0.2s; }
.hero-heading .word:nth-child(4) { animation-delay: 0.3s; }
.hero-heading .word:nth-child(5) { animation-delay: 0.4s; }
.hero-heading .word:nth-child(6) { animation-delay: 0.5s; }

@keyframes wordCascade {
  from { opacity: 0; transform: translateY(1.5rem); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- Before/After comparison component --- */
.ba-container {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--color-primary);
}

.ba-label {
  position: absolute;
  top: var(--space-2);
  padding: 0.3rem 1rem;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 2;
}

.ba-label--before {
  left: var(--space-2);
  background: rgba(0,0,0,0.8);
  color: var(--color-text-muted);
}

.ba-label--after {
  right: var(--space-2);
  background: var(--color-primary);
  color: #fff;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(13,13,13,0.98);
    backdrop-filter: blur(16px);
    padding: var(--space-3);
    gap: var(--space-2);
    border-bottom: 2px solid var(--color-primary);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .section {
    padding-block: var(--space-5);
  }
}

/* --- Reduced Motion Guard --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-timeline: auto !important;
  }
  .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .shimmer-border::before { animation: none !important; }
  .noise-overlay, .mesh-glow { display: none; }
  .card:hover { transform: none; box-shadow: var(--shadow-md); }
  .btn:hover { transform: none; }
}
