:root {
  --soil:       #2C1810;
  --bark:       #6B4C3B;
  --moss:       #4A6741;
  --sage:       #7A9E73;
  --fern:       #A8C5A0;
  --cream:      #F5F0E8;
  --parchment:  #F7F3EA;
  --sand:       #E0D5BE;
  --terracotta: #C4703F;
  --harvest:    #E8A838;
  --white:      #FFFFFF;
  --error:      #C0392B;
  --success:    #27AE60;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;
  --radius: 6px;
  --transition: 0.22s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: #FAFAF7;
  color: var(--soil);
  font-size: 16px;
  line-height: 1.6;
}

/* NAV */
nav {
  background: var(--soil);
  position: sticky; top: 0; z-index: 100;
  padding: 0 clamp(1rem, 5vw, 3rem);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.nav-logo {
  font-family: var(--font-display); font-size: 1.3rem;
  color: var(--cream); text-decoration: none; letter-spacing: -0.02em;
}
.nav-logo span { color: var(--sage); }
.nav-back {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--sand); text-decoration: none; font-size: 0.85rem;
  font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--fern); }
.nav-back svg { transition: transform 0.2s; }
.nav-back:hover svg { transform: translateX(-3px); }

/* CALC PAGE LAYOUT */
.calc-page {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 5vw, 3rem);
  display: grid; grid-template-columns: 1fr 380px; gap: 3rem;
  align-items: start;
}
@media (max-width: 860px) {
  .calc-page { grid-template-columns: 1fr; }
}

/* PAGE HEADER */
.page-header { margin-bottom: 2.5rem; }
.page-eyebrow {
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--moss);
  margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.5rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  color: var(--soil); letter-spacing: -0.025em; line-height: 1.15;
  margin-bottom: 0.75rem;
}
.page-desc {
  color: var(--bark); font-size: 1rem; font-weight: 300;
  line-height: 1.75; max-width: 520px;
}

/* CALCULATOR WIDGET */
.calc-widget {
  background: #FAFAF7;
  border: 1.5px solid var(--sand);
  border-radius: 10px;
  overflow: hidden;
}
.calc-widget-header {
  background: #F9F6F0;
  border-bottom: 1px solid var(--sand);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.calc-widget-icon { font-size: 1.4rem; }
.calc-widget-title {
  font-family: var(--font-display); font-size: 1.1rem;
  color: var(--soil); font-weight: 700;
}
.calc-widget-body { padding: 1.5rem; }

/* UNIT TOGGLE */
.unit-toggle {
  display: flex; background: #F9F6F0;
  border: 1px solid var(--sand); border-radius: 30px;
  padding: 3px; width: fit-content; margin-bottom: 1.5rem;
}
.unit-btn {
  padding: 0.3rem 1rem; border-radius: 30px;
  border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 500;
  color: var(--bark); transition: all 0.2s;
}
.unit-btn.active {
  background: var(--moss); color: var(--white);
}

/* FORM FIELDS */
.field { margin-bottom: 1.1rem; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.4rem;
}
.field-label label {
  font-size: 0.82rem; font-weight: 500; color: var(--soil);
  letter-spacing: 0.02em;
}
.field-hint { font-size: 0.72rem; color: var(--bark); }
.field-row { display: flex; gap: 0.5rem; }
.field-row input { flex: 1; }

input[type="number"], input[type="text"], select {
  width: 100%; padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--sand); border-radius: var(--radius);
  background: #FFFFFF; color: var(--soil);
  font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; appearance: none;
}
input:focus, select:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(74,103,65,0.12);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235C3D2E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem; cursor: pointer;
}

/* RANGE SLIDER */
.range-container { position: relative; }
.range-value {
  position: absolute; right: 0; top: -1.4rem;
  font-size: 0.8rem; font-weight: 500; color: var(--moss);
}
input[type="range"] {
  width: 100%; height: 4px; border: none; padding: 0;
  background: linear-gradient(to right, var(--moss) 0%, var(--moss) var(--val, 50%), var(--sand) var(--val, 50%), var(--sand) 100%);
  border-radius: 2px; cursor: pointer; outline: none;
  box-shadow: none; appearance: none; -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--moss); border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* CALCULATE BUTTON */
.btn-calc {
  width: 100%; padding: 0.85rem;
  background: var(--moss); color: var(--white);
  border: none; border-radius: var(--radius);
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background var(--transition), transform 0.1s;
  letter-spacing: 0.01em; margin-top: 0.5rem;
}
.btn-calc:hover { background: var(--soil); }
.btn-calc:active { transform: scale(0.99); }

/* RESULTS */
.results {
  margin-top: 1.25rem; padding: 1.25rem;
  background: #F9F6F0; border-radius: var(--radius);
  border: 1px solid var(--sand); display: none;
}
.results.visible { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.results-title {
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--moss); margin-bottom: 0.9rem;
}
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.5rem 0; border-bottom: 1px solid rgba(212,197,169,0.6);
}
.result-row:last-child { border-bottom: none; padding-bottom: 0; }
.result-label { font-size: 0.85rem; color: var(--bark); }
.result-value {
  font-family: var(--font-display); font-size: 1.15rem;
  color: var(--soil); font-weight: 700;
}
.result-value .unit { font-size: 0.75rem; font-weight: 400; color: var(--bark); margin-left: 0.25rem; font-family: var(--font-body); }

.result-highlight {
  background: var(--moss); color: var(--white);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 0.75rem; display: flex; justify-content: space-between; align-items: center;
}
.result-highlight .result-label { color: rgba(255,255,255,0.8); }
.result-highlight .result-value { color: var(--white); font-size: 1.6rem; }

/* NOTE BOX */
.note-box {
  margin-top: 1.5rem; padding: 1rem 1.25rem;
  background: rgba(74,103,65,0.08); border-left: 3px solid var(--moss);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.82rem; color: var(--bark); line-height: 1.65;
}
.note-box strong { color: var(--moss); }

/* INFO SECTION */
.info-section { margin-top: 2.5rem; }
.info-section h2 {
  font-family: var(--font-display); font-size: 1.5rem;
  color: var(--soil); margin-bottom: 0.75rem; letter-spacing: -0.02em;
}
.info-section h3 {
  font-family: var(--font-display); font-size: 1.1rem;
  color: var(--bark); margin: 1.5rem 0 0.5rem;
}
.info-section p {
  font-size: 0.9rem; color: var(--bark); line-height: 1.75; margin-bottom: 0.75rem;
}
.info-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem; margin: 1rem 0;
}
.info-table th {
  background: #F9F6F0; padding: 0.6rem 0.8rem;
  text-align: left; font-weight: 600; color: var(--soil);
  border-bottom: 2px solid var(--sand);
}
.info-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--sand); color: var(--bark);
}
.info-table tr:last-child td { border-bottom: none; }
.info-table tr:hover td { background: #F9F6F0; }

/* RELATED CALCS */
.related-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
  margin-top: 1rem;
}
.related-card {
  border: 1px solid var(--sand); border-radius: 6px;
  padding: 0.9rem; text-decoration: none; color: inherit;
  display: flex; align-items: center; gap: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
  font-size: 0.875rem; font-weight: 500;
}
.related-card:hover { border-color: var(--moss); background: #F9F6F0; }
.related-card-icon { font-size: 1.1rem; }

/* FOOTER */
footer {
  background: var(--soil); color: var(--sand);
  padding: 2rem clamp(1rem, 5vw, 3rem);
  margin-top: 4rem;
}
.footer-bottom-simple {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-logo-sm {
  font-family: var(--font-display); font-size: 1.1rem;
  color: var(--cream); text-decoration: none;
}
.footer-logo-sm span { color: var(--sage); }
.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.4); }
