*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-system);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.15s ease;
}
a:hover { opacity: 0.8; }

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

h1, h2, h3, h4 {
    margin: 0 0 var(--s-3);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
p { margin: 0 0 var(--s-4); color: var(--text-2); }

/* ---------- Animated background (matches DynamicBackground) ---------- */
#bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(ellipse at top, #14110C 0%, #000 60%);
    pointer-events: none;
}
#bg::before, #bg::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    will-change: transform;
}
#bg::before {
    width: 90vw; height: 90vw;
    left: 10vw; top: -25vh;
    background: var(--accent);
    opacity: 0.28;
    animation: drift-a 28s ease-in-out infinite alternate;
}
#bg::after {
    width: 85vw; height: 85vw;
    right: 12vw; bottom: -30vh;
    background: var(--accent-2);
    opacity: 0.18;
    animation: drift-b 34s ease-in-out infinite alternate;
}
@keyframes drift-a {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-10vw, 7vh); }
}
@keyframes drift-b {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(10vw, -8vh); }
}
body.bg-paused #bg::before, body.bg-paused #bg::after {
    animation-play-state: paused;
}

/* ---------- Navbar ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(0, 0, 0, 0.55);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: var(--w-page);
    margin: 0 auto;
    padding: var(--s-3) var(--s-5);
    display: flex;
    align-items: center;
    gap: var(--s-5);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}
/* The icons already include the "enve" wordmark, so we hide the duplicate
   text label in the navbar and footer brand and rely on the logo. */
.brand > span { display: none; }
img.brand-mark, .brand-mark {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    border-radius: 9px;
    box-shadow: 0 0 18px var(--accent-soft);
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent) 0%, #C26A0E 100%);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
a.brand:hover .brand-mark {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 0 24px var(--accent-glow),
                0 4px 14px rgba(245, 146, 26, 0.35);
    filter: brightness(1.08);
}
a.brand:active .brand-mark {
    transform: translateY(0) scale(0.98);
}
a.brand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 12px;
}
.nav-links {
    display: flex;
    gap: var(--s-4);
    margin-left: auto;
    align-items: center;
}
.nav-links a {
    color: var(--text-2);
    font-size: 0.93rem;
    font-weight: 500;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-sm);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); opacity: 1; }
.nav-cta {
    background: var(--accent) !important;
    color: #1a1108 !important;
    font-weight: 600 !important;
    padding: var(--s-2) var(--s-4) !important;
    border-radius: var(--r-pill) !important;
}
.nav-cta:hover { background: var(--accent-2) !important; opacity: 1 !important; }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: auto;
}

/* ---------- Layout primitives ---------- */
.wrap {
    max-width: var(--w-page);
    margin: 0 auto;
    padding: var(--s-7) var(--s-5);
}
.wrap-narrow {
    max-width: var(--w-narrow);
    margin: 0 auto;
    padding: var(--s-7) var(--s-5);
}
section { padding: var(--s-8) 0; }
.section-eyebrow {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: var(--s-3);
}

/* ---------- Hero ---------- */
.hero {
    padding: var(--s-8) var(--s-5) var(--s-7);
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}
.hero h1 { margin-bottom: var(--s-4); }
.hero .lede {
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    color: var(--text-2);
    max-width: 640px;
    margin: 0 auto var(--s-6);
}
.hero-ctas {
    display: flex;
    gap: var(--s-3);
    justify-content: center;
    flex-wrap: wrap;
}

/* Big hero logo that sits above the title on the landing page */
img.hero-logo {
    width: 112px !important;
    height: 112px !important;
    max-width: 112px !important;
    border-radius: 24px;
    margin: 0 auto var(--s-5);
    display: block;
    object-fit: cover;
    box-shadow: 0 18px 48px rgba(245, 146, 26, 0.28),
                0 0 0 1px var(--border);
}

/* Small page-header icon used on app pages */
img.page-logo {
    width: 76px !important;
    height: 76px !important;
    max-width: 76px !important;
    border-radius: 18px;
    margin: 0 auto var(--s-4);
    display: block;
    object-fit: cover;
    box-shadow: 0 10px 28px var(--accent-soft),
                0 0 0 1px var(--border);
}

/* Provider logo strip: a tidy row of server logos. */
.providers {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-4) var(--s-6);
    justify-content: center;
    align-items: center;
    padding: var(--s-5) var(--s-4);
}
.providers img {
    height: 32px !important;
    width: auto !important;
    max-width: 110px !important;
    max-height: 32px !important;
    object-fit: contain;
    filter: grayscale(0.4) brightness(0.95);
    opacity: 0.85;
    transition: filter 0.2s ease, opacity 0.2s ease;
}
.providers img:hover {
    filter: none;
    opacity: 1;
}

/* ---------- Phone screenshots ---------- */
/* iPhone-shaped screenshot container with rounded corners and shadow. */
.phone {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1260 / 2736;
    margin: 0 auto;
    border-radius: 28px;
    overflow: hidden;
    background: var(--surface);
    box-shadow:
        0 0 0 1px var(--border-strong),
        0 30px 80px rgba(0, 0, 0, 0.55),
        0 0 60px rgba(245, 146, 26, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.phone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.phone:hover {
    transform: translateY(-4px);
    box-shadow:
        0 0 0 1px var(--accent-soft),
        0 36px 90px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(245, 146, 26, 0.18);
}
.phone-sm { max-width: 220px; }
.phone-lg { max-width: 340px; }

/* E-ink phone variant: light background, sharp border, no orange glow,
   and the real BigMe tablet aspect ratio (~3:4). Larger than an iPhone
   because the physical device is larger. */
.phone.eink {
    aspect-ratio: 1072 / 1448;
    max-width: 100%;     /* take the grid cell, no shrink */
    width: 100%;
    border-radius: 20px;
    background: #ffffff;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.18),
        0 20px 60px rgba(0, 0, 0, 0.4);
}
.phone.eink:hover {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.25),
        0 28px 70px rgba(0, 0, 0, 0.5);
}

/* When an e-ink tour-row needs the items wider, override the parent grid */
.tour-row.eink-row {
    grid-template-columns: repeat(2, minmax(0, 420px));
    justify-content: center;
}
.tour-row.eink-row.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 360px));
}
@media (max-width: 900px) {
    .tour-row.eink-row { grid-template-columns: 1fr; }
    .tour-row.eink-row.cols-3 { grid-template-columns: 1fr; }
}

/* A row of phones with captions below */
.tour-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-6) var(--s-5);
    align-items: start;
    margin: var(--s-6) 0;
}
.tour-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tour-item {
    text-align: center;
}
.tour-item h4 {
    margin: var(--s-4) 0 6px;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.tour-item p {
    color: var(--text-3);
    font-size: 0.9rem;
    margin: 0;
}
@media (max-width: 700px) {
    .tour-row, .tour-row.cols-3 { grid-template-columns: 1fr; }
}

/* Hero screenshot variant: phone tilted slightly */
.hero-phone-stack {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--s-4);
    margin: 0 auto var(--s-6);
    max-width: 760px;
}
.hero-phone-stack .phone {
    max-width: 240px;
    flex: 0 0 auto;
}
.hero-phone-stack .phone:nth-child(1) {
    transform: rotate(-4deg) translateY(8px);
    opacity: 0.78;
    max-width: 200px;
}
.hero-phone-stack .phone:nth-child(2) {
    z-index: 2;
    box-shadow:
        0 0 0 1px var(--accent-soft),
        0 36px 100px rgba(0, 0, 0, 0.65),
        0 0 100px rgba(245, 146, 26, 0.22);
}
.hero-phone-stack .phone:nth-child(3) {
    transform: rotate(4deg) translateY(8px);
    opacity: 0.78;
    max-width: 200px;
}
@media (max-width: 700px) {
    .hero-phone-stack .phone:nth-child(1),
    .hero-phone-stack .phone:nth-child(3) {
        display: none;
    }
    .hero-phone-stack .phone:nth-child(2) {
        max-width: 220px;
    }
}

/* Provider tile used inside server cards in the docs */
.provider-row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}
.provider-row img {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 4px;
}
.provider-row h2, .provider-row h3 {
    margin: 0;
}

/* ---------- Buttons / pills ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-5);
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    color: var(--text);
}
.btn:hover { transform: translateY(-1px); opacity: 1; }
.btn-primary {
    background: var(--accent);
    color: #1a1108;
    box-shadow: 0 8px 28px rgba(245, 146, 26, 0.35);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
    color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--border-strong); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.pill-muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-2);
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.card-link { color: inherit; display: block; }
.card-link:hover {
    border-color: var(--accent-soft);
    background: var(--surface-2);
    transform: translateY(-2px);
    opacity: 1;
}
.card h3 { color: var(--text); margin-bottom: var(--s-2); }
.card p { color: var(--text-2); margin-bottom: 0; }

.card-glow {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-glow);
}

/* ---------- Grid ---------- */
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- App tile (landing page apps grid) ---------- */
.app-tile {
    position: relative;
    overflow: hidden;
    padding: var(--s-6);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    transition: border-color 0.18s ease, transform 0.18s ease;
    color: inherit;
    display: block;
}
.app-tile:hover {
    border-color: var(--accent-soft);
    transform: translateY(-3px);
    opacity: 1;
}
img.app-tile .icon, .app-tile img.icon, .app-tile .icon {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--accent-soft);
    margin-bottom: var(--s-4);
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent), #B65E0C);
    display: block;
}
.app-tile h3 { font-size: 1.4rem; margin-bottom: 4px; }
.app-tile .platform {
    color: var(--text-3);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--s-3);
}
.app-tile p { color: var(--text-2); margin-bottom: var(--s-4); }
.app-tile .more {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.92rem;
}

/* ---------- Feature list with bullets ---------- */
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li {
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    color: var(--text-2);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 9px;
    flex-shrink: 0;
}
.feature-list strong { color: var(--text); font-weight: 600; }

/* ---------- Stats row ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-4);
    padding: var(--s-5) 0;
}
.stat { text-align: center; }
.stat .num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.stat .label {
    font-size: 0.82rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
@media (max-width: 700px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Compare table ---------- */
.compare {
    width: 100%;
    border-collapse: collapse;
    margin: var(--s-5) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface);
}
.compare th, .compare td {
    padding: var(--s-3) var(--s-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.94rem;
}
.compare th {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.compare td { color: var(--text-2); }
.compare tr:last-child td { border-bottom: none; }
.compare .yes { color: var(--accent); font-weight: 600; }
.compare .no { color: var(--text-3); }
.compare-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Docs sidebar layout ---------- */
.docs-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--s-6);
    max-width: var(--w-page);
    margin: 0 auto;
    padding: var(--s-6) var(--s-5);
}
.docs-side {
    position: sticky;
    top: 80px;
    align-self: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-4);
}
.docs-side h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-3);
    margin: var(--s-3) 0 var(--s-2);
}
.docs-side h4:first-child { margin-top: 0; }
.docs-side ul { list-style: none; padding: 0; margin: 0; }
.docs-side a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 0.92rem;
}
.docs-side a:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.docs-side a.active { background: var(--accent-soft); color: var(--accent); }
.docs-main { min-width: 0; }
.docs-main h1 { font-size: 2.2rem; }
.docs-main h2 { margin-top: var(--s-7); }
.docs-main h3 { margin-top: var(--s-5); }
.docs-main p, .docs-main li { color: var(--text-2); }
.docs-main code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.88em;
    color: var(--accent-2);
    font-family: "SF Mono", ui-monospace, Menlo, monospace;
}
.docs-main ul { padding-left: var(--s-4); }
.docs-main li { padding: 4px 0; }
.callout {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: var(--s-4);
    border-radius: var(--r-md);
    margin: var(--s-4) 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout-title {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

@media (max-width: 900px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-side { position: static; }
}

/* ---------- FAQ ---------- */
.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    overflow: hidden;
}
.faq-item summary {
    padding: var(--s-4);
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: 400;
    transition: transform 0.2s ease;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-body { padding: var(--s-4); color: var(--text-2); }
.faq-body p:last-child { margin-bottom: 0; }
.faq-body ul { padding-left: var(--s-4); margin: 0; }

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    margin-top: var(--s-8);
    padding: var(--s-6) var(--s-5);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
}
.footer-inner {
    max-width: var(--w-page);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: var(--s-6);
}
.footer h5 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-3);
    margin: 0 0 var(--s-3);
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { padding: 4px 0; }
.footer a { color: var(--text-2); font-size: 0.92rem; }
.footer a:hover { color: var(--accent); opacity: 1; }
.footer-legal {
    max-width: var(--w-page);
    margin: var(--s-6) auto 0;
    padding-top: var(--s-4);
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s-3);
}
@media (max-width: 760px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ---------- Mobile nav ---------- */
@media (max-width: 820px) {
    .nav-toggle { display: block; }
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.92);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        padding: var(--s-3);
        gap: 0;
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-links a { width: 100%; padding: var(--s-3) var(--s-4); }
}
