/* The whole site's styles, written by hand: there is no build step. Elements are styled directly where they can be, and the classes below name things on the page (a card, a meal, an item) rather than how they look. */
:root {
    --paper: #fbfaf7;
    --card: #ffffff;
    --tint: #f6f5f1;
    --text: #1f2933;
    --muted: #667085;
    --line: #e4e2dc;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-tint: #eff6ff;
    --good: #15803d;
    --good-tint: #f0fdf4;
    --warn: #b45309;
    --warn-tint: #fffbeb;
    --danger: #dc2626;
    --danger-tint: #fef2f2;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(31, 41, 51, 0.12);
    --shadow-lifted: 0 10px 24px rgba(31, 41, 51, 0.16);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('/Images/Paper1.webp') var(--paper);
    font: 16px/1.5 'Libre Baskerville', Georgia, serif;
}

a { color: var(--primary); text-decoration: none; }

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

h1, h2, h3, p { margin: 0; }

h1 { font-size: 1.85rem; margin-bottom: 1.5rem; }

h2 { font-size: 1.15rem; }

h3 { font-size: 1rem; }

img, video { display: block; max-width: 100%; }

[hidden] { display: none !important; }

/* Forms */

label { display: block; margin-bottom: 4px; font-size: 0.875rem; font-weight: 700; color: #3d4852; }

input[type=text], input[type=email], input[type=password], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cfd4dc;
    border-radius: 4px;
    background: var(--card);
    color: var(--text);
    font: inherit;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus, button:focus-visible, .button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

input[type=range] { width: 100%; accent-color: var(--primary); }

input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }

.field { margin-bottom: 1rem; }

.check { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; cursor: pointer; }

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #cfd4dc;
    border-radius: 4px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

button:hover, .button:hover { background: var(--tint); color: var(--text); }

button:disabled { opacity: 0.55; cursor: default; }

.primary { border-color: var(--primary); background: var(--primary); color: #fff; }

.primary:hover { background: var(--primary-dark); color: #fff; }

.danger-outline { border-color: #fca5a5; color: var(--danger); }

.danger-outline:hover { background: var(--danger-tint); color: var(--danger); }

.wide { width: 100%; }

/* A bare icon that acts as a button, such as a row's delete. */
.icon { padding: 6px 8px; border: none; background: none; color: var(--muted); }

.icon:hover { background: var(--tint); }

.icon.good { color: var(--good); }

.icon.danger { color: var(--danger); }

.icon.danger:hover { background: var(--danger-tint); color: var(--danger); }

/* Layout */

.bar { position: sticky; top: 0; z-index: 10; background: var(--card); box-shadow: var(--shadow); }

.bar > div { display: flex; align-items: center; gap: 8px; max-width: 80rem; margin: 0 auto; padding: 12px 16px; }

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.1rem; }

.brand img { width: 24px; height: 24px; }

.bar nav { display: flex; gap: 2px; }

.bar nav a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px; color: #3d4852; font-size: 0.875rem; font-weight: 700; }

.bar nav a:hover { background: var(--tint); color: var(--primary); }

/* On a phone the brand and the links keep their icons and give up their words. */
@media (max-width: 900px) {
    .bar nav span, .brand span { display: none; }

    .bar nav a { font-size: 1.15rem; }
}

.page { max-width: 80rem; margin: 0 auto; padding: 24px 16px 48px; }

.page.narrow { max-width: 30rem; }

.page.narrow h1 { text-align: center; }

.row { display: flex; align-items: center; gap: 8px; }

.row.wrap { flex-wrap: wrap; }

.spacer { flex: 1; }

.stack > * + * { margin-top: 1rem; }

.columns { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }

.muted { color: var(--muted); }

.small { font-size: 0.875rem; }

.center { text-align: center; }

.late { color: var(--danger); font-weight: 700; }

.soon { color: var(--warn); font-weight: 700; }

/* Card: a titled box. <section class="card"><header>…</header><div>…</div></section> */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--tint); border-bottom: 1px solid var(--line); }

.card > div { padding: 20px; }

.card + .card { margin-top: 24px; }

.empty { padding: 24px 0; text-align: center; color: var(--muted); }

.empty i { display: block; margin-bottom: 8px; font-size: 1.9rem; color: #c3c8d0; }

.alert { padding: 12px 16px; border: 1px solid; border-radius: var(--radius); margin-bottom: 1rem; }

.alert.info { background: var(--primary-tint); border-color: #bfdbfe; color: #1e40af; }

.alert.good { background: var(--good-tint); border-color: #bbf7d0; color: #166534; }

.alert.warn { background: var(--warn-tint); border-color: #fde68a; color: #92400e; }

.alert.danger { background: var(--danger-tint); border-color: #fecaca; color: #991b1b; }

.badge { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; background: #eef0f3; color: #3d4852; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }

.badge.blue { background: #dbeafe; color: #1e40af; }

.badge.amber { background: #fef3c7; color: #92400e; }

.badge.red { background: #fee2e2; color: #991b1b; }

.badge.green { background: #dcfce7; color: #166534; }

details > summary { cursor: pointer; color: var(--primary); font-weight: 700; }

details[open] > summary { margin-bottom: 12px; }

/* Shown while an htmx request from the element named by hx-indicator is in flight. */
.htmx-indicator { font-weight: 400; }

/* Item: one line of the pantry or the equipment list. Click it to edit it in place. */

.items { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.item { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--card); border-bottom: 1px solid var(--line); cursor: pointer; }

.item:last-child { border-bottom: none; }

.item:hover { background: var(--tint); }

.item .name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item.editing { background: var(--primary-tint); cursor: default; }

.item.editing form, .add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }

.item.editing input[name=name], .add input[name=name] { flex: 1 1 12rem; }

input.quantity { width: 7rem; }

input.bestBy { width: 8rem; }

/* Meal: a card in the grid of meals. */

.meals { display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }

.meal { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow 0.25s, transform 0.25s; }

.meal:hover { box-shadow: var(--shadow-lifted); transform: translateY(-3px); }

.meal .media { position: relative; display: block; aspect-ratio: 3 / 2; background: var(--tint); }

.meal .media img, .meal .media video { width: 100%; height: 100%; object-fit: cover; }

.meal .media .badge { position: absolute; top: 8px; right: 8px; padding: 4px 10px; }

.meal .failed { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; padding: 16px; background: var(--danger-tint); color: #991b1b; text-align: center; }

.meal .about { display: flex; flex-direction: column; flex: 1; gap: 10px; padding: 12px; }

.meal h3 { flex: 1; color: var(--text); }

@keyframes spin { to { transform: rotate(360deg); } }

.spin { display: inline-block; animation: spin 1.4s linear infinite; }

/* The short list of meals on the home page. */

.recent { display: flex; align-items: stretch; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: box-shadow 0.25s; }

.recent:hover { box-shadow: var(--shadow-lifted); color: var(--text); }

.recent img, .recent .placeholder { width: 9rem; aspect-ratio: 3 / 2; object-fit: cover; flex-shrink: 0; background: var(--tint); }

.recent > div { min-width: 0; padding: 12px 12px 12px 0; }

.recent h3 { margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Welcome: the page for someone who is not signed in. */

.welcome { max-width: 62rem; }

.welcome > section { margin-bottom: 5rem; }

.welcome h1 { font-size: 2.9rem; margin-bottom: 1rem; }

.welcome h2 { font-size: 1.85rem; margin-bottom: 1.25rem; }

.welcome h3 { font-size: 1.2rem; margin-bottom: 0.75rem; }

.welcome p { font-size: 1.1rem; color: #3d4852; }

.welcome .lead { font-size: 1.45rem; color: var(--muted); margin-bottom: 2.5rem; }

.panel { padding: 2.5rem; border-radius: var(--radius); background: var(--tint); }

.panel.warm { background: linear-gradient(90deg, #fff7ed, #fefce8); }

.panel.fresh { background: linear-gradient(90deg, #f0fdf4, #eff6ff); }

.quote { font-style: italic; }

.story { display: grid; gap: 4rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }

.problems { margin: 0; padding-left: 1.25rem; }

.problems li { margin-bottom: 1rem; }

.problems li::marker { color: var(--danger); }

.features { display: grid; gap: 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); max-width: 48rem; margin: 3rem auto 0; }

.features img { width: 14rem; height: 8rem; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 auto 1.5rem; }

.picture { border-radius: var(--radius); box-shadow: var(--shadow-lifted); margin: 0 auto; }

.signup { max-width: 28rem; margin: 0 auto; }

.signup form { text-align: left; margin-top: 1.5rem; }

.ticks { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1rem; font-size: 0.875rem; color: var(--muted); }

.ticks i { color: var(--good); }

/* Admin */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 12px; margin-bottom: 24px; }

.tile { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

.tile .label { font-size: 0.8rem; color: var(--muted); }

.tile .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.tile.alarm { border-color: var(--danger); }

.tile.alarm .value { color: var(--danger); }

.tableWrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font: 0.875rem/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

th { color: var(--muted); font-weight: 600; white-space: nowrap; }

td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }

td .error { max-width: 36rem; color: var(--danger); overflow-wrap: anywhere; }

td form { display: inline; }

@media print {
    .bar { display: none; }
}
