/* ---------------------------------------------------------------------------
   Site publico — mobile-first.
   Escrito para 360px primeiro; tablet e desktop entram por min-width.
   Sem framework, sem fontes externas: carrega rapido no 4G.
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   Cores em tokens. A paleta CLARA e a base; a escura so redefine os tokens.
   Nenhuma cor pode ficar escrita direto numa regra, senao ela nao acompanha
   a troca de tema.

   Tres estados de tema:
     - sem data-theme  -> segue o sistema (prefers-color-scheme)
     - data-theme=dark -> escuro, escolhido pela pessoa
     - data-theme=light-> claro, escolhido pela pessoa
   --------------------------------------------------------------------------- */
:root {
    color-scheme: light;

    --brand:        #b23a17;
    --brand-dark:   #8d2c10;
    --brand-soft:   #fdf3ee;
    --on-brand:     #ffffff;
    --green:        #1f7a3d;
    --green-soft:   #eaf6ee;
    --green-line:   #cbe7d5;
    --red:          #b0281f;
    --red-soft:     #fdeceb;
    --red-line:     #f3cfcc;
    --warn:         #9a4b12;
    --warn-soft:    #fdf0e6;
    --ink:          #23201e;
    --ink-soft:     #5d5651;
    --line:         #e5ded9;
    --bg:           #faf7f5;
    --surface:      #ffffff;
    --surface-2:    #f4f1ef;
    --neutral:      #efeae6;
    --bar-bg:       rgba(255, 255, 255, .97);

    --radius:       14px;
    --tap:          48px;
    --bar-height:   132px;
}

/* Escuro por preferencia do sistema — a menos que a pessoa tenha pedido claro. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --brand:      #e2683f;
        --brand-dark: #f0805a;
        --brand-soft: #2e1d16;
        --on-brand:   #1a1512;
        --green:      #5fc383;
        --green-soft: #16281c;
        --green-line: #244430;
        --red:        #ef8279;
        --red-soft:   #2e1917;
        --red-line:   #4a2723;
        --warn:       #e6a86e;
        --warn-soft:  #2d2016;
        --ink:        #f0eae5;
        --ink-soft:   #b4a89f;
        --line:       #3a3128;
        --bg:         #17140f;
        --surface:    #211c17;
        --surface-2:  #2a241d;
        --neutral:    #2a241d;
        --bar-bg:     rgba(33, 28, 23, .97);
    }
}

/* Escuro escolhido pela pessoa: vale sobre qualquer preferencia do sistema. */
:root[data-theme="dark"] {
    color-scheme: dark;

    --brand:      #e2683f;
    --brand-dark: #f0805a;
    --brand-soft: #2e1d16;
    --on-brand:   #1a1512;
    --green:      #5fc383;
    --green-soft: #16281c;
    --green-line: #244430;
    --red:        #ef8279;
    --red-soft:   #2e1917;
    --red-line:   #4a2723;
    --warn:       #e6a86e;
    --warn-soft:  #2d2016;
    --ink:        #f0eae5;
    --ink-soft:   #b4a89f;
    --line:       #3a3128;
    --bg:         #17140f;
    --surface:    #211c17;
    --surface-2:  #2a241d;
    --neutral:    #2a241d;
    --bar-bg:     rgba(33, 28, 23, .97);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    /* ui-rounded / SF Pro Rounded existe no iOS e no macOS e da um ar bem mais
       simpatico sem custar nenhum download. Quem nao tem cai na fonte do
       sistema, como antes.
       Para uma fonte propria em TODOS os aparelhos (Nunito, Quicksand...):
         1. baixe o .woff2 e coloque em public/assets/fonts/;
         2. declare aqui em cima um @font-face apontando para ela;
         3. ponha o nome dela na frente desta lista.
       Hospede o arquivo no proprio site: a CSP usa font-src 'self', entao
       Google Fonts seria bloqueado — e local carrega mais rapido de qualquer
       forma. */
    font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
                 "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.55;
    padding-bottom: calc(var(--bar-height) + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .8em; }

a { color: var(--brand-dark); }

.wrap {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }

/* Marca campos que o cliente pode deixar em branco. */
.optional {
    font-weight: 400;
    color: var(--ink-soft);
    font-size: .85rem;
}

/* Visivel apenas para leitores de tela. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus {
    left: 8px;
    top: 8px;
    z-index: 20;
    background: var(--surface);
    padding: 10px 14px;
    border-radius: 8px;
}

/* --------------------------------------------------------------- cabecalho */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.brand-logo { border-radius: 10px; object-fit: cover; }
.brand-emoji { font-size: 1.6rem; }
.brand-name { font-size: 1.05rem; }

.status-badge {
    margin: 0;
    font-size: .875rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.status-badge.is-open   { background: var(--green-soft); color: var(--green); }
.status-badge.is-closed { background: var(--red-soft);   color: var(--red); }

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

.theme-toggle {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.theme-toggle:hover { border-color: var(--brand); }

.day-head { margin: 20px 0 12px; }

/* ------------------------------------------------------------------ avisos */

.notice {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 0 0 16px;
}
.notice-title { font-weight: 700; margin-bottom: .3em; }
.notice-closed  { border-left-color: var(--red); }
.notice-success { border-left-color: var(--green); }

.flashes { margin: 12px 0; }
.flash {
    border-radius: 10px;
    padding: 11px 14px;
    margin: 0 0 8px;
    font-size: .95rem;
}
.flash-error   { background: var(--red-soft);   color: var(--red);   border: 1px solid var(--red-line); }
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }

.form-errors { margin: 12px 0; }

/* ------------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0 0 16px;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.price {
    font-weight: 700;
    color: var(--brand-dark);
    white-space: nowrap;
}

.group { margin-top: 14px; }
.group h3 { margin-bottom: .1em; }

.rule {
    color: var(--ink-soft);
    font-size: .9rem;
    margin: 0 0 .5em;
}

/* Cabecalho do grupo: numero do passo + nome, com peso de secao. */
.group-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
}

.group-step {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: .85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.group-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 2px 0 12px;
}

.group-head .rule { margin: 0; }

/* Situacao do grupo em uma palavra: o cliente ve o que falta antes de tentar
   adicionar a marmita, em vez de descobrir pelo erro. */
.counter {
    font-size: .8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.counter.is-pending  { background: var(--warn-soft); color: var(--warn); }
.counter.is-done     { background: var(--green-soft); color: var(--green); }
.counter.is-optional { background: var(--neutral); color: var(--ink-soft); }

.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.item-list li {
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}
.item-list li:last-child { border-bottom: 0; }

.item-name  { font-weight: 500; }
.item-group { color: var(--ink-soft); margin-right: 4px; }
.item-desc  { display: block; color: var(--ink-soft); font-size: .875rem; }
.item-extra { color: var(--brand-dark); font-size: .875rem; margin-left: 6px; }

/* ------------------------------------------------- escolhas (toque grande) */

fieldset.card { border: 1px solid var(--line); }
legend {
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0 4px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap);
    padding: 10px 12px;
    margin: 0 0 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    background: var(--surface);
}
.choice:last-child { margin-bottom: 0; }

.choice input[type="radio"],
.choice input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--brand);
    flex: none;
}

.choice:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.choice-text { flex: 1 1 auto; }

/* Emoji com metrica propria: line-height fixo evita que ele desalinhe o
   texto em relacao ao radio, porque a fonte de emoji varia por aparelho. */
.choice-icon {
    flex: none;
    font-size: 1.15rem;
    line-height: 1;
}
.choice-name { display: block; font-weight: 500; }
.choice-desc { display: block; font-size: .85rem; color: var(--ink-soft); }

.choice-group legend { font-size: 1rem; }

/* ------------------------------------------------------------------ botoes */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: var(--neutral);
    color: var(--ink);
}

.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.btn-danger { color: var(--red); }

.btn-block { display: flex; width: 100%; }
.btn-lg { font-size: 1.05rem; min-height: 54px; }

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

/* ------------------------------------------------------------- barra fixa */

.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bar-bg);
    border-top: 1px solid var(--line);
}

@media (min-width: 760px) {
    .action-bar {
        flex-direction: row-reverse;
        justify-content: center;
        gap: 12px;
    }
    .action-bar .btn { width: auto; min-width: 220px; }
}

/* ------------------------------------------------------------- formularios */

.form { margin: 0; }

.field { margin: 0 0 14px; }

/* :not(.choice) e essencial: sem isso estas regras tambem pegavam os rotulos
   de escolha (radio/checkbox) dentro de um fieldset.field, transformando-os em
   bloco e quebrando o alinhamento com o marcador. */
.field label:not(.choice),
.field legend {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .95rem;
}

/* Pelo mesmo motivo, radio e checkbox nao podem herdar o tamanho dos campos
   de texto (width 100%, altura minima, borda). */
.field input:not([type="radio"]):not([type="checkbox"]),
.field textarea,
.field select {
    width: 100%;
    min-height: var(--tap);
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: var(--surface);
    color: var(--ink);
}

.field textarea { min-height: 76px; }

/* Ajuda logo abaixo de um campo: precisa de folga para o anel de foco
   (outline de 3px com 2px de afastamento) nao passar por cima do texto. */
.field > p.muted {
    margin: 8px 0 0;
    line-height: 1.4;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

fieldset.field {
    border: 0;
    padding: 0;
    margin: 0 0 14px;
}

.totals {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 12px 0;
}
.totals-line { margin: 0 0 4px; color: var(--ink-soft); }
.totals-box { padding: 14px 16px; }

.meal-summary h3 { display: flex; justify-content: space-between; gap: 12px; }

.meal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.meal-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 12px;
    font-size: .9rem;
}

.step-head { margin-bottom: 12px; }

.message-preview {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 12px;
    font-size: .875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.prose h2 { margin-top: 1.2em; }
.prose ul { padding-left: 1.2em; }

/* Sem JavaScript: mostra o cardapio estatico e esconde o montador. */
.app.no-js [data-interactive] { display: none !important; }

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 28px;
    padding: 18px 0;
    font-size: .9rem;
}

@media (min-width: 760px) {
    body { font-size: 17px; }
    .wrap { padding: 0 24px; }
    h1 { font-size: 1.8rem; }
}

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