/* -------------------------------------------------------------
 * Theme Tokens & Design System
 * ------------------------------------------------------------- */
:root {
  /* Default: Dark Theme */
  --bg-primary: #120e0c;
  --bg-secondary: #1a1411;
  --bg-glow: radial-gradient(circle at 10% 20%, rgba(90, 60, 40, 0.15) 0%, rgba(18, 14, 12, 0) 90%);
  
  --card-bg: rgba(32, 24, 20, 0.45);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  
  --text-primary: #fcfaf7;
  --text-secondary: #bbaea6;
  --text-muted: #837267;
  
  --accent: #eb5e28;
  --accent-rgb: 235, 94, 40;
  --accent-glow: rgba(235, 94, 40, 0.25);
  
  /* Coffee Liquid Colors */
  --coffee-light: #b07d4b;
  --coffee-dark: #3a1e05;
  --coffee-grounds: #583e23;
  --coffee-wet: #2e1a0d;
  
  /* Theme Transition Speed */
  --theme-transition: background-color 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                      color 0.5s ease, 
                      border-color 0.5s ease,
                      box-shadow 0.5s ease;
}

body.light-theme {
  --bg-primary: #f8f5f0;
  --bg-secondary: #f0eae1;
  --bg-glow: radial-gradient(circle at 10% 20%, rgba(235, 94, 40, 0.06) 0%, rgba(248, 245, 240, 0) 90%);
  
  --card-bg: rgba(255, 255, 255, 0.55);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 16px 40px rgba(90, 60, 40, 0.08);
  
  --text-primary: #2d2420;
  --text-secondary: #6e5e55;
  --text-muted: #9e8e84;
  
  --accent: #d04d16;
  --accent-rgb: 208, 77, 22;
  --accent-glow: rgba(208, 77, 22, 0.15);
  
  --card-border-focus: rgba(208, 77, 22, 0.35);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  position: relative;
}

body {
  transition: var(--theme-transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-glow);
  pointer-events: none;
  z-index: 0;
}

/* Background Canvas */
#steam-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  z-index: 2;
  position: relative;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* -------------------------------------------------------------
 * Header Components
 * ------------------------------------------------------------- */
.header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 2rem;
  transition: var(--theme-transition);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-icon {
  color: var(--accent);
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo:hover .logo-icon {
  transform: rotate(-10deg) scale(1.1);
}

/* Subdomain Navigation Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.25rem;
  position: relative;
  transition: color 0.3s ease;
}

.nav-link-icon {
  color: var(--text-muted);
  transition: transform 0.3s ease, color 0.3s ease;
}

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

.nav-link:hover .nav-link-icon {
  color: var(--accent);
  transform: translateY(-1px) rotate(-8deg);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

@media (max-width: 640px) {
  .nav-menu {
    gap: 0.75rem;
  }
  .nav-link span {
    display: none;
  }
  .nav-link {
    padding: 0.5rem;
  }
  .nav-link-icon {
    width: 20px;
    height: 20px;
  }
}

.theme-toggle-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 5px 15px var(--accent-glow);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

.sun-icon {
  display: none;
}

body.light-theme .sun-icon {
  display: block;
}

body.light-theme .moon-icon {
  display: none;
}

/* -------------------------------------------------------------
 * Main Layout & Content Panel
 * ------------------------------------------------------------- */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
  padding-bottom: 3rem;
}

@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 4.5fr 5.5fr;
    gap: 4rem;
  }
}

/* Left Column: Visual Panel */
.visual-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 2rem 0;
}

.glow-orb {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.12;
  filter: blur(80px);
  pointer-events: none;
  animation: orbPulse 8s ease-in-out infinite alternate;
}

.dripper-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.25));
}

/* SVG Drip Styling */
.coffee-brewer-svg {
  display: block;
  overflow: visible;
}

.stop-coffee-light {
  stop-color: var(--coffee-light);
  transition: stop-color 0.5s ease;
}

.stop-coffee-dark {
  stop-color: var(--coffee-dark);
  transition: stop-color 0.5s ease;
}

/* Drip Animation */
.drip-drop {
  animation: fallDrip 1.6s infinite cubic-bezier(0.4, 0, 1, 0.6);
  transform-origin: 100px 120px;
}

#drip-drop-1 {
  animation-delay: 0s;
}

#drip-drop-2 {
  animation-delay: 0.5s;
}

#drip-drop-3 {
  animation-delay: 1.1s;
}

/* SVG liquid wave motion */
#liquid-wave-path {
  animation: waveMotion 4s ease-in-out infinite alternate;
}

.stir-active #liquid-wave-path {
  animation: waveMotionFast 1.5s linear infinite;
}

/* Steam Wisps in SVG Area */
.steam-container {
  position: absolute;
  top: 0px;
  left: 30%;
  right: 30%;
  height: 80px;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
}

.steam-wisp {
  width: 8px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  filter: blur(5px);
  opacity: 0;
  animation: wispMove 3s infinite linear;
}

body.light-theme .steam-wisp {
  background: rgba(90, 60, 40, 0.15);
}

.wisp-1 { animation-delay: 0s; left: 20%; }
.wisp-2 { animation-delay: 1s; left: 50%; }
.wisp-3 { animation-delay: 1.8s; left: 80%; }

/* Right Column: Content Panel */
.content-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.badge {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: dotPulse 2s infinite;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.5rem;
  }
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, #ff9e7d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 520px;
}

/* -------------------------------------------------------------
 * Cards & Glassmorphism
 * ------------------------------------------------------------- */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transition: var(--theme-transition), transform 0.3s ease;
}

.control-widget {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.widget-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.25rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Roast Selector Toggles */
.roast-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.35rem;
  border-radius: 12px;
}

body.light-theme .roast-selector {
  background: rgba(0, 0, 0, 0.05);
}

.roast-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.6rem 0.5rem;
  border-radius: 9px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.roast-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

body.light-theme .roast-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.roast-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bean-icon {
  width: 10px;
  height: 14px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  transform: rotate(-15deg);
  display: inline-block;
  position: relative;
}

.bean-icon::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 45%;
  width: 1px;
  height: 80%;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  transform: rotate(5deg);
}

.light-bean { background-color: #d1a17b; }
.medium-bean { background-color: #8b5a2b; }
.dark-bean { background-color: #3d2314; }

/* Custom Sliders */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.custom-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: all 0.3s;
}

body.light-theme .custom-range {
  background: rgba(0, 0, 0, 0.08);
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--text-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.2s, background-color 0.3s;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Action button row */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s;
}

.secondary-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: translateY(0);
}

.stir-icon {
  transition: transform 0.8s ease-in-out;
}

.secondary-btn:hover .stir-icon {
  transform: rotate(180deg);
}

.stats-mini {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Interactive Quote Bubble */
.quote-bubble-wrapper {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.quote-bubble-wrapper.show {
  max-height: 100px;
  opacity: 1;
  margin-top: 0.5rem;
}

.quote-bubble {
  background: rgba(var(--accent-rgb), 0.08);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 12px 12px 12px;
}

.quote-bubble p {
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------
 * Subscribe Widget
 * ------------------------------------------------------------- */
.subscribe-widget {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.subscribe-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.subscribe-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .input-group {
    flex-direction: row;
  }
}

.input-wrapper {
  position: relative;
  flex: 1;
}

.mail-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s;
}

body.light-theme .input-wrapper input {
  background: rgba(255, 255, 255, 0.8);
}

.input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Standard Buttons */
.primary-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  outline: none;
  padding: 0.85rem 1.75rem;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.45);
  background: linear-gradient(135deg, var(--accent) 0%, #ff7e50 100%);
}

.primary-btn:active {
  transform: translateY(0);
}

.feedback-msg {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: none;
}

.feedback-msg.error {
  display: block;
  color: #ff6b6b;
}

body.light-theme .feedback-msg.error {
  color: #d93838;
}

.feedback-msg.success {
  display: block;
  color: #51cf66;
}

body.light-theme .feedback-msg.success {
  color: #2b8a3e;
}

/* Success State Widget Collapse Animation */
.subscribe-widget.success-state {
  animation: successCollapse 0.5s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Spinner for Button Loading */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spinner 0.8s linear infinite;
}

/* -------------------------------------------------------------
 * Footer Components
 * ------------------------------------------------------------- */
.footer {
  height: 60px;
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2rem;
  transition: var(--theme-transition);
}

/* -------------------------------------------------------------
 * Keyframe Animations
 * ------------------------------------------------------------- */

/* Orb Pulse background glow */
@keyframes orbPulse {
  0% { transform: scale(1) translate(0, 0); opacity: 0.12; }
  100% { transform: scale(1.15) translate(10px, 15px); opacity: 0.18; }
}

/* Steam Rising Wisps */
@keyframes wispMove {
  0% {
    transform: translateY(40px) translateX(0) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 0.35;
  }
  70% {
    opacity: 0.15;
  }
  100% {
    transform: translateY(-40px) translateX(8px) scale(1.3);
    opacity: 0;
  }
}

/* Coffee Drip Drop falling keyframe */
@keyframes fallDrip {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  15% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  80% {
    transform: translateY(110px) scale(0.9);
    opacity: 1;
  }
  90% {
    transform: translateY(115px) scale(0.4);
    opacity: 0.3;
  }
  100% {
    transform: translateY(118px) scale(0.1);
    opacity: 0;
  }
}

/* Liquid level wave oscillation */
@keyframes waveMotion {
  0% {
    d: path("M 0 160 Q 25 152 50 160 T 100 160 T 150 160 T 200 160 L 200 270 L 0 270 Z");
  }
  100% {
    d: path("M 0 160 Q 25 168 50 160 T 100 160 T 150 160 T 200 160 L 200 270 L 0 270 Z");
  }
}

@keyframes waveMotionFast {
  0% {
    d: path("M 0 160 Q 25 145 50 160 T 100 160 T 150 160 T 200 160 L 200 270 L 0 270 Z");
  }
  50% {
    d: path("M 0 160 Q 25 175 50 160 T 100 160 T 150 160 T 200 160 L 200 270 L 0 270 Z");
  }
  100% {
    d: path("M 0 160 Q 25 145 50 160 T 100 160 T 150 160 T 200 160 L 200 270 L 0 270 Z");
  }
}

/* Pulse Dot animation */
@keyframes dotPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  }
}

/* Spinner Rotate */
@keyframes spinner {
  to { transform: rotate(360deg); }
}

/* Subscribe form successful collapse */
@keyframes successCollapse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
