/* =========================================================================
   Lennett Fitness — Application stylesheet
   v15 buildout — refined typography (Inter + Audiowide), dual themes:
     - LIGHT  : DFYNE-style editorial black/white with a pink accent
     - DARK   : cinematic radial pink-glow over deep purple-black
   ========================================================================= */

/* ---------------- Fonts ---------------- */
@font-face {
    font-family: 'Audiowide';
    src: url('/static/fonts/audiowide-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'Inter Variable';
    src: url('/static/fonts/inter-variable.woff2') format('woff2-variations'),
         url('/static/fonts/inter-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

.brand-font {
    font-family: 'Audiowide', 'Eurostile', 'Bank Gothic', system-ui, sans-serif;
    letter-spacing: 0.04em;
}

/* Set Inter as the default body font everywhere except where brand-font wins. */
html, body {
    font-family: 'Inter Variable', 'Inter', system-ui, -apple-system,
                 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Editorial display class — apply to module page H1s. Tight tracking, heavy
   weight, slight optical-size feel. */
.display {
    font-family: 'Inter Variable', 'Inter', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.display-sm {
    font-family: 'Inter Variable', 'Inter', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* Eyebrow — small uppercase tracked-out label above section titles. */
.eyebrow {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-ink-soft);
}


/* =========================================================================
   THEME TOKENS
   Reading the body via CSS custom properties so all components can lean on
   a tiny vocabulary regardless of theme. Switching themes is one class
   change on <html>.
   ========================================================================= */

/* Light (default) */
:root {
    --c-bg:        #fafafa;
    --c-surface:   #ffffff;
    --c-surface-2: #f4f4f5;
    --c-ink:       #0a0a0a;
    --c-ink-soft:  #525252;
    --c-ink-faint: #a3a3a3;
    --c-divider:   #e5e5e5;
    --c-divider-strong: #d4d4d8;
    --c-pink:      #ec4899;
    --c-pink-soft: #fce7f3;
    --c-cta:       #0a0a0a;          /* DFYNE-style black primary button */
    --c-cta-on:    #ffffff;
    --shadow-card: 0 1px 0 0 #e5e5e5, 0 4px 12px -8px rgba(0,0,0,0.08);
}

/* Dark — cinematic */
html.dark {
    --c-bg:        #0f0f12;
    --c-surface:   #16161c;
    --c-surface-2: #1c1d22;
    --c-ink:       #f5f5f7;
    --c-ink-soft:  #a3a3ad;
    --c-ink-faint: #6b6b75;
    --c-divider:   rgba(255,255,255,0.10);
    --c-divider-strong: rgba(255,255,255,0.18);
    --c-pink:      #ec4899;
    --c-pink-soft: rgba(236,72,153,0.15);
    --c-cta:       #ec4899;          /* Pink primary CTAs in dark mode */
    --c-cta-on:    #ffffff;
    --shadow-card: 0 0 0 1px rgba(255,255,255,0.05), 0 8px 30px -10px rgba(0,0,0,0.6);
    /* Tells Chromium to draw native form widgets (select dropdowns,
       date pickers, scrollbars, autofill, etc.) in dark mode so they
       don't flash white over the cinematic background. */
    color-scheme: dark;
}
html:not(.dark) {
    color-scheme: light;
}

/* Native <select> options inherit OS chrome by default. Force them
   onto the same surface as our other dark fields so the Meal /
   Timezone / etc. dropdowns don't open as bright white panels. */
html.dark select option,
html.dark select optgroup {
    background-color: #16161c;
    color: #f5f5f7;
}
html.dark select option:checked,
html.dark select option:hover {
    background-color: rgba(236, 72, 153, 0.25);
    color: #ffffff;
}

body {
    background: var(--c-bg);
    color: var(--c-ink);
    /* iOS safe-area: handled natively now that viewport-fit=cover is
       removed from the meta tag. Page renders below the status bar
       automatically — no manual env() padding needed. The cinematic
       gradient still spans the full visible area; we just lose the
       under-the-status-bar bleed (worth it: the mobile hamburger menu
       is always reachable now). */
}

/* Cinematic radial gradient on the dark theme body — the look the user
   loved on the login page, dialed back so authenticated content stays
   readable on top. */
html.dark body {
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(236, 72, 153, 0.22), transparent 60%),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(236, 72, 153, 0.12), transparent 65%),
        linear-gradient(135deg, #1a0712 0%, #0a0a0a 70%) !important;
    background-attachment: fixed !important;
}


/* =========================================================================
   COMPONENTS — small, named primitives the templates can compose.
   ========================================================================= */

/* Card */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-divider);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}
.card-flat {
    background: var(--c-surface);
    border: 1px solid var(--c-divider);
    border-radius: 14px;
}
.card-hover {
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    border-color: var(--c-divider-strong);
    box-shadow: 0 12px 30px -12px rgba(0,0,0,0.12);
}
html.dark .card-hover:hover {
    box-shadow: 0 12px 40px -10px rgba(236,72,153,0.25);
}

/* Hairline divider — DFYNE editorial vibe in light mode */
.hairline { height: 1px; background: var(--c-divider); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.01em;
    transition: background 150ms ease, transform 80ms ease, border-color 150ms ease;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--c-cta);
    color: var(--c-cta-on);
}
.btn-primary:hover { filter: brightness(0.92); }
.btn-pink {
    background: var(--c-pink);
    color: #ffffff;
}
.btn-pink:hover { background: #db2777; }
.btn-ghost {
    background: transparent;
    color: var(--c-ink);
    border-color: var(--c-divider-strong);
}
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger {
    background: transparent;
    color: #b91c1c;
    border-color: #fecaca;
}
html.dark .btn-danger {
    color: #fca5a5;
    border-color: rgba(252,165,165,0.3);
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* Form inputs (general — different from .lf-input which is for login bg) */
.field {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--c-surface);
    border: 1px solid var(--c-divider-strong);
    color: var(--c-ink);
    font-size: 15px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.field::placeholder { color: var(--c-ink-faint); }
.field:focus {
    outline: none;
    border-color: var(--c-pink);
    box-shadow: 0 0 0 3px rgba(236,72,153,0.15);
}
html.dark .field {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
}
html.dark .field:focus {
    background: rgba(255,255,255,0.08);
    border-color: var(--c-pink);
}
.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

/* Pills + tags */
.pill {
    display: inline-flex; align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    background: var(--c-surface-2);
    color: var(--c-ink-soft);
    border: 1px solid var(--c-divider);
}
.pill-pink {
    background: var(--c-pink-soft);
    color: var(--c-pink);
    border-color: transparent;
}
html.dark .pill-pink { color: #f9a8d4; }

/* Hero section — used at the top of module pages with optional bg image/video.
   Compact on desktop so module content lands above the fold on a typical
   laptop viewport (~640-720px usable). Mobile gets more breathing room. */
.module-hero {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 200px;
    background: var(--c-surface);
}
@media (min-width: 1024px) {
    .module-hero {
        min-height: 130px;
        margin-bottom: 16px;
    }
}
.module-hero-bg {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.85;
}
.module-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.30) 100%);
}
html.dark .module-hero-overlay {
    background: linear-gradient(135deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.45) 100%);
}
.module-hero-content {
    position: relative;
    color: #ffffff;
    padding: 28px;
    z-index: 1;
}
@media (min-width: 1024px) {
    .module-hero-content {
        padding: 18px 28px;
    }
}
.module-hero-content .eyebrow { color: rgba(255,255,255,0.65); }


/* =========================================================================
   Login screen helpers (kept here so the login templates can still import
   one stylesheet). The cinematic dark look is the only treatment for login
   regardless of authenticated theme — it's a brand moment.
   ========================================================================= */
.lf-input {
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    caret-color: #ec4899;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.lf-input::placeholder { color: rgba(255, 255, 255, 0.45); opacity: 1; }
.lf-input:hover { background-color: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.28); }
.lf-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.16);
    border-color: #ec4899;
    box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.40);
}
.lf-input:-webkit-autofill,
.lf-input:-webkit-autofill:hover,
.lf-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(40, 20, 30, 0.85) inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s;
}

/* ---------------------------------------------------------------------------
   Phone polish — universal improvements that help across all modern phones
   regardless of make/model.
   --------------------------------------------------------------------------- */

/* Use dvh on the login layout. Mobile Safari counts the URL bar towards 100vh
   which causes the hero to clip when the bar is visible vs hidden. dvh is
   the "dynamic" viewport unit that adjusts. */
.login-bg, .login-video, .login-overlay {
    height: 100dvh;
}
@supports not (height: 100dvh) {
    .login-bg, .login-video, .login-overlay { height: 100vh; }
}

/* Safe-area insets — keeps fixed elements clear of the iPhone notch and the
   bottom home indicator. The mobile top bar, the sidebar drawer, and the
   iOS install banner all benefit. */
@supports (padding: max(0px)) {
    body { padding-bottom: env(safe-area-inset-bottom); }
    .safe-bottom { padding-bottom: max(env(safe-area-inset-bottom), 0.5rem); }
    .safe-top { padding-top: max(env(safe-area-inset-top), 0.5rem); }
}

/* Fluid display headings — hero h1s scale with viewport instead of jumping
   between fixed Tailwind sizes. clamp(min, preferred, max) keeps small
   phones from oversized text and large phones from undersized text. */
.display {
    font-size: clamp(1.5rem, 6.5vw, 2.5rem);
    font-family: 'Inter Variable', 'Inter', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
@media (min-width: 1024px) {
    .display { font-size: 2rem; }     /* dialed back from 2.5rem so the
                                         hero heading doesn't dominate
                                         desktop viewports */
}
.display-sm {
    font-size: clamp(1.125rem, 4.5vw, 1.5rem);
    font-family: 'Inter Variable', 'Inter', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.015em;
}
@media (min-width: 1024px) {
    .display-sm { font-size: 1.5rem; }
}

/* htmx swap animations */
.htmx-swapping { opacity: 0; transition: opacity 150ms ease-out; }
.htmx-settling { opacity: 1; transition: opacity 150ms ease-in; }

/* Subtle card lift used on legacy dashboard tiles — kept for compatibility */
.card-lift { transition: transform 200ms ease, box-shadow 200ms ease; }
.card-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -12px rgba(236, 72, 153, 0.25);
}

/* Number ticker — rest timer countdown overlay */
.tabular { font-variant-numeric: tabular-nums; }
