/* ============================================================
   LUMATEXT — BRUTALIST DESIGN SYSTEM
   
   Visual language: bold type, thick borders, sharp corners,
   high-contrast black/white, intentional asymmetry.
   ============================================================ */

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

/* A class that sets `display` outranks the UA stylesheet's rule for the
   `hidden` attribute, so state-swapped blocks (e.g. the tool pages'
   input/processing/gate panels) need this to actually stay hidden. */
[hidden] {
    display: none !important;
}

/* ---- DESIGN TOKENS ---- */
:root {
    /* Palette */
    --black: #0a0a0a;
    --white: #fafafa;
    --gray-50: #f5f5f5;
    --gray-100: #ebebeb;
    --gray-200: #d6d6d6;
    --gray-300: #b8b8b8;
    --gray-400: #999;
    --gray-500: #777;
    --gray-600: #555;
    --gray-700: #333;
    --gray-800: #1a1a1a;
    --accent: #ff3d00;
    --accent-hover: #e63600;
    --accent-light: #fff0eb;
    --success: #00c853;
    --success-bg: #e6faf0;
    --warning: #ffd600;
    --error: #ff1744;
    --error-bg: #ffeaef;

    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Borders */
    --border-3: 3px solid var(--black);
    --border-2: 2px solid var(--black);
    --border-1: 1px solid var(--black);
    --border-accent: 3px solid var(--accent);
    --border-gray: 1px solid var(--gray-200);

    /* Radius — brutalist = sharp */
    --radius: 0px;
    --radius-sm: 2px;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;
    --sp-20: 80px;
    --sp-24: 96px;

    /* Layout */
    --max-width: 1200px;
    --nav-height: 64px;
    /* Side padding for every full-bleed section, site-wide. Narrowing
       the page on a phone is one override in the RESPONSIVE block
       below rather than one per stylesheet — so use var(--gutter),
       not a raw --sp-* value, for horizontal section padding. */
    --gutter: 24px;

    /* Transitions */
    --transition: 150ms ease;
}

/* ---- BASE ---- */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* iOS inflates text when a page is rotated to landscape unless
       this is pinned, which silently breaks every tuned font-size. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--black);
    background: var(--white);
    overflow-x: hidden;
    /* A long URL or email address in body copy would otherwise push
       its container wider than the phone and scroll the whole page. */
    overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

a {
    color: var(--black);
    text-decoration: none;
}

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

/* ---- NAVIGATION ---- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--white);
    border-bottom: var(--border-3);
    height: var(--nav-height);
}

.nav__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    text-decoration: none;
}

.nav__logo-mark {
    color: var(--accent);
    font-size: 18px;
}

.nav__menu {
    display: flex;
    align-items: center;
    gap: var(--sp-8);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
}

.nav__link {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: var(--sp-2) 0;
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition);
}

.nav__link:hover {
    border-bottom-color: var(--black);
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.nav__badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 2px 8px;
    border: var(--border-2);
}

.nav__badge--pro {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

/* Mobile toggle */
.nav__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--sp-2);
}

.nav__toggle-bar {
    width: 24px;
    height: 3px;
    background: var(--black);
    transition: all var(--transition);
}

/* ---- BUTTONS ---- */
.btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 14px 28px;
    border: var(--border-3);
    background: transparent;
    color: var(--black);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover {
    background: var(--black);
    color: var(--white);
}

.btn--primary {
    background: var(--black);
    color: var(--white);
}

.btn--primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white);
}

.btn--outline {
    background: transparent;
    color: var(--black);
}

.btn--outline:hover {
    background: var(--black);
    color: var(--white);
}

.btn--google {
    background: var(--white);
    border: var(--border-2);
    color: var(--black);
    gap: var(--sp-3);
}

.btn--google:hover {
    background: var(--gray-50);
    color: var(--accent);
    border-color: var(--accent);
}

.btn__icon {
    flex-shrink: 0;
}

.btn--sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn--lg {
    padding: 18px 36px;
    font-size: 16px;
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: var(--sp-5);
}

.form-label {
    display: block;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--sp-2);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 15px;
    border: var(--border-2);
    background: var(--white);
    color: var(--black);
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--gray-400);
}

/* ---- MESSAGES ---- */
.messages {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    z-index: 999;
}

.message {
    padding: var(--sp-4) var(--sp-6);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: var(--border-2);
}

.message--success {
    background: var(--success-bg);
    color: #006b2e;
}

.message--error,
.message--danger {
    background: var(--error-bg);
    color: #b71c1c;
}

.message--warning {
    background: #fff8e1;
    color: #8d6e00;
}

.message--info {
    background: #e3f2fd;
    color: #0d47a1;
}

.message__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
}

.message__close:hover {
    opacity: 1;
}

/* ---- MAIN CONTENT ---- */
.main {
    margin-top: var(--nav-height);
    min-height: calc(100vh - var(--nav-height));
}

/* ---- FOOTER ---- */
.footer {
    background: var(--black);
    color: var(--white);
    border-top: var(--border-3);
    /* Last thing on the page, so it clears the home-indicator bar. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--sp-16) var(--gutter) var(--sp-8);
}

.footer__top {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-12);
    margin-bottom: var(--sp-12);
}

.footer__logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.05em;
}

.footer__logo-mark {
    color: var(--accent);
}

.footer__tagline {
    margin-top: var(--sp-3);
    color: var(--gray-400);
    font-size: 14px;
}

.footer__links {
    display: flex;
    gap: var(--sp-16);
}

.footer__col {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.footer__heading {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    margin-bottom: var(--sp-2);
}

.footer__link {
    color: var(--gray-300);
    font-size: 14px;
    transition: color var(--transition);
}

.footer__link:hover {
    color: var(--white);
}

.footer__bottom {
    border-top: 1px solid var(--gray-700);
    padding-top: var(--sp-6);
    font-size: 13px;
    color: var(--gray-500);
}

/* ---- PLAN BADGES ---- */
.plan-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border: var(--border-2);
    text-transform: uppercase;
}

.plan-badge--pro,
.plan-badge--active {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.plan-badge--free {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.plan-badge--cancelled {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error);
}

.plan-badge--expired,
.plan-badge--past_due {
    background: #fff3e0;
    color: #e65100;
    border-color: #e65100;
}

/* ---- SECTION TITLE ---- */
.section-title {
    font-size: clamp(26px, 5.5vw, 56px);
    margin-bottom: var(--sp-12);
    text-transform: uppercase;
}

/* ---- RESPONSIVE ----
   Ladder used site-wide: 900 (tablet / app sidebar collapse), 768 (nav
   collapse), 600, 480 (phone), 380 (small phone). Per-page stylesheets
   reuse these same widths so breakpoints never disagree mid-page.
   ------------------------------------------------------------------ */

@media (max-width: 900px) {
    .section-title {
        margin-bottom: var(--sp-10);
    }
}

@media (max-width: 768px) {
    :root {
        --gutter: 20px;
    }

    .nav__toggle {
        display: flex;
        /* 24px of bars is a 40px tap target with this padding. */
        padding: var(--sp-3);
        margin-right: calc(-1 * var(--sp-3));
    }

    .nav__menu {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: var(--border-3);
        flex-direction: column;
        align-items: stretch;
        padding: var(--sp-4) var(--gutter) var(--sp-6);
        gap: var(--sp-4);
        /* A phone held in landscape is ~380px tall; without this the
           bottom of the menu sits under the fold with nothing to
           scroll, because the panel is positioned, not in flow. */
        max-height: calc(100vh - var(--nav-height));
        max-height: calc(100dvh - var(--nav-height));
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav__menu.nav__menu--open {
        display: flex;
    }

    .nav__links {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    /* A 13px link is a 17px-tall tap target left alone — under half
       the 44px minimum. Give each row real height in the drawer. */
    .nav__link {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: var(--sp-2) 0;
        border-bottom: 1px solid var(--gray-100);
    }

    .nav__actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-3);
        padding-top: var(--sp-4);
        border-top: var(--border-1);
        width: 100%;
    }

    .nav__actions .btn {
        width: 100%;
    }

    /* Under 16px, iOS Safari zooms the viewport on focus and never
       zooms back out, leaving the user scrolled sideways mid-form. */
    .form-input {
        font-size: 16px;
    }

    .message {
        padding: var(--sp-3) var(--gutter);
        font-size: 13px;
        gap: var(--sp-3);
        line-height: 1.4;
    }

    .message__close {
        padding: var(--sp-2);
        margin: calc(-1 * var(--sp-2));
        flex-shrink: 0;
    }

    .footer__inner {
        padding: var(--sp-12) var(--gutter) var(--sp-6);
    }

    .footer__top {
        flex-direction: column;
        gap: var(--sp-8);
        margin-bottom: var(--sp-8);
    }

    /* Two short link columns still fit side by side at this width —
       stacking them makes the footer twice as tall for no gain. */
    .footer__links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--sp-8) var(--sp-12);
    }

    /* 14px text is a 22px row; give each link real height now that
       they are stacked and thumb-driven. */
    .footer__link {
        display: inline-flex;
        align-items: center;
        min-height: 34px;
    }

    .faq {
        padding: var(--sp-16) var(--gutter);
    }
}

@media (max-width: 600px) {
    .section-title {
        margin-bottom: var(--sp-8);
    }

    .faq__question {
        font-size: 15px;
        padding: var(--sp-4) 0;
        gap: var(--sp-3);
    }

    .faq__toggle {
        margin-left: var(--sp-2);
    }

    .faq__answer p {
        font-size: 14px;
        padding-bottom: var(--sp-4);
    }
}

@media (max-width: 480px) {
    :root {
        --gutter: 16px;
        --nav-height: 56px;
    }

    .nav__logo {
        font-size: 17px;
    }

    .nav__logo-mark {
        font-size: 15px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 13px;
    }

    .btn--lg {
        padding: 15px 22px;
        font-size: 14px;
    }

    .btn--sm {
        padding: 9px 14px;
    }

    /* `.btn` is nowrap by default so labels never break mid-phrase on
       a toolbar. A full-width CTA is the exception: "CREATE FREE
       ACCOUNT →" cannot fit one 320px line, and nowrap would push it
       straight out of the card. */
    .btn--full,
    .btn--lg {
        white-space: normal;
    }

    .form-input {
        padding: 12px 14px;
    }

    .faq {
        padding: var(--sp-12) var(--gutter);
    }

    .footer__links {
        gap: var(--sp-6) var(--sp-8);
    }

    .footer__col {
        min-width: 130px;
    }

    .footer__bottom {
        padding-top: var(--sp-5);
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    body {
        font-size: 15px;
    }

    .btn {
        padding: 11px 16px;
        letter-spacing: 0.04em;
    }

    .nav__logo-text {
        letter-spacing: 0.02em;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Floating tooltip (JS-positioned, see showDataTooltip in main.js) —
   for any [data-tooltip] element. Global because it must escape
   scrolling/clipped ancestors anywhere on the site, not just one
   page's stylesheet.
   ══════════════════════════════════════════════════════════════════ */
.floating-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    max-width: 280px;
    padding: var(--sp-2) var(--sp-3);
    background: var(--black);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 120ms ease;
    z-index: 1000;
    display: none;
}

.floating-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--black);
}

.floating-tooltip--below::after {
    top: auto;
    bottom: 100%;
    transform: translateX(-50%) rotate(180deg);
}

.floating-tooltip--visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   SHARED PAGE PRIMITIVES
   Used by the home page and the public tool pages, which load
   different stylesheets — keep them here, not in landing.css.
   ============================================================ */

/* ---- FAQ ---- */
.faq {
    padding: var(--sp-20) var(--gutter);
    border-bottom: var(--border-3);
}

.faq__inner {
    max-width: 720px;
    margin: 0 auto;
}

.faq__list {
    display: flex;
    flex-direction: column;
}

.faq__item {
    border-bottom: var(--border-2);
}

.faq__question {
    width: 100%;
    padding: var(--sp-5) 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    color: var(--black);
}

.faq__toggle {
    font-size: 24px;
    font-weight: 400;
    color: var(--accent);
    transition: transform var(--transition);
    flex-shrink: 0;
    margin-left: var(--sp-4);
}

.faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease, padding 300ms ease;
}

.faq__answer p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-600);
    padding-bottom: var(--sp-5);
}

.faq__item--open .faq__answer {
    /* Ceiling, not a real height: a max-height transition needs a
       finite value, and at phone width a long answer runs well past
       the 300px this used to be — which silently clipped it. */
    max-height: 720px;
}

.faq__item--open .faq__toggle {
    transform: rotate(45deg);
}

/* ---- SCROLL REVEAL ---- */
/* Scoped to `html.js` (set by an inline script in base.html) so that a
   JS failure or a no-JS client shows the content rather than hiding it
   forever behind an animation that will never run. */
.js .reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.js .reveal--visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .js .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
