@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
    --bg-top: #f8fbff;
    --bg-bottom: #eaf0f8;
    --surface: rgba(255, 255, 255, 0.42);
    --surface-strong: rgba(255, 255, 255, 0.58);
    --surface-soft: rgba(255, 255, 255, 0.34);
    --stroke: rgba(255, 255, 255, 0.58);
    --stroke-soft: rgba(137, 156, 183, 0.2);
    --text: #17202b;
    --muted: #667384;
    --accent: #4f6df6;
    --accent-strong: #3f5ae8;
    --accent-soft: rgba(79, 109, 246, 0.12);
    --shadow-lg: 0 30px 80px rgba(39, 57, 86, 0.14);
    --shadow-md: 0 18px 42px rgba(50, 69, 102, 0.1);
    --shadow-sm: 0 10px 24px rgba(48, 65, 95, 0.08);
    --radius-xl: 32px;
    --radius-lg: 26px;
    --radius-md: 20px;
    --radius-sm: 16px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.62),
            rgba(255, 255, 255, 0.1)
        ),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body.modal-open {
    overflow: hidden;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.blur-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(30px);
    opacity: 0.65;
}

.orb-one {
    top: -120px;
    left: -40px;
    width: 380px;
    height: 380px;
    background: rgba(79, 109, 246, 0.18);
}

.orb-two {
    top: 70px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: rgba(115, 220, 255, 0.18);
}

.orb-three {
    bottom: -110px;
    left: 50%;
    width: 360px;
    height: 360px;
    background: rgba(199, 214, 255, 0.22);
    transform: translateX(-20%);
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 44px;
}

.site-header,
.workspace,
.hero {
    display: grid;
    gap: 20px;
}

.site-header,
.hero-glass,
.panel,
.scanner-dialog {
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.52),
            rgba(255, 255, 255, 0.28)
        ),
        rgba(255, 255, 255, 0.22);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(28px) saturate(145%);
    -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.site-header,
.hero-glass,
.panel,
.scanner-dialog {
    position: relative;
    overflow: hidden;
}

.site-header::before,
.hero-glass::after,
.panel::before,
.scanner-dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.36),
        rgba(255, 255, 255, 0.02) 42%
    );
    opacity: 0.9;
}

.site-header {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 18px 22px;
    border-radius: 24px;
    margin-bottom: 20px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.brand-mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.98),
        rgba(79, 109, 246, 0.64)
    );
    box-shadow:
        0 0 0 10px rgba(255, 255, 255, 0.14),
        inset 0 1px 1px rgba(255, 255, 255, 0.86),
        0 14px 30px rgba(79, 109, 246, 0.2);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.52);
    background: rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(23, 32, 43, 0.76);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.brand-wordmark {
    display: block;
    margin-top: 4px;
    font-family:
        "SF Pro Display", "SF Pro Text", "Plus Jakarta Sans", "Segoe UI",
        sans-serif;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.06em;
    color: rgba(18, 24, 34, 0.94);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-note,
.lead,
.panel-copy,
.result-copy,
.stat-label,
.empty-copy,
.meta-row p,
.portion-copy,
.ingredients-copy,
.scanner-status,
.search-helper {
    color: var(--muted);
}

.brand-note {
    margin: 4px 0 0;
    font-size: 0.93rem;
}

.header-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

.header-chip,
.quick-tag,
.type-badge,
.type-inline,
.result-foot span,
.detail-tags span,
.nutrient-meta span,
.empty-tags span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
    font-size: 0.8rem;
    font-weight: 700;
}

.header-chip {
    color: var(--text);
}

.hero {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: center;
    margin-bottom: 20px;
}

.hero-copy {
    padding: 10px 8px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

h1 {
    max-width: 10ch;
    font-size: clamp(3rem, 5vw, 4.8rem);
    font-weight: 800;
}

h2 {
    font-size: clamp(1.8rem, 2.4vw, 2.4rem);
    font-weight: 800;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
}

.lead {
    max-width: 58ch;
    margin: 16px 0 0;
    font-size: 1rem;
    line-height: 1.72;
}

.hero-glass {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: var(--radius-xl);
}

.hero-glass::before {
    content: "";
    position: absolute;
    inset: -1px;
    background:
        radial-gradient(
            circle at top right,
            rgba(255, 255, 255, 0.62),
            transparent 32%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(79, 109, 246, 0.09),
            transparent 28%
        );
    pointer-events: none;
}

.hero-glass::after {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 48%);
}

.search-shell,
.hero-stats,
.results-list,
.detail-card {
    position: relative;
    z-index: 1;
}

.search-shell {
    display: grid;
    gap: 16px;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
}

.search-input-wrap,
.scan-button,
.primary-button,
.stat-card,
.result-card,
.meta-row,
.topline-card,
.portion-card,
.nutrient-group,
.scanner-close,
.manual-row {
    border: 1px solid var(--stroke);
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.5),
            rgba(255, 255, 255, 0.24)
        ),
        rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.search-input-wrap,
.scan-button,
.stat-card,
.result-card,
.meta-row,
.topline-card,
.portion-card,
.nutrient-group,
.manual-row {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        var(--shadow-sm);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 0 18px;
    border-radius: 22px;
}

.search-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: #7a899d;
}

input[type="search"],
input[type="text"] {
    width: 100%;
    min-height: 30px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

input::placeholder {
    color: #8897a9;
}

.primary-button,
.scan-button,
.quick-tag,
.scanner-close {
    font: inherit;
    cursor: pointer;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease;
}

.primary-button:hover,
.scan-button:hover,
.quick-tag:hover,
.result-card:hover,
.scanner-close:hover {
    transform: translateY(-2px);
}

.primary-button {
    min-height: 64px;
    padding: 0 22px;
    border-radius: 22px;
    border: 1px solid rgba(79, 109, 246, 0.28);
    color: #fff;
    font-weight: 800;
    background: linear-gradient(
        180deg,
        rgba(79, 109, 246, 0.96),
        rgba(63, 90, 232, 0.94)
    );
    box-shadow: 0 18px 36px rgba(79, 109, 246, 0.24);
}

.scan-button {
    min-height: 64px;
    padding: 0 18px;
    border-radius: 22px;
    color: var(--accent-strong);
    font-weight: 700;
}

.search-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-tag {
    padding: 10px 14px;
    color: var(--text);
}

.search-helper {
    margin: 0;
    max-width: 34ch;
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: right;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    min-height: 104px;
    padding: 14px 16px;
    border-radius: 22px;
}

.stat-label {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stat-value {
    margin: 12px 0 0;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.workspace {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    align-items: start;
}

.panel {
    padding: 22px;
    border-radius: var(--radius-xl);
}

.detail-panel {
    position: sticky;
    top: 18px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-copy {
    max-width: 28ch;
    margin: 0;
    text-align: right;
    line-height: 1.58;
}

.results-list {
    display: grid;
    gap: 12px;
}

.result-card {
    width: 100%;
    padding: 16px;
    border-radius: 22px;
    text-align: left;
    cursor: pointer;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        border-color 160ms ease;
}

.result-card.is-active {
    border-color: rgba(79, 109, 246, 0.38);
    box-shadow: 0 22px 40px rgba(79, 109, 246, 0.14);
}

.result-top {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
}

.type-badge,
.type-inline {
    padding: 7px 10px;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.type-foundation_food {
    color: #1f726c;
    background: rgba(109, 221, 212, 0.16);
}

.type-branded_food {
    color: #3653db;
    background: rgba(79, 109, 246, 0.16);
}

.type-sr_legacy_food,
.type-survey_fndds_food {
    color: #6b5680;
    background: rgba(181, 143, 255, 0.16);
}

.result-card h3 {
    margin-bottom: 8px;
}

.result-copy {
    margin: 0;
    line-height: 1.5;
}

.result-foot,
.detail-subtitle,
.detail-tags,
.nutrient-meta,
.empty-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-foot {
    margin-top: 14px;
}

.detail-view {
    min-height: 680px;
}

.empty-state {
    display: grid;
    place-items: center;
    padding: 44px 18px;
    text-align: center;
}

.empty-illustration {
    position: relative;
    width: 132px;
    height: 132px;
    margin-bottom: 22px;
}

.empty-illustration span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.52);
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
}

.empty-illustration span:nth-child(2) {
    inset: 16px;
}

.empty-illustration span:nth-child(3) {
    inset: 34px;
}

.empty-copy {
    max-width: 36ch;
    margin: 14px 0 0;
    line-height: 1.6;
}

.detail-card {
    display: grid;
    gap: 20px;
}

.detail-subtitle {
    margin-top: 12px;
}

.topline-grid,
.meta-grid,
.portion-grid,
.nutrient-groups {
    display: grid;
    gap: 12px;
}

.topline-grid {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
}

.meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portion-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.meta-row,
.topline-card,
.portion-card,
.nutrient-group {
    padding: 16px;
    border-radius: 22px;
}

.meta-row strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.meta-row p,
.portion-copy,
.ingredients-copy {
    margin: 0;
    line-height: 1.62;
}

.topline-card strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.topline-card span {
    display: block;
    margin-top: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.ingredients-block summary {
    cursor: pointer;
    font-weight: 700;
}

.ingredients-block[open] summary {
    margin-bottom: 10px;
}

.nutrient-groups {
    grid-template-columns: 1fr;
}

.nutrient-group h3 {
    margin-bottom: 12px;
}

.nutrient-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid rgba(136, 155, 183, 0.18);
}

.nutrient-row:first-child {
    padding-top: 0;
    border-top: 0;
}

.nutrient-row:last-child {
    padding-bottom: 0;
}

.nutrient-name {
    display: block;
    margin-bottom: 6px;
}

.nutrient-value {
    font-weight: 800;
    text-align: right;
}

.scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(17, 26, 38, 0.28);
    backdrop-filter: blur(16px);
}

.scanner-dialog {
    position: relative;
    width: min(760px, 100%);
    padding: 24px;
    border-radius: 32px;
}

.scanner-close {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--text);
}

.scanner-stage {
    position: relative;
    min-height: 320px;
    margin-top: 18px;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(
        180deg,
        rgba(35, 54, 85, 0.84),
        rgba(35, 54, 85, 0.62)
    );
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.scanner-stage video {
    display: block;
    width: 100%;
    min-height: 320px;
    object-fit: cover;
}

.scanner-frame {
    position: absolute;
    inset: 18% 12%;
    border-radius: 22px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 0 0 999px rgba(11, 18, 29, 0.18);
}

.scanner-manual {
    margin-top: 18px;
}

.manual-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.manual-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 0 14px;
    border-radius: 22px;
}

.manual-row .primary-button {
    min-height: 50px;
    padding: 0 18px;
    border-radius: 18px;
    flex: 0 0 auto;
}

.skeleton-block {
    min-height: 96px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.36) 0%,
        rgba(255, 255, 255, 0.72) 50%,
        rgba(255, 255, 255, 0.36) 100%
    );
    background-size: 220% 100%;
    animation: shimmer 1.6s linear infinite;
}

.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;
}

.reveal {
    animation: fade-up 480ms ease both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    from {
        background-position: 100% 0;
    }
    to {
        background-position: -100% 0;
    }
}

@media (max-width: 1080px) {
    .hero,
    .workspace,
    .site-header {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
    }

    .panel-copy,
    .search-helper {
        text-align: left;
        max-width: none;
    }
}

@media (max-width: 820px) {
    .search-bar,
    .hero-stats,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .search-input-wrap,
    .scan-button,
    .primary-button {
        min-height: 58px;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 18px, 100%);
        padding-top: 18px;
    }

    .site-header,
    .hero-glass,
    .panel,
    .scanner-dialog {
        padding: 18px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .panel-heading {
        flex-direction: column;
    }

    .manual-row {
        flex-wrap: wrap;
        padding: 14px;
    }

    .manual-row .primary-button {
        width: 100%;
    }

    .scanner-stage,
    .scanner-stage video {
        min-height: 240px;
    }
}
