/* Espresso Extraction Troubleshooter - Styles */
:root {
  --espresso: #2C1810;
  --crema: #D4A574;
  --crema-light: #F5E6D3;
  --puck: #4A2C2A;
  --steam: #F8F4F0;
  --water: #E8DDD4;
  --milk: #FFF8F0;
  --sour: #E8A838;
  --bitter: #8B4513;
  --balanced: #5B8C5A;
  --text: #2C1810;
  --text-light: #6B5A4F;
  --border: #D4C4B5;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(44, 24, 16, 0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--steam);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header {
  background: var(--espresso);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--crema);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
}

.main-nav a {
  color: var(--crema-light);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.main-nav a:hover { opacity: 1; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--espresso) 0%, var(--puck) 100%);
  color: var(--milk);
  padding: 3rem 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 0.75rem;
  color: var(--crema);
}

.hero-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* Diagnose Section */
.diagnose-section { padding: 2.5rem 0; }

.diagnose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.input-panel, .result-panel {
  background: var(--milk);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.input-panel h2, .result-panel h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  color: var(--puck);
}

/* Form */
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: var(--text-light);
}

input[type="number"], select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--steam);
  color: var(--text);
  transition: border-color 0.2s;
}

input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--crema);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

.taste-group {
  border: none;
  margin: 1.25rem 0;
  padding: 0;
}

.taste-group legend {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.taste-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.taste-option {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--steam);
}

.taste-option:hover { border-color: var(--crema); }
.taste-option:has(input:checked) {
  border-color: var(--puck);
  background: var(--crema-light);
}

.taste-option input {
  grid-row: 1 / 3;
  align-self: center;
  accent-color: var(--puck);
}

.taste-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.taste-desc {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: var(--puck);
  color: var(--milk);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--espresso); }

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--crema-light);
  color: var(--puck);
  border: 2px solid var(--crema);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover { background: var(--crema); }

.btn-text {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.5rem;
}

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

/* Results */
.result-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
}

.result-empty svg { margin-bottom: 1rem; opacity: 0.5; }

.result-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-badge.under { background: #FFF3CD; color: #856404; }
.result-badge.over { background: #F8D7DA; color: #721C24; }
.result-badge.channel { background: #E2D5F1; color: #4A2080; }
.result-badge.weak { background: #D1ECF1; color: #0C5460; }

.result-header { margin-bottom: 1rem; }
.result-header h3 { font-size: 1.2rem; margin-top: 0.5rem; }

.result-explanation {
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.result-actions, .result-details {
  margin-bottom: 1.25rem;
}

.result-actions h4, .result-details h4 {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-actions ol {
  padding-left: 1.25rem;
}

.result-actions li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.result-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
}

.result-details dt { font-weight: 600; }
.result-details dd { color: var(--text-light); }

.result-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Worksheet */
.worksheet-section {
  background: var(--water);
  padding: 2.5rem 0;
}

.worksheet-section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.worksheet-section > .container > p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.worksheet-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.worksheet-table-wrapper {
  overflow-x: auto;
  background: var(--milk);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.worksheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.worksheet-table th {
  background: var(--puck);
  color: var(--milk);
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.worksheet-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.worksheet-table tr:hover td { background: var(--crema-light); }
.worksheet-empty td { text-align: center; color: var(--text-light); padding: 1.5rem; }

/* Reference */
.reference-section { padding: 2.5rem 0; }

.reference-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.reference-card {
  background: var(--milk);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--crema);
}

.reference-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--puck);
}

.reference-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.reference-card ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.reference-card li { margin-bottom: 0.25rem; }

.common-mistakes {
  background: var(--crema-light);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.common-mistakes h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.common-mistakes ul {
  padding-left: 1.25rem;
}

.common-mistakes li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* FAQ */
.faq-section {
  background: var(--water);
  padding: 2.5rem 0;
}

.faq-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.faq-item dt {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--puck);
}

.faq-item dd {
  color: var(--text-light);
  line-height: 1.7;
}

/* Footer */
.site-footer {
  background: var(--espresso);
  color: var(--crema-light);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a { color: var(--crema); }
.footer-links { margin: 0.5rem 0; }
.footer-note { opacity: 0.6; font-size: 0.8rem; }

/* Responsive */
@media (max-width: 768px) {
  .diagnose-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .site-header .container { flex-direction: column; gap: 0.75rem; }
  .main-nav { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .hero { padding: 2rem 0; }
  .result-buttons { flex-direction: column; }
  .worksheet-controls { flex-direction: column; align-items: flex-start; }
}

@media print {
  .site-header, .site-footer, .btn-primary, .btn-secondary, .btn-text,
  .worksheet-controls, .result-buttons, .hero { display: none; }
  body { background: white; color: black; }
  .input-panel, .result-panel, .worksheet-table-wrapper { box-shadow: none; border: 1px solid #ccc; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
