/* BrewTools - Shared Styles */
/* Fonts loaded via Google Fonts in HTML */

:root {
  --bg-dark: #1a1410;
  --bg-card: #241e17;
  --bg-input: #2e2620;
  --bg-hover: #352d24;
  --amber: #d97706;
  --amber-light: #f59e0b;
  --copper: #b87333;
  --copper-light: #d4956b;
  --cream: #f5e6d3;
  --cream-muted: #c4a882;
  --text-primary: #f5e6d3;
  --text-secondary: #c4a882;
  --text-muted: #8a7a6a;
  --border: #3d3428;
  --border-focus: #d97706;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: var(--amber);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--amber-light); }

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

/* Navigation */
.nav {
  background: linear-gradient(180deg, rgba(26,20,16,0.98) 0%, rgba(26,20,16,0.95) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cream);
}

.nav-logo svg { width: 28px; height: 28px; }

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--amber);
  background: rgba(217,119,6,0.1);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.6rem 0.5rem; }
}

/* Hero / Page Header */
.page-header {
  text-align: center;
  padding: 3rem 1rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--cream);
  margin-bottom: 0.75rem;
}

.page-header h1 span { color: var(--amber); }

.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.container--narrow {
  max-width: 800px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: rgba(184,115,51,0.3); }

.card-title {
  font-size: 1.25rem;
  color: var(--cream);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .icon {
  width: 24px;
  height: 24px;
  color: var(--amber);
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

label .unit {
  color: var(--text-muted);
  font-weight: 400;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.15);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23c4a882' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber) 0%, #b45309 100%);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--amber-light) 0%, var(--amber) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217,119,6,0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--cream);
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

/* Results Display */
.results {
  background: linear-gradient(135deg, rgba(217,119,6,0.08) 0%, rgba(184,115,51,0.05) 100%);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.result-item {
  text-align: center;
}

.result-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1.1;
}

.result-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Hop / Grain rows */
.addition-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .addition-row {
    grid-template-columns: 1fr 1fr;
  }
}

.btn-remove {
  background: rgba(239,68,68,0.15);
  color: var(--error);
  border: none;
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.btn-remove:hover { background: rgba(239,68,68,0.3); }

/* Info Tooltip */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-icon {
  width: 16px;
  height: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: help;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 240px;
  z-index: 50;
  box-shadow: var(--shadow);
  font-weight: 400;
  line-height: 1.4;
}

.tooltip-wrap:hover .tooltip-text { display: block; }

/* Ad Slot */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin: 1.5rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Education / Content Section */
.edu-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.edu-section h2 {
  font-size: 1.5rem;
  color: var(--cream);
  margin-bottom: 1rem;
}

.edu-section h3 {
  font-size: 1.1rem;
  color: var(--copper-light);
  margin: 1.25rem 0 0.5rem;
}

.edu-section p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.edu-section ul, .edu-section ol {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.edu-section li { margin-bottom: 0.35rem; font-size: 0.95rem; }

.edu-section code {
  background: var(--bg-input);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color: var(--amber-light);
}

/* Cross-link Cards */
.crosslinks {
  margin-top: 2.5rem;
}
.crosslinks h2 {
  font-size: 1.25rem;
  color: var(--cream);
  margin-bottom: 1rem;
  text-align: center;
}
.crosslink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.crosslink-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition);
  color: inherit;
}
.crosslink-card:hover {
  border-color: var(--amber);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}
.crosslink-card h3 {
  font-size: 1rem;
  color: var(--cream);
  margin-bottom: 0.35rem;
}
.crosslink-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2rem;
}
.footer a { color: var(--text-secondary); }
.footer a:hover { color: var(--amber); }
.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* Home Page Specific */
.hero {
  text-align: center;
  padding: 4rem 1rem 2.5rem;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--cream);
  margin-bottom: 0.75rem;
}
.hero h1 span { color: var(--amber); }
.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 550px;
  margin: 0 auto;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  max-width: 1000px;
  margin: 2rem auto 0;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--copper));
  opacity: 0;
  transition: opacity var(--transition);
}
.tool-card:hover {
  border-color: var(--copper);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}
.tool-card:hover::before { opacity: 1; }

.tool-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.tool-card h2 {
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex: 1;
}

.tool-card .tool-arrow {
  color: var(--amber);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 600;
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Color Swatch (SRM Calculator) */
.color-swatch {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  margin: 1rem 0;
  transition: background-color 0.4s ease;
  position: relative;
  overflow: hidden;
}
.color-swatch::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 40%, rgba(0,0,0,0.1) 100%);
  border-radius: inherit;
  pointer-events: none;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  text-align: left;
  padding: 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.5rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(61,52,40,0.5);
}

/* Schema / Structured Data hidden */
.schema-data { display: none; }

@media print {
  .nav, .ad-slot, .crosslinks, .footer, .nav-toggle { display: none; }
  body { background: #fff; color: #333; }
  .card { border-color: #ddd; }
}
