/* ============================================
   御膳小厨 — Main Stylesheet
   Core styles, typography, layout, components
   ============================================ */

/* ----- CSS Custom Properties ----- */
:root {
  /* Colors */
  --color-red:       #8B1A2B;
  --color-red-dark:  #6B1A1A;
  --color-gold:      #C8A45C;
  --color-cream:     #FDFBF7;
  --color-wood:      #5C3D2E;
  --color-wood-dark: #3D2B1A;
  --color-text:      #2C2416;
  --color-text-alt:  #8C7B6B;
  --color-surface:   #1A1410;

  /* Typography */
  --font-display: 'Noto Serif SC', 'STSong', 'SimSun', 'Songti SC', 'KaiTi', serif;
  --font-body:    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, sans-serif;

  /* Spacing */
  --spacing-xs:   0.5rem;
  --spacing-sm:   1rem;
  --spacing-md:   2rem;
  --spacing-lg:   4rem;
  --spacing-xl:   8rem;

  /* Layout */
  --container-max: 1200px;
  --container-pad: clamp(1rem, 5vw, 3rem);

  /* Borders & Shadows */
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    16px;
  --shadow-card:  0 2px 20px rgba(44, 36, 22, 0.08);
  --shadow-hover: 0 12px 40px rgba(44, 36, 22, 0.14);
  --shadow-nav:   0 1px 20px rgba(0, 0, 0, 0.06);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-cream);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ----- Layout Utilities ----- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: clamp(4rem, 8vw, 8rem);
}

.section-alt {
  background-color: #FAF5EE;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  margin-bottom: var(--spacing-sm);
  letter-spacing: 0.04em;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-alt);
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  margin-bottom: var(--spacing-lg);
}

/* ----- Navigation ----- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding-block: var(--spacing-sm);
  transition: background-color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

.nav.scrolled {
  background-color: rgba(253, 251, 247, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-nav);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  z-index: 1001;
}

.logo-seal {
  display: block;
}

.nav-links {
  display: flex;
  gap: var(--spacing-md);
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.06em;
  padding: var(--spacing-xs) 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav.scrolled .nav-link {
  color: var(--color-text);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width 0.3s var(--ease-out);
}

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

/* Hamburger toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}

.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s var(--ease-smooth);
}

.nav.scrolled .hamburger-line {
  background: var(--color-text);
}

/* ----- Hero Section ----- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(170deg, #6B1A1A 0%, #8B1A2B 25%, #5C2D1A 60%, #1A1410 100%);
  overflow: hidden;
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 Q40 20 30 35 Q20 50 30 55' fill='none' stroke='white' stroke-width='1'/%3E%3Ccircle cx='30' cy='30' r='25' fill='none' stroke='white' stroke-width='0.5'/%3E%3C/svg%3E");
  background-size: 60px 60px;
}

.hero-content {
  position: relative;
  z-index: 1;
  color: #fff;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: var(--spacing-sm);
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero-subtitle {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  opacity: 0.85;
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.05em;
  font-weight: 300;
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: var(--color-gold);
  letter-spacing: 0.08em;
  font-style: italic;
  margin-bottom: var(--spacing-lg);
}

.hero-scroll {
  animation: bounceDown 2s ease-in-out infinite;
  opacity: 0.7;
  display: inline-block;
  color: var(--color-gold);
  cursor: pointer;
}

/* ----- Story Section ----- */
.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: start;
  margin-top: var(--spacing-lg);
}

.story-text {
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 2;
  color: var(--color-text);
}

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

.highlight {
  color: var(--color-red);
  font-weight: 700;
  font-family: var(--font-display);
}

.story-honors {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.honor-card {
  background: #fff;
  border: 1px solid rgba(200, 164, 92, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

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

.honor-icon {
  font-size: 2rem;
  margin-bottom: var(--spacing-xs);
}

.honor-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.honor-year {
  font-size: 0.85rem;
  color: var(--color-gold);
  font-weight: 500;
}

/* ----- Dishes Grid ----- */
.dishes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
}

.dish-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
  cursor: pointer;
}

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

.dish-image {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #FDF3E0;
}

.dish-image svg {
  width: 100%;
  height: 100%;
  transition: transform 0.5s var(--ease-out);
}

.dish-card:hover .dish-image svg {
  transform: scale(1.04);
}

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

.dish-name {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.5vw, 1.4rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.dish-desc {
  font-size: 0.9rem;
  color: var(--color-text-alt);
  line-height: 1.8;
}

/* ----- Game Section ----- */
.game-wrapper {
  display: flex;
  justify-content: center;
  margin-top: var(--spacing-lg);
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 600px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-md);
  z-index: 10;
  pointer-events: none;
}

.score-label,
.timer-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-alt);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.score-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--color-gold);
  line-height: 1;
}

.timer-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.game-area {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Wok (pure CSS) */
.game-wok {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.4s var(--ease-out);
}

.game-wok.tossing {
  animation: wokToss 0.4s var(--ease-out);
}

.wok-body {
  width: 180px;
  height: 70px;
  background: radial-gradient(ellipse at center, #4A4A4A 0%, #2A2A2A 60%, #1A1A1A 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 -4px 12px rgba(0,0,0,0.5),
    inset 0 4px 12px rgba(255,255,255,0.08),
    0 4px 16px rgba(0,0,0,0.4);
  position: relative;
}

.wok-body::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 20px;
  right: 20px;
  bottom: 12px;
  background: radial-gradient(ellipse at center, #5A4A3A 0%, #3A2A1A 100%);
  border-radius: 50%;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

.wok-handle {
  position: absolute;
  top: 15px;
  width: 20px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(180deg, #6B4A2A, #4A2A1A);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.wok-handle-left {
  left: -28px;
  transform: rotate(-15deg);
}

.wok-handle-right {
  right: -28px;
  transform: rotate(15deg);
}

/* Game Overlay */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-screen {
  text-align: center;
  padding: var(--spacing-md);
  color: #fff;
}

.game-intro-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: var(--spacing-md);
  color: var(--color-gold);
}

.game-hint {
  margin-top: var(--spacing-md);
  font-size: 0.8rem;
  color: var(--color-text-alt);
  line-height: 1.8;
}

.btn {
  display: inline-block;
  padding: 0.85rem 2.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  letter-spacing: 0.04em;
}

.btn-game {
  background: var(--color-red);
  color: #fff;
  font-size: 1.15rem;
  padding: 1rem 3rem;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(139, 26, 43, 0.4);
}

.btn-game:hover {
  background: #A51F33;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 26, 43, 0.55);
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 8rem;
  font-weight: 900;
  color: var(--color-gold);
  animation: countPulse 0.8s ease-out;
}

.finish-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-gold);
  margin-bottom: var(--spacing-sm);
}

.finish-score {
  font-size: 1.3rem;
  margin-bottom: var(--spacing-xs);
  color: #fff;
}

.finish-score span {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-gold);
}

.finish-rank {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-gold);
  margin-bottom: var(--spacing-md);
}

/* Ingredient (emoji-based) */
.ingredient {
  position: absolute;
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
  z-index: 5;
  transition: transform 0.15s ease, opacity 0.3s ease;
}

.ingredient.caught {
  animation: ingredientCaught 0.5s ease-out forwards;
}

.ingredient.missed {
  animation: ingredientMissed 0.5s ease-out forwards;
}

/* Particle */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-gold);
  pointer-events: none;
  z-index: 6;
  animation: particleBurst 0.7s ease-out forwards;
}

/* ----- Footer ----- */
.footer {
  background: var(--color-wood-dark);
  color: #D4C5A0;
  padding-block: var(--spacing-xl);
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.05) 4px,
    rgba(255,255,255,0.05) 5px
  );
  pointer-events: none;
}

.footer-title {
  color: var(--color-gold);
  margin-bottom: var(--spacing-lg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: center;
}

.info-item {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.info-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.info-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-gold);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.info-item p {
  font-size: 0.95rem;
  color: #C4B898;
  line-height: 1.7;
}

.info-note {
  font-size: 0.85rem !important;
  color: var(--color-text-alt) !important;
}

.btn-reserve {
  background: transparent;
  border: 1.5px solid var(--color-gold);
  color: var(--color-gold);
  margin-top: var(--spacing-sm);
}

.btn-reserve:hover {
  background: var(--color-gold);
  color: var(--color-wood-dark);
}

.footer-map svg {
  max-width: 300px;
  margin: 0 auto;
}

.footer-closing {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(200, 164, 92, 0.15);
  text-align: center;
}

.closing-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-gold);
  font-style: italic;
  margin-bottom: var(--spacing-sm);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-text-alt);
}

/* ----- Screen Reader Only ----- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
