/* public/Styles/styles.css — app shell (v3): base, header, footer, bottom nav, notifications.
   Every student-facing page loads this after tokens.css + components.css. */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
    min-height: 100vh;
    display: flex; flex-direction: column;
    background: var(--paper); color: var(--ink);
    font: 400 var(--fs-base)/1.6 var(--font-body);
    -webkit-font-smoothing: antialiased;
}
body > main, #main { flex: 1; }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: var(--fs-3xl); letter-spacing: -.035em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); letter-spacing: -.01em; }

.container { width: min(var(--shell), 100% - 32px); margin-inline: auto; }
@media (min-width: 768px) { .container { width: min(var(--shell), 100% - 64px); } }

.desktop-only { display: none !important; }
@media (min-width: 992px) { .desktop-only { display: inline-flex !important; } }

/* Page intro — the shared heading block at the top of app pages */
.page-head { padding: var(--space-8) 0 var(--space-5); }
.page-head h1 { font-size: var(--fs-4xl); margin-bottom: var(--space-2); }
.page-head p { color: var(--muted); max-width: 60ch; }
/* Small orange label above a heading — the landing page's section marker */
.eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); font: 700 12px/1.2 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--orange-text) !important; }
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.serif-accent { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--orange-text); }
.back-link {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px;
    font-weight: 600; font-size: var(--fs-sm); color: var(--muted);
}
.back-link:hover { color: var(--ink); }

/* ═══ Store cards (home + stores) ═══════════════════ */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-4); }
@media (max-width: 520px) { .store-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); } }
.store-card { display: flex; flex-direction: column; min-width: 0; }
.store-card-photo { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-lg); overflow: hidden; background: var(--paper-deep); }
.store-card-photo > img:first-child { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-med); }
.store-card:hover .store-card-photo > img:first-child { transform: scale(1.03); }
.store-card-logo {
    position: absolute; left: 10px; bottom: 10px; width: 44px; height: 44px;
    border-radius: 50%; object-fit: contain; background: #fff; padding: 3px; border: 2px solid var(--paper);
}
.store-card-body { padding: var(--space-3) 2px 0; }
.store-card-body h3 { font-size: var(--fs-lg); }
.store-card-body p { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.rating { color: var(--ink); font-weight: 600; white-space: nowrap; }

.store-card-body .store-desc { font-size: var(--fs-sm); color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.store-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: var(--space-2); font-size: var(--fs-xs); color: var(--muted); }
.store-card-photo .chip { position: absolute; top: 10px; left: 10px; }
.store-card.is-closed .store-card-photo > img:first-child { filter: grayscale(.8); opacity: .7; }

/* Vendors without food photography show their logo on a white plate */
.store-card-photo.is-logo { background: #fff; border: 1px solid var(--line); }
.store-card-photo.is-logo > img:first-child { object-fit: contain; padding: 12% 18%; }

/* ═══ Header ═════════════════════════════════════════ */
.site-header {
    position: sticky; top: 0; z-index: 900;
    background: var(--paper); border-bottom: 1px solid var(--line);
}
.header-content { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); }

.wordmark {
    display: inline-flex; align-items: center; gap: 7px; min-height: 44px;
    font: 700 26px/1 'Inter', sans-serif; letter-spacing: -.01em; color: var(--ink); white-space: nowrap;
}
.wordmark svg { width: 22px; height: 22px; color: var(--orange-text); flex-shrink: 0; }

.desktop-nav { display: none; }
@media (min-width: 992px) {
    .desktop-nav { display: flex; gap: var(--space-2); }
    .desktop-nav a {
        position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3);
        font-size: var(--fs-sm); font-weight: 500; color: var(--muted); transition: color var(--t-fast);
    }
    .desktop-nav a:hover { color: var(--ink); }
    .desktop-nav a.active { color: var(--ink); font-weight: 600; }
    .desktop-nav a.active::after {
        content: ''; position: absolute; left: var(--space-3); right: var(--space-3); bottom: 6px;
        height: 2px; border-radius: 2px; background: var(--orange);
    }
}

.header-actions { display: flex; align-items: center; gap: var(--space-1); }
.icon-btn {
    position: relative; display: inline-grid; place-items: center;
    width: 44px; height: 44px; border: 0; border-radius: var(--radius-full);
    background: transparent; color: var(--ink); transition: background var(--t-fast);
}
.icon-btn:hover, .icon-btn.active { background: var(--paper-deep); }
.icon-btn svg { width: 21px; height: 21px; }
.header-text-link {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3);
    font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
}
.header-text-link:hover { color: var(--orange-text); }
.header-cta { margin-left: var(--space-2); }
@media (max-width: 991px) { .header-cta { display: none; } }

.cart-count, .notif-badge {
    position: absolute; top: 4px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
    display: grid; place-items: center;
    background: var(--orange); color: var(--ink);
    font: 700 11px/1 var(--font-body); border: 2px solid var(--paper);
}
.cart-count[hidden] { display: none; }

/* ═══ Footer ═════════════════════════════════════════ */
.site-footer { margin-top: var(--space-10); border-top: 1px solid var(--line); background: var(--paper); }
.footer-content {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: var(--space-6) 0 var(--space-4);
}
.footer-brand { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.footer-brand p { font-size: var(--fs-xs); color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-sm); color: var(--ink); }
.footer-links a:hover { color: var(--orange-text); text-decoration: underline; text-underline-offset: 4px; }
.footer-base {
    display: flex; justify-content: space-between; gap: var(--space-4);
    padding: var(--space-4) 0 var(--space-6); border-top: 1px solid var(--line);
    font-size: var(--fs-xs); color: var(--muted);
}

/* ═══ Bottom nav (phones) ════════════════════════════ */
.bottom-nav { display: none; }
@media (max-width: 991px) {
    body { padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); }
    .bottom-nav {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--paper); border-top: 1px solid var(--line);
    }
    .bottom-nav-list { height: var(--bottom-nav-height); display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; padding: 0 var(--space-2); }
    .bottom-nav-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 52px; margin: 0 4px; border-radius: var(--radius-lg);
        font-size: 12px; font-weight: 600; color: var(--muted);
        -webkit-tap-highlight-color: transparent; transition: background var(--t-fast), color var(--t-fast);
    }
    .bottom-nav-item svg { width: 21px; height: 21px; }
    .bottom-nav-item.active { background: var(--lime); color: var(--green); }
    .site-footer { margin-top: var(--space-8); }
    .footer-base { flex-direction: column; gap: var(--space-1); }
}

/* Inputs never below 16px on phones — stops iOS zoom-on-focus */
@media (max-width: 991px) {
    input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
}

/* ═══ Notifications ══════════════════════════════════ */
.notif-backdrop { display: none; }
.notif-panel {
    position: fixed; top: calc(var(--header-h) + 8px); right: 24px; z-index: 1100;
    width: 380px; max-height: 70vh; display: flex; flex-direction: column;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}
.notif-panel.active { opacity: 1; visibility: visible; transform: none; }
.notif-panel-header {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); border-bottom: 1px solid var(--line);
}
.notif-panel-header h2, .notif-panel-header h3 { font-size: var(--fs-lg); }
.notif-mark-all {
    min-height: 40px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md);
    background: none; font-size: var(--fs-xs); font-weight: 600; color: var(--orange-text);
}
.notif-mark-all:hover { background: var(--paper-deep); }
.notif-list { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.notif-item {
    position: relative; display: flex; align-items: flex-start; gap: var(--space-3);
    padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); cursor: pointer;
}
.notif-item:hover { background: var(--paper); }
.notif-item:not(.notif-read)::before {
    content: ''; position: absolute; left: 8px; top: 22px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--orange);
}
.notif-item.notif-read .notif-title { font-weight: 500; }
.notif-icon {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; background: var(--paper-deep); color: var(--ink);
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 700; font-size: var(--fs-sm); margin-bottom: 2px; }
.notif-body { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-empty, .notif-loading { padding: var(--space-8) var(--space-4); text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.notif-load-more {
    min-height: 44px; border: 0; border-top: 1px solid var(--line); background: none;
    font-weight: 600; font-size: var(--fs-sm); color: var(--orange-text);
}
.notif-load-more:hover { background: var(--paper); }

@media (max-width: 991px) {
    .notif-panel {
        left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 80vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0; border-bottom: 0;
        transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom);
        transition: transform .32s cubic-bezier(.32, .72, 0, 1), visibility .32s;
        opacity: 1;
    }
    .notif-panel.active { transform: none; }
    .notif-panel::before {
        content: ''; display: block; width: 36px; height: 4px; margin: 10px auto 2px;
        border-radius: var(--radius-full); background: var(--line-strong);
    }
    .notif-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1099;
        background: rgba(37, 42, 34, .45); opacity: 0; visibility: hidden;
        transition: opacity var(--t-med), visibility var(--t-med);
    }
    .notif-backdrop.active { opacity: 1; visibility: visible; }
}

/* ═══ iOS install banner ═════════════════════════════ */
.ios-install-banner {
    position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom)); z-index: 960;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
    background: var(--green); color: var(--paper); font-size: var(--fs-sm); box-shadow: var(--shadow-2);
}
.ios-banner-content { display: flex; align-items: center; gap: var(--space-3); }
.ios-banner-content svg { flex-shrink: 0; color: var(--lime); }
.ios-banner-content strong { display: block; }
.ios-banner-content span { color: rgba(248, 245, 238, .8); font-size: var(--fs-xs); }
.ios-banner-close {
    flex-shrink: 0; width: 40px; height: 40px; border: 0; border-radius: var(--radius-full);
    background: rgba(248, 245, 238, .12); color: var(--paper); font-size: 1.3rem; line-height: 1;
}
