/* Scolefy — shared stylesheet for the public site (landing + legal pages).
   Palette is sampled from the app icon's gradient: #5AD7FF → #0066FF. */

:root {
    color-scheme: light dark;

    --bg: #ffffff;
    --bg-soft: #f7f8fa;
    --bg-sink: #eef1f6;
    --fg: #10131a;
    --fg-muted: #565e6e;
    --fg-faint: #848c9b;
    --accent: #0a6cff;
    --accent-hover: #0057d8;
    --accent-soft: #eaf2ff;
    --border: #e4e7ec;
    --border-strong: #ccd2db;
    --warn-bg: #fff8e6;
    --warn-border: #f0d68a;

    /* Brand gradient, straight off the app icon. */
    --brand-from: #5ad7ff;
    --brand-to: #0066ff;

    --maxw: 46rem;        /* reading width — legal pages, body copy */
    --maxw-wide: 60rem;   /* showcase width — landing page only */
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 1px 2px rgba(16, 19, 26, .04), 0 8px 24px -8px rgba(16, 19, 26, .10);
    --shadow-lift: 0 2px 4px rgba(16, 19, 26, .06), 0 24px 48px -16px rgba(16, 19, 26, .22);
    --phone-shadow: rgba(16, 19, 26, .28);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0f13;
        --bg-soft: #14171d;
        --bg-sink: #10131a;
        --fg: #eef0f4;
        --fg-muted: #a5acba;
        --fg-faint: #7d8595;
        --accent: #5ab2ff;
        --accent-hover: #8ccbff;
        --accent-soft: #14243a;
        --border: #232830;
        --border-strong: #343b46;
        --warn-bg: #2a2415;
        --warn-border: #5c4d21;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -8px rgba(0, 0, 0, .6);
        --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 24px 48px -16px rgba(0, 0, 0, .7);
        /* Pure black disappears against a dark page, so lift the device with a
           faint cool glow instead of a shadow. */
        --phone-shadow: rgba(90, 178, 255, .16);
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

::selection { background: var(--accent-soft); }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ── Layout ─────────────────────────────────────────────────────── */

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.wrap--wide { max-width: var(--maxw-wide); }

header.site {
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

header.site .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 62px;
    flex-wrap: wrap;
}

/* Brand lockup: the ScolefyLogo asset is a template (white-on-transparent)
   PNG, so it is used as a mask and tinted with currentColor. That way one
   asset works in both light and dark without a second file. */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.06rem;
    letter-spacing: -0.015em;
    color: var(--fg);
    text-decoration: none;
}

.brand-mark {
    width: 25px;
    height: 22px;
    flex: none;
    background-color: currentColor;
    -webkit-mask: url("assets/logo-mask.png") center / contain no-repeat;
            mask: url("assets/logo-mask.png") center / contain no-repeat;
}

nav.site a {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-left: 1.15rem;
    transition: color .15s ease;
}

nav.site a:hover { color: var(--fg); }
nav.site a[aria-current="page"] { color: var(--fg); font-weight: 550; }

main { padding: 2.75rem 0 4rem; }

footer.site {
    border-top: 1px solid var(--border);
    padding: 1.75rem 0 3rem;
    color: var(--fg-faint);
    font-size: 0.85rem;
}

footer.site a { color: var(--fg-muted); }

footer.site .row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

/* ── Typography ─────────────────────────────────────────────────── */

h1 {
    font-size: clamp(2.05rem, 1.5rem + 2.2vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 0.6rem;
}

h2 {
    font-size: 1.32rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin: 2.5rem 0 0.75rem;
    padding-top: 0.5rem;
}

h3 {
    font-size: 1.02rem;
    margin: 1.75rem 0 0.4rem;
}

p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.35rem; }
li { margin-bottom: 0.35rem; }

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

strong { font-weight: 650; }

.lede {
    font-size: 1.1rem;
    color: var(--fg-muted);
    margin-bottom: 2rem;
}

.updated {
    display: inline-block;
    font-size: 0.82rem;
    color: var(--fg-faint);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    margin-bottom: 1.5rem;
}

/* ── Components ─────────────────────────────────────────────────── */

.toc {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem 1.1rem 2.4rem;
    margin-bottom: 2.5rem;
    font-size: 0.93rem;
}

.toc li { margin-bottom: 0.25rem; }

.callout {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.callout p:last-child { margin-bottom: 0; }

.callout.todo {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    border-left-color: #d9a520;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0 1.5rem;
    font-size: 0.9rem;
}

.table-scroll { overflow-x: auto; margin-bottom: 1.5rem; }
.table-scroll table { margin-bottom: 0; }

th, td {
    text-align: left;
    vertical-align: top;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 650;
    color: var(--fg);
    border-bottom-color: var(--border-strong);
    white-space: nowrap;
}

td { color: var(--fg-muted); }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.87em;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.08em 0.35em;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.68rem 1.4rem;
    border-radius: 999px;
    transition: background .15s ease, transform .15s ease;
}

.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:active { transform: translateY(1px); }

.btn.secondary {
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border-strong);
}

.btn.secondary:hover { background: var(--bg-soft); color: var(--fg); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
    margin: 2.5rem 0 1rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem;
    background: var(--bg-soft);
}

.card h3 { margin-top: 0; }
.card p { margin-bottom: 0; color: var(--fg-muted); font-size: 0.93rem; }

.contact {
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    margin: 2rem 0 0;
}

.contact p:last-child { margin-bottom: 0; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 3rem 0 0;
}

/* The sticky header would otherwise cover an anchored heading. */
h2[id], section[id] { scroll-margin-top: 5rem; }

/* ── Hero ───────────────────────────────────────────────────────── */

.hero { text-align: center; padding-top: 0.5rem; }

.hero .lede {
    max-width: 34rem;
    margin-inline: auto;
    margin-bottom: 1.75rem;
}

/* The real App Store icon, squircled to match iOS. */
.hero-icon {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    display: block;
    margin: 0 auto 1.4rem;
    box-shadow: var(--shadow-lift);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.hero-note {
    font-size: 0.85rem;
    color: var(--fg-faint);
    margin-bottom: 0;
}

/* ── Showcase (phone carousel + per-screen copy) ────────────────── */

.showcase { margin-top: 3.5rem; }

.showcase-grid {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}

/* — Tabs — */
.showcase-tabs {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 2.25rem;
    padding: 0.3rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    width: fit-content;
    margin-inline: auto;
}

.showcase-tabs button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--fg-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease;
}

.showcase-tabs button:hover { color: var(--fg); }

.showcase-tabs button[aria-selected="true"] {
    background: var(--bg);
    color: var(--fg);
    box-shadow: var(--shadow);
}

/* — Swipeable phone track — */
.phone-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
}

.phone-track::-webkit-scrollbar { display: none; }

.phone-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

/* — The device — */
/* Geometry is measured from the iPhone 17 frame asset (450×920): the screen
   cutout is x 24–425, y 23–896. Those pixel offsets are expressed as
   percentages below so the whole thing scales from one width. */
.phone {
    position: relative;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 450 / 920;
    filter: drop-shadow(0 26px 40px var(--phone-shadow));
}

.phone-screen {
    position: absolute;
    left: 5.3333%;
    top: 2.5%;
    width: 89.3333%;
    height: 95%;
    object-fit: cover;
    object-position: top center;
    /* Elliptical radii keep the corner circular on a non-square box. */
    border-radius: 13.7% / 6.3%;
    background: var(--bg-sink);
}

/* Sits above the screenshot so the bezel and Dynamic Island render on top. */
.phone-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* — Arrows — */
.showcase-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.showcase-nav button {
    appearance: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg);
    color: var(--fg-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.showcase-nav button:hover {
    background: var(--bg-soft);
    color: var(--fg);
    border-color: var(--fg-faint);
}

.showcase-nav button:disabled { opacity: .35; cursor: default; }
.showcase-nav button:disabled:hover { background: var(--bg); color: var(--fg-muted); }

.showcase-count {
    font-size: 0.82rem;
    color: var(--fg-faint);
    font-variant-numeric: tabular-nums;
    min-width: 3.2rem;
    text-align: center;
}

/* — Copy panels, stacked in one grid cell and cross-faded — */
.panels { display: grid; }

.panel {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .3s ease, transform .3s ease, visibility .3s;
}

.panel[data-active="true"] {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.panel-eyebrow {
    display: block;
    font-size: 0.76rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.panel h3 {
    font-size: 1.5rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin: 0 0 0.6rem;
}

.panel p {
    color: var(--fg-muted);
    margin-bottom: 1rem;
}

.panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.94rem;
    color: var(--fg-muted);
}

.panel li {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 0.45rem;
}

/* Brand-gradient tick, drawn in CSS so there is no icon font to load. */
.panel li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 0.62rem;
    height: 0.34rem;
    border-left: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg);
    border-radius: 1px;
}

/* ── Feature strip ──────────────────────────────────────────────── */

.strip {
    margin: 4.5rem 0 0;
    padding: 2rem 0 0;
    border-top: 1px solid var(--border);
}

/* ── Motion & responsive ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .phone-track { scroll-behavior: auto; }
    .panel { transition: none; transform: none; }
    .btn, nav.site a, .showcase-tabs button { transition: none; }
}

@media (max-width: 820px) {
    /* Items must stay stretched: `justify-items: center` would shrink the
       scroll track to its content width and collapse the phone. Centring is
       done inside each item instead. */
    .showcase-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.75rem;
    }
    .panels {
        text-align: center;
        max-width: 30rem;
        margin-inline: auto;
    }
    .panel ul { display: inline-block; text-align: left; }
    .phone { max-width: 258px; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    nav.site a { margin-left: 0; margin-right: 1rem; }
    header.site .wrap { padding-top: 0.5rem; padding-bottom: 0.5rem; }

    .hero-icon { width: 72px; height: 72px; border-radius: 19px; }
    .hero-actions .btn { flex: 1 1 auto; justify-content: center; }

    /* Keep all four on one row rather than orphaning "Study" on a second
       line. overflow-x is the safety valve for very narrow screens. */
    .showcase-tabs {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .showcase-tabs::-webkit-scrollbar { display: none; }
    .showcase-tabs button { padding: 0.38rem 0.55rem; font-size: 0.78rem; }

    .phone { max-width: 232px; }
}
