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

/* Elements that also set their own `display` (e.g. flex containers) would
   otherwise defeat the hidden attribute at equal CSS specificity. */
[hidden] { display: none !important; }

:root {
    --bg-primary: #f7f5f2;
    --bg-surface: #ffffff;
    --text-primary: #22262b;
    --text-muted: #6b7280;
    --accent-primary: #c0392b;
    --accent-secondary: #e67e22;
    --border-color: #e2e0db;
    --radius: 10px;
    /* Logo badge colors are fixed brand colors, not theme tokens - the badge
       carries its own dark background in both light and dark mode, so these
       are deliberately left out of the prefers-color-scheme override below. */
    --logo-bg: #1f1b17;
    --logo-accent: #e8503d;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #181614;
        --bg-surface: #232019;
        --text-primary: #f2efe9;
        --text-muted: #a8a196;
        --border-color: #3a352c;
    }
}

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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Bounds the page to the viewport (instead of growing past it) so the
   .main-content--editor flex chain has something to actually shrink
   against - min-height alone gives flexbox no shrink pressure. overflow
   stays auto rather than hidden so chrome is never truly unreachable if
   a very short viewport can't fit it even with the canvas shrunk to 0.
   100vh on mobile Safari/Chrome doesn't account for the dynamic address-
   bar/toolbar chrome collapsing/expanding, so it's systematically wrong
   there even though it's invisible in desktop testing - 100dvh tracks the
   *actual* visible viewport instead. Kept as a same-property cascade (not
   an @supports block) so a browser without dvh support just ignores that
   line and keeps the vh value - zero-risk progressive enhancement. */
body.body--editor { height: 100vh; height: 100dvh; min-height: 0; overflow: auto; }

img { max-width: 100%; height: auto; }

a { color: var(--accent-primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ===== Header ===== */
.site-header { background: var(--bg-surface); border-bottom: 1px solid var(--border-color); }
.navbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar__brand { display: flex; align-items: center; text-decoration: none; }
/* The badge is a self-contained dark surface (fixed --logo-bg, not a theme
   token) so the white/red wordmark inside it always has enough contrast,
   regardless of the site's light/dark mode - the rest of the navbar keeps
   using the theme's normal surface color. */
.navbar__logo { display: flex; align-items: center; gap: 0.5rem; background: var(--logo-bg); padding: 0.4rem 0.75rem; border-radius: var(--radius); }
.navbar__icon { flex-shrink: 0; display: block; }
.navbar__title { font-weight: 700; font-size: 1.25rem; color: #fff; }
.navbar__title-accent { color: var(--logo-accent); }
.navbar__link { font-weight: 600; text-decoration: none; }

/* ===== Main / Footer ===== */
.main-content { flex: 1; max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem; width: 100%; }

/* Editor needs the full viewport, not the marketing-page reading width, so
   the design canvas has room to scale to fit without scrolling. Deliberately
   NOT min-height:0 - the design area has a hard floor (see
   .editor__canvas-wrap), and this needs its default content-based min-height
   so that floor properly grows this box (and .editor below it) instead of
   letting the canvas visually spill past them into the footer.
   body.body--editor's fixed height + overflow:auto is the one place that
   actually falls back to page scrolling once that floor doesn't fit. */
.main-content--editor {
    max-width: none;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
}
.site-footer { border-top: 1px solid var(--border-color); padding: 1.5rem 1.25rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.site-footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
.site-footer__note { margin-top: 0.25rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1rem;
}
.btn-primary { background: var(--accent-primary); color: #fff; }
.btn-secondary { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-small { padding: 0.35rem 0.75rem; font-size: 0.875rem; }
.btn-danger { color: var(--accent-primary); border-color: var(--accent-primary); background: transparent; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Hero / Product grid ===== */
.hero { text-align: center; padding: 2rem 0 3rem; }
.hero h1 { font-size: 2.25rem; margin-bottom: 0.75rem; }
.hero__lede { color: var(--text-muted); max-width: 640px; margin: 0 auto; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.product-card__icon { font-size: 2.5rem; }
.product-card__title { font-size: 1.15rem; }
.product-card__tagline { color: var(--text-muted); font-size: 0.9rem; flex: 1; }
.product-card__badge {
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--border-color);
    color: var(--text-muted);
}
.product-card__badge--active { background: var(--accent-primary); color: #fff; }
.product-card--planned { opacity: 0.75; }

/* ===== Product page ===== */
.product-page { max-width: 640px; margin: 0 auto; text-align: center; }
.product-page__icon { font-size: 3rem; }
.product-page__tagline { color: var(--text-muted); margin-bottom: 1rem; }
.product-page__specs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
}
.product-page__specs dt { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.product-page__specs dd { font-weight: 700; }
.product-page__coming-soon { color: var(--text-muted); font-style: italic; }
.product-page__features {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.product-page__features li::before { content: "✓ "; color: var(--accent-primary); font-weight: 700; }
.product-page__back { display: block; margin-top: 2rem; }

/* ===== Projects page ===== */
.projects-page__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.projects-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.project-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1rem; }
.project-card__meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; }
.project-card__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.projects-list__empty { color: var(--text-muted); }

/* ===== Error page ===== */
.error-page { text-align: center; padding: 3rem 0; }

/* ===== Cookie & Ads Notice ===== */
.map-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1150;
    background: var(--bg-surface);
    border-top: 2px solid var(--accent-primary);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    padding: 1.25rem 1rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.map-consent--visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.map-consent__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

.map-consent__text h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.map-consent__text p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.map-consent__actions {
    display: flex;
    flex-shrink: 0;
}

.map-consent #map-consent-accept {
    min-height: 44px;
    padding: 0.7rem 2rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-consent #map-consent-accept:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.map-consent #map-consent-accept:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (min-width: 576px) {
    .map-consent__inner {
        flex-direction: row;
        text-align: left;
    }
}

/* ===== Update Available Banner ===== */
.map-update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1160;
    background: var(--bg-surface);
    border-top: 2px solid var(--accent-primary);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    padding: 1rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.map-update-banner--visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.map-update-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    text-align: center;
}

.map-update-banner__text {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.map-update-banner__btn {
    min-height: 44px;
    padding: 0.7rem 2rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.map-update-banner__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.map-update-banner__btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (min-width: 576px) {
    .map-update-banner__inner {
        flex-direction: row;
        justify-content: center;
    }
}
