/* ============================================
   NUTRIPAWZA — Dog Health & Care Toolkit
   Shared stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600;9..144,700;9..144,800&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Palette — warm clinical */
  --bone: #F5F0E8;
  --cream: #EFE7D8;
  --paper: #FAF6EE;
  --ink: #1A1814;
  --charcoal: #2D2A24;
  --slate: #5A554B;
  --mist: #B8B0A0;
  --sage: #8A9A7B;
  --sage-deep: #5C6B4F;
  --terracotta: #C97B4F;
  --rust: #A0522D;
  --amber: #D4A04C;
  --crimson: #B43E3E;
  --safe: #6B8E5A;
  --warn: #D4A04C;
  --danger: #B43E3E;

  /* Typography */
  --display: 'Fraunces', 'Times New Roman', serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --max-w: 1280px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle paper texture via SVG noise */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer, nav, section { position: relative; z-index: 2; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(26, 24, 20, 0.08);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background-image: url('images/logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
  display: inline-block;
}

/* Footer/dark-bg variant — slight glow for legibility on dark background */
footer .brand-mark,
.crosslinks .brand-mark {
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.08));
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
  list-style: none;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--terracotta);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--terracotta); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 0.5rem;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--ink);
  transition: 0.2s;
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    background: var(--paper);
    padding: 1.5rem var(--gutter);
    gap: 1.25rem;
    border-bottom: 1px solid rgba(26, 24, 20, 0.08);
    transform: translateY(-110%);
    transition: transform 0.3s, visibility 0s linear 0.3s;
    visibility: hidden;
    box-shadow: 0 16px 32px -16px rgba(26, 24, 20, 0.15);
  }
  .nav-links.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.3s, visibility 0s linear 0s;
  }
}

/* ============================================
   LAYOUT PRIMITIVES
   ============================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rust);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--rust);
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
}

h1 { font-size: clamp(2.5rem, 6vw, 5.5rem); font-weight: 400; }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
h3 { font-size: clamp(1.5rem, 2.5vw, 2rem); font-weight: 500; }

/* Italic accents for serif */
h1 em, h2 em, h3 em {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--rust);
}

p { font-size: 1.05rem; color: var(--charcoal); max-width: 65ch; }

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: clamp(4rem, 10vh, 8rem) 0 clamp(3rem, 8vh, 6rem);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

.hero-eyebrow { margin-bottom: 1.5rem; }

.hero h1 {
  margin-bottom: 1.5rem;
}

.hero-lede {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  color: var(--slate);
  max-width: 50ch;
  margin-bottom: 2.5rem;
  line-height: 1.55;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.hero-stat {
  border-left: 2px solid var(--terracotta);
  padding-left: 1rem;
}

.hero-stat-num {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 400;
  display: block;
  line-height: 1;
}

.hero-stat-lbl {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  margin-top: 0.4rem;
  display: block;
}

/* Hero illustration */
.hero-illustration {
  position: relative;
  max-width: 540px;
  margin: 0 auto;
}

.hero-illustration svg,
.hero-illustration img {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.75rem;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border-radius: 999px;
  transition: all 0.25s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--terracotta);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-arrow::after {
  content: '→';
  transition: transform 0.25s;
}
.btn-arrow:hover::after { transform: translateX(3px); }

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* ============================================
   TOOL CARDS GRID
   ============================================ */
.tools-section {
  padding: clamp(4rem, 8vh, 7rem) 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3.5rem;
  gap: 2rem;
  flex-wrap: wrap;
}

.section-head h2 { max-width: 18ch; }
.section-head p { max-width: 36ch; color: var(--slate); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 800px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card {
  background: var(--bone);
  padding: 2.5rem;
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  border: 1px solid rgba(26, 24, 20, 0.06);
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(201, 123, 79, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 60px -20px rgba(26, 24, 20, 0.15);
}

.tool-card:hover::before { opacity: 1; }

.tool-card-num {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--rust);
  margin-bottom: 1.5rem;
}

.tool-card-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 1.5rem;
  color: var(--ink);
}

.tool-card h3 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.tool-card p {
  font-size: 0.95rem;
  color: var(--slate);
  margin-bottom: auto;
  padding-bottom: 1.5rem;
}

.tool-card-arrow {
  font-family: var(--display);
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-weight: 500;
}

.tool-card-arrow::after {
  content: '→';
  transition: transform 0.25s;
}
.tool-card:hover .tool-card-arrow::after { transform: translateX(4px); }

/* ============================================
   TOOL PAGE LAYOUT
   ============================================ */
.tool-page {
  padding: 3rem 0 5rem;
}

.tool-page-header {
  max-width: 720px;
  margin: 0 auto 3rem;
  text-align: center;
}

.tool-page-header .eyebrow {
  margin-bottom: 1.5rem;
}

.tool-page-header h1 {
  font-size: clamp(2rem, 4.5vw, 4rem);
  margin-bottom: 1rem;
}

.tool-page-header p {
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--slate);
}

.tool-card-shell {
  max-width: 880px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid rgba(26, 24, 20, 0.1);
  border-radius: 6px;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: 0 30px 80px -40px rgba(26, 24, 20, 0.2);
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 2rem;
}

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

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field-full { grid-column: 1 / -1; }

.field label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  font-weight: 500;
}

.field input,
.field select {
  font-family: var(--body);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bone);
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--terracotta);
  background: var(--paper);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--mist);
  font-style: italic;
}

.radio-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.radio-pill {
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--mist);
  border-radius: 999px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--paper);
}

.radio-pill:hover { border-color: var(--ink); }

.radio-pill.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ============================================
   RESULT CARDS
   ============================================ */
.result {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid rgba(26, 24, 20, 0.1);
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-headline {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-headline strong {
  color: var(--terracotta);
  font-weight: 500;
}

.result-sub {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 2rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.result-stat {
  background: var(--bone);
  padding: 1.25rem;
  border-radius: 4px;
  border-left: 3px solid var(--terracotta);
}

.result-stat-num {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
  display: block;
  margin-bottom: 0.4rem;
}

.result-stat-lbl {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}

.result-explainer {
  background: rgba(138, 154, 123, 0.08);
  border-left: 3px solid var(--sage);
  padding: 1.25rem 1.5rem;
  border-radius: 0 4px 4px 0;
  margin-top: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.result-explainer strong {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--sage-deep);
}

/* ============================================
   FOOD SEARCH
   ============================================ */
.search-wrap {
  max-width: 720px;
  margin: 0 auto 3rem;
  position: relative;
}

.search-input {
  width: 100%;
  font-family: var(--body);
  font-size: 1.15rem;
  padding: 1.2rem 3rem 1.2rem 1.5rem;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: 999px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 4px rgba(201, 123, 79, 0.12);
}

.search-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  pointer-events: none;
}

.filter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.food-card {
  background: var(--paper);
  border: 1px solid rgba(26, 24, 20, 0.08);
  border-radius: 6px;
  padding: 1.5rem;
  transition: all 0.25s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.food-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -20px rgba(26, 24, 20, 0.15);
}

.food-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.status-safe { background: rgba(107, 142, 90, 0.15); color: var(--safe); }
.status-caution { background: rgba(212, 160, 76, 0.18); color: #8a6420; }
.status-danger { background: rgba(180, 62, 62, 0.15); color: var(--danger); }

.food-card-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-safe::before { background: var(--safe); }
.status-caution::before { background: var(--warn); }
.status-danger::before { background: var(--danger); }

.food-card h3 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.food-card-summary {
  font-size: 0.9rem;
  color: var(--slate);
  line-height: 1.5;
}

.food-card-detail {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(26, 24, 20, 0.08);
  font-size: 0.9rem;
  line-height: 1.6;
}

.food-card.open .food-card-detail { display: block; animation: fadeUp 0.3s; }

.food-card-detail dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.food-card-detail dt:first-child { margin-top: 0; }

.food-card-detail dd { color: var(--charcoal); }

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--slate);
  font-style: italic;
}

/* ============================================
   FOOTER & CROSS-LINKS
   ============================================ */
.crosslinks {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(4rem, 8vh, 6rem) 0;
  margin-top: 4rem;
}

.crosslinks .eyebrow { color: var(--amber); }
.crosslinks .eyebrow::before { background: var(--amber); }

.crosslinks h2 { color: var(--paper); }
.crosslinks h2 em { color: var(--amber); }

.crosslink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  margin-top: 3rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.crosslink {
  background: var(--ink);
  padding: 2rem 1.75rem;
  transition: background 0.25s;
  text-decoration: none;
  color: var(--paper);
}

.crosslink:hover { background: var(--charcoal); }

.crosslink-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--amber);
  margin-bottom: 1rem;
}

.crosslink h4 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--paper);
}

.crosslink p {
  font-size: 0.85rem;
  color: rgba(245, 240, 232, 0.65);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.crosslink-go {
  font-size: 0.85rem;
  color: var(--amber);
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

footer {
  background: var(--ink);
  color: rgba(245, 240, 232, 0.6);
  padding: 3rem 0 2rem;
  font-size: 0.85rem;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

footer .brand { color: var(--paper); }
footer a { color: rgba(245, 240, 232, 0.7); transition: color 0.2s; }
footer a:hover { color: var(--amber); }

footer ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}

/* ============================================
   FEATURE STRIP (homepage)
   ============================================ */
.features {
  background: var(--bone);
  padding: clamp(3rem, 6vh, 5rem) 0;
  border-top: 1px solid rgba(26, 24, 20, 0.06);
  border-bottom: 1px solid rgba(26, 24, 20, 0.06);
}

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

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

.feature-num {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--terracotta);
  line-height: 1;
}

.feature h4 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

.feature p {
  font-size: 0.92rem;
  color: var(--slate);
  line-height: 1.55;
}

/* ============================================
   SCIENCE NOTE
   ============================================ */
.science-note {
  background: var(--bone);
  padding: 2rem;
  border-radius: 4px;
  margin-top: 3rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--slate);
  border-left: 3px solid var(--sage);
}

.science-note strong {
  font-family: var(--display);
  font-size: 1.05rem;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-weight: 500;
}

/* ============================================
   UTILS
   ============================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }

::selection { background: var(--terracotta); color: var(--paper); }
