:root {
    color-scheme: light;
    --paper: #f7f6f1;
    --paper-deep: #efeee6;
    --card: #fffefa;
    --ink: #26372d;
    --muted: #7a8179;
    --line: #e8e7df;
    --sage: #6b806c;
    --sage-dark: #425b49;
    --sage-pale: #edf1e9;
    --gold: #b79a66;
    --serif: "DM Serif Display", Georgia, serif;
    --sans: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }
.site-header {
    height: 84px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(72, 88, 72, .11);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
    width: 36px; height: 36px; display: inline-grid; place-items: center;
    color: var(--sage-dark); background: #e8ece3; border-radius: 50%;
}
.brand-mark svg { width: 29px; height: 29px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.9px; color: var(--ink); }
.brand-name span { color: var(--sage); font-weight: 500; }
.header-note { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.home-main {
    min-height: 615px;
    display: grid;
    grid-template-columns: .92fr 1fr;
    align-items: center;
    gap: clamp(48px, 8vw, 112px);
    padding: 68px 0 76px;
}
.intro { padding-bottom: 8px; }
.eyebrow, .card-kicker {
    color: var(--sage);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
}
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 22px; }
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
h1, h2, p { margin-top: 0; }
.intro h1, .results-heading h1, .error-card h1 {
    font-family: var(--serif);
    font-size: clamp(48px, 5.1vw, 68px);
    font-weight: 400;
    line-height: 1.04;
    letter-spacing: -.035em;
    margin: 0 0 22px;
}
h1 em { color: var(--sage); font-weight: 400; }
.intro-copy { max-width: 410px; color: #707870; font-size: 15px; line-height: 1.8; margin: 0; }
.promise-row { display: flex; align-items: center; gap: 9px; color: #687368; margin-top: 27px; font-size: 11px; }
.promise-row i { width: 3px; height: 3px; border-radius: 50%; background: #b7b7aa; margin: 0 3px; }
.promise-icon { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #e5eae1; color: var(--sage-dark); }
.promise-icon svg { width: 13px; height: 13px; }
.quiet-note { margin-top: 80px; display: flex; gap: 15px; align-items: center; color: #96968a; font-size: 11px; line-height: 1.6; }
.quiet-note p { max-width: 230px; margin: 0; }
.quiet-line { width: 32px; height: 1px; background: #c9b88f; flex: 0 0 auto; }
.upload-card {
    background: var(--card);
    border: 1px solid rgba(72, 88, 72, .08);
    border-radius: 15px;
    padding: 31px;
    box-shadow: 0 18px 60px rgba(50, 61, 48, .055), 0 2px 6px rgba(50, 61, 48, .025);
}
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.card-kicker { margin: 0 0 8px; font-size: 9px; }
.card-heading h2 { font-family: var(--serif); font-weight: 400; font-size: 27px; letter-spacing: -.02em; margin: 0; }
.step-count { font-family: var(--serif); font-size: 17px; color: var(--sage-dark); }
.step-count span { color: #b8b9ae; font-size: 13px; }
.upload-zone {
    min-height: 184px;
    display: grid;
    place-items: center;
    padding: 20px;
    border: 1px dashed #c8cec2;
    border-radius: 10px;
    background: #fafaf6;
    cursor: pointer;
    text-align: center;
    transition: border-color .18s ease, background .18s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--sage); background: #f1f4ed; }
.upload-zone:focus-visible, .detail-chip:focus-visible, .primary-button:focus-visible, textarea:focus-visible, .back-link:focus-visible {
    outline: 3px solid rgba(107, 128, 108, .32); outline-offset: 3px;
}
.upload-content { display: flex; flex-direction: column; align-items: center; }
.camera-icon {
    width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%;
    background: #e9eee5; color: var(--sage-dark); margin-bottom: 11px;
}
.camera-icon svg { width: 25px; height: 25px; }
.upload-content strong { font-size: 13px; font-weight: 600; }
.upload-hint { color: #8b9189; font-size: 11px; margin-top: 5px; }
.browse-label { color: var(--sage-dark); font-size: 11px; font-weight: 700; margin-top: 11px; border-bottom: 1px solid #aeb8aa; padding-bottom: 2px; }
.preview-content { width: 100%; }
.preview-content[hidden], .upload-content[hidden], [hidden] { display: none !important; }
.preview-content img { width: 100%; max-height: 190px; object-fit: cover; border-radius: 7px; display: block; }
.preview-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 3px 0; color: #737c72; font-size: 11px; }
.preview-caption #file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-photo { color: var(--sage-dark); font-weight: 700; }
.form-error { color: #a44e42; font-size: 12px; margin: 8px 0 0; }
.details-label { display: flex; flex-direction: column; gap: 5px; margin: 19px 0 8px; font-size: 12px; font-weight: 700; }
.optional, .details-help { color: #92968d; font-size: 10px; font-weight: 400; }
.details-help { font-size: 10px; }
textarea {
    display: block;
    width: 100%;
    min-height: 79px;
    padding: 11px 12px;
    resize: vertical;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 11px;
    line-height: 1.55;
}
textarea::placeholder { color: #a1a39b; }
.detail-examples { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 18px; }
.detail-chip { background: transparent; border: 1px solid #e3e4dc; border-radius: 20px; color: #6f786e; padding: 6px 9px; font-size: 10px; cursor: pointer; }
.detail-chip:hover { border-color: #aab6a6; background: #f6f8f3; color: var(--sage-dark); }
.primary-button {
    min-height: 48px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    border: 0;
    border-radius: 7px;
    background: var(--sage-dark);
    color: #fffefa;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}
.primary-button:hover:not(:disabled) { background: #334a3b; transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; background: #b8c1b5; color: #f8f8f2; }
.button-arrow { width: 17px; height: 17px; }
.spinner { width: 17px; height: 17px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.privacy-note { color: #a0a198; font-size: 9px; text-align: center; margin: 11px 0 0; }
.upload-consent { display: flex; align-items: flex-start; gap: 10px; margin: 15px 0; font-size: 12px; line-height: 1.6; color: #53624f; }
.upload-consent input { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; accent-color: #405e48; }
.privacy-note a { text-decoration: underline; }
.upload-consent ~ .primary-button { margin-top: 20px; }
.how-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 29px;
    border-top: 1px solid rgba(72, 88, 72, .12);
    border-bottom: 1px solid rgba(72, 88, 72, .12);
}
.how-item { display: flex; align-items: center; gap: 13px; }
.how-number { font-family: var(--serif); font-size: 21px; color: #a79770; }
.how-item strong { font-size: 11px; font-weight: 600; }
.how-item p { color: #8b9088; font-size: 10px; margin: 4px 0 0; }
.how-divider { width: 1px; height: 30px; background: #dfdfd6; }
.site-footer { min-height: 84px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; color: #999b91; font-size: 10px; }
.brand-small { gap: 7px; }
.brand-small .brand-mark { width: 25px; height: 25px; }
.brand-small .brand-mark svg { width: 21px; height: 21px; }
.brand-small .brand-name { font-size: 15px; }

/* Results */
.results-main { max-width: 760px; padding: 55px 0 72px; margin: 0 auto; }
.results-heading { text-align: center; margin: 0 0 28px; }
.results-heading .eyebrow { justify-content: center; margin-bottom: 15px; }
.results-heading h1 { font-size: clamp(42px, 6vw, 56px); margin-bottom: 0; }
.result-card { overflow: hidden; background: var(--card); border: 1px solid rgba(72, 88, 72, .08); border-radius: 14px; box-shadow: 0 18px 55px rgba(50, 61, 48, .06); }
.result-photo { position: relative; height: 260px; background: var(--paper-deep); }
.result-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tag { position: absolute; left: 19px; top: 18px; padding: 7px 10px; border-radius: 3px; background: rgba(255, 254, 250, .9); color: var(--sage-dark); font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.result-content { padding: 30px; }
.food-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.food-heading .card-kicker { margin-bottom: 6px; }
.food-heading h2 { font-family: var(--serif); font-size: 30px; line-height: 1.1; font-weight: 400; margin: 0 0 6px; }
.serving-copy { color: var(--muted); font-size: 11px; margin: 0; }
.leaf-seal { display: grid; place-items: center; width: 43px; height: 43px; color: var(--sage-dark); background: #e9eee5; border-radius: 50%; }
.leaf-seal svg { width: 34px; height: 34px; }
.details-recap { border-left: 2px solid #c4a96d; padding: 2px 0 2px 12px; margin: 0 0 21px; }
.recap-label { color: #9a895e; font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.details-recap p { color: #72796e; font-size: 11px; line-height: 1.6; margin: 5px 0 0; }
.macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.macro-tile { min-height: 137px; padding: 16px 13px 14px; background: #f5f5ef; border-radius: 8px; display: flex; flex-direction: column; align-items: flex-start; }
.macro-dot { width: 7px; height: 7px; background: var(--sage); border-radius: 50%; margin-bottom: 11px; }
.macro-name { color: #697168; font-size: 10px; }
.macro-tile strong { color: var(--ink); font-family: var(--serif); font-size: 30px; line-height: 1.2; font-weight: 400; margin-top: 8px; }
.macro-tile strong small { font-family: var(--sans); color: #697168; font-size: 12px; margin-left: 2px; }
.macro-unit { color: #9a9d94; font-size: 9px; margin-top: 3px; }
.calories-tile { background: #f6f0e4; }.calories-tile .macro-dot { background: #b9975f; }
.protein-tile { background: #edf1e9; }.protein-tile .macro-dot { background: #67816b; }
.carbs-tile { background: #f4eee7; }.carbs-tile .macro-dot { background: #b27e58; }
.fat-tile { background: #edf0f0; }.fat-tile .macro-dot { background: #778b91; }
.fiber-row { display: flex; justify-content: space-between; color: #697168; font-size: 11px; padding: 14px 2px 0; }
.fiber-row strong { color: var(--ink); }
.estimate-disclaimer { border-top: 1px solid var(--line); color: #93968e; font-size: 10px; line-height: 1.6; margin: 21px 0 18px; padding-top: 15px; }
.another-button { max-width: 270px; margin: 0 auto; }
.error-card { max-width: 520px; text-align: center; background: var(--card); border-radius: 14px; padding: 48px 35px; margin: 60px auto; box-shadow: 0 18px 55px rgba(50, 61, 48, .06); }
.error-symbol { width: 43px; height: 43px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; background: #f5ece7; color: #a56856; font-family: var(--serif); font-size: 24px; }
.archive-warning { margin: 0 0 18px; padding: 12px 15px; border: 1px solid #e5d5a9; border-radius: 7px; background: #fbf6e9; color: #75643c; font-size: 11px; line-height: 1.55; }
.error-card .eyebrow { justify-content: center; margin-bottom: 12px; }
.error-card h1 { font-size: 39px; margin-bottom: 12px; }
.error-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.65; margin-bottom: 22px; }
.retry-button { max-width: 240px; margin: 0 auto; }
.back-link { display: inline-flex; gap: 7px; align-items: center; text-decoration: none; color: var(--sage-dark); font-size: 12px; }
.back-link:hover { color: var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 780px) {
    .page-shell { width: min(100% - 40px, 560px); }
    .site-header { height: 72px; }
    .home-main { grid-template-columns: 1fr; gap: 32px; padding: 48px 0 43px; }
    .intro h1 { font-size: clamp(47px, 11vw, 62px); }
    .intro-copy { font-size: 14px; }
    .quiet-note { margin-top: 24px; }
    .upload-card { padding: 24px; }
    .how-section { align-items: flex-start; padding: 19px 4px; gap: 14px; }
    .how-item { gap: 8px; align-items: flex-start; }
    .how-number { font-size: 17px; }
    .how-item strong { font-size: 10px; }
    .how-item p { line-height: 1.5; }
    .how-divider { height: 36px; margin-top: 2px; }
    .results-main { padding: 42px 0 54px; }
}
@media (max-width: 480px) {
    .page-shell { width: calc(100% - 32px); }
    .header-note { font-size: 10px; }
    .home-main { padding-top: 37px; }
    .intro h1 { font-size: 48px; }
    .intro-copy { line-height: 1.7; }
    .promise-row { flex-wrap: wrap; font-size: 10px; }
    .quiet-note { margin-top: 20px; }
    .upload-card { padding: 19px; }
    .upload-zone { min-height: 168px; }
    .how-section { flex-direction: column; gap: 16px; padding: 18px 4px; }
    .how-item { align-items: center; }
    .how-divider { width: 100%; height: 1px; margin: 0; }
    .site-footer { min-height: 72px; }
    .site-footer > span { max-width: 150px; text-align: right; line-height: 1.5; }
    .result-photo { height: 210px; }
    .result-content { padding: 22px 17px; }
    .macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .macro-tile { min-height: 125px; padding: 14px; }
    .food-heading h2 { font-size: 27px; }
    .results-heading h1 { font-size: 43px; }
    .error-card { padding: 38px 22px; }
}

/* Refinements: calmer hierarchy, larger targets, clearer focus */
.upload-card { border-radius: 20px; }
.upload-zone { border-radius: 14px; min-height: 200px; }
.upload-content strong { font-size: 15px; }
.upload-hint { font-size: 12px; color: #6f776e; }
.browse-label {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; margin-top: 14px;
    border: 1px solid var(--sage); border-radius: 12px; background: var(--card); font-size: 13px;
    cursor: pointer; transition: background .18s ease, transform .18s ease;
}
.browse-label:hover { background: var(--sage-pale); transform: translateY(-1px); }
.upload-zone:focus-within .browse-label { outline: 3px solid rgba(107, 128, 108, .32); outline-offset: 2px; }
.details-label { font-size: 14px; }
.optional, .details-help { font-size: 12px; color: #6f776e; }
textarea { font-size: 14px; border-radius: 12px; }
textarea:focus-visible { border-color: var(--sage); }
.detail-chip { min-height: 40px; padding: 8px 14px; font-size: 12px; color: #4d5c51; border-color: #d5d8cc; transition: background .18s ease, border-color .18s ease; }
.upload-consent { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: #3f4f44; transition: background .18s ease, border-color .18s ease; }
.upload-consent:has(input:checked) { background: var(--sage-pale); border-color: var(--sage); }
.upload-consent input { width: 22px; height: 22px; flex-basis: 22px; margin-top: 0; }
.upload-consent:focus-within { outline: 3px solid rgba(107, 128, 108, .32); outline-offset: 2px; }
.privacy-note { font-size: 13px; color: #6f776e; }
.primary-button { min-height: 56px; border-radius: 14px; font-size: 15px; }
.primary-button:active:not(:disabled) { transform: scale(.985); }
.primary-button:disabled { background: #aab5a7; }
.preview-caption { font-size: 12px; }
.form-error { font-size: 13px; }
@media (max-width: 480px) { .upload-card { padding: 18px; } .site-footer > span { max-width: none; text-align: left; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
