/* PlateMate landing page. Tokens mirror the app's dark theme (docs/UI_SCREEN_TRACKER.md). */
:root {
    --canvas: #0F1013;
    --card: #17181C;
    --raised: #1F2126;
    --border: #26282E;
    --text: #ECEDEF;
    --muted: #9A9CA5;
    --accent: #8B7CF6;
    --accent-strong: #7A69F2;
    --protein: #F0716A;
    --carbs: #5AA2F5;
    --fat: #5FD3A0;
    --radius: 18px;
    --wrap: 1120px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

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

h1,
h2,
h3 {
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0;
    text-wrap: balance;
}

h2 {
    font-size: clamp(28px, 4.2vw, 42px);
    margin-bottom: 20px;
}

h3 {
    font-size: 19px;
}

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 22px;
}

.narrow {
    max-width: 720px;
}

.center {
    text-align: center;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Platform-specific content. <html data-platform> is ios | android | other, set by landing.js;
   without JavaScript it stays "other", which shows the App Store badge plus the Android link. */
.only-android {
    display: none !important;
}

html[data-platform="android"] .only-android {
    display: inline-flex !important;
}

html[data-platform="android"] .hide-android {
    display: none !important;
}

html:not([data-platform="other"]) .only-other {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 26px;
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    color: #0F1013;
    font: 600 17px/1 var(--font);
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

.btn:hover {
    background: #9D90F8;
}

.btn:active {
    transform: scale(.98);
}

.btn:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.btn-small {
    min-height: 40px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 15px;
}

/* "Download on the App Store" button, drawn in the style of Apple's black badge */
.store-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 0 22px 0 18px;
    border-radius: 13px;
    background: #000;
    border: 1px solid #A6A6A6;
    color: #fff;
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease;
}

.store-badge:hover {
    border-color: #fff;
}

.store-badge:active {
    transform: scale(.98);
}

.store-badge svg {
    width: 26px;
    height: 30px;
    fill: #fff;
}

.store-badge span {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    text-align: left;
}

.store-badge small {
    font-size: 12px;
    letter-spacing: .01em;
}

.store-badge strong {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 16, 19, .82);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 19px;
    text-decoration: none;
}

.brand img {
    border-radius: 10px;
}

.header-nav {
    display: flex;
    gap: 26px;
    margin-left: auto;
}

.header-nav a {
    color: var(--muted);
    font-size: 15px;
    text-decoration: none;
}

.header-nav a:hover {
    color: var(--text);
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    padding: 56px 0 72px;
}

.hero::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto auto;
    width: 720px;
    height: 720px;
    background: radial-gradient(closest-side, rgba(139, 124, 246, .22), transparent);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 48px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(40px, 5.2vw, 62px);
    letter-spacing: -0.035em;
}

.accent {
    color: var(--accent);
}

.lead {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: clamp(17px, 1.6vw, 20px);
    max-width: 34em;
}

.lead.center {
    margin: 0 auto 36px;
}

.cta-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-top: 30px;
}

.cta-note {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.cta-note strong {
    color: var(--text);
    font-weight: 600;
}

.cta-alt {
    flex-basis: 100%;
    margin: 0;
    font-size: 15px;
    color: var(--muted);
}

.final-cta .cta-block {
    justify-content: center;
}

/* Phone frame around real app screenshots */
.phone {
    width: min(300px, 74vw);
    margin: 0 auto;
    padding: 10px;
    border-radius: 46px;
    background: var(--raised);
    border: 1px solid #33353C;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .03) inset;
}

.screen {
    position: relative;
    aspect-ratio: 640 / 1305;
    overflow: hidden;
    border-radius: 36px;
    background: var(--canvas);
}

.hero-demo {
    margin: 0;
}

.demo-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .5s ease;
}

.demo-frame.is-active {
    opacity: 1;
}

.demo-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.demo-steps li {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

.demo-steps li.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0F1013;
}

/* Sections */
.section {
    padding: 88px 0;
}

/* Anchor targets clear the sticky header */
section[id] {
    scroll-margin-top: 64px;
}

.section-alt {
    background: #131418;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

#how h2,
#features h2,
#pricing h2 {
    text-align: center;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
}

.step {
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
}

/* step images are pre-framed at 3:4 (scratch crop of the part of the screen that tells the step),
   so they are shown whole, never cropped by CSS */
.step img {
    width: 100%;
    background: var(--canvas);
    border-bottom: 1px solid var(--border);
}

.step>div {
    padding: 22px 22px 26px;
}

.step-num {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: rgba(139, 124, 246, .16);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}

.step p,
.feature p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 56px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.chips li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 15px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot-protein {
    background: var(--protein);
}

.dot-carbs {
    background: var(--carbs);
}

.dot-fat {
    background: var(--fat);
}

/* The full breakdown scrolls slowly inside the phone */
.phone-scroll .screen img {
    width: 100%;
    animation: breakdown-scroll 16s ease-in-out infinite alternate;
}

@keyframes breakdown-scroll {

    0%,
    8% {
        transform: translateY(0);
    }

    92%,
    100% {
        /* image height (2335/640 of the width) minus the screen height (1305/640 of the width) */
        transform: translateY(calc(-100% + 1305 / 2335 * 100%));
    }
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 40px;
}

.feature {
    padding: 26px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
}

.feature svg {
    width: 26px;
    height: 26px;
    margin-bottom: 16px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Pricing */
.plans {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 340px));
    justify-content: center;
    gap: 20px;
}

.plan {
    padding: 30px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
}

.plan-featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

.price {
    margin: 10px 0 0;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.price span {
    color: var(--muted);
    font-size: 17px;
    font-weight: 500;
}

.price-alt {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.plan ul {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}

.plan li {
    position: relative;
    padding: 6px 0 6px 28px;
    font-size: 16px;
}

.plan li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 13px;
    width: 12px;
    height: 7px;
    border-left: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg);
}

.fine-print {
    margin: 26px auto 0;
    max-width: 36em;
    color: var(--muted);
    font-size: 14px;
}

/* FAQ */
details {
    border-bottom: 1px solid var(--border);
}

summary {
    position: relative;
    padding: 20px 40px 20px 0;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-size: 26px;
    font-weight: 400;
}

details[open] summary::after {
    content: "–";
}

details p {
    margin: -6px 0 22px;
    color: var(--muted);
}

/* Final CTA */
.final-cta {
    background: radial-gradient(600px 300px at 50% 100%, rgba(139, 124, 246, .18), transparent);
}

/* Android waitlist */
.waitlist {
    text-align: center;
}

.waitlist h2 {
    margin-bottom: 10px;
}

.waitlist>p {
    margin: 0 auto;
    max-width: 30em;
    color: var(--muted);
}

.waitlist-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 26px;
}

.waitlist-form input {
    flex: 1 1 180px;
    min-height: 52px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font: 17px var(--font);
}

.waitlist-form input::placeholder {
    color: #6E7079;
}

.waitlist-form input[aria-invalid="true"] {
    border-color: var(--protein);
}

.waitlist-status {
    min-height: 1.5em;
    margin: 14px 0 0;
    font-size: 15px;
}

.waitlist-status.is-error {
    color: var(--protein);
}

.waitlist-status.is-success {
    color: var(--fat);
}

/* Footer */
.site-footer {
    padding: 36px 0 48px;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px 28px;
}

.footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.footer-inner nav a {
    color: var(--muted);
    font-size: 15px;
    text-decoration: none;
}

.footer-inner nav a:hover {
    color: var(--text);
}

.copyright {
    margin: 0 0 0 auto;
    color: #6E7079;
    font-size: 14px;
}

/* Sticky download bar (phones only) */
.sticky-cta {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 10px 12px;
    border-radius: 20px;
    background: rgba(31, 33, 38, .94);
    border: 1px solid #33353C;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transform: translateY(140%);
    transition: transform .3s ease;
}

.sticky-cta[hidden] {
    display: none;
}

.sticky-cta.is-visible {
    transform: translateY(0);
}

.sticky-cta img {
    border-radius: 10px;
}

.sticky-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: 14px;
    color: var(--muted);
}

.sticky-text strong {
    color: var(--text);
    font-size: 16px;
}

.sticky-cta .btn {
    margin-left: auto;
}

/* Layout: tablet and phone */
@media (max-width: 900px) {
    .header-nav {
        display: none;
    }

    .header-inner .btn {
        margin-left: auto;
    }

    .split {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Phone hero, in one column: headline > the app in action > App Store button > trial note.
       The description is dropped here: the demo says it faster. */
    .hero {
        padding: 22px 0 44px;
    }

    .hero-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    .hero-copy {
        display: contents;
        text-align: center;
    }

    .hero .eyebrow {
        order: 1;
        margin-bottom: 10px;
    }

    .hero h1 {
        order: 2;
    }

    .hero .lead {
        display: none;
    }

    .hero-demo {
        order: 3;
        margin-top: 20px;
    }

    .hero .cta-block {
        order: 4;
        justify-content: center;
        margin-top: 18px;
    }

    /* The phone shows its top part (where every demo screen has its content), fading out at the
       bottom. Its height follows the visible screen, so the App Store button always lands in the
       first screenful, also in Instagram's and TikTok's shorter in-app browsers. 420px is
       everything else above the button's bottom edge; vh is the fallback where svh is missing. */
    .hero .phone {
        width: min(236px, 62vw);
        height: clamp(220px, calc(100vh - 420px), 470px);
        height: clamp(220px, calc(100svh - 420px), 470px);
        overflow: hidden;
        padding-bottom: 0;
        -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
        mask-image: linear-gradient(to bottom, #000 72%, transparent);
    }

    .hero .demo-steps {
        display: none;
    }

    .hero h1 {
        font-size: clamp(34px, 9.2vw, 48px);
    }

    /* steps: one swipeable row, the next card peeking in from the right */
    .steps {
        display: flex;
        gap: 14px;
        margin: 32px -22px 0;
        padding: 0 22px 6px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 22px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .steps::-webkit-scrollbar {
        display: none;
    }

    .step {
        flex: 0 0 78%;
        max-width: 340px;
        scroll-snap-align: start;
    }

    .step>div {
        padding: 18px 18px 22px;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 28px;
    }

    .feature {
        padding: 18px 16px;
    }

    .feature svg {
        width: 22px;
        height: 22px;
        margin-bottom: 10px;
    }

    .feature h3 {
        font-size: 16px;
    }

    .feature p {
        font-size: 14px;
        line-height: 1.45;
    }

    .split-copy {
        text-align: center;
    }

    .chips {
        justify-content: center;
    }

    .section {
        padding: 64px 0;
    }

    .plans {
        grid-template-columns: minmax(0, 420px);
    }

    .copyright {
        margin-left: 0;
        flex-basis: 100%;
    }

    /* room for the sticky bar so it never covers the footer */
    .site-footer {
        padding-bottom: 110px;
    }
}

@media (min-width: 901px) {
    .sticky-cta {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .phone-scroll .screen img {
        animation: none;
    }

    .demo-frame,
    .demo-steps li,
    .sticky-cta {
        transition: none;
    }
}
