:root {
    color-scheme: light;
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #6e6e73;
    --bg-white: #ffffff;
    --bg-gray: #f5f5f7;
    --accent: #C2410C;
    --accent-hover: #9A3412;
    --accent-light: #FFF7ED;
    /* High-contrast orange for text and filled controls. */
    --accent-strong: #C2410C;
    --green: #1DB954;
    --blue: #0071e3;
    --nav-h: 120px;
    --section-pad: clamp(80px, 12vw, 140px);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.53;
    color: var(--text-primary);
    background: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* =============================================
   TYPOGRAPHY: APPLE-SCALE
   ============================================= */
.headline-hero {
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.025em;
}
.headline-section {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.07;
    letter-spacing: -0.02em;
}
.headline-feature {
    font-size: clamp(24px, 3.5vw, 40px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.015em;
}
.headline-subsection {
    font-size: clamp(19px, 2vw, 24px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.body-large {
    font-size: clamp(17px, 1.5vw, 21px);
    line-height: 1.5;
    color: var(--text-secondary);
}
.body-elevated {
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.5;
    color: var(--text-secondary);
}
.eyebrow {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--accent);
}
.caption {
    font-size: 14px;
    color: var(--text-tertiary);
    line-height: 1.43;
}

/* =============================================
   LAYOUT
   ============================================= */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}
.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}
.container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}
.text-center { text-align: center; }
.section { padding: var(--section-pad) 0; }
.section-gray { background: var(--bg-gray); }

.skip-link {
    position: absolute; top: -100%; left: 16px; z-index: 10000;
    padding: 10px 20px; background: var(--accent); color: #fff;
    border-radius: 8px; font-size: 14px; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--nav-h);
    background: rgba(251, 251, 253, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}
.nav-logo {
    display: flex;
    align-items: center;
}
.nav-logo img { height: 52px; width: auto; }
.nav-links { display: flex; gap: clamp(16px, 1.9vw, 24px); }
.nav-links a {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.store-badge img { display: block; }

/* =============================================
   THIRD-PARTY IMAGE FALLBACK
   External images include the badges from developer.apple.com
   and the headshot from moosen.app; the brand logo is local.
   A blocker or a CDN outage would otherwise erase the wordmark and every
   download button, on the one site whose audience most reliably runs
   blockers. Script tags the anchor, CSS substitutes real text.
   ============================================= */
.store-badge.img-failed img,
.nav-logo.img-failed img { display: none; }
.store-badge.img-failed::after {
    content: attr(aria-label);
    display: inline-flex; align-items: center;
    min-height: 44px; padding: 0 20px;
    background: #1d1d1f; color: #fff;
    border-radius: 10px;
    font-size: 14px; font-weight: 600; text-align: center;
}
.nav-logo.img-failed::after {
    content: "MoosePad";
    font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text-primary);
}
.nav-mobile {
    display: none; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 5px; width: 44px; height: 44px;
    margin-right: -13px; /* keeps the bars optically flush with the container edge */
    z-index: 10;
}
.nav-mobile span {
    display: block; width: 18px; height: 1.5px; background: var(--text-primary);
    transition: all 0.3s;
}
.nav-mobile[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(4px, 4.5px); }
.nav-mobile[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-mobile[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4.5px); }
/* Must stay a direct child of <body>. Nested inside .site-nav, that element's
   backdrop-filter becomes this fixed element's containing block, so inset:0
   resolves to the 60px nav box instead of the viewport and the panel paints
   only a strip of background while its links spill over the live page. */
.mobile-menu {
    display: none; position: fixed; inset: 0;
    background: var(--bg-white); z-index: 999;
    padding: calc(var(--nav-h) + 24px) 24px
             max(24px, env(safe-area-inset-bottom));
    flex-direction: column; gap: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.mobile-menu.open { display: flex; }
/* Direct children only: the store badges are anchors too and should not
   inherit the 28px row treatment or the divider. */
.mobile-menu > a {
    padding: 16px 0; font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em; color: var(--text-primary);
    border-bottom: 0.5px solid rgba(0,0,0,0.06);
}
/* Keep the mobile menu usable in short windows. */
@media (max-height: 560px) {
    .mobile-menu { gap: 0; }
    .mobile-menu > a { padding: 10px 0; font-size: 20px; }
}

.site-footer {
    padding: 20px 0;
    background: var(--bg-gray);
    border-top: 0.5px solid rgba(0,0,0,0.06);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    font-size: 12px;
    color: var(--text-tertiary);
}
.footer-left { display: flex; align-items: center; gap: 6px; }
.footer-left svg { width: 18px; height: 18px; color: var(--accent); }
/* nowrap here overflowed the 375px viewport (iPhone SE, 13 mini) by 3px */
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 20px; row-gap: 2px; }
.footer-links a { transition: color 0.2s; }
.footer-links a:hover { color: var(--text-primary); }
.footer-social { display: inline-flex; align-items: center; }
.footer-social svg { width: 18px; height: 18px; vertical-align: middle; }
.footer-right span { color: #e25555; }

.nav-links [aria-current], .mobile-menu [aria-current] { color: var(--accent); }
.mobile-store-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

@media (min-width: 1024px) and (max-width: 1119px) {
    .nav-logo img { height: 44px; }
}

@media (width < 1024px) {
    :root { --nav-h: 60px; }
    .nav-logo img { height: 40px; }
    .nav-links, .nav-cta { display: none; }
    .nav-mobile { display: flex; }
}

@media (max-width: 768px) {
    :root { --section-pad: 64px; }
    .footer-inner { flex-direction: column; text-align: center; }
}

@media (width < 1024px), (pointer: coarse) {
    .footer-links a, .skip-link, .nav-logo, .store-badge, .nav-links a {
        min-height: 44px; display: inline-flex; align-items: center;
    }
    .footer-social { min-width: 44px; justify-content: center; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .site-nav { background: #fbfbfd; }
}

@media (forced-colors: active) {
    .store-badge.img-failed::after { border: 2px solid; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .nav-mobile span { transition: none; }
}
