/* Niemann Family Cookbook — HomeView-first */

:root {
  --ink: #1a2a1f;
  --ink-soft: #3d4f42;
  --paper: #e8efe6;
  --paper-deep: #d4e0d2;
  --forest: #1f3d2b;
  --forest-mid: #2f5a3f;
  --leaf: #4a7c59;
  --copper: #a65d2e;
  --copper-bright: #c9743a;
  --cream-ban: transparent; /* never use cream AI palette */
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 40px rgba(26, 42, 31, 0.12);
  --radius: 18px;
  --touch: 3.25rem;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
  --max: 68rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 10% -10%, rgba(201, 116, 58, 0.22), transparent 55%),
    radial-gradient(90% 80% at 100% 0%, rgba(74, 124, 89, 0.28), transparent 50%),
    radial-gradient(70% 60% at 50% 100%, rgba(31, 61, 43, 0.18), transparent 55%),
    linear-gradient(160deg, #dfe9dc 0%, #e8efe6 42%, #cfdccb 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  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.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  z-index: 0;
}

a {
  color: var(--forest-mid);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--copper);
}

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

.site-shell {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 1rem 1.15rem 3rem;
}

/* Nav — large touch targets */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0 1rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  font-weight: 600;
  color: var(--forest);
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 12ch;
}

.nav-links {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--forest);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid rgba(31, 61, 43, 0.12);
  transition: transform 0.35s var(--ease), background 0.25s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: var(--forest);
  color: #f3f7f1;
  transform: translateY(-1px);
}

/* Hero — brand first, one composition */
.hero {
  position: relative;
  min-height: min(92dvh, 1088px);
  display: grid;
  align-content: end;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  color: #f6faf4;
  isolation: isolate;
  animation: hero-in 0.9s var(--ease) both;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(18, 36, 26, 0.15) 0%, rgba(18, 36, 26, 0.72) 62%, rgba(14, 28, 20, 0.88) 100%),
    radial-gradient(80% 60% at 70% 30%, rgba(201, 116, 58, 0.35), transparent 60%),
    url("../images/hero-kitchen.svg") center / cover no-repeat,
    linear-gradient(135deg, #2a4a35, #1a2e22);
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 4.6rem);
  font-weight: 650;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  max-width: 12ch;
  text-wrap: balance;
  animation: rise 0.85s var(--ease) 0.12s both;
}

.hero-lead {
  margin: 0 0 1.5rem;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  max-width: 32ch;
  color: rgba(246, 250, 244, 0.9);
  animation: rise 0.85s var(--ease) 0.22s both;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  animation: rise 0.85s var(--ease) 0.32s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 1.35rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--copper-bright);
  color: #1a140f;
}

.btn-primary:hover {
  background: #e08748;
  color: #1a140f;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #f6faf4;
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* Sections */
.section {
  margin-top: 2.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--forest);
  margin: 0 0 0.4rem;
}

.section-lead {
  margin: 0 0 1.35rem;
  color: var(--ink-soft);
  max-width: 42ch;
}

/* Recipe browse — interaction containers OK */
.toolbar {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 0.35rem;
}

.search-input,
.filter-select {
  width: 100%;
  min-height: var(--touch);
  padding: 0 1rem;
  border-radius: 14px;
  border: 1px solid rgba(31, 61, 43, 0.18);
  background: var(--surface-strong);
  font: inherit;
  color: var(--ink);
}

.search-input:focus,
.filter-select:focus {
  outline: 3px solid rgba(166, 93, 46, 0.35);
  outline-offset: 2px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 61, 43, 0.16);
  background: var(--surface);
  color: var(--forest);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.25s var(--ease);
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip[aria-pressed="true"] {
  background: var(--forest);
  color: #f3f7f1;
  border-color: var(--forest);
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 640px) {
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar {
    grid-template-columns: 1.4fr 1fr;
    align-items: end;
  }
}

@media (min-width: 980px) {
  .recipe-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Recipe links as interaction surfaces (not decorative cards-in-hero) */
.recipe-link {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--surface-strong);
  border: 1px solid rgba(31, 61, 43, 0.1);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: rise 0.7s var(--ease) both;
}

.recipe-link:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 48px rgba(26, 42, 31, 0.16);
  color: inherit;
}

.recipe-thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, var(--forest-mid), var(--leaf));
  position: relative;
  overflow: hidden;
}

.recipe-thumb img,
.recipe-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-meta {
  padding: 1rem 1.1rem 1.2rem;
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.recipe-meta h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--forest);
  line-height: 1.2;
}

.recipe-meta p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--copper);
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

/* Recipe page */
.recipe-hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  animation: rise 0.75s var(--ease) both;
}

@media (min-width: 800px) {
  .recipe-hero {
    grid-template-columns: 1fr 1.05fr;
    align-items: stretch;
  }
}

.recipe-photo {
  aspect-ratio: 1 / 1;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  background: linear-gradient(145deg, #355f44, #1f3d2b);
  box-shadow: var(--shadow);
}

.recipe-photo img,
.recipe-photo svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--forest);
  margin: 0 0 0.65rem;
  text-wrap: balance;
}

.recipe-intro .description {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: 42ch;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.stats li {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 12px;
  background: rgba(31, 61, 43, 0.08);
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--forest);
}

.recipe-layout {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 860px) {
  .recipe-layout {
    grid-template-columns: 0.95fr 1.25fr;
    align-items: start;
  }
}

.panel {
  background: var(--surface-strong);
  border: 1px solid rgba(31, 61, 43, 0.1);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0 0 0.85rem;
  color: var(--forest);
  letter-spacing: -0.02em;
}

.ingredients {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.ingredients li {
  position: relative;
  padding: 0.65rem 0.75rem 0.65rem 2.4rem;
  border-radius: 12px;
  background: rgba(31, 61, 43, 0.05);
  font-size: 1.05rem;
  line-height: 1.4;
}

.ingredients li::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  transform: translateY(-50%) rotate(45deg);
  background: var(--copper-bright);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 0.9rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 1rem 1rem 1rem 3.6rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(31, 61, 43, 0.08);
  font-size: 1.08rem;
  min-height: 4.5rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 1rem;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: #f3f7f1;
  font-weight: 800;
  font-size: 0.95rem;
}

.steps .step-name {
  display: block;
  font-weight: 750;
  color: var(--forest);
  margin-bottom: 0.2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--forest-mid);
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(31, 61, 43, 0.12);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

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

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

@keyframes hero-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Square HomeView bias: tighten padding when near-square */
@media (min-aspect-ratio: 9/10) and (max-aspect-ratio: 10/9) and (min-width: 700px) {
  .site-shell {
    padding: 1.25rem 1.5rem 2.5rem;
  }

  .hero {
    min-height: min(88dvh, 980px);
  }

  .hero-brand {
    font-size: clamp(3rem, 7vw, 4.8rem);
  }

  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
