/* Family Meal Plan — self-contained styles. No external fonts or scripts. */

:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #241f18;
  --ink-soft: #5e564b;
  --ink-faint: #8a8175;
  --line: #ddd3c2;
  --accent: #21543c;
  --accent-hover: #163b2a;
  --accent-soft: #e4efe8;
  --terracotta: #9a4526;
  --focus: #21543c;
  --shadow: 0 1px 2px rgba(36, 31, 24, 0.06), 0 10px 28px rgba(36, 31, 24, 0.07);
  --radius: 14px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", Georgia, serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --wide: 64rem;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 420px at 50% -120px, #fbf7ee, transparent 65%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus { top: 0.75rem; }

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 239, 230, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  min-width: 0;
}

.brand span { white-space: nowrap; }

.brand:hover { color: var(--accent); }

.brand img {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 8px;
}

nav {
  display: flex;
  gap: 0.2rem;
}

nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .header-inner { padding: 0.65rem 0.9rem; gap: 0.5rem; }
  .brand { font-size: 1rem; gap: 0.45rem; }
  .brand img { width: 28px; height: 28px; }
  nav a { padding: 0.3rem 0.55rem; font-size: 0.88rem; }
}

nav a:hover,
nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.25rem;
}

article.week {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.25rem 2.25rem;
}

@media (min-width: 720px) {
  article.week { padding: 2.4rem 2.7rem 2.9rem; }
}

.kicker {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.55rem;
}

article.week > h1:first-of-type,
.archive > h1 {
  font-family: var(--font-serif);
  font-weight: 650;
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

article.week > p { color: var(--ink-soft); }

article.week > p:first-of-type {
  font-size: 1.06rem;
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.7rem 0;
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.42rem;
  margin: 2rem 0 0.8rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin: 1.4rem 0 0.35rem;
  font-weight: 700;
}

.table-wrap {
  margin: 1rem 0 1.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

table.meals {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
  min-width: 36rem;
}

table.meals th,
table.meals td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

table.meals th {
  background: var(--bg);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
}

table.meals tbody tr:last-child td { border-bottom: 0; }

table.meals tbody tr:nth-child(even) { background: #fbf8f2; }

table.meals td:nth-child(2) {
  font-weight: 600;
  color: #4a3f30;
}

table.meals td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--terracotta);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  table.meals { min-width: 0; }

  table.meals thead { display: none; }

  table.meals,
  table.meals tbody,
  table.meals tr,
  table.meals td {
    display: block;
    width: 100%;
  }

  table.meals tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 0.85rem;
    padding: 0.45rem 0.1rem 0.55rem;
    box-shadow: 0 1px 2px rgba(36, 31, 24, 0.04);
  }

  table.meals tbody tr:nth-child(even) { background: #fff; }

  table.meals td {
    display: grid;
    grid-template-columns: 6.6rem 1fr;
    gap: 0.5rem;
    padding: 0.42rem 0.85rem;
    border-bottom: 0;
    white-space: normal;
  }

  table.meals td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ink-faint);
    padding-top: 0.18rem;
  }

  table.meals td:nth-child(1) { font-size: 1.05rem; }
}

table.meals .cell-value { display: block; min-width: 0; }

article.week ul {
  margin: 0.3rem 0 1rem;
  padding-left: 1.2rem;
}

article.week li { margin: 0.22rem 0; }

article.week strong { font-weight: 700; }

article.week p:has(> strong:only-child) {
  margin: 1.15rem 0 0.15rem;
  color: var(--ink);
  font-size: 1.02rem;
}

article.week p:has(> strong:only-child) + ul {
  margin-top: 0.15rem;
}

.shopping ul {
  list-style: none;
  padding-left: 0;
  margin: 0.15rem 0 0.8rem;
}

.shop-item {
  margin: 0;
  border-bottom: 1px dashed var(--line);
}

.shop-item:last-child { border-bottom: 0; }

.shop-item label {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.58rem 0.4rem;
  cursor: pointer;
  border-radius: 8px;
}

.shop-item label:hover { background: var(--bg); }

.shop-item input[type="checkbox"] {
  appearance: auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.18rem 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.shop-item input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.shop-item input[type="checkbox"]:checked + .item-text {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.shopping-total,
.shopping > p:last-child {
  margin-top: 1.2rem;
  background: var(--accent-soft);
  border: 1px solid #cfe0d4;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--accent);
}

.more-weeks { margin-top: 2.25rem; }

.more-weeks > h2,
.archive > h1 { margin-top: 0; }

.week-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
}

.week-list li { margin: 0 0 0.6rem; }

.week-list a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 1px 2px rgba(36, 31, 24, 0.04);
}

.more-weeks .week-list a,
.archive .week-list a { background: #fff; }

.week-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.week-list .week-name {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 650;
}

.week-list .week-range {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}

.site-footer {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.site-footer a { color: inherit; }

@media print {
  body {
    background: #fff;
    font-size: 11pt;
    color: #000;
  }

  .skip-link,
  .site-header,
  .more-weeks,
  .site-footer {
    display: none !important;
  }

  main { padding: 0; max-width: none; }

  article.week {
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    background: #fff;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  table.meals {
    display: table;
    width: 100%;
    min-width: 0;
    font-size: 9.5pt;
    border: 1px solid #ccc;
    border-collapse: collapse;
  }

  table.meals thead { display: table-header-group; }
  table.meals tbody { display: table-row-group; }

  table.meals tr {
    display: table-row;
    border: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
    background: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  table.meals th,
  table.meals td {
    display: table-cell;
    white-space: normal;
    border-bottom: 1px solid #ddd;
    padding: 0.35rem 0.45rem;
  }

  table.meals td::before { content: none; }

  .shop-item,
  table.meals tr,
  h2,
  h3 { break-inside: avoid; }

  .shop-item label:hover { background: none; }

  a { color: inherit; }

  .shopping-total,
  .shopping > p:last-child {
    background: none;
    border: 1px solid #ccc;
    color: #000;
  }
}

@page { margin: 0.65in; }
