/* Restaurangen – mörk, varm och stillsam, som en finare restaurangs meny: serif i stor storlek,
   tunna guldlinjer, kapitäler med luft mellan bokstäverna. */

/* ---------- Bas ---------- */
:root {
    --bg: #0e0c0b;
    --surface: #161210;
    --surface-raised: #1e1916;
    --line: rgba(201, 169, 110, 0.22);   /* hårfina guldlinjer */
    --line-strong: rgba(201, 169, 110, 0.5);
    --gold: #c9a96e;
    --gold-bright: #e3c890;
    --gold-ink: #17110a;
    --ivory: #efe7da;
    --muted: #978c7f;
    --have: #a7b596;     /* finns hemma – dämpad salvia */
    --short: #d8b46a;    /* räcker inte */
    --missing: #d58b76;  /* saknas – dämpad terrakotta */
    --serif: 'Cormorant Garamond', 'Times New Roman', serif;
    --sans: 'Inter', system-ui, sans-serif;
    --maxw: 560px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ivory);
    font-family: var(--sans);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Svagt ljus uppifrån, som en spot över bordet. */
body {
    background:
        radial-gradient(120% 60% at 50% -10%, rgba(201, 169, 110, 0.10), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}

.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: calc(28px + env(safe-area-inset-top)) 24px calc(120px + env(safe-area-inset-bottom));
}

button { font: inherit; color: inherit; }
a { color: var(--gold); }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 3px; }

/* Kapitäler: små versaler med luft. */
.kicker,
.course-title,
.block-title,
.field-label,
.house-tagline,
.btn,
.back-link {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

/* Ornament: linje – romb – linje. */
.ornament {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 40px auto;
    max-width: 220px;
}

.ornament::before,
.ornament::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--line-strong));
}

.ornament::after { background: linear-gradient(to left, transparent, var(--line-strong)); }

.ornament span {
    width: 6px;
    height: 6px;
    border: 1px solid var(--gold);
    transform: rotate(45deg);
}

/* ---------- Menyn ---------- */
.masthead {
    text-align: center;
    padding: 28px 0 4px;
}

.monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    font-family: var(--serif);
    font-style: italic;
    font-size: 26px;
    letter-spacing: 0.02em;
    color: var(--gold);
    box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 5px var(--line);
}

.house-name {
    margin: 22px 0 8px;
    font-family: var(--serif);
    font-weight: 500;
    font-size: 40px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.1;
}

.house-tagline { margin: 0; color: var(--gold); }

.course { text-align: center; }

.course-title {
    margin: 0 0 26px;
    color: var(--gold);
}

.dish-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dish {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--ivory);
    text-decoration: none;
}

.dish-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 27px;
    line-height: 1.15;
    transition: color 0.2s ease;
}

.dish:active .dish-title { color: var(--gold-bright); }

.dish-desc {
    max-width: 34ch;
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    line-height: 1.35;
    color: var(--muted);
}

.dish-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.dish-meta .is-ready { color: var(--have); }
.dish-meta .is-missing { color: var(--missing); }

.empty {
    text-align: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    line-height: 1.5;
    color: var(--muted);
}

/* ---------- Knappar ---------- */
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 0;
    border: 1px solid var(--gold);
    background: transparent;
    color: var(--gold);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn-gold {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border-color: var(--gold);
    color: var(--gold-ink);
    font-weight: 500;
}

.btn-ghost { background: rgba(14, 12, 11, 0.75); }
.btn:active { opacity: 0.85; }
.btn-wide { width: 100%; }
.btn-small { min-height: 42px; padding: 0 18px; font-size: 10.5px; }

.bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 28px 24px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(14, 12, 11, 0), var(--bg) 45%);
}

.back-link {
    display: inline-block;
    padding: 6px 0;
    color: var(--muted);
    text-decoration: none;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(100px + env(safe-area-inset-bottom));
    z-index: 40;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 48px);
    margin: 0;
    padding: 12px 20px;
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    color: var(--ivory);
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Receptet ---------- */
.recipe-head {
    margin-top: 26px;
    text-align: center;
}

.kicker { margin: 0 0 14px; color: var(--gold); }

.recipe-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 500;
    font-size: 40px;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.recipe-desc {
    margin: 14px auto 0;
    max-width: 32ch;
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    line-height: 1.4;
    color: var(--muted);
}

.notice {
    margin: 22px 0 0;
    padding: 12px 16px;
    border: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.recipe-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
}

.servings {
    display: flex;
    align-items: center;
    gap: 18px;
}

.round-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    color: var(--gold);
    font-size: 20px;
    text-decoration: none;
}

.round-btn.is-disabled { opacity: 0.3; pointer-events: none; }
.round-btn:active { background: var(--surface-raised); }

.servings-value {
    min-width: 120px;
    text-align: center;
    font-family: var(--serif);
    font-size: 20px;
}

.servings-value strong { font-weight: 600; font-size: 24px; color: var(--gold-bright); }

.recipe-time {
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.block { margin-top: 8px; }

.block-title {
    display: block;
    margin: 0 0 18px;
    text-align: center;
    color: var(--gold);
}

.ingredients {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredient {
    display: grid;
    grid-template-columns: 10px 72px 1fr;
    align-items: baseline;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.ingredient:first-child { border-top: 1px solid var(--line); }

.state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    align-self: center;
    border: 1px solid currentColor;
}

.state-have .state-dot { color: var(--have); background: var(--have); }
.state-short .state-dot { color: var(--short); background: linear-gradient(90deg, var(--short) 50%, transparent 50%); }
.state-missing .state-dot { color: var(--missing); }

.ing-amount {
    text-align: right;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 18px;
    color: var(--gold-bright);
    white-space: nowrap;
    font-variant-numeric: lining-nums tabular-nums;
}

.ing-amount em { font-weight: 400; font-size: 15px; color: var(--muted); }

.ing-text { min-width: 0; }
.ing-name { font-size: 16px; font-weight: 400; }
.ing-note { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); }

.ing-status {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.state-short .ing-status { color: var(--short); }
.state-missing .ing-status { color: var(--missing); }

.shopping-box {
    margin-top: 34px;
    padding: 26px 22px 22px;
    border: 1px solid var(--line);
    background: rgba(22, 18, 16, 0.6);
    text-align: center;
}

.buy-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    text-align: left;
}

.buy-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dotted var(--line);
}

.buy-list li:last-child { border-bottom: 0; }
.buy-name { font-size: 16px; font-weight: 400; }

.buy-amount {
    flex-shrink: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 17px;
    color: var(--gold-bright);
    text-align: right;
}

.all-home {
    margin: 34px 0 0;
    text-align: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 21px;
    color: var(--have);
}

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.steps li {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
}

.step-no {
    font-family: var(--serif);
    font-style: italic;
    font-size: 30px;
    line-height: 1;
    color: var(--gold);
}

.steps p {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ivory);
}

/* ---------- Inköpslistan ---------- */
.page-shopping { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

.pick-form { margin-top: 34px; }

.pick-recipes {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
}

.pick-recipes li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.pick-recipes li:first-child { border-top: 1px solid var(--line); }

.pick-recipes label {
    flex: 1;
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 500;
    color: var(--muted);
    transition: color 0.2s ease;
}

.pick-recipes li.is-picked label { color: var(--ivory); }

.servings-select { width: 104px; flex-shrink: 0; text-align: right; }
.pick-recipes li.is-picked .servings-select { color: var(--gold-bright); border-bottom-color: var(--gold); }

.buy-check label {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    cursor: pointer;
}

.buy-check input {
    appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.buy-check input:checked {
    background: radial-gradient(circle, var(--gold) 0 45%, transparent 50%);
    border-color: var(--gold);
}

.buy-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.buy-for { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--muted); }
.buy-check li:has(input:checked) .buy-name,
.buy-check li:has(input:checked) .buy-amount { text-decoration: line-through; color: var(--muted); }

.at-home { margin-top: 30px; }
.at-home summary { cursor: pointer; list-style: none; }
.at-home summary::-webkit-details-marker { display: none; }
.at-home .buy-amount { font-size: 15px; color: var(--muted); }

/* ---------- Formuläret ---------- */
.page-edit { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.edit-form { margin-top: 34px; }

.field { margin-bottom: 26px; min-width: 0; }
.field-label { display: block; margin-bottom: 8px; color: var(--gold); }

.field-hint {
    margin: 10px 0 0;
    font-family: var(--serif);
    font-style: italic;
    font-size: 16px;
    line-height: 1.4;
    color: var(--muted);
}

/* Bara en linje under fältet, som en rad på ett menykort. */
.field-input {
    width: 100%;
    min-width: 0;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
    color: var(--ivory);
    font-family: var(--sans);
    font-size: 17px; /* 16px+ hindrar iOS från att zooma in */
    font-weight: 400;
}

.field-input::placeholder { color: rgba(151, 140, 127, 0.6); }
.field-input:focus { outline: none; border-bottom-color: var(--gold-bright); }

select.field-input {
    appearance: none;
    padding-right: 18px;
    background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
    background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

select.field-input option { background: var(--surface); color: var(--ivory); }

.field-title { font-family: var(--serif); font-size: 26px; font-weight: 500; }

.field-textarea {
    min-height: 180px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    line-height: 1.6;
    resize: vertical;
}

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

.ing-rows {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.ing-row {
    padding: 6px 0 14px;
    border-bottom: 1px solid var(--line);
}

.ing-row-top { display: flex; align-items: flex-end; gap: 8px; }
.ing-row-top .autocomplete { flex: 1; }
.ing-name-input { font-family: var(--serif); font-size: 20px; font-weight: 500; }

.ing-row-bottom {
    display: grid;
    grid-template-columns: 74px 70px 1fr;
    gap: 12px;
}

.ing-row-bottom .field-input { font-size: 16px; border-bottom-color: var(--line); }

.remove-row {
    appearance: none;
    width: 36px;
    height: 40px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.autocomplete { position: relative; }

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 0;
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.suggestions button {
    appearance: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    background: none;
    color: var(--ivory);
    text-align: left;
    font-size: 16px;
    cursor: pointer;
}

.suggestions button span { color: var(--muted); font-size: 13px; }
.suggestions button:active { background: var(--surface); }

.form-actions {
    position: sticky;
    bottom: 0;
    margin: 30px -24px 0;
    padding: 26px 24px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(14, 12, 11, 0), var(--bg) 40%);
}

.form-error {
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--missing);
    background: rgba(213, 139, 118, 0.1);
    font-size: 14px;
}

.delete-form { margin-top: 10px; text-align: center; }

.delete-btn {
    appearance: none;
    padding: 12px 18px;
    border: 0;
    background: none;
    color: var(--missing);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    cursor: pointer;
}

.btn:disabled { opacity: 0.35; cursor: default; }

.buy-form { margin-bottom: 12px; }
.buy-form .buy-list { margin-bottom: 8px; }
.buy-check input:disabled { opacity: 0.5; }

.buy-hint {
    margin: 0 0 16px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 16px;
    color: var(--muted);
    text-align: center;
}

@media (hover: hover) {
    .dish:hover .dish-title { color: var(--gold-bright); }
    .btn-ghost:hover { background: rgba(201, 169, 110, 0.08); }
    .suggestions button:hover { background: var(--surface); }
    .back-link:hover { color: var(--gold); }
}

@media (max-width: 380px) {
    .page { padding-left: 18px; padding-right: 18px; }
    .house-name { font-size: 32px; }
    .recipe-title { font-size: 34px; }
    .ingredient { grid-template-columns: 10px 60px 1fr; gap: 10px; }
    .field-row { grid-template-columns: 1fr 1fr; }
    .field-row .field:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
