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

:root {
  --cream: #f6f1e9;
  --cream-card: #fffdf9;
  --ink: #1f1b16;
  --ink-soft: #4a4238;
  --ink-softer: #5e554a;
  --ink-softest: #6b6155;
  --border: #cfc4b4;
  --border-soft: #e4dacb;
  --border-softer: #ede4d6;
  --band: #fbf7f0;
  --terracotta: #a8361f;
  --terracotta-dark: #7e2714;
  --error-border: #d9a99c;
  --dark-ground: #14100c;
  --cream-glow: #ffe2c9;
  --instacart-bg: #003d29;
  --instacart-fg: #faf1e5;
  --instacart-logo: #ff7009;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Public Sans", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

a {
  color: var(--terracotta);
}
a:hover {
  color: var(--terracotta-dark);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Fraunces, Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: inherit;
}
.wordmark svg {
  flex-shrink: 0;
}

/* ---------- Splash (empty state), video background ---------- */

.splash {
  position: relative;
  overflow: hidden;
  min-height: 100svh;
  background: var(--dark-ground);
  color: #fffdf9;
}

.splash video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.splash .scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.38);
  transition: background 0.3s ease;
}

.splash[data-state="result"] .scrim,
.splash[data-state="error"] .scrim {
  background: rgba(20, 16, 12, 0.52);
}

.splash[data-state="result"] video,
.splash[data-state="error"] video {
  filter: blur(6px);
  transform: scale(1.06);
}

.splash-content {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  box-sizing: border-box;
  padding: 28px 16px 24px;
  display: flex;
  flex-direction: column;
}

.splash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.splash-header .wordmark {
  font-size: 18px;
}

.glass {
  background: rgba(255, 250, 242, 0.13);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.26);
}

@supports not (backdrop-filter: blur(1px)) {
  .glass {
    background: rgba(31, 27, 22, 0.82);
  }
}

.pause-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fffdf9;
  cursor: pointer;
}

.headline {
  margin: 48px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 44px;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  max-width: 900px;
}

.splash-form {
  margin-top: auto;
  box-sizing: border-box;
  padding: 18px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.splash-form label {
  font-size: 14px;
  font-weight: 600;
}

.splash-form input {
  height: 52px;
  box-sizing: border-box;
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 14px;
  background: rgba(20, 16, 12, 0.28);
  color: #fffdf9;
}
.splash-form input::placeholder {
  color: rgba(255, 253, 249, 0.62);
}

.splash-form button {
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.splash-footer {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(255, 253, 249, 0.72);
}
.splash-footer a {
  color: var(--cream-glow);
}

/* ---------- Loading state ---------- */

.loading-panel {
  margin-top: 14px;
  box-sizing: border-box;
  padding: 18px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.spinner {
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-panel strong {
  display: block;
  font-size: 16px;
}
.loading-panel span {
  font-size: 13px;
  color: rgba(255, 253, 249, 0.78);
}

/* ---------- Result card (glass, over the still-playing/blurred video) ---------- */

.result-card {
  margin-top: 14px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-head {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-glow);
}

.result-title {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 500;
}

.result-meta {
  font-size: 13px;
  color: rgba(255, 253, 249, 0.8);
}

.ingredient-list {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
}

.ingredient-list label {
  display: flex;
  gap: 10px;
  min-height: 34px;
  align-items: center;
  cursor: pointer;
}
.ingredient-list input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #fffdf9;
  flex-shrink: 0;
  margin-top: 1px;
}
.ingredient-list .off {
  color: rgba(255, 253, 249, 0.55);
  text-decoration: line-through;
}

.method-panel {
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.method-panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.method-panel ol {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cta-row {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.shop-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  padding: 16px 18px;
  border-radius: 29.5px;
  background: var(--instacart-bg);
  color: var(--instacart-fg);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}
.shop-cta:hover {
  color: var(--instacart-fg);
}
.shop-cta img {
  height: 22px;
  width: auto;
  display: inline-block;
}

.count-line {
  font-size: 12px;
  color: rgba(255, 253, 249, 0.78);
  text-align: center;
}

.shop-error {
  font-size: 12px;
  color: #ffb4a8;
  text-align: center;
}

/* ---------- Error state ---------- */

.error-panel {
  margin-top: 14px;
  border-radius: 18px;
  background: var(--cream-card);
  border: 1.5px solid var(--error-border);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--ink);
}

.error-panel .error-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.error-panel h2 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 23px;
  font-weight: 500;
}
.error-panel p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.error-panel ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.btn-primary,
.btn-secondary {
  height: 50px;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary {
  border: 0;
  background: var(--ink);
  color: var(--cream);
}
.btn-secondary {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

/* ---------- Desktop ---------- */

@media (min-width: 760px) {
  .splash-content {
    padding: 48px 72px 40px;
  }
  .splash-header .wordmark {
    font-size: 22px;
  }
  .headline {
    font-size: 96px;
    margin-top: 72px;
  }
  .splash-form {
    width: 640px;
    padding: 24px;
    border-radius: 26px;
  }
  .splash-form .row {
    display: flex;
    gap: 12px;
  }
  .splash-form input {
    flex-grow: 1;
    height: 56px;
    border-radius: 16px;
    font-size: 17px;
  }
  .splash-form button {
    height: 56px;
    padding: 0 26px;
    border-radius: 16px;
    font-size: 17px;
  }
  .result-card,
  .error-panel,
  .loading-panel {
    width: 640px;
    align-self: center;
  }
}
