:root {
  color-scheme: light;
  --forest: #173f34;
  --forest-2: #245646;
  --sage: #dce9df;
  --sage-light: #edf4ee;
  --cream: #f7f2e8;
  --paper: #fffdf8;
  --ink: #1d2923;
  --muted: #667269;
  --line: #d9ded6;
  --coral: #e96f52;
  --gold: #d7a642;
  --shadow: 0 18px 50px rgba(23, 63, 52, .09);
  font-family: Inter, Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(44px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 8% 2%, rgba(215, 166, 66, .12), transparent 27rem),
    var(--cream);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin-top: 0;
}

h1,
h2,
h3,
.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -.025em;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.25rem, 8vw, 4.7rem);
  line-height: .98;
  font-weight: 600;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.08;
  font-weight: 600;
}

h3 {
  font-size: 1.12rem;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(23, 63, 52, .12);
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
}

.header-inner,
.view-switcher,
main {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(13px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    10px max(18px, env(safe-area-inset-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--forest);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50% 50% 48% 42%;
  background: var(--forest);
  color: var(--cream);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  transform: rotate(-5deg);
}

.brand > span:last-child {
  display: grid;
}

.brand strong {
  font-size: 1.2rem;
  line-height: 1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .67rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.status {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  padding: 10px 14px;
  border: 1px solid rgba(36, 86, 70, .14);
  border-radius: 999px;
  background: var(--sage);
  color: var(--forest);
  box-shadow: 0 10px 30px rgba(23, 63, 52, .18);
  font-size: .78rem;
  font-weight: 800;
  pointer-events: none;
}

.status[hidden] {
  display: none;
}

.status::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #3d8b69;
  content: "";
}

.status.offline {
  border-color: #e8c890;
  background: #fae7c3;
  color: #744d16;
}

.status.offline::before {
  background: #c47c20;
}

.view-switcher {
  display: flex;
  gap: 6px;
  padding: 0 max(14px, env(safe-area-inset-right)) 9px
    max(14px, env(safe-area-inset-left));
}

.view-switcher button {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
  cursor: pointer;
}

.view-switcher button[aria-selected="true"] {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 8px 22px rgba(23, 63, 52, .16);
}

.nav-number {
  font-size: .61rem;
  letter-spacing: .08em;
  opacity: .62;
}

.nav-count {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding-inline: 5px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: .66rem;
}

main {
  padding: 30px max(18px, env(safe-area-inset-right)) 0
    max(18px, env(safe-area-inset-left));
}

.view-panel[hidden] {
  display: none;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--coral);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(.95rem, 2vw, 1.08rem);
  line-height: 1.65;
}

.week-hero,
.shopping-hero,
.data-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 42px;
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.week-hero {
  display: grid;
  min-height: 300px;
  align-items: end;
  padding: clamp(24px, 6vw, 52px);
  background:
    linear-gradient(100deg, rgba(23, 63, 52, .98), rgba(23, 63, 52, .78)),
    radial-gradient(circle at 85% 20%, rgba(215, 166, 66, .45), transparent 35%);
  color: #fff;
}

.week-hero::after {
  position: absolute;
  top: -95px;
  right: -70px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 46% 54% 62% 38%;
  content: "";
  transform: rotate(21deg);
}

.week-hero > * {
  position: relative;
  z-index: 1;
}

.week-hero .eyebrow {
  color: #efbc74;
}

.week-hero .hero-copy {
  color: rgba(255, 255, 255, .72);
}

.week-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 28px;
}

.week-facts span {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  font-size: .78rem;
}

.week-facts strong {
  margin-right: 3px;
  font-size: .9rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--forest-2);
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
}

.meal-grid {
  display: grid;
  gap: 14px;
}

.meal-card {
  position: relative;
  display: grid;
  min-height: 155px;
  overflow: hidden;
  border: 1px solid rgba(23, 63, 52, .11);
  border-radius: 19px;
  background: var(--paper);
  box-shadow: 0 7px 25px rgba(23, 63, 52, .055);
}

.meal-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.meal-card.flex-meal {
  min-height: 130px;
  border-style: dashed;
  background: var(--sage-light);
  box-shadow: none;
}

.meal-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 17px;
}

.meal-day {
  margin-bottom: 6px;
  color: var(--coral);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.meal-name {
  margin-bottom: 8px;
  font-size: 1.28rem;
  line-height: 1.08;
}

.meal-meta,
.image-credit {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .77rem;
}

.image-credit {
  margin-top: auto;
  padding-top: 12px;
}

.image-credit a {
  text-decoration-color: rgba(102, 114, 105, .35);
  text-underline-offset: 3px;
}

.recipes-section {
  margin-top: 48px;
}

.recipes {
  display: grid;
  gap: 10px;
}

.recipe {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.recipe summary {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  color: var(--forest);
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.recipe summary::-webkit-details-marker {
  display: none;
}

.recipe summary::after {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  content: "+";
  font-size: 1.1rem;
}

.recipe[open] summary::after {
  content: "−";
}

.recipe-content {
  padding: 0 18px 18px;
  color: #38463f;
  line-height: 1.6;
}

.recipe-content h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.recipe-content ol,
.recipe-content ul {
  margin-bottom: 0;
  padding-left: 21px;
}

.shopping-hero {
  display: grid;
  gap: 28px;
  padding: clamp(24px, 5vw, 42px);
  background: var(--paper);
}

.progress-card {
  align-self: end;
  padding: 17px;
  border-radius: 16px;
  background: var(--sage-light);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--forest);
  font-size: .83rem;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #d2ded4;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--forest-2), #4c9478);
  transition: width .25s ease;
}

.shopping-list {
  display: grid;
  gap: 13px;
}

.shopping-category {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 6px 22px rgba(23, 63, 52, .045);
}

.shopping-category h3 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e8ece6;
  background: var(--sage-light);
  color: var(--forest);
  font-family: inherit;
  font-size: .78rem;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.shopping-item {
  display: grid;
  min-height: 55px;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  border-top: 1px solid #eeeae1;
  cursor: pointer;
}

.shopping-item:first-of-type {
  border-top: 0;
}

.shopping-item input {
  width: 23px;
  height: 23px;
  margin: 0;
  accent-color: var(--forest-2);
}

.shopping-item.checked .item-name {
  color: var(--muted);
  text-decoration: line-through;
}

.item-name {
  font-weight: 650;
}

.item-quantity {
  color: var(--muted);
  font-size: .82rem;
}

.add-item {
  display: grid;
  gap: 13px;
  margin-top: 25px;
  padding: clamp(20px, 5vw, 30px);
  border-radius: 20px;
  background: var(--forest);
  color: #fff;
  box-shadow: var(--shadow);
}

.add-item .eyebrow {
  color: #efbc74;
}

.add-item label {
  display: grid;
  gap: 6px;
  font-size: .78rem;
  font-weight: 800;
}

.add-item label small {
  color: rgba(255, 255, 255, .6);
  font-weight: 500;
}

.add-item input {
  width: 100%;
  min-height: 47px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 11px;
  outline: 0;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  padding: 11px 13px;
}

.add-item input::placeholder {
  color: rgba(255, 255, 255, .47);
}

.add-item input:focus {
  border-color: #efbc74;
  box-shadow: 0 0 0 3px rgba(239, 188, 116, .18);
}

.add-item button,
.load-more {
  min-height: 47px;
  border: 0;
  border-radius: 11px;
  background: var(--coral);
  color: #fff;
  padding: 11px 18px;
  font-weight: 850;
  cursor: pointer;
}

.data-hero {
  padding: clamp(27px, 6vw, 52px);
  border: 1px solid rgba(23, 63, 52, .11);
  background: var(--paper);
}

.data-hero h1 {
  color: var(--forest);
}

.model-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 30px;
}

.model-button {
  display: grid;
  min-height: 112px;
  align-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
  color: var(--ink);
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.model-button:hover,
.model-button.active {
  border-color: var(--forest-2);
  box-shadow: 0 8px 25px rgba(23, 63, 52, .08);
}

.model-button.active {
  background: var(--sage-light);
}

.model-button strong {
  color: var(--forest);
  font-size: .88rem;
}

.model-button span {
  color: var(--muted);
  font-size: .76rem;
}

.model-records {
  display: grid;
  gap: 12px;
}

.records-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}

.records-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .78rem;
}

.model-record {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.model-record > summary {
  display: grid;
  min-height: 64px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 17px;
  color: var(--forest);
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.model-record > summary::-webkit-details-marker {
  display: none;
}

.record-meta {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 650;
}

.model-fields {
  display: grid;
  gap: 1px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.model-field {
  min-width: 0;
  padding: 12px 16px;
  background: #fff;
}

.model-field dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.model-field dd {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: .86rem;
  line-height: 1.5;
}

.nested-value {
  margin-top: 5px;
  border-left: 2px solid var(--sage);
  padding-left: 11px;
}

.nested-value .model-field {
  padding: 8px 0;
}

.value-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.value-list > li {
  border-radius: 9px;
  background: var(--sage-light);
  padding: 9px 11px;
}

.empty,
.loading-state,
.error-state {
  grid-column: 1 / -1;
  padding: 28px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, .72);
  color: var(--muted);
  text-align: center;
}

.empty span {
  display: block;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 1.4rem;
}

.empty p,
.loading-state,
.error-state {
  margin-bottom: 0;
}

.load-more {
  justify-self: start;
  margin-top: 6px;
  background: var(--forest);
}

@media (min-width: 680px) {
  .header-inner {
    padding-top: calc(17px + env(safe-area-inset-top));
  }

  .view-switcher {
    width: min(1120px, 100%);
    margin: 0 auto;
    justify-content: flex-end;
    padding: 0 max(18px, env(safe-area-inset-right)) 12px
      max(18px, env(safe-area-inset-left));
  }

  .view-switcher button {
    min-width: 142px;
    flex: 0 0 auto;
  }

  main {
    padding-top: 44px;
  }

  .week-hero {
    grid-template-columns: 1fr auto;
  }

  .week-facts {
    max-width: 250px;
    align-self: end;
    justify-content: flex-end;
  }

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

  .meal-card {
    grid-template-columns: minmax(135px, 42%) 1fr;
  }

  .meal-card img {
    height: 100%;
    aspect-ratio: auto;
  }

  .meal-card.flex-meal {
    grid-template-columns: 1fr;
  }

  .shopping-hero {
    grid-template-columns: 1.3fr .7fr;
  }

  .add-item {
    grid-template-columns: 1.1fr 1fr .75fr auto;
    align-items: end;
  }

  .model-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .model-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .meal-card,
  .meal-card.flex-meal {
    grid-template-columns: 1fr;
  }

  .meal-card img {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .meal-card:first-child:not(.flex-meal) {
    grid-column: span 2;
    grid-template-columns: 1.25fr .75fr;
  }

  .meal-card:first-child img {
    height: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .progress-track span {
    transition: none;
  }
}
