/* Calorie Deficit Calculator — modern UK-English design
   Palette: warm off-white, deep teal accent, soft shadows. */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --ink: #0f1f24;
  --ink-2: #3a4a52;
  --muted: #6b7a82;
  --line: #e6e3da;
  --accent: #0e7c66;       /* deep teal-green */
  --accent-2: #0a5b4b;
  --accent-soft: #d9efe8;
  --warn: #b54708;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,31,36,.05);
  --shadow-md: 0 6px 20px rgba(15,31,36,.08);
  --shadow-lg: 0 16px 40px rgba(15,31,36,.10);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif Pro", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

/* Layout */
.container { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.site-header { padding: 28px 0 8px; }
.site-header h1 a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.site-header h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin: 0 0 10px;
  line-height: 1.15;
}
.lede {
  font-size: 1.08rem;
  color: var(--ink-2);
  margin: 0 0 8px;
  max-width: 62ch;
}

main { padding: 8px 0 40px; }

/* Calculator card */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: clamp(20px, 3vw, 32px);
  margin: 24px 0 40px;
}
.calc-card h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.calc-sub { color: var(--muted); margin: 0 0 22px; font-size: 0.96rem; }

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 18px;
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.field .hint { font-size: 0.78rem; color: var(--muted); }
.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b7a82' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field input.invalid { border-color: #c2410c; box-shadow: 0 0 0 3px #fde4d3; }

/* Unit toggle (segmented) */
.unit-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.unit-input.height-ftin {
  grid-template-columns: 1fr 1fr auto;
}
.toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.toggle button[aria-pressed="true"] {
  background: #fff;
  color: var(--accent-2);
  box-shadow: var(--shadow-sm);
}
.toggle button:hover:not([aria-pressed="true"]) { color: var(--ink-2); }

/* Calculate button */
.actions {
  margin-top: 26px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .08s, background .15s, box-shadow .15s, opacity .15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,124,102,.30);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  background: #c8d3d0;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
  opacity: .85;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* Results */
.results {
  margin-top: 28px;
  border-top: 1px dashed var(--line);
  padding-top: 24px;
  display: none;
}
.results.is-visible { display: block; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.results h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0 0 4px;
}
.results .summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 12px 0 20px;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.results .summary .pill {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.results-table thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 12px 14px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.results-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr.highlight td {
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft));
}
.results-table .plan { font-weight: 600; color: var(--ink); }
.results-table .calories { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.results-table .delta { color: var(--muted); font-variant-numeric: tabular-nums; }
.results .disclaimer {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Content sections */
.content {
  background: transparent;
  padding: 16px 0 8px;
}
.content h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  margin: 36px 0 10px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.content h3 {
  font-size: 1.15rem;
  margin: 22px 0 8px;
  color: var(--ink);
}
.content p { margin: 10px 0; color: var(--ink-2); }
.content ul, .content ol { padding-left: 22px; color: var(--ink-2); }
.content li { margin: 6px 0; }
.content section.faq-item {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.content section.faq-item:first-of-type { border-top: 0; padding-top: 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 22px 0 36px;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer a { color: var(--ink-2); }

/* Privacy page */
.privacy-page main { padding-top: 8px; }
.privacy-page .content h2:first-of-type { margin-top: 12px; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
