/* ============================================================
   小花咖啡 (Xiaohua Coffee) 官網 - 共用樣式表
   Design System & Global Styles
   ============================================================ */

/* ============================================================
   RESET & BOX-SIZING
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   DESIGN VARIABLES (根變數)
   ============================================================ */
:root {
  /* 顏色 */
  --primary: #6f4e37;           /* 咖啡棕 */
  --primary-dark: #4a3528;      /* 深棕 */
  --accent: #c8956d;             /* 拿鐵奶色 */
  --bg: #fbf7f2;                 /* 米白背景 */
  --surface: #ffffff;            /* 白色表面 */
  --text: #2e2620;               /* 深灰棕文字 */
  --muted: #7a6f64;              /* 灰化文字 */

  /* 排版 */
  --ff-base: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --fs-base: 16px;
  --fs-sm: 0.875rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-bold: 700;

  /* 間距 & 尺寸 */
  --radius: 14px;
  --maxw: 1140px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* 陰影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* 過渡 */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   TYPOGRAPHY & BASE STYLES
   ============================================================ */
body {
  font-family: var(--ff-base);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: 1.2;
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: var(--fs-3xl);
}

h2 {
  font-size: var(--fs-2xl);
  color: var(--primary);
}

h3 {
  font-size: var(--fs-xl);
}

h4 {
  font-size: var(--fs-lg);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text);
}

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

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ============================================================
   CONTAINER & LAYOUT
   ============================================================ */
.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.2rem, 5vw, 3rem);
}

main {
  min-height: calc(100vh - 70px - 280px); /* Header height - Footer height */
}

/* ============================================================
   HEADER & NAVIGATION (Sticky)
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(111, 78, 55, 0.1);
}

.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.75rem;
}

/* 品牌名稱 */
.brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.brand:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

.brand-emoji {
  display: inline-block;
  font-size: 1.4em;
}

/* 導航 */
nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

nav a {
  display: inline-block;
  font-size: var(--fs-base);
  color: var(--text);
  position: relative;
  padding-bottom: 4px;
  font-weight: var(--fw-medium);
}

nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* 漢堡選單 (純CSS checkbox) */
.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 6px;
  width: 28px;
  height: 24px;
  background: none;
  border: none;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
  transition: var(--transition);
}

.menu-toggle:hover span {
  background-color: var(--accent);
}

#menu-checkbox {
  display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: 0.7em 1.6em;
  border-radius: 999px;
  font-family: var(--ff-base);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn, .btn-primary {
  background-color: var(--primary);
  color: var(--surface);
}

.btn:hover, .btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: var(--surface);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background-color: var(--accent);
  color: var(--surface);
}

.btn-accent:hover {
  background-color: #b37d5a;
  box-shadow: var(--shadow-md);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url("../images2/hero-bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 53, 40, 0.45);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--surface);
  max-width: 700px;
  padding: var(--spacing-lg);
}

.hero h1 {
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: var(--surface);
  margin-bottom: var(--spacing-md);
  font-weight: var(--fw-bold);
}

.hero p {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: var(--spacing-lg);
}

/* ============================================================
   SECTIONS & SPACING
   ============================================================ */
section {
  padding-block: clamp(3rem, 8vw, 6rem);
}

section.alt-bg {
  background-color: var(--bg);
}

section.dark-bg {
  background-color: var(--primary-dark);
  color: var(--surface);
}

section.dark-bg h2 {
  color: var(--accent);
}

section.dark-bg p {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background-color: var(--surface);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid rgba(111, 78, 55, 0.08);
}

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

.card-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
  display: block;
  object-fit: cover;
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--primary);
  margin-bottom: var(--spacing-sm);
}

.card-text {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.7;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(111, 78, 55, 0.1);
}

/* ============================================================
   MENU LIST / 菜單價目表
   ============================================================ */
.menu-list {
  list-style: none;
}

.menu-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding-block: var(--spacing-md);
  border-bottom: 1px dotted var(--muted);
  min-height: 2.5rem;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-name {
  font-weight: var(--fw-medium);
  color: var(--primary);
  flex: 0 0 auto;
  white-space: nowrap;
}

.menu-description {
  font-size: var(--fs-sm);
  color: var(--muted);
  flex: 1;
  display: none;
}

.menu-leader {
  flex: 1;
  border-bottom: 1px dotted var(--muted);
  margin: 0 var(--spacing-sm);
  min-width: 20px;
}

.menu-price {
  font-weight: var(--fw-bold);
  color: var(--accent);
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
}

/* 平板以上顯示描述 */
@media (min-width: 768px) {
  .menu-item {
    flex-direction: column;
    gap: var(--spacing-xs);
    padding-block: var(--spacing-lg);
  }

  .menu-description {
    display: block;
    font-size: var(--fs-sm);
    color: var(--muted);
    margin-left: 0;
  }

  .menu-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-md);
  }

  .menu-leader {
    display: none;
  }
}

/* ============================================================
   GRID & FLEXBOX UTILITIES
   ============================================================ */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background-color: var(--primary-dark);
  color: var(--surface);
  padding-block: var(--spacing-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--fs-sm);
}

footer a {
  color: var(--accent);
}

footer a:hover {
  color: var(--surface);
  text-decoration: underline;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.footer-section h3 {
  font-size: var(--fs-lg);
  color: var(--accent);
  margin-bottom: var(--spacing-md);
  margin-top: 0;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: var(--spacing-sm);
  font-size: var(--fs-sm);
}

.footer-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: var(--spacing-lg);
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--fs-sm);
}

/* ============================================================
   RESPONSIVE DESIGN (RWD)
   ============================================================ */

/* 平板設備 (768px 以下) */
@media (max-width: 768px) {
  :root {
    --fs-3xl: 2rem;
    --fs-2xl: 1.5rem;
    --spacing-xl: 2rem;
  }

  /* 隱藏桌面導航，顯示漢堡選單 */
  .menu-toggle {
    display: flex;
  }

  nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background-color: var(--surface);
    border-bottom: 1px solid rgba(111, 78, 55, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  nav a {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(111, 78, 55, 0.05);
  }

  nav a::after {
    display: none;
  }

  #menu-checkbox:checked ~ nav {
    max-height: 300px;
  }

  #menu-checkbox:checked ~ .menu-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
  }

  #menu-checkbox:checked ~ .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  #menu-checkbox:checked ~ .menu-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }

  /* Hero 調整 */
  .hero {
    min-height: 350px;
  }

  .hero h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }

  /* Grid 調整 */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Footer 調整 */
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  section {
    padding-block: clamp(2rem, 5vw, 3rem);
  }
}

/* 小手機 (480px 以下) */
@media (max-width: 480px) {
  :root {
    --fs-xl: 1.25rem;
    --fs-lg: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-md: 1rem;
  }

  .brand {
    font-size: var(--fs-lg);
  }

  h1 {
    font-size: var(--fs-2xl);
  }

  h2 {
    font-size: var(--fs-xl);
  }

  .card {
    padding: var(--spacing-md);
  }

  .btn {
    width: 100%;
  }
}

/* ============================================================
   UTILITIES & HELPER CLASSES
   ============================================================ */
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.text-center { text-align: center; }
.text-sm { font-size: var(--fs-sm); }
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-white { color: var(--surface); }

.hidden { display: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.no-wrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   ANIMATION
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

/* ============================================================
   FOCUS & ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  header, footer {
    display: none;
  }

  body {
    background: white;
  }

  a {
    text-decoration: underline;
  }
}
