/* Mobile Styles - Baby Food Kitchen */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--color-body);
  background: var(--color-cream);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* ===== Views ===== */
.view { display: none; min-height: 100vh; min-height: 100dvh; }
.view.active { display: flex; flex-direction: column; }

/* ===== List View ===== */
.list-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 251, 245, 0.95);
  backdrop-filter: blur(12px);
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-md));
  border-bottom: 1px solid var(--color-border-light);
}
.list-nav-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-xl);
  color: var(--color-foreground);
}
.list-nav-sub { font-size: var(--text-xs); color: var(--color-muted); margin-top: 2px; }
.list-filters {
  display: flex; gap: var(--space-sm); padding: var(--space-md) var(--space-lg);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.list-filters::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 6px 16px; border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border); background: #fff;
  font-size: var(--text-sm); font-weight: 500; color: var(--color-body);
  transition: all var(--transition-fast);
}
.filter-chip.active {
  background: var(--color-primary); border-color: var(--color-primary); color: #fff;
}
.filter-chip:active { transform: scale(0.95); }

.list-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-md); padding: 0 var(--space-lg) var(--space-xl);
  flex: 1;
}
/* ===== List Pagination ===== */
.list-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-md); padding: 0 var(--space-lg) var(--space-lg);
}
.list-pagination:empty { display: none; }
.page-btn {
  padding: 9px 18px; border-radius: var(--radius-full);
  background: var(--color-card); border: 1.5px solid var(--color-border);
  font-size: var(--text-sm); font-weight: 600; color: var(--color-primary);
  cursor: pointer; transition: all var(--transition-fast);
}
.page-btn:active { transform: scale(0.95); }
.page-btn:disabled {
  opacity: 0.4; cursor: not-allowed; color: var(--color-muted);
  border-color: var(--color-border);
}
.page-info { font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
.list-card {
  background: var(--color-card); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast);
  cursor: pointer;
}
.list-card:active { transform: scale(0.97); }
.list-card-img {
  aspect-ratio: 1; overflow: hidden; position: relative;
}
.list-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--transition-base);
}
.list-card-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(69, 26, 3, 0.8); color: var(--color-gold-light);
  font-size: 0.6rem; font-weight: 600; padding: 3px 8px;
  border-radius: var(--radius-full); backdrop-filter: blur(4px);
}
.list-card-body { padding: var(--space-md); }
.list-card-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-sm); color: var(--color-foreground);
  line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.list-card-meta {
  display: flex; gap: var(--space-sm); margin-top: var(--space-xs);
  font-size: 0.65rem; color: var(--color-muted);
}

/* ===== Fullscreen Recipe View ===== */
.recipe-view {
  position: fixed; inset: 0; z-index: 100;
  background: var(--color-cream);
  display: none; flex-direction: column;
}
.recipe-view.active { display: flex; }

/* Top bar */
.recipe-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-sm));
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%);
}
.recipe-topbar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.9); display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.recipe-topbar-btn svg { width: 18px; height: 18px; fill: var(--color-foreground); }
.recipe-topbar-center {
  color: #fff; font-size: var(--text-sm); font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.recipe-topbar-actions { display: flex; gap: var(--space-sm); }

/* Portrait layout */
.recipe-portrait {
  display: flex; flex-direction: column; height: 100%;
}
.recipe-hero-img {
  width: 100%; height: 40vh; object-fit: cover;
  flex-shrink: 0;
}
.recipe-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + var(--space-lg));
}
.recipe-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: var(--text-2xl); color: var(--color-foreground);
  margin-bottom: var(--space-sm); line-height: 1.3;
}
.recipe-tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-lg); }
.recipe-tag {
  font-size: var(--text-xs); font-weight: 600; padding: 3px 10px;
  border-radius: var(--radius-full); background: var(--color-tag-bg);
  color: var(--color-tag-text); border: 1px solid var(--color-tag-border);
}
.recipe-tag.age { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.recipe-tag.time { background: #E0F2FE; color: #075985; border-color: #BAE6FD; }

.recipe-section-title {
  font-size: var(--text-sm); font-weight: 700; color: var(--color-gold);
  letter-spacing: 1px; margin-bottom: var(--space-md);
  display: flex; align-items: center; gap: var(--space-sm);
}
.recipe-section-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px;
  background: var(--color-gold);
}

.recipe-ingredients-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-xl);
}
.ingredient-item {
  font-size: var(--text-sm); background: #FFF7ED;
  border: 1px solid var(--color-border); padding: 6px 14px;
  border-radius: var(--radius-full); color: #78350F;
}

.recipe-steps { list-style: none; counter-reset: step; margin-bottom: var(--space-xl); }
.recipe-steps li {
  counter-increment: step; position: relative;
  padding-left: 40px; margin-bottom: var(--space-lg);
  font-size: var(--text-base); line-height: 1.8; color: var(--color-body);
}
.recipe-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-tag-bg); border: 1.5px solid var(--color-tag-border);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs);
  color: var(--color-tag-text); display: flex; align-items: center; justify-content: center;
}

.recipe-tips {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-left: 4px solid var(--color-gold); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-lg); font-size: var(--text-sm); color: #78350F; line-height: 1.7;
}

/* Bottom bar */
.recipe-bottombar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--safe-bottom) + var(--space-md));
  background: rgba(255, 251, 245, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border-light);
}
.recipe-nav-btn {
  display: flex; align-items: center; gap: var(--space-xs);
  padding: 10px 18px; border-radius: var(--radius-full);
  background: var(--color-primary); color: #fff;
  font-size: var(--text-sm); font-weight: 600;
  transition: transform var(--transition-fast);
}
.recipe-nav-btn:active { transform: scale(0.95); }
.recipe-nav-btn.disabled { opacity: 0.4; pointer-events: none; }
.recipe-nav-btn svg { width: 16px; height: 16px; fill: currentColor; }
.recipe-timer-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--color-tag-bg); border: 2px solid var(--color-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-lg); transition: transform var(--transition-fast);
}
.recipe-timer-btn:active { transform: scale(0.9); }
.recipe-timer-btn.running { background: var(--color-gold); animation: pulse-ring 1.5s infinite; }
@keyframes pulse-ring { 0%,100% { box-shadow: 0 0 0 0 rgba(217,119,6,0.4); } 50% { box-shadow: 0 0 0 8px rgba(217,119,6,0); } }

/* ===== Landscape Layout ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .recipe-portrait { flex-direction: row; }
  .recipe-hero-img { width: 45%; height: 100%; }
  .recipe-content {
    width: 55%; padding: var(--space-lg);
    padding-top: calc(var(--safe-top) + 48px);
    padding-bottom: calc(var(--bottom-bar-height) + var(--safe-bottom));
  }
  .recipe-title { font-size: var(--text-xl); }
  .recipe-topbar { background: linear-gradient(to bottom, rgba(255,251,245,0.95) 0%, rgba(255,251,245,0.8) 100%); }
  .recipe-topbar-center { color: var(--color-foreground); text-shadow: none; }
  .recipe-topbar-btn { background: rgba(0,0,0,0.06); }
  .recipe-topbar-btn svg { fill: var(--color-foreground); }
}

/* ===== Timer Modal ===== */
.timer-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: var(--space-xl);
}
.timer-modal.active { display: flex; }
.timer-card {
  background: #fff; border-radius: var(--radius-xl); padding: var(--space-2xl);
  text-align: center; width: 100%; max-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.timer-display {
  font-family: var(--font-mono, monospace); font-size: 3rem; font-weight: 700;
  color: var(--color-primary); margin: var(--space-lg) 0;
}
.timer-label { font-size: var(--text-sm); color: var(--color-muted); margin-bottom: var(--space-lg); }
.timer-actions { display: flex; gap: var(--space-md); justify-content: center; }
.timer-btn {
  padding: 12px 24px; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 600;
}
.timer-btn.primary { background: var(--color-primary); color: #fff; }
.timer-btn.secondary { background: #F5F5F4; color: var(--color-body); }

/* ===== Image Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.95); display: none;
  align-items: center; justify-content: center;
  touch-action: none;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 95vw; max-height: 90vh; object-fit: contain;
  transition: transform var(--transition-fast);
}
.lightbox-close {
  position: absolute; top: var(--space-lg); right: var(--space-lg);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.2); color: #fff;
  font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
}

/* ===== Font Size Control ===== */
body.font-lg { --text-base: 1.05rem; --text-sm: 0.9rem; --text-lg: 1.15rem; }
body.font-xl { --text-base: 1.2rem; --text-sm: 1rem; --text-lg: 1.3rem; }

/* ===== Swipe Indicator ===== */
.swipe-hint {
  position: absolute; bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + 60px);
  left: 50%; transform: translateX(-50%);
  font-size: var(--text-xs); color: var(--color-muted);
  opacity: 0.7; animation: fadeInOut 3s ease forwards;
  pointer-events: none;
}
@keyframes fadeInOut { 0% { opacity: 0; } 20% { opacity: 0.7; } 80% { opacity: 0.7; } 100% { opacity: 0; } }

/* ===== Loading ===== */
.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; flex-direction: column; gap: var(--space-md);
}
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid var(--color-border);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: var(--text-sm); color: var(--color-muted); }

/* ===== Desktop link ===== */
.desktop-link {
  display: block; margin: var(--space-md) var(--space-lg) var(--space-lg);
  padding: 10px 16px; border-radius: var(--radius-full);
  background: var(--color-card); border: 1px solid var(--color-border);
  font-size: var(--text-xs); color: var(--color-body); text-align: center;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .desktop-link { display: block; } }

/* ===== Shake Animation ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

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