:root {
    --red: #CE1141;
    --yellow: #FFC72C;
    --brown: #EEE1C6;
    --white: #FFFFFF;
    --grey: #8a8d8f;
    --black: #000000;

    --bg: var(--brown);
    --surface: var(--white);
    --text: var(--black);
    --muted: rgba(0, 0, 0, 0.55);
    --accent: var(--red);
    --highlight: var(--yellow);
    --highlight-soft: rgba(255, 199, 44, 0.35);
    --border: rgba(0, 0, 0, 0.15);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    --search-height: 3rem;
    --nav-height: 3.3rem;
    --footer-height: 5rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-y: scroll; }
body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem clamp(1rem, 4vw, 2rem);
    background:
        linear-gradient(90deg, var(--red), var(--yellow)) bottom / 100% 3px no-repeat,
        var(--white);
    transition: box-shadow 0.2s;
}
.navbar.nav-elevated { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--black);
}
.nav-brand:hover { text-decoration: none; }
.nav-logo { width: 2.1rem; height: 2.1rem; flex: 0 0 auto; }
.nav-word {
    font-size: clamp(1.05rem, 2.6vw, 1.35rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.nav-word em { font-style: normal; color: var(--red); }

/* Footer */
.site-footer {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
}
.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.3rem;
}
.footer-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--grey);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.15s;
}
.footer-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.footer-legal {
    font-size: 0.72rem;
    color: var(--muted);
}

/* Main */
main {
    max-width: 50rem;
    margin: 0 auto;
    padding: 0 1.25rem var(--footer-height);
}
.page { padding-top: 1.5rem; }
.loader {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
    font-weight: 600;
}

/* Back button */
.back-bar {
    margin-bottom: 0.5rem;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--grey);
    text-decoration: none;
    transition: color 0.15s;
}
.back-btn:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Home page */
.home.page {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    padding-top: max(0px, calc(var(--footer-height) - var(--nav-height)));
    height: calc(100vh - var(--nav-height) - var(--footer-height));
    height: calc(100dvh - var(--nav-height) - var(--footer-height));
}
.home.page > .search-wrap {
    grid-row: 2;
    animation: search-enter 0.4s ease-out;
}
@keyframes search-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Search */
.search-wrap {
    position: relative;
    max-width: 40rem;
    margin: 0 auto;
    text-align: left;
    width: 100%;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: var(--search-height);
    background: var(--surface);
    border: 1.5px solid var(--black);
    border-radius: 999px;
    padding: 0 1rem;
    box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--accent); }
.search-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    transition: transform 0.15s;
    cursor: pointer;
}
.search-box:hover .search-icon { transform: scale(1.12); }
#search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--text);
    min-width: 0;
}
#search-input::placeholder { color: var(--muted); }

/* Autocomplete */
.autocomplete {
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 6px);
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-height: min(22rem, max(6rem, calc(50dvh - var(--search-height) / 2 - var(--footer-height))));
    overflow-y: auto;
}
.autocomplete[hidden] { display: none; }
.ac-option {
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.ac-option.selected, .ac-option:hover { background: var(--highlight-soft); }
.ac-kind {
    flex: 0 0 auto;
    width: 9rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
}
.ac-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-count {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--surface);
    background: var(--accent);
    border-radius: 999px;
    min-width: 1.3rem;
    height: 1.3rem;
    line-height: 1.3rem;
    text-align: center;
    padding: 0 0.35rem;
}
.ac-note { color: var(--muted); font-size: 0.85rem; }

/* Page headings */
.page h2 { margin: 0.5rem 0 1rem; font-weight: 800; }
.page h3 { margin: 1.6rem 0 0.7rem; font-weight: 800; }

/* Breadcrumb / preparation notes */
.crumb { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.3rem; }
.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }
.prep-note {
    color: var(--grey);
    font-size: 0.85rem;
    margin: 0 0 0.9rem;
}
.page-note { font-style: italic; }
.drop-note {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}
.drop-note a { color: var(--grey); text-decoration: underline; }

/* Row cards */
.rows { display: grid; gap: 0.7rem; }
.row-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text);
    box-shadow: var(--shadow);
}
.row-card:hover { border-color: var(--accent); text-decoration: none; }
.row-title { font-weight: 700; }
.row-sub { color: var(--muted); font-size: 0.9rem; }
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--black);
    background: var(--highlight);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Overview card (restaurant profile) */
.overview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    box-shadow: var(--shadow);
}
.overview h2 { margin-top: 0; }
.facts { display: grid; grid-template-columns: 9rem 1fr; gap: 0.3rem 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.hours { border-collapse: collapse; }
.hours td { padding: 0.05rem 0.9rem 0.05rem 0; }
.hours .closed { color: var(--muted); }
.branch-hours { margin-bottom: 0.5rem; }
.branch-hours:last-child { margin-bottom: 0; }
.branch-select {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--black);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}
.muted { color: var(--muted); }

/* Icon links */
.icon-links {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.icon-link {
    display: inline-flex;
    color: var(--grey);
    transition: color 0.15s;
}
.icon-link:hover { color: var(--accent); text-decoration: none; }
.link-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Menu statistics */
.menu-stats-summary {
    font-size: 0.95rem;
    margin: 1rem 0;
    line-height: 1.6;
}
.chart-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0.5rem auto 0;
}

/* Sort bar */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    font-size: 0.9rem;
}
.sort-bar select {
    font-family: 'Outfit', sans-serif;
    font-size: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--black);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
}

/* Pizza rows */
.pizza-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}
.pizza-row summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 0.9rem minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 7rem;
    gap: 0.9rem;
    align-items: center;
    padding: 0.65rem 1rem;
    white-space: nowrap;
    min-width: 0;
    font-size: 0.95rem;
}
.pizza-row.no-rest summary {
    grid-template-columns: 0.9rem minmax(0, 1fr) 7rem;
}
.pizza-row summary::-webkit-details-marker { display: none; }
.pizza-row[open] summary { border-bottom: 1px solid var(--border); }
.slice-icon {
    width: 0.95rem;
    height: 0.95rem;
    align-self: center;
    transition: none;
}
.pizza-row[open] .slice-icon { transform: rotate(90deg); }
.pl-name { font-weight: 700; text-transform: capitalize; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pl-restname, .pl-branch { color: var(--grey); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pl-price { font-weight: 700; color: var(--accent); justify-self: end; white-space: nowrap; }
.pizza-drop { padding: 0.7rem 1rem 0.9rem 2.1rem; }
.ingredients { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.15rem 0.8rem; font-size: 0.92rem; }
.ingredients dt { color: var(--muted); }
.ingredients dd { margin: 0; }
.diet-chips { margin-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.diet {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--border);
    color: var(--muted);
}
.diet.yes { color: var(--black); border-color: var(--black); background: var(--highlight); }
.diet.no { color: var(--red); border-color: var(--red); text-decoration: line-through; }
.price-note { margin-top: 0.5rem; color: var(--muted); font-size: 0.8rem; }

/* Pizza profile stat cards */
.pizza-stat-row {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.pizza-stat-card {
    flex: 1;
    min-width: 140px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.pizza-stat-currency {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.pizza-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
}
.pizza-stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 700;
    margin-top: 0.15rem;
}

/* Pizza profile chart */
.pizza-profile-chart-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    min-height: 350px;
    margin: 0.5rem auto 0;
}

/* Pizza profile row (restaurant as primary, branch as secondary) */
.pizza-row.pizza-profile-row summary {
    grid-template-columns: 0.9rem minmax(0, 1.4fr) minmax(0, 1fr) 7rem;
}
.pizza-profile-row .pl-name { text-transform: none; overflow: visible; white-space: normal; text-overflow: unset; }
.pizza-profile-row .pl-branch { color: var(--grey); }

/* Responsive */
@media (max-width: 560px) {
    .ingredients, .facts { grid-template-columns: 1fr; }
    .ingredients dt, .facts dt { margin-top: 0.35rem; }
    .pizza-row summary {
        font-size: 0.8rem;
        gap: 0.5rem;
        grid-template-columns: 0.8rem minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 5.6rem;
    }
    .pizza-row.no-rest summary {
        grid-template-columns: 0.8rem minmax(0, 1fr) 5.6rem;
    }
    .pizza-stat-row { flex-wrap: nowrap; gap: 0.4rem; }
    .pizza-stat-card { min-width: 0; padding: 0.5rem 0.4rem; }
    .pizza-stat-currency { font-size: 0.6rem; }
    .pizza-stat-value { font-size: 0.95rem; }
    .pizza-stat-label { font-size: 0.6rem; }
    .pizza-row.pizza-profile-row summary {
        grid-template-columns: 0.8rem minmax(0, 1.4fr) minmax(0, 1fr) 5.6rem;
    }
}
