/* food — THE TEST KITCHEN CARD
 *
 * Softer-Neistat (PLAN §9): bold, high-contrast chrome + a small warm
 * utilitarian palette; the food photo is the hero. The Workshop-Web spine is
 * intact — border-radius:0, hard 2px borders, block shadows (no soft shadow,
 * no gradient), an 8px module, split type (Oswald display / IBM Plex Mono
 * body), safety paint earned only by an action. ONE accent: kitchen mustard.
 *
 * Content vs chrome: house voice (labels, plates, buttons) is UPPERCASE;
 * anything a person typed (a recipe title, a note) is NEVER transformed
 * (REUSE_NOTES 41).
 */

:root {
    --paper: #EDE4D3;     /* warm paper-white — the field                    */
    --paper-2: #E4D8C0;   /* a slightly deeper surface for cards/sheets      */
    --paper-3: #D8CBB0;   /* muted, for no-data + dividers                   */
    --ink: #1B1A17;       /* charcoal near-black — structure + text          */
    --ink-soft: #4C473D;  /* secondary text                                  */
    --mustard: #E7B23A;   /* kitchen yellow — the single accent (fills)      */
    --mustard-deep: #B9851A; /* deep mustard for text/edges on light         */
    --brick: #A93B2C;     /* STOP only — destructive actions, never decor    */
    --chalk: #F5EFE2;     /* near-white for text on dark fills (not #fff)    */

    --unit: 8px;
    --rule: 3px;
    --border: 2px solid var(--ink);
    --shadow-block: 4px 4px 0 var(--ink);

    --font-display: 'Oswald', 'Arial Narrow', sans-serif;
    --font-body: 'IBM Plex Mono', ui-monospace, monospace;
    --font-mark: 'Permanent Marker', var(--font-display);
}

/* A rounded corner is a bug. */
*, *::before, *::after { border-radius: 0 !important; box-sizing: border-box; }

[x-cloak] { display: none !important; }

body {
    /* Pico v2: override on body, NOT :root, or these lose to Pico's own more
       specific selectors (REUSE_NOTES 28). */
    --pico-border-radius: 0;
    --pico-font-family: var(--font-body);
    --pico-background-color: var(--paper);
    --pico-color: var(--ink);
    --pico-spacing: var(--unit);

    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(var(--unit) * 12); /* room above the FAB */
}

/* Data plates + labels are display type, uppercase, letterspaced. */
.brand-name, .serial, .field-label, .btn-primary, .btn-plain, .btn-danger,
.chip, .seg-btn, .mono, .set-head span, .settings-section h4, .boot-plate,
.empty-plate, .card-meta, .minitag, .tag-pill, .site-plate .icon-btn {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Anything the user typed stays as typed. */
.card-title, .note, code, .link, .nsec, .host, .prev-card strong,
.prev-card small, input, textarea { text-transform: none; }

/* ---------------------------------------------------------------- boot */
.boot {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: var(--unit);
}
.boot-plate {
    font-family: var(--font-display); font-weight: 700; font-size: 2.4rem;
    letter-spacing: 0.12em; background: var(--mustard); color: var(--ink);
    border: var(--border); box-shadow: var(--shadow-block);
    padding: var(--unit) calc(var(--unit) * 2);
}
.boot-sub { font-size: 0.8rem; color: var(--ink-soft); }

/* --------------------------------------------------------- site plate */
.site-plate {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--ink); color: var(--chalk);
    padding: calc(var(--unit) * 1.5) calc(var(--unit) * 2);
    border-bottom: var(--rule) solid var(--ink);
}
.brand { display: flex; align-items: baseline; gap: var(--unit); }
.brand-name { font-weight: 700; font-size: 1.3rem; color: var(--mustard); }
.serial { font-size: 0.6rem; color: var(--paper-3); letter-spacing: 0.14em; }
.plate-right { display: flex; align-items: center; gap: var(--unit); }
.icon-btn {
    background: transparent; border: none; color: inherit;
    font-size: 1.2rem; line-height: 1; padding: 4px 8px; cursor: pointer;
}
.site-plate .icon-btn { color: var(--chalk); border: var(--border); border-color: var(--paper-3); }
.lamp {
    width: 12px; height: 12px; background: var(--paper-3);
    border: 2px solid var(--chalk); display: inline-block;
}
.lamp.is-active { background: var(--mustard); }
.lamp.is-queued { background: var(--mustard-deep); }
.lamp.is-offline { background: var(--brick); }

/* ------------------------------------------------------------- banners */
.banner {
    padding: var(--unit) calc(var(--unit) * 2); font-size: 0.78rem;
    border-bottom: var(--border);
}
.banner.is-bad { background: var(--brick); color: var(--chalk); }
.banner.is-warn { background: var(--mustard); color: var(--ink); }
.link-btn {
    background: none; border: none; color: inherit; text-decoration: underline;
    text-decoration-thickness: 3px; cursor: pointer; font: inherit;
}

/* ------------------------------------------------------------- toolbar */
.toolbar {
    display: flex; gap: var(--unit); align-items: center;
    padding: calc(var(--unit) * 1.5) calc(var(--unit) * 2) var(--unit);
}
.search {
    flex: 1; font-family: var(--font-body); font-size: 0.9rem;
    background: var(--chalk); color: var(--ink); border: var(--border);
    padding: var(--unit); margin: 0;
}
.tagbar {
    display: flex; gap: var(--unit); flex-wrap: nowrap; overflow-x: auto;
    padding: 0 calc(var(--unit) * 2) var(--unit); scrollbar-width: thin;
}
.chip {
    flex: 0 0 auto; background: var(--paper-2); color: var(--ink);
    border: var(--border); padding: 6px 10px; font-size: 0.68rem;
    cursor: pointer; white-space: nowrap; display: inline-flex; gap: 5px; align-items: center;
}
.chip.is-on { background: var(--mustard); box-shadow: var(--shadow-block); }
.chip .chip-n { color: var(--ink-soft); font-size: 0.6rem; }
.chip.clear, .chip.toggle { background: var(--ink); color: var(--chalk); }
.chip.toggle.is-on { background: var(--mustard); color: var(--ink); }

/* ---------------------------------------------------------------- grid */
.grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: calc(var(--unit) * 1.5);
    padding: 0 calc(var(--unit) * 2);
}
.card {
    position: relative; background: var(--paper-2); border: var(--border);
    box-shadow: var(--shadow-block); cursor: pointer; overflow: hidden;
    display: flex; flex-direction: column;
}
.card.is-fav { border-color: var(--mustard-deep); box-shadow: 4px 4px 0 var(--mustard-deep); }
.card-thumb { aspect-ratio: 1 / 1; background: var(--paper-3); border-bottom: var(--border); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-none {
    aspect-ratio: 3 / 2; background: var(--ink); color: var(--mustard);
    border-bottom: var(--border); display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em;
    font-size: 0.9rem; padding: var(--unit); text-align: center; overflow-wrap: anywhere;
}
.star {
    position: absolute; top: 6px; right: 6px; width: 34px; height: 34px;
    background: var(--paper); border: var(--border); color: var(--paper-3);
    font-size: 1.1rem; line-height: 1; cursor: pointer; z-index: 2;
}
.star.is-on { background: var(--mustard); color: var(--ink); }
.card-body { padding: var(--unit); display: flex; flex-direction: column; gap: 4px; }
.card-title { font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
    line-height: 1.25; margin: 0; overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { font-size: 0.58rem; color: var(--ink-soft); display: flex; gap: 5px; }
.card-meta .dot { color: var(--paper-3); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.minitag { font-size: 0.55rem; background: var(--ink); color: var(--chalk); padding: 2px 5px; }

/* --------------------------------------------------------------- empty */
.empty { text-align: center; padding: calc(var(--unit) * 6) var(--unit); color: var(--ink-soft); }
.empty-plate {
    display: inline-block; background: var(--paper-3); color: var(--ink);
    border: var(--border); padding: var(--unit) calc(var(--unit) * 2);
    font-weight: 700; font-size: 1.1rem;
}
.empty p { margin-top: var(--unit); font-size: 0.82rem; }

/* ----------------------------------------------------------------- FAB */
.fab-wrap { position: fixed; right: calc(var(--unit) * 2); bottom: calc(var(--unit) * 2); z-index: 30; }
.fab {
    width: 60px; height: 60px; background: var(--mustard); color: var(--ink);
    border: var(--border); box-shadow: var(--shadow-block);
    font-family: var(--font-display); font-size: 2rem; line-height: 1; cursor: pointer;
    transition: transform 120ms linear;
}
.fab.is-open { transform: rotate(45deg); }
.fab-menu { display: flex; flex-direction: column; gap: var(--unit); margin-bottom: var(--unit); align-items: flex-end; }
.fab-action {
    background: var(--ink); color: var(--chalk); border: var(--border);
    box-shadow: var(--shadow-block); padding: var(--unit) calc(var(--unit) * 1.5);
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
    font-size: 0.78rem; cursor: pointer; display: flex; gap: var(--unit); align-items: center;
}
.fab-action .fa-ico { font-size: 1rem; }

/* -------------------------------------------------------------- sheets */
.sheet-scrim, .ask-scrim {
    position: fixed; inset: 0; z-index: 40; background: rgba(27, 26, 23, 0.55);
    display: flex; align-items: flex-end; justify-content: center;
}
.ask-scrim { align-items: center; }
.sheet {
    width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
    background: var(--paper); border-top: var(--rule) solid var(--ink);
    border-left: var(--border); border-right: var(--border);
}
.sheet-head {
    position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
    background: var(--ink); color: var(--chalk); padding: var(--unit) calc(var(--unit) * 2);
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.95rem;
}
.sheet-head .icon-btn { color: var(--chalk); }
.sheet-body { padding: calc(var(--unit) * 2); display: flex; flex-direction: column; gap: var(--unit); }
.sheet-actions {
    position: sticky; bottom: 0; display: flex; gap: var(--unit); justify-content: space-between;
    background: var(--paper-2); border-top: var(--border); padding: var(--unit) calc(var(--unit) * 2);
}
.field-label { font-size: 0.66rem; color: var(--ink-soft); margin-top: 4px; }
.field-label .opt { color: var(--paper-3); text-transform: none; letter-spacing: 0; }
.ff {
    width: 100%; font-family: var(--font-body); font-size: 0.9rem;
    background: var(--chalk); color: var(--ink); border: var(--border); padding: var(--unit); margin: 0;
}
textarea.ff { resize: vertical; }

.shot {
    aspect-ratio: 4 / 3; background: var(--ink); color: var(--mustard);
    border: var(--border); display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden; text-align: center; padding: var(--unit);
    font-family: var(--font-display); letter-spacing: 0.08em; font-size: 0.85rem;
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.hidden-file { display: none; }
.prev { font-size: 0.72rem; color: var(--ink-soft); }
.prev-card { display: flex; gap: var(--unit); border: var(--border); background: var(--paper-2); padding: var(--unit); }
.prev-card img { width: 64px; height: 64px; object-fit: cover; border: var(--border); flex: 0 0 auto; }
.prev-card strong { display: block; font-size: 0.82rem; }
.prev-card small { display: block; font-size: 0.68rem; color: var(--ink-soft); }

/* tag editing */
.tag-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill { background: var(--mustard); color: var(--ink); border: var(--border); padding: 4px 8px; font-size: 0.66rem; cursor: pointer; }
.ac { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-chip { background: var(--paper-2); color: var(--ink); border: var(--border); padding: 4px 8px; font-family: var(--font-body); font-size: 0.72rem; cursor: pointer; }
.ac-chip.is-on { background: var(--mustard); }
.quickpick { display: flex; flex-direction: column; gap: 4px; }
.qp-group summary { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; cursor: pointer; padding: 4px 0; }
.qp-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: var(--unit); }

/* segmented rating control */
.seg { display: flex; border: var(--border); }
.seg-btn { flex: 1; background: var(--paper-2); color: var(--ink); border: none; border-right: var(--border); padding: var(--unit) 4px; font-size: 0.64rem; cursor: pointer; }
.seg-btn:last-child { border-right: none; }
.seg-btn.is-on { background: var(--mustard); }

/* detail original */
.orig { display: flex; flex-direction: column; gap: var(--unit); }
.open-link { text-align: center; text-decoration: none; }
.host { font-size: 0.72rem; color: var(--ink-soft); }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--unit); }
.photo { position: relative; }
.photo img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border: var(--border); display: block; }
.photo-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; background: var(--brick); color: var(--chalk); border: var(--border); cursor: pointer; }
.note { font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; background: var(--paper-2); border-left: var(--rule) solid var(--mustard-deep); padding: var(--unit); margin: 0; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(27,26,23,0.92); display: flex; align-items: center; justify-content: center; padding: var(--unit); }
.lightbox img { max-width: 100%; max-height: 100%; border: var(--border); }

/* -------------------------------------------------------------- buttons */
.btn-primary, .btn-plain, .btn-danger {
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
    font-size: 0.8rem; border: var(--border); padding: var(--unit) calc(var(--unit) * 1.5);
    cursor: pointer; box-shadow: var(--shadow-block);
}
.btn-primary { background: var(--mustard); color: var(--ink); }
.btn-plain { background: var(--paper-2); color: var(--ink); }
.btn-danger { background: var(--brick); color: var(--chalk); }
.btn-primary:disabled, .btn-plain:disabled { opacity: 0.5; box-shadow: none; cursor: default; }
.sm { font-size: 0.68rem; padding: 6px 10px; box-shadow: none; }
.btn-row { display: flex; gap: var(--unit); flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------- settings */
.settings { padding-bottom: calc(var(--unit) * 6); }
.set-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--unit);
    background: var(--ink); color: var(--chalk); padding: var(--unit) calc(var(--unit) * 2);
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; }
.set-head .icon-btn { color: var(--chalk); font-size: 1.4rem; }
.settings-section { border: var(--border); background: var(--paper-2); margin: calc(var(--unit) * 2); padding: calc(var(--unit) * 1.5); box-shadow: var(--shadow-block); display: flex; flex-direction: column; gap: var(--unit); }
.settings-section h4 { margin: 0 0 4px; font-size: 0.8rem; border-bottom: var(--rule) solid var(--ink); padding-bottom: 6px; }
.kv { display: flex; justify-content: space-between; gap: var(--unit); font-size: 0.74rem; align-items: baseline; }
.kv code, code { font-family: var(--font-body); font-size: 0.7rem; word-break: break-all; background: var(--chalk); padding: 1px 4px; }
.hint { font-size: 0.72rem; color: var(--ink-soft); margin: 0; }
.invite-box { border: var(--border); background: var(--paper); padding: var(--unit); display: flex; flex-direction: column; gap: 6px; }
.link, .nsec { display: block; font-size: 0.66rem; word-break: break-all; background: var(--chalk); border: var(--border); padding: 6px; }
.members { display: flex; flex-direction: column; gap: 6px; }
.member { display: flex; align-items: center; gap: var(--unit); font-size: 0.72rem; border-bottom: 2px dotted var(--paper-3); padding-bottom: 6px; }
.member.pending { opacity: 0.85; }
.member code { flex: 1; }
.member .mono { font-size: 0.6rem; background: var(--ink); color: var(--chalk); padding: 2px 5px; }
.member .me { background: var(--mustard); color: var(--ink); font-size: 0.58rem; padding: 2px 5px; font-family: var(--font-display); }

/* ------------------------------------------------------------------ ask */
.ask { width: min(420px, calc(100vw - var(--unit) * 4)); background: var(--paper); border: var(--border); box-shadow: var(--shadow-block); padding: calc(var(--unit) * 2); display: flex; flex-direction: column; gap: var(--unit); }
.ask h4 { margin: 0; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 1rem; border-bottom: var(--rule) solid var(--ink); padding-bottom: 6px; }
.ask p { margin: 0; font-size: 0.82rem; line-height: 1.45; }

/* ---------------------------------------------------------------- toasts */
.toast-wrap { position: fixed; left: var(--unit); right: var(--unit); bottom: calc(var(--unit) * 2); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; background: var(--ink); color: var(--chalk); border: var(--border); box-shadow: var(--shadow-block); padding: var(--unit) calc(var(--unit) * 1.5); font-size: 0.78rem; cursor: pointer; }
.toast.is-error { background: var(--brick); }
.toast.is-ok { background: var(--ink); }

/* -------------------------------------------------------------- login */
#nostr-login-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--paper); padding: var(--unit); }
#nostr-login-card { width: min(440px, 100%); border: var(--border); box-shadow: var(--shadow-block); background: var(--paper-2); }

@media (prefers-reduced-motion: reduce) {
    .fab { transition: none; }
    * { scroll-behavior: auto; }
}
