/* CSS Custom Properties */
:root {
  /* Coffee-inspired color palette */
  --coffee-dark: #2c1810;
  --coffee-medium: #4a2c2a;
  --coffee-light: #8b4513;
  --coffee-cream: #f4e7d1;
  --coffee-foam: #faf6f0;
  --coffee-accent: #d4a574;
  
  /* Typography */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Source Sans Pro', sans-serif;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;
  
  /* Containers */
  --container-max-width: 1200px;
  --border-radius: 8px;
  --border-radius-lg: 16px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(44, 24, 16, 0.1);
  --shadow-md: 0 4px 8px rgba(44, 24, 16, 0.15);
  --shadow-lg: 0 8px 16px rgba(44, 24, 16, 0.2);
  
  /* Transitions */
  --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--coffee-dark);
  background-color: var(--coffee-foam);
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: var(--spacing-sm);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 2rem; }
h4 { font-size: 1.5rem; }

p {
  margin-bottom: var(--spacing-sm);
}

/* Container */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Navigation */
.navbar {
  background: rgba(250, 246, 240, 0.95);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  max-width: var(--container-max-width);
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.nav-logo {
  width: 32px;
  height: 32px;
}

.nav-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--coffee-dark);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
}

.nav-link {
  text-decoration: none;
  color: var(--coffee-medium);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--coffee-light);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--coffee-accent);
  transition: var(--transition);
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
}

.nav-toggle span {
  width: 25px;
  height: 3px;
  background: var(--coffee-medium);
  margin: 3px 0;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--coffee-foam) 0%, var(--coffee-cream) 100%);
  padding: var(--spacing-xxl) var(--spacing-md);
  position: relative;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  max-width: 600px;
  z-index: 2;
}

.hero-title {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  color: var(--coffee-dark);
  text-shadow: 2px 2px 4px rgba(44, 24, 16, 0.1);
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-xl);
  color: var(--coffee-medium);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.hero-visual {
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

.coffee-steam {
  position: relative;
  width: 100px;
  height: 200px;
}

.steam-line {
  position: absolute;
  width: 2px;
  height: 60px;
  background: linear-gradient(to top, var(--coffee-accent), transparent);
  border-radius: 1px;
  animation: steam 3s ease-in-out infinite;
}

.steam-line:nth-child(1) {
  left: 20px;
  animation-delay: 0s;
}

.steam-line:nth-child(2) {
  left: 40px;
  animation-delay: 0.5s;
}

.steam-line:nth-child(3) {
  left: 60px;
  animation-delay: 1s;
}

@keyframes steam {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-20px) scale(1.1);
    opacity: 0.3;
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  border: 2px solid;
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--coffee-light);
  color: white;
  border-color: var(--coffee-light);
}

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

.btn-secondary {
  background: transparent;
  color: var(--coffee-light);
  border-color: var(--coffee-light);
}

.btn-secondary:hover {
  background: var(--coffee-light);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Section Styling */
section {
  padding: var(--spacing-xxl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.section-title {
  color: var(--coffee-dark);
  margin-bottom: var(--spacing-sm);
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--coffee-medium);
  max-width: 600px;
  margin: 0 auto;
}

/* Calculator Section */
.calculator-section {
  background: white;
}

.calculator-container {
  display: flex;
  justify-content: center;
}

.calculator-card {
  background: var(--coffee-foam);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
}

.calculator-input {
  margin-bottom: var(--spacing-lg);
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--coffee-dark);
}

.input-field {
  width: 100%;
  padding: var(--spacing-sm);
  border: 2px solid var(--coffee-cream);
  border-radius: var(--border-radius);
  font-size: 1.125rem;
  transition: var(--transition);
  background: white;
}

.input-field:focus {
  outline: none;
  border-color: var(--coffee-accent);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.input-slider {
  margin-top: var(--spacing-sm);
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--coffee-cream);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--coffee-light);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--coffee-light);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
}

.ratio-selector {
  margin-bottom: var(--spacing-lg);
}

.ratio-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.ratio-btn {
  padding: var(--spacing-sm);
  border: 2px solid var(--coffee-cream);
  background: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.ratio-btn.active,
.ratio-btn:hover {
  background: var(--coffee-light);
  color: white;
  border-color: var(--coffee-light);
}

.calculator-results {
  background: white;
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--coffee-cream);
}

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

.result-label {
  font-weight: 500;
  color: var(--coffee-medium);
}

.result-value {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--coffee-dark);
}

.timer-btn {
  width: 100%;
  margin-bottom: var(--spacing-md);
}

.timer-display {
  text-align: center;
  background: white;
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}

.timer-time {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--coffee-dark);
  margin-bottom: var(--spacing-sm);
}

.timer-controls {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

.timer-control-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  border: 1px solid var(--coffee-light);
  background: transparent;
  color: var(--coffee-light);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.timer-control-btn:hover {
  background: var(--coffee-light);
  color: white;
}

/* Recipes Section */
.recipes-section {
  background: var(--coffee-foam);
}

.recipe-filters {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  border: 2px solid var(--coffee-cream);
  background: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  color: var(--coffee-medium);
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--coffee-light);
  color: white;
  border-color: var(--coffee-light);
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.recipe-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
}

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

.recipe-header {
  margin-bottom: var(--spacing-md);
}

.recipe-title {
  color: var(--coffee-dark);
  margin-bottom: var(--spacing-xs);
}

.recipe-category {
  color: var(--coffee-accent);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recipe-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.meta-item {
  text-align: center;
  padding: var(--spacing-xs);
  background: var(--coffee-foam);
  border-radius: var(--border-radius);
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  color: var(--coffee-medium);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  display: block;
  font-weight: 600;
  color: var(--coffee-dark);
  margin-top: 2px;
}

.recipe-description {
  color: var(--coffee-medium);
  line-height: 1.5;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 24, 16, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--coffee-medium);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--coffee-foam);
  color: var(--coffee-dark);
}

.modal-body {
  padding: var(--spacing-xl);
}

.modal-recipe-title {
  margin-bottom: var(--spacing-sm);
  color: var(--coffee-dark);
}

.modal-recipe-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--coffee-foam);
  border-radius: var(--border-radius);
}

.ingredients-section,
.instructions-section {
  margin-bottom: var(--spacing-lg);
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--coffee-dark);
  border-bottom: 2px solid var(--coffee-cream);
  padding-bottom: var(--spacing-xs);
}

.ingredients-list {
  list-style: none;
  margin-bottom: var(--spacing-md);
}

.ingredient-item {
  padding: var(--spacing-xs) 0;
  color: var(--coffee-medium);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ingredient-item::before {
  content: "•";
  color: var(--coffee-accent);
  font-weight: bold;
  margin-right: var(--spacing-sm);
}

.instructions-list {
  list-style: none;
  counter-reset: step-counter;
}

.instruction-step {
  counter-increment: step-counter;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--coffee-foam);
  border-radius: var(--border-radius);
  position: relative;
  padding-left: 3.5rem;
}

.instruction-step::before {
  content: counter(step-counter);
  position: absolute;
  left: var(--spacing-md);
  top: var(--spacing-md);
  background: var(--coffee-light);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.step-time {
  font-weight: 600;
  color: var(--coffee-accent);
  margin-bottom: var(--spacing-xs);
}

/* Brewing Guide */
.brewing-guide {
  background: white;
}

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

.tip-card {
  text-align: center;
  padding: var(--spacing-lg);
  background: var(--coffee-foam);
  border-radius: var(--border-radius-lg);
  transition: var(--transition);
}

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

.tip-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--spacing-md);
  background: var(--coffee-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.tip-icon svg {
  width: 24px;
  height: 24px;
}

.tip-title {
  margin-bottom: var(--spacing-sm);
  color: var(--coffee-dark);
}

.tip-description {
  color: var(--coffee-medium);
  line-height: 1.6;
}

/* Footer */
.footer {
  background: var(--coffee-dark);
  color: var(--coffee-cream);
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.footer-logo {
  width: 24px;
  height: 24px;
  filter: brightness(0) saturate(100%) invert(89%) sepia(12%) saturate(463%) hue-rotate(14deg) brightness(98%) contrast(90%);
}

.footer-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.footer-text {
  margin: 0;
  color: var(--coffee-accent);
}

.footer-social {
  margin-top: var(--spacing-sm);
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  text-decoration: none;
  color: var(--coffee-cream);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-weight: 500;
}

.social-link:hover {
  background: rgba(212, 165, 116, 0.2);
  color: var(--coffee-accent);
  transform: translateY(-2px);
}

.social-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) saturate(100%) invert(89%) sepia(12%) saturate(463%) hue-rotate(14deg) brightness(98%) contrast(90%);
  transition: var(--transition);
}

.social-link:hover .social-icon {
  filter: brightness(0) saturate(100%) invert(84%) sepia(21%) saturate(1031%) hue-rotate(14deg) brightness(98%) contrast(90%);
}

.social-handle {
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background-color: var(--coffee-foam);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: var(--shadow-md);
    padding: var(--spacing-lg) 0;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-visual {
    display: none;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 300px;
  }

  .ratio-buttons {
    grid-template-columns: 1fr;
  }

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

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

  .timer-controls {
    flex-direction: column;
  }

  .modal-content {
    margin: 10% auto;
    width: 95%;
  }

  .modal-recipe-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  .hero {
    padding: var(--spacing-xl) var(--spacing-sm);
  }

  .hero-title {
    font-size: 2rem;
  }

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

  .section-title {
    font-size: 2rem;
  }

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

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

/* Print Styles */
@media print {
  .navbar,
  .hero,
  .footer,
  .modal-close,
  .btn {
    display: none !important;
  }

  .modal {
    display: block !important;
    position: static !important;
    background: none !important;
  }

  .modal-content {
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .calculator-section,
  .recipes-section,
  .brewing-guide {
    page-break-inside: avoid;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.input-field:focus,
.ratio-btn:focus,
.filter-btn:focus,
.timer-control-btn:focus,
.nav-link:focus {
  outline: 2px solid var(--coffee-accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --coffee-dark: #000000;
    --coffee-medium: #333333;
    --coffee-light: #666666;
    --coffee-cream: #f0f0f0;
    --coffee-foam: #ffffff;
    --coffee-accent: #0066cc;
  }
}
