/* ==========================================================================
   PillBuddy — site-wide styles
   Design tokens follow the in-app legal pages so the site and the app match.
   ========================================================================== */

:root {
    color-scheme: light dark;

    /* Brand */
    --primary: #5c4eb5;
    --primary-dark: #463a92;
    --primary-light: #f0eeff;
    --accent: #10b981;

    /* Surfaces */
    --bg-color: #ffffff;
    --bg-subtle: #f7f6fc;
    --card-bg: #f9f8fe;
    --table-header: #f2effd;
    --header-bg: rgba(255, 255, 255, 0.82);

    /* Text */
    --text-primary: #1e1b2e;
    --text-secondary: #5e5a71;
    --text-tertiary: #8b879e;
    --text-on-primary: #ffffff;

    /* Lines & elevation */
    --border-color: #e4e2ee;
    --shadow-sm: 0 1px 2px rgba(30, 27, 46, 0.06);
    --shadow-md: 0 8px 24px rgba(30, 27, 46, 0.08);
    --shadow-lg: 0 24px 60px rgba(30, 27, 46, 0.16);

    /* Callout blocks */
    --highlight-bg: #eef8f2;
    --highlight-border: #10b981;
    --highlight-text: #065f46;
    --alert-bg: #fff8eb;
    --alert-border: #f59e0b;
    --alert-text: #92400e;

    /* Segmented / language toggle */
    --toggle-bg: #eae7f6;
    --toggle-active: #ffffff;

    /* Layout */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;
    --page-max: 1120px;
    --legal-max: 820px;
    --gradient-brand: linear-gradient(135deg, #7a63e8 0%, #5c4eb5 55%, #43358c 100%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #9b8ef6;
        --primary-dark: #b3a8ff;
        --primary-light: #2b254a;
        --accent: #34d399;

        --bg-color: #161420;
        --bg-subtle: #1a1728;
        --card-bg: #1f1b2f;
        --table-header: #26213c;
        --header-bg: rgba(22, 20, 32, 0.82);

        --text-primary: #f2effd;
        --text-secondary: #aba7c0;
        --text-tertiary: #787391;

        --border-color: #2e2a42;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

        --highlight-bg: #0f2c1d;
        --highlight-border: #059669;
        --highlight-text: #a7f3d0;
        --alert-bg: #2e2010;
        --alert-border: #d97706;
        --alert-text: #fde68a;

        --toggle-bg: #27223c;
        --toggle-active: #3c355c;

        --gradient-brand: linear-gradient(135deg, #4b3f8f 0%, #352c6b 55%, #241d4a 100%);
    }
}

/* --------------------------------------------------------------- Reset --- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    letter-spacing: 0.1px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* -------------------------------------------------------------- Layout --- */

.container {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 10px 16px;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 100;
}

.skip-link:focus {
    left: 0;
}

/* -------------------------------------------------------------- Header --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border-color);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 10px 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    margin-right: auto;
}

.brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav a {
    display: inline-block;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
}

.site-nav a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.lang-switch {
    display: inline-flex;
    background: var(--toggle-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 3px;
}

.lang-switch a {
    padding: 4px 13px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.lang-switch a[aria-current="page"] {
    background: var(--toggle-active);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 22px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.btn--on-brand {
    background: #ffffff;
    color: #463a92;
    box-shadow: var(--shadow-md);
}

.btn--on-brand-ghost {
    border-color: rgba(255, 255, 255, 0.55);
    color: #ffffff;
}

.btn--on-brand-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn--solid {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.btn--outline {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: default;
}

.btn[aria-disabled="true"]:hover {
    transform: none;
}

.text-link {
    font-weight: 600;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------- Hero --- */

.hero {
    position: relative;
    background: var(--gradient-brand);
    color: var(--text-on-primary);
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -10% -55% 45%;
    height: 420px;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.22), transparent 70%);
    pointer-events: none;
}

.hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: center;
    gap: 44px;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 72px 20px 84px;
}

.hero__eyebrow {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 20px;
}

.hero__title {
    margin: 0 0 16px;
    font-size: clamp(32px, 5vw, 50px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero__lead {
    margin: 0 0 30px;
    max-width: 34em;
    font-size: clamp(16px, 1.7vw, 18px);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.88);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero__note {
    margin: 22px 0 0;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.75);
}

.hero__visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero__visual img {
    width: min(300px, 78vw);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------ Sections --- */

.section {
    padding: 72px 0;
}

.section--subtle {
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.section__header {
    max-width: 42em;
    margin: 0 auto 44px;
    text-align: center;
}

.section__title {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.2vw, 32px);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.section__lead {
    margin: 0;
    font-size: 17px;
    color: var(--text-secondary);
}

/* ------------------------------------------------------------ Features --- */

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.feature {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 22px;
    box-shadow: var(--shadow-sm);
}

.feature__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: 13px;
    background: var(--primary-light);
    color: var(--primary);
}

.feature__icon svg {
    width: 22px;
    height: 22px;
}

.feature h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
}

.feature p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

/* ------------------------------------------------------------ Gallery --- */

.shots {
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 6px max(20px, calc((100% - var(--page-max)) / 2)) 26px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.shots img {
    width: 236px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    scroll-snap-align: center;
}

.shots__hint {
    margin: 0;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-tertiary);
}

.note-line {
    margin: 28px 0 0;
    text-align: center;
    font-size: 14.5px;
    color: var(--text-secondary);
}

/* ------------------------------------------------------------- Promise --- */

.promises {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 20px;
}

.promise {
    background: var(--highlight-bg);
    border: 1px solid var(--highlight-border);
    border-radius: var(--radius-lg);
    padding: 24px 22px;
    color: var(--highlight-text);
}

.promise h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--highlight-text);
}

.promise p {
    margin: 0;
    font-size: 15px;
    color: var(--highlight-text);
}

.promise a {
    color: inherit;
}

/* ----------------------------------------------------------------- CTA --- */

.cta {
    text-align: center;
}

.cta__title {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.2vw, 32px);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.cta__lead {
    margin: 0 auto 28px;
    max-width: 34em;
    font-size: 17px;
    color: var(--text-secondary);
}

.cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* -------------------------------------------------------------- Footer --- */

.site-footer {
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    padding: 48px 0 32px;
    font-size: 14.5px;
    color: var(--text-secondary);
}

.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
    gap: 32px;
    margin-bottom: 36px;
}

.site-footer__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.site-footer__brand img {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.site-footer p {
    margin: 0 0 10px;
    max-width: 32em;
}

.site-footer h2 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.site-footer ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer li {
    margin-bottom: 9px;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: space-between;
    padding-top: 22px;
    border-top: 1px solid var(--border-color);
    font-size: 13.5px;
    color: var(--text-tertiary);
}

/* ---------------------------------------------------------- Responsive --- */

@media (max-width: 880px) {
    .hero__inner {
        grid-template-columns: minmax(0, 1fr);
        padding: 52px 20px 64px;
        text-align: center;
    }

    .hero__lead {
        margin-inline: auto;
    }

    .hero__actions {
        justify-content: center;
    }

    .hero__visual {
        order: -1;
    }

    .hero__visual img {
        width: min(250px, 62vw);
    }

    .section {
        padding: 56px 0;
    }

    .site-footer__grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .site-footer__about {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .nav-features {
        display: none;
    }

    .site-nav a {
        padding: 7px 9px;
        font-size: 14px;
    }

    .shots img {
        width: 200px;
    }
}

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

    .btn {
        transition: none;
    }

    .btn:hover {
        transform: none;
    }
}
