/* ==========================================================================
   Family Recipes - Warm Minimalist Stylesheet
   Designed for Heirloom Recipe Collection & Index Grid
   ========================================================================== */

:root {
  --font-serif: "Playfair Display", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  --bg-page: #fdfbf7;
  --bg-card: #ffffff;
  --bg-warm-tint: #f8f4ee;
  --bg-badge: #f4ede4;
  --bg-badge-hover: #ebdccf;
  
  --text-main: #2d251e;
  --text-muted: #766657;
  --text-light: #9c8e80;
  
  --accent: #9c522b;
  --accent-hover: #7b3d1b;
  --accent-light: #d48b50;
  
  --border-light: #e8ded2;
  --border-subtle: #f0eae1;
  
  --shadow-sm: 0 2px 6px rgba(50, 35, 20, 0.04);
  --shadow-md: 0 6px 18px rgba(50, 35, 20, 0.06);
  --shadow-lg: 0 12px 30px rgba(50, 35, 20, 0.09);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--bg-page);
  min-height: 100vh;
  padding: 24px 16px 60px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Top Navigation Bar */
.site-nav {
  max-width: 900px;
  margin: 0 auto 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.back-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateX(-3px);
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.btn-action:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* Recipe Detail Card Container */
.recipe-container {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 40px;
  position: relative;
}

/* Recipe Header */
.recipe-header {
  text-align: center;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.recipe-header .category {
  display: inline-block;
  background: var(--bg-badge);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
  border: 1px solid rgba(156, 82, 43, 0.15);
}

h1 {
  font-family: var(--font-serif);
  color: var(--text-main);
  margin: 6px 0 10px;
  font-size: 2.15rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-transform: capitalize;
}

.recipe-meta {
  color: var(--text-light);
  font-size: 0.88rem;
  font-style: italic;
  margin-top: 6px;
}

/* Headings within Recipe */
h2, h3 {
  font-family: var(--font-serif);
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

h3::before {
  content: "•";
  color: var(--accent-light);
  font-size: 1.4rem;
  line-height: 1;
}

/* Ingredients List */
ul.ingredients-list, ul {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
}

ul.ingredients-list li, ul li {
  position: relative;
  padding: 9px 12px 9px 28px;
  margin-bottom: 6px;
  font-size: 1.02rem;
  color: var(--text-main);
  background: #fbf9f6;
  border-radius: var(--radius-sm);
  border-left: 3px solid #e0d4c5;
  transition: var(--transition);
}

ul.ingredients-list li::before, ul li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent);
}

ul.ingredients-list li:hover, ul li:hover {
  background: var(--bg-badge);
  border-left-color: var(--accent);
}

/* Instructions & Notes Callout */
.instructions {
  background: var(--bg-warm-tint);
  padding: 22px 24px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 14px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #382c23;
  white-space: pre-line;
}

/* Recipe Card Footer */
.recipe-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-light);
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* ==========================================================================
   Main Index / Catalog Page Styles
   ========================================================================== */

.index-container {
  max-width: 1040px;
  margin: 0 auto;
}

/* Hero Header */
.site-hero {
  text-align: center;
  padding: 30px 16px 24px;
  margin-bottom: 24px;
}

.site-hero .brand-pill {
  display: inline-block;
  background: var(--bg-badge);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  border: 1px solid rgba(156, 82, 43, 0.12);
}

.site-hero h1 {
  font-size: 2.85rem;
  color: var(--text-main);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-hero .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Controls: Search & Category Filters */
.controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.search-and-sort-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.search-box-wrapper {
  position: relative;
  flex: 1;
}

.sort-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-page);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='14'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%239c522b'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding: 12px 38px 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.sort-select:hover {
  background-color: #ffffff;
  border-color: var(--accent-light);
  color: var(--accent);
}

.sort-select:focus {
  background-color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(156, 82, 43, 0.12);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: 1.05rem;
}

.search-input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  font-family: var(--font-sans);
  font-size: 1.02rem;
  color: var(--text-main);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(156, 82, 43, 0.12);
}

.search-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.15rem;
  cursor: pointer;
  display: none;
  line-height: 1;
  padding: 4px;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

/* Category Filter Pills */
.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: var(--bg-badge);
  color: var(--accent);
  border-color: var(--accent-light);
}

.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(156, 82, 43, 0.25);
}

/* Results Status Bar */
.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.results-count {
  font-weight: 600;
}

/* Recipe Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

/* Recipe Card in Grid */
.recipe-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.recipe-card-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-light);
  opacity: 0;
  transition: var(--transition);
}

.recipe-card-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #d8c7b4;
}

.recipe-card-item:hover::before {
  opacity: 1;
}

.card-top {
  margin-bottom: 12px;
}

.card-category {
  display: inline-block;
  background: var(--bg-badge);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 8px;
  text-transform: capitalize;
  transition: color 0.2s;
}

.recipe-card-item:hover .card-title {
  color: var(--accent);
}

.card-snippet {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.card-ingredients-count {
  color: var(--text-light);
}

.card-cta {
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
}

.recipe-card-item:hover .card-cta {
  transform: translateX(3px);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  border: none;
  justify-content: center;
  margin-top: 0;
  font-size: 1.25rem;
}

.empty-state h3::before {
  display: none;
}

.empty-state p {
  color: var(--text-light);
  margin-bottom: 16px;
}

.btn-reset {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-reset:hover {
  background: var(--accent-hover);
}

/* Footer */
.site-footer {
  text-align: center;
  margin-top: 50px;
  color: var(--text-light);
  font-size: 0.88rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 16px 12px 40px;
  }
  
  .site-hero h1 {
    font-size: 2.2rem;
  }
  
  .recipe-container {
    padding: 24px 18px;
    border-radius: var(--radius-sm);
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  .controls-panel {
    padding: 16px;
  }
  
  .search-and-sort-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .sort-wrapper {
    justify-content: space-between;
    width: 100%;
  }
  
  .sort-select {
    flex: 1;
  }
  
  .category-filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  
  .filter-btn {
    white-space: nowrap;
  }
  
  .recipe-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ==========================================================================
   Print Optimization
   ========================================================================== */

@media print {
  body {
    background: #ffffff;
    color: #000000;
    padding: 0;
    font-size: 12pt;
  }
  
  .site-nav,
  .btn-action,
  .controls-panel,
  .results-meta,
  .site-footer,
  .card-cta {
    display: none !important;
  }
  
  .recipe-container {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 100%;
  }
  
  .recipe-header {
    border-bottom: 1.5pt solid #ccc;
    padding-bottom: 12pt;
  }
  
  h1 {
    color: #000;
    font-size: 20pt;
  }
  
  .category {
    border: 1pt solid #999;
    background: none !important;
    color: #000 !important;
  }
  
  ul.ingredients-list li, ul li {
    background: none;
    border-left: none;
    padding: 3pt 0 3pt 15pt;
  }
  
  ul.ingredients-list li::before, ul li::before {
    background-color: #000;
  }
  
  .instructions {
    background: #f7f7f7 !important;
    border-left: 3pt solid #333 !important;
    color: #000 !important;
  }
}
