:root {
    --rose: #B25379;
    --rose-dark: #9A4364;
    --plum: #7A3B5E;
    --ink: #2A2130;
    --paper: #FBF9FA;
    --white: #FFFFFF;
    --muted: #7A6E76;
    --line: #EEE7EA;
    --radius: 12px;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

:focus-visible {
    outline: 3px solid var(--plum);
    outline-offset: 2px;
}

h1:focus,
h1:focus-visible {
    outline: none;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------------------------------------------------------------- header */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    height: 64px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo {
    height: 46px; /* bigger: the mark's lines were barely visible at 34px */
    width: auto;
    display: block;
}

.brand-word {
    margin: 0 auto; /* centered between the logo and the scan button */
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.header-scan {
    flex-shrink: 0;
    background: var(--rose);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.15rem;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}
.header-scan:hover { background: var(--rose-dark); }

/* ----------------------------------------------------------------- modal */
.scan-modal {
    border: none;
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 28rem;
    width: calc(100% - 2rem);
    background: var(--white);
    box-shadow: 0 24px 64px rgba(42, 33, 48, 0.35);
    text-align: center;
}

.scan-modal::backdrop {
    background: rgba(42, 33, 48, 0.5);
}

.scan-modal .tagline { margin-bottom: 1.25rem; }
.scan-modal .hint { margin-top: 0.75rem; margin-bottom: 0; }

.scan-modal .scan-form {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.scan-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}
.scan-modal-close:hover { color: var(--ink); }

/* ------------------------------------------------------------------ main */
.site-main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

.tagline {
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--muted);
    margin: 0 auto 1.25rem;
    max-width: 30rem;
}

@media (max-width: 480px) {
    .site-main { padding-top: 1rem; }
    .tagline { font-size: 1rem; margin-bottom: 1rem; }
}

/* ------------------------------------------------------------ scan form */
.scan-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 26rem;
    margin: 0 auto;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(42, 33, 48, 0.05);
}

.scan-form label {
    font-weight: 600;
    font-size: 0.9rem;
}

.scan-form input {
    font-size: 1.3rem;
    letter-spacing: 0.06em;
    padding: 0.9rem 1rem;
    border: 2px solid #E4DCE1;
    border-radius: var(--radius);
    background: var(--paper);
    font-family: var(--font-sans);
    color: var(--ink);
    width: 100%;
}

.scan-form input:focus {
    border-color: var(--plum);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(180, 85, 122, 0.14);
}

.scan-form input:focus-visible {
    outline: 3px solid var(--plum);
    outline-offset: 2px;
}

.scan-form button {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.9rem 1rem;
    border: none;
    border-radius: var(--radius);
    background: var(--rose);
    color: var(--white);
    cursor: pointer;
    transition: background 0.15s ease;
}

.scan-form button:hover { background: var(--rose-dark); }

.hint {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 1.5rem;
    text-align: center;
}

/* -------------------------------------------------------- scanner */
.scan-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.scan-actions .scanner-btn {
    flex: 1 1 calc(50% - 0.375rem);
}

.scanner-panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--ink);
}

.scanner-panel video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 68vh;
    object-fit: contain;
    background: #000;
}

.scanner-scanline {
    position: absolute;
    left: 6%;
    right: 6%;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(90deg, transparent, var(--rose) 25%, #ff6f9c 50%, var(--rose) 75%, transparent);
    box-shadow: 0 0 14px 3px rgba(178, 83, 121, 0.55);
    pointer-events: none;
    z-index: 2;
    animation: scanline-sweep 2.4s ease-in-out infinite;
}

@keyframes scanline-sweep {
    0%   { top: 16%; }
    50%  { top: 82%; }
    100% { top: 16%; }
}

.scanner-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(42, 33, 48, 0.65);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.scanner-controls .scanner-btn {
    flex: 0 0 auto;
}

.scanner-btn {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--radius);
    background: var(--rose);
    color: var(--white);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.scanner-btn:hover { background: var(--rose-dark); }

.scanner-btn:active { transform: translateY(1px); }

.scanner-btn.primary { background: var(--rose); }

.scanner-btn.secondary {
    background: var(--white);
    color: var(--ink);
    border: 1px solid var(--line);
}

.scanner-btn.secondary:hover { background: var(--paper); }

.rescan-actions { margin-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.rescan-actions .rescan-form { margin: 0; }

a.scanner-btn { display: inline-block; text-decoration: none; text-align: center; }

.front-photo-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    text-align: left;
}

.front-photo-form label {
    font-weight: 600;
    font-size: 0.9rem;
}

.front-photo-form input[type="file"] {
    font-size: 0.9rem;
}

.ocr-debug {
    margin: 1.5rem 0;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    background: #fff8fa;
}

.ocr-debug summary {
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.ocr-debug pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
    color: var(--ink);
}

.scanner-message {
    min-height: 1.35rem;
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: 0.9rem;
}

.scanner-message.info { color: var(--muted); }
.scanner-message.error { color: #c33; }

/* ---------------------------------------------------------- scan status */
.scan-status h1 { margin-bottom: 1.5rem; }

.status-card {
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.status-card > .status-body { flex: 1; }

.status-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.status-hint {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

.status-running {
    background: var(--white);
    border: 1px solid var(--line);
}

.status-failed {
    background: #FFF1F0;
    border: 1px solid #F5C6C6;
    color: #8A2A2A;
    display: block;
}

.status-failed .status-title { color: #8A2A2A; margin-bottom: 0.75rem; }

.status-unrecognised {
    background: #FDF6EF;
    border: 1px solid #EBD3B0;
    color: #7A5320;
    display: block;
}

.status-unrecognised .status-title { color: #7A5320; }

.status-error {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #8A2A2A;
}

.spinner {
    display: inline-block;
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid var(--line);
    border-top-color: var(--rose);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- status dl */
dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

dt { font-weight: 700; color: var(--muted); }
dd { margin: 0; font-weight: 500; }

h1 { letter-spacing: -0.02em; }

a { color: var(--plum); }

/* -------------------------------------------------------------- sections */
.how, .scale, .trust, .recent-scans {
    margin-top: 3rem;
}

.how:first-child, .recent-scans:first-child {
    margin-top: 0;
}

.how h2, .scale h2, .trust h2, .recent-scans h2 {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    margin: 0 0 1.25rem;
}

/* how it works */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
    counter-reset: step;
}

.steps li {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--plum);
    color: var(--white);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.steps li strong { display: block; font-size: 1rem; }
.steps li span { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }

/* rating scale */
.ratings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.ratings li {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.ratings li strong { font-weight: 700; }
.ratings li span { color: var(--muted); font-size: 0.9rem; }

.ratings .r-supported { border-left-color: #2E8B57; }
.ratings .r-plausible { border-left-color: #2A9D8F; }
.ratings .r-weak { border-left-color: #D9A441; }
.ratings .r-unsupported { border-left-color: #C25450; }
.ratings .r-canttell { border-left-color: #9A8F96; }

/* trust */
.trust {
    background: var(--plum);
    color: var(--white);
    border-radius: var(--radius);
    padding: 1.75rem;
}

.trust h2 { color: var(--white); margin-bottom: 0.75rem; }
.trust p { margin: 0; line-height: 1.6; font-size: 0.98rem; color: rgba(255, 255, 255, 0.92); }

/* recently scanned — two presentation variants */
.recent-full {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
}

.recent-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    text-decoration: none;
    border: 1px solid var(--line);
}

.recent-card.full {
    height: 96px; /* ~6 per screen */
    background: linear-gradient(135deg, var(--rose), var(--plum)); /* fallback */
    border: none;
}

.recent-card.grid {
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, #faf4f8, #efe7f2); /* soft fallback */
}

.recent-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.recent-card:hover img { transform: scale(1.04); }

/* full-width: image backdrop + scrim + text */
.recent-card-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(22, 16, 26, 0.82) 0%,
        rgba(22, 16, 26, 0.32) 48%,
        rgba(22, 16, 26, 0.08) 74%,
        rgba(22, 16, 26, 0.30) 100%);
}

.recent-card-brand {
    position: absolute;
    top: 0.65rem;
    left: 0.9rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
}

.recent-card-footer {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.recent-card-title {
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-card.full .recent-card-footer {
    left: 0.9rem;
    right: 0.9rem;
    bottom: 0.65rem;
}

.recent-card.full .recent-card-title {
    color: #fff;
    font-size: 0.95rem;
}

/* square tile: frosted footer bar */
.recent-card.grid .recent-card-footer {
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
}

.recent-card.grid .recent-card-title {
    color: var(--ink);
    font-size: 0.84rem;
}

/* colour-coded evidence score pill */
.score-pill {
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.32rem 0.55rem;
    border-radius: 999px;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
.score-pill.strong { background: #2e7d32; }
.score-pill.mid    { background: #c77700; }
.score-pill.weak   { background: #b3261e; }

/* small price guidance badge on product tiles */
.price-tag {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(20, 16, 22, 0.78);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.32rem 0.52rem;
    border-radius: 999px;
    letter-spacing: 0.01em;
    backdrop-filter: blur(2px);
}

/* ---------------------------------------------------------- alternatives */
.alternatives-hint { color: var(--muted); font-size: 0.88rem; margin: -0.5rem 0 0.9rem; }

.alternative-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.alternative-card img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f4eaf0;
}

.alternative-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.alternative-brand {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.alternative-name {
    font-weight: 600;
    color: var(--ink);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alternative-reason {
    font-size: 0.76rem;
    color: var(--muted);
}

/* ------------------------------------------------------------- verdicts */
.verdict-text {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

/* ------------------------------------------------------------- product */

/* product facts (dl override) */
.product-facts { margin: 1rem 0; }

/* ingredients + claims sections */
.ingredients, .claims { margin-top: 2rem; }
.ingredients h2, .claims h2 { font-size: 1.2rem; margin: 0 0 0.75rem; letter-spacing: -0.02em; }

.ingredient-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ingredient-list li {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.9rem;
    color: var(--ink);
}

/* product hero + title */
.product-hero {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--paper);
    margin-bottom: 1rem;
}

.product-hero img { width: 100%; height: auto; max-height: 340px; object-fit: cover; display: block; }

.product-photo-placeholder-large {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, var(--rose), var(--plum));
    opacity: 0.16;
}

.product-title { margin-bottom: 1.25rem; }
.product-title h1 { margin: 0 0 0.25rem; font-size: 1.7rem; letter-spacing: -0.02em; }
.product-brand { color: var(--rose); font-weight: 700; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em; margin: 0 0 0.25rem; }
.product-sub { color: var(--muted); margin: 0; font-size: 0.9rem; }

/* evidence score card */
.score-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.score-number { font-size: 3.25rem; font-weight: 800; color: var(--plum); line-height: 1; letter-spacing: -0.02em; }
.score-number span { font-size: 1rem; color: var(--muted); font-weight: 600; }
.score-card.strong .score-number { color: #2E8B57; }
.score-card.mid .score-number { color: #D9A441; }
.score-card.weak .score-number { color: #C25450; }
.score-body { display: flex; flex-direction: column; gap: 0.15rem; }
.score-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.score-summary { margin: 0; font-size: 0.95rem; color: var(--ink); }

/* claim quickview bars (drill-down via <details>) */
.claim-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.claim-item summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
}

.claim-item summary::-webkit-details-marker { display: none; }

.claim-bar {
    flex: 1;
    height: 10px;
    background: var(--paper);
    border-radius: 999px;
    overflow: hidden;
    min-width: 56px;
}

.claim-fill { display: block; height: 100%; border-radius: 999px; }
.claim-fill.supported { background: #2E8B57; }
.claim-fill.plausible { background: #2A9D8F; }
.claim-fill.weak { background: #D9A441; }
.claim-fill.unsupported { background: #C25450; }
.claim-fill.cant_tell { background: #9A8F96; }

.claim-text { flex: 2; font-weight: 600; font-size: 0.95rem; line-height: 1.3; }

.claim-rating {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.claim-rating.supported { background: #EDF7F0; color: #1E6332; }
.claim-rating.plausible { background: #E8F6F3; color: #1E6B5E; }
.claim-rating.weak { background: #FDF6EF; color: #7A5320; }
.claim-rating.unsupported { background: #FFF1F0; color: #8A2A2A; }
.claim-rating.cant_tell { background: #F1EEF0; color: #6B646B; }

.claim-item .verdict-text { padding: 0 1rem 1rem; margin: 0; }

/* affiliate buy links */
.affiliates { margin-bottom: 1.5rem; }
.affiliates h2 { font-size: 1.25rem; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
.affiliate-links { display: flex; flex-direction: column; gap: 0.5rem; }
.buy-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}
.buy-button::after { content: '↗'; opacity: 0.5; font-weight: 400; }
.buy-button:hover { border-color: var(--rose); color: var(--rose); }
.affiliate-disclosure { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--muted); }

/* footer links + about page */
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-bottom: 0.5rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.footer-links a:hover { color: var(--rose); }
.about h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 0.5rem 0 1rem; }
.about .lead { font-size: 1.1rem; line-height: 1.5; }
.about h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 1.75rem 0 0.5rem; }
.about p { line-height: 1.6; }
.about-steps { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.about-steps li { margin-bottom: 0.5rem; line-height: 1.5; }

/* ---------------------------------------------------------------- footer */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 1.25rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    background: var(--white);
}

