/* =========================================================
   Hadith Agent — Landing page
   Takhrij Hadith Lab
   Light is default. Dark via [data-theme="dark"].
   ========================================================= */

/* ---------- Hadith Agent wordmark font (from the chat UI: 'Collapse') ---------- */
@font-face {
    font-family: 'Collapse';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('assets/fonts/Collapse-Bold.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* Light theme (default) */
    --bg: #ffffff;
    --bg-alt: #f6f5f2;
    --surface: #ffffff;
    --surface-2: #f1f0ec;
    --text: #14130f;
    --text-soft: #4a4843;
    --text-mute: #7a776f;
    --border: #e6e3dc;
    --border-strong: #d6d2c8;
    --accent: #0053fd;
    --accent-soft: #2f74ff;
    --accent-ink: #0046d6;
    --on-accent: #ffffff;
    --shadow-sm: 0 1px 2px rgba(20, 19, 15, 0.06), 0 2px 8px rgba(20, 19, 15, 0.04);
    --shadow-md: 0 8px 30px rgba(20, 19, 15, 0.08);
    --shadow-lg: 0 24px 60px rgba(20, 19, 15, 0.12);
    --grid-line: rgba(20, 19, 15, 0.04);
    --nav-bg: rgba(255, 255, 255, 0.78);
    --accent-glow: rgba(0, 83, 253, 0.16);

    --maxw: 1160px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
    /* Obsidian-inspired: near-black canvas, violet accent, lots of quiet. */
    --bg: #0b0b0d;
    --bg-alt: #101013;
    --surface: #151518;
    --surface-2: #1b1b1f;
    --text: #dcddde;
    --text-soft: #b6b7ba;
    --text-mute: #76767c;
    --border: #232327;
    --border-strong: #313137;
    --accent: #0053fd;
    --accent-soft: #2f74ff;
    --accent-ink: #6f9bff;
    --on-accent: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
    --grid-line: rgba(255, 255, 255, 0.035);
    --nav-bg: rgba(11, 11, 13, 0.72);
    --accent-glow: rgba(0, 83, 253, 0.26);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.022em;
    margin: 0;
}

em { font-style: normal; color: var(--accent-ink); }

/* Brand wordmark — "Hadith Agent" set in the chat UI's Collapse face */
.wordmark {
    font-family: 'Collapse', var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-ink);
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: clamp(20px, 5vw, 40px);
}
.container-narrow { max-width: 800px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--on-accent);
    padding: 10px 16px;
    border-radius: 0 0 8px 0;
    z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- Eyebrow / titles ---------- */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin: 0 0 1rem;
    font-weight: 500;
}

.section { padding: clamp(64px, 9vw, 130px) 0; }
.section-alt { background: var(--bg-alt); }

.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-title {
    font-size: clamp(1.9rem, 4.4vw, 3.1rem);
}
.section-sub {
    margin: 1.2rem 0 0;
    color: var(--text-soft);
    font-size: 1.08rem;
    max-width: 620px;
}

.lead {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2.05rem);
    line-height: 1.32;
    font-weight: 400;
    color: var(--text);
    max-width: 940px;
    margin: 0 0 clamp(48px, 6vw, 80px);
    letter-spacing: -0.01em;
}

/* ---------- Buttons ---------- */
.btn {
    --btn-pad-y: 0.72rem;
    --btn-pad-x: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: var(--btn-pad-y) var(--btn-pad-x);
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s var(--ease), background-color 0.2s var(--ease),
                border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 0.9em; }

.btn-sm { --btn-pad-y: 0.55rem; --btn-pad-x: 1rem; font-size: 0.88rem; }
.btn-lg { --btn-pad-y: 0.95rem; --btn-pad-x: 1.7rem; font-size: 1.02rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-soft); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--text); transform: translateY(-2px); background: var(--surface-2); }

.btn-disabled {
    background: transparent;
    color: var(--text-mute);
    border-color: var(--border);
    cursor: not-allowed;
    opacity: 0.85;
}
.btn-disabled:active { transform: none; }

/* ---------- Nav ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 68px;
}

.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 42px; width: auto; }

/* logo swap by theme */
.brand-logo--dark { display: none; }
[data-theme="dark"] .brand-logo--light { display: none; }
[data-theme="dark"] .brand-logo--dark { display: block; }

.nav-links {
    display: flex;
    gap: 1.6rem;
    list-style: none;
    margin: 0 auto 0 1.2rem;
    padding: 0;
}
.nav-links a {
    font-size: 0.95rem;
    color: var(--text-soft);
    font-weight: 500;
    transition: color 0.2s var(--ease);
    position: relative;
}
.nav-links a:hover { color: var(--text); }

.nav-item.has-submenu {
    position: relative;
}
.nav-submenu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-soft);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s var(--ease);
}
.nav-submenu-toggle:hover,
.nav-submenu-toggle.is-active,
.nav-item.has-submenu.is-open > .nav-submenu-toggle {
    color: var(--text);
}
.nav-submenu-toggle .fa-chevron-down {
    font-size: 0.65rem;
    opacity: 0.7;
    transition: transform 0.2s var(--ease);
}
.nav-item.has-submenu.is-open > .nav-submenu-toggle .fa-chevron-down {
    transform: rotate(180deg);
}
.nav-submenu {
    list-style: none;
    margin: 0;
    padding: 0.45rem;
    position: absolute;
    /* Flush to trigger; visual gap via ::before so hover never drops in the gap */
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
    z-index: 120;
}
/* Invisible hover bridge between the Product label and the panel */
.nav-submenu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}
.nav-item.has-submenu.is-open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.nav-submenu a {
    display: block;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    white-space: nowrap;
}
.nav-submenu a:hover,
.nav-submenu a[aria-current="page"] {
    color: var(--text);
    background: var(--bg-alt);
}

.nav-actions { display: flex; align-items: center; gap: 0.7rem; }

.nav-signin {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-soft);
    padding: 0.4rem 0.5rem;
}
.nav-signin:hover { color: var(--text); }

/* ---------- Auth dropdown (signed-in nav) ---------- */
#nav-auth-root { display: inline-flex; align-items: center; }

.nav-auth-user { position: relative; display: inline-flex; }

.nav-auth-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.32rem 0.7rem 0.32rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-auth-trigger:hover { border-color: var(--border-strong); background: var(--bg-alt); }

.nav-auth-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    flex: none;
    letter-spacing: 0.02em;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.nav-auth-avatar--img { background-color: #141416; }

.nav-auth-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-auth-trigger .fa-chevron-down { transition: transform 0.2s var(--ease); }
.nav-auth-trigger[aria-expanded="true"] .fa-chevron-down { transform: rotate(180deg); }

.nav-auth-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 224px;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: navAuthIn 0.16s var(--ease);
}
.nav-auth-menu[hidden] { display: none; }

@keyframes navAuthIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-auth-menu a,
.nav-auth-menu button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-auth-menu a:hover,
.nav-auth-menu button:hover { background: var(--bg-alt); color: var(--text); }
.nav-auth-menu a i,
.nav-auth-menu button i { width: 1rem; text-align: center; opacity: 0.7; font-size: 0.85rem; }

.nav-auth-menu-divider { height: 1px; background: var(--border); margin: 0.35rem 0.25rem; }
.nav-auth-menu #nav-auth-signout { color: #e5484d; }
.nav-auth-menu #nav-auth-signout:hover { background: rgba(229, 72, 77, 0.1); color: #e5484d; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle i { position: absolute; transition: opacity 0.25s var(--ease), transform 0.3s var(--ease); }
.theme-toggle .fa-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.theme-toggle .fa-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .fa-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .fa-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 8px;
}
.nav-burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    isolation: isolate;
    padding: clamp(70px, 12vw, 150px) 0 clamp(56px, 9vw, 110px);
    overflow: hidden;
}

/* Minimal full-height hero — just the brand wordmark centered */
.hero--wordmark {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(80px, 10vw, 120px) 0;
}

.hero-wordmark-wrap {
    position: relative;
    z-index: 1;
    text-align: center;
    padding-inline: clamp(20px, 5vw, 40px);
}
.hero--wordmark .hero-backdrop__filler,
.hero--wordmark .hero-backdrop__noise,
.hero-brand-name,
.hero-brand-tagline,
.section-intro .hero-backdrop__filler { will-change: transform, opacity; }

.hero-brand-name {
    font-family: 'Collapse', var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 11vw, 9.5rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 0.95;
    white-space: nowrap;
    color: var(--text);
    margin: 0;
}

.hero-brand-tagline {
    margin: clamp(1.4rem, 3vw, 2.4rem) 0 0;
    font-family: var(--font-mono);
    font-size: clamp(0.82rem, 1.8vw, 1.12rem);
    letter-spacing: 0.14em;
    color: var(--text-mute);
    line-height: 1.55;
    min-height: 3.1em;
}
.hero-tagline-text {
    white-space: pre-line;
}

/* Typewriter caret */
.hero-tagline-text::after {
    content: '';
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    margin-left: 0.1em;
    vertical-align: -0.18em;
    background: var(--accent);
    animation: tagline-caret 1s steps(1) infinite;
}
/* Solid caret while actively typing, blink once finished */
.hero-tagline-text.is-typing::after { animation: none; opacity: 1; }
@keyframes tagline-caret { 50% { opacity: 0; } }

/* Scribe wallpaper positioning in the wordmark hero */
.hero--wordmark .hero-backdrop__filler img {
    object-position: center 25%;
    height: 160%;
}

/* ---------- Section intro (former hero pitch: heading + CTA + providers) ---------- */
.section-intro {
    padding: clamp(72px, 11vw, 140px) 0;
}
.section-intro-inner {
    max-width: 800px;
}
.section-intro .hero-actions {
    width: min(var(--maxw), calc(100vw - clamp(40px, 10vw, 80px)));
    max-width: none;
}
.section-intro .hero-cta .btn {
    width: auto;
    flex: 0 0 auto;
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-backdrop__filler {
    position: absolute;
    inset: 0;
    opacity: 0.045;
    mix-blend-mode: difference;
}

.hero-backdrop__filler img {
    display: block;
    width: auto;
    min-width: 100%;
    height: 145%;
    object-fit: cover;
    object-position: top 18% left;
    filter: invert(1);
}

/* Overview / intro — Sabil wallpaper behind the content */
.overview-section {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.overview-section .container {
    position: relative;
    z-index: 1;
}
.overview-section .hero-backdrop__filler {
    opacity: 0.052;
}
.overview-section .hero-backdrop__filler img {
    object-position: top 18% left;
    height: 155%;
}
.overview-section .hero-backdrop__noise {
    opacity: 0.09;
}

/* Light mode — the difference/invert treatment vanishes on white, so switch the
   wallpapers to a darkened multiply so they read as faint dark texture. */
html:not([data-theme="dark"]) .hero-backdrop__filler {
    opacity: 0.16;
    mix-blend-mode: multiply;
}
html:not([data-theme="dark"]) .hero-backdrop__filler img {
    filter: grayscale(1) contrast(1.06) brightness(0.92);
}
html:not([data-theme="dark"]) .overview-section .hero-backdrop__filler {
    opacity: 0.14;
}

.hero-backdrop__noise {
    position: absolute;
    inset: 0;
    opacity: 0.11;
    mix-blend-mode: color-dodge;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

.hero-inner {
    position: relative;
    z-index: 1;
    text-align: left;
}

.hero-title {
    font-size: clamp(2.1rem, 5.2vw, 3.7rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    margin: 0 0 1.3rem;
    max-width: 18ch;
}
.hero-sub {
    font-size: clamp(1.05rem, 2vw, 1.26rem);
    color: var(--text-soft);
    max-width: 600px;
    margin: 0 0 2.2rem;
    line-height: 1.55;
}

/* Hero actions — downloads grouped left, primary CTA at the right end, one line */
.hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
}
.hero-downloads { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0; }
.hero-actions .hero-cta { margin-left: auto; }
.hero-actions .btn { min-width: 250px; }

/* Final CTA reuses hero-actions layout (downloads left, try right) */
.final-cta-inner .hero-actions { width: 100%; }

@media (max-width: 760px) {
    .hero-actions { flex-direction: column; align-items: stretch; max-width: 440px; }
    .hero-actions .hero-cta { order: -1; margin-left: 0; }
    .hero-actions .hero-cta .btn,
    .hero-actions .hero-downloads .btn { width: 100%; min-width: 0; }
    .hero-downloads { flex-wrap: nowrap; }
    .section-intro .hero-actions { width: 100%; max-width: 440px; }
}
@media (max-width: 440px) {
    .hero-downloads { flex-direction: column; }
}

.hero-meta {
    list-style: none;
    margin: clamp(36px, 5vw, 56px) 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.8rem;
    justify-content: flex-start;
    max-width: 760px;
}
.hero-meta li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-mute);
}
.hero-meta .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

/* ---------- Provider strip ---------- */
.providers-band {
    margin-top: clamp(40px, 6vw, 68px);
    padding-top: clamp(28px, 4vw, 40px);
    border-top: 1px solid var(--border);
}
.providers-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin: 0 0 1.6rem;
    text-align: center;
}
.providers-marquee {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.providers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(2.4rem, 5vw, 4.2rem);
    width: max-content;
}
.providers-track {
    animation: providers-marquee 28s linear infinite;
}
.providers-marquee:hover .providers-track {
    animation-play-state: paused;
}
@keyframes providers-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .providers-track { animation: none; }
    .providers-marquee {
        overflow-x: auto;
        mask-image: none;
        -webkit-mask-image: none;
    }
    .providers { flex-wrap: wrap; justify-content: center; width: auto; }
}
.provider {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--text-mute);
    font-size: 1.5rem;
    font-weight: 500;
    transition: color 0.2s var(--ease);
    flex: none;
}
.provider:hover { color: var(--text-soft); }
.provider-mark {
    width: 46px;
    height: 46px;
    flex: none;
    background: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.pm-anthropic { -webkit-mask-image: url(assets/logos/anthropic.svg); mask-image: url(assets/logos/anthropic.svg); }
.pm-openai { -webkit-mask-image: url(assets/logos/openai.svg); mask-image: url(assets/logos/openai.svg); }
.pm-gemini { -webkit-mask-image: url(assets/logos/googlegemini.svg); mask-image: url(assets/logos/googlegemini.svg); }
.pm-deepseek { -webkit-mask-image: url(assets/logos/deepseek.svg); mask-image: url(assets/logos/deepseek.svg); }
.pm-grok { -webkit-mask-image: url(assets/logos/grok.svg); mask-image: url(assets/logos/grok.svg); }


/* ---------- Feature blocks (Overview) ---------- */
.feature-blocks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(28px, 4vw, 56px);
}
.feature-block { border-top: 1px solid var(--border-strong); padding-top: 1.4rem; }
.feature-num {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-ink);
    letter-spacing: 0.1em;
}
.feature-block h3 { font-size: 1.5rem; margin: 0.8rem 0 0.7rem; }
.feature-block p { color: var(--text-soft); margin: 0; font-size: 1rem; }

/* ---------- Technology ---------- */
.tech-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(32px, 5vw, 72px);
    align-items: start;
}
.tech-copy p { color: var(--text-soft); font-size: 1.08rem; margin: 0 0 1.2rem; }
.tech-copy strong { color: var(--text); font-weight: 600; }

.tech-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
    display: grid;
    gap: 0.9rem;
}
.tech-steps li {
    counter-increment: step;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem 1.1rem 3.4rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.tech-steps li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 1.2rem;
    top: 1.15rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-ink);
}
.step-k {
    display: block;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
}
.tech-steps p { margin: 0; color: var(--text-soft); font-size: 0.96rem; }

/* ---------- Capabilities ---------- */
.cap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}
.cap-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem;
    transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.cap-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.cap-card h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}
.cap-card h3 i { color: var(--accent); font-size: 0.95rem; }
.cap-card p { margin: 0; color: var(--text-soft); font-size: 0.98rem; }

.tier-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 2.4rem;
}
.tier-pill {
    flex: 1 1 240px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    font-size: 0.96rem;
    color: var(--text-soft);
}
.section-alt .tier-pill { background: var(--surface); }
.tier-k {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-right: 0.5rem;
    padding: 0.18rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
}

/* ---------- Results ---------- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.3rem;
}
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.7rem 1.6rem;
    box-shadow: var(--shadow-sm);
}
.result-k {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.result-card h3 { font-size: 1.32rem; margin: 0.6rem 0 0.7rem; }
.result-card p { margin: 0; color: var(--text-soft); font-size: 0.98rem; }

.credibility-row {
    list-style: none;
    margin: 2.6rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
}
.credibility-row li {
    border-top: 2px solid var(--accent);
    padding-top: 0.9rem;
}
.credibility-row strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.credibility-row span { color: var(--text-soft); font-size: 0.92rem; }

/* ---------- Testimonials ---------- */
.testi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.3rem;
}
.testi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem 1.7rem;
    margin: 0;
    position: relative;
}
.testi-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-ink);
    letter-spacing: 0.1em;
}
.testi blockquote {
    margin: 0.8rem 0 1.1rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1.45;
    color: var(--text);
}
.testi figcaption {
    font-size: 0.86rem;
    color: var(--text-mute);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

/* ---------- Pricing ---------- */
.pricing-interval-toggle {
    display: flex;
    width: max-content;
    margin: 0 auto 2rem;
}
.pricing-interval-toggle.billing-interval-toggle {
    display: flex;
    margin-left: auto;
    margin-right: auto;
}
.billing-interval-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}
.billing-interval-option {
    min-height: 38px;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.billing-interval-option span {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0.12rem 0.45rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.75rem;
}
.billing-interval-option.is-active {
    background: var(--text);
    color: var(--bg);
}
/* The method panel sits ABOVE the price cards and is deliberately wider than
   them: it is the product. The cards below only answer "which library", so they
   must not be the first thing the eye lands on. */
.method-panel {
    max-width: 62rem;
    margin: 0 auto 2.75rem;
    padding: 1.9rem 2.1rem;
    border: 1px solid var(--border, rgba(23, 32, 51, 0.12));
    border-radius: 18px;
    background: var(--surface, #fff);
}

.method-panel h3 {
    margin: 0 0 1.15rem;
    font-size: 1.02rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.62;
}

.method-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 0.95rem 2.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.method-list li {
    position: relative;
    padding-left: 1.15rem;
    font-size: 0.94rem;
    line-height: 1.62;
}

.method-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.66em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.34;
}

@media (max-width: 640px) {
    .method-panel { padding: 1.4rem 1.25rem; border-radius: 14px; }
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
    align-items: stretch;
}
.price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.8rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.price-card--featured {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
.price-badge {
    position: absolute;
    top: -13px;
    left: 1.8rem;
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
}
.price-card h3 { font-size: 1.5rem; margin-bottom: 0.6rem; }
.price { display: flex; align-items: baseline; gap: 0.3rem; }
.price .amount {
    font-family: var(--font-display);
    font-size: 2.9rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.price .per { color: var(--text-mute); font-size: 0.95rem; }
.price-billing-note {
    margin: 0.2rem 0 0;
    color: var(--text-mute);
    font-size: 0.88rem;
}
.price-tag { color: var(--text-soft); margin: 0.5rem 0 0.85rem; font-size: 0.96rem; line-height: 1.5; }
.price-usage {
    margin: 0 0 1.1rem;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--border-strong, var(--border));
    background: color-mix(in srgb, var(--surface) 88%, var(--text) 12%);
    border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-soft);
}
.price-card--featured .price-usage {
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.price-usage strong { color: var(--text); font-weight: 600; }
.price-list {
    list-style: none;
    margin: 0 0 1.6rem;
    padding: 0;
    display: grid;
    gap: 0.6rem;
    flex: 1;
}
.price-list li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-soft);
    font-size: 0.92rem;
    line-height: 1.55;
}
.price-list li::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    top: 0.15rem;
    font-size: 0.74rem;
    color: var(--accent);
}

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 0.7rem; }
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.faq-q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1.15rem 1.3rem;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 500;
    color: var(--text);
}
.faq-q i { color: var(--accent); transition: transform 0.3s var(--ease); flex: none; }
.faq-q[aria-expanded="true"] i { transform: rotate(45deg); }
.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
}
.faq-a p {
    margin: 0;
    padding: 0 1.3rem 1.25rem;
    color: var(--text-soft);
    font-size: 1rem;
}

/* ---------- Final CTA ---------- */
.final-cta {
    padding: clamp(64px, 9vw, 130px) 0;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
}
.final-cta-inner { text-align: center; max-width: var(--maxw); margin-inline: auto; }
.final-cta-inner h2 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: 1rem; }
.final-cta-inner > p { color: var(--text-soft); font-size: 1.1rem; margin: 0 0 2rem; }
.final-cta-inner .hero-cta { margin-top: 0; }

/* ---------- Footer ---------- */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: clamp(48px, 7vw, 80px) 0 2rem;
}
.footer-main {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: clamp(32px, 6vw, 80px);
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}
.footer-logo { height: 30px; width: auto; margin-bottom: 1rem; }
.footer-blurb { color: var(--text-soft); font-size: 0.98rem; max-width: 380px; margin: 0 0 1.3rem; }
.footer-social { display: flex; gap: 0.7rem; }
.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--text-soft);
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.footer-col h4 {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-mute);
    font-weight: 500;
    margin-bottom: 1rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { color: var(--text-soft); font-size: 0.96rem; transition: color 0.2s var(--ease); }
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.6rem;
}
.footer-bottom p { margin: 0; color: var(--text-mute); font-size: 0.88rem; }
.footer-domain { font-family: var(--font-mono); }

/* ---------- Language switch (footer, bottom-left) ---------- */
.lang-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    margin-inline-end: auto;
}
.lang-btn {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    line-height: 1;
    padding: 0.42rem 0.72rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-mute);
    cursor: pointer;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { background: var(--accent); color: var(--on-accent); }
.lang-btn[lang="ar"] { font-family: "Geeza Pro", "Noto Naskh Arabic", Tahoma, serif; font-size: 0.82rem; }

/* ---------- RTL + Arabic (keeps alignment sane when the page mirrors) ---------- */
[lang="ar"] {
    font-family: "Geeza Pro", "Noto Naskh Arabic", "Segoe UI", Tahoma, serif;
}
/* letter-spacing + uppercase break Arabic letter-joining — neutralise on mono labels */
[lang="ar"] .eyebrow,
[lang="ar"] .providers-label,
[lang="ar"] .hero-meta li {
    letter-spacing: 0;
    text-transform: none;
    font-family: "Geeza Pro", "Noto Naskh Arabic", Tahoma, serif;
}
[dir="rtl"] .hero-inner { text-align: right; }
[dir="rtl"] .hero-title { max-width: 18ch; margin-inline: 0 0; }
[dir="rtl"] .hero-actions .hero-cta { margin-left: 0; margin-right: auto; }
[dir="rtl"] .nav-links { margin: 0 1.2rem 0 auto; }
[dir="rtl"] .hero-title em { font-style: normal; }

/* ---------- Sticky CTA ---------- */
.sticky-cta {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: var(--nav-bg);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--border);
    transform: translateY(120%);
    transition: transform 0.4s var(--ease);
}
.sticky-cta.is-visible { transform: translateY(0); }
.sticky-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.7rem;
}
.sticky-cta-text { font-size: 0.95rem; color: var(--text-soft); font-weight: 500; }
.sticky-cta-btns { display: flex; gap: 0.6rem; flex: none; }

/* ---------- Product showcase ---------- */
.product { padding: clamp(36px, 6vw, 88px) 0 clamp(56px, 8vw, 120px); }
.product-head { text-align: center; max-width: 680px; margin-inline: auto; margin-bottom: clamp(30px, 5vw, 54px); }
.product-head .section-sub { margin-inline: auto; }
.product-stage { position: relative; max-width: min(980px, 96vw); margin: 0 auto; }
.app-window {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 44px 130px -50px rgba(0, 0, 0, 0.85);
}
.app-screenshot {
    margin: 0;
    line-height: 0;
    background: #0e0e0e;
}
.app-screenshot img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
}
.app-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.app-dots { display: inline-flex; gap: 6px; align-items: center; }
.app-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.app-dots i:nth-child(1) { background: #ff5f57; }
.app-dots i:nth-child(2) { background: #febc2e; }
.app-dots i:nth-child(3) { background: #28c840; }
.app-title { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-mute); }
.app-pill {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-ink);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
}
.app-body { padding: clamp(1.2rem, 3vw, 2rem); display: grid; gap: 1.1rem; }
.chat-q {
    justify-self: end;
    max-width: 76%;
    background: var(--accent);
    color: var(--on-accent);
    padding: 0.8rem 1.1rem;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.98rem;
    line-height: 1.45;
}
.chat-a {
    max-width: 90%;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    padding: 1.1rem 1.2rem;
}
.chat-a p { margin: 0 0 0.7rem; color: var(--text-soft); font-size: 0.98rem; line-height: 1.55; }
.chat-a p:last-child { margin-bottom: 0; }
.chat-a strong { color: var(--text); font-weight: 600; }
.grade-badge {
    display: inline-block;
    margin-bottom: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.38);
    background: rgba(52, 211, 153, 0.08);
    border-radius: 999px;
    padding: 0.2rem 0.62rem;
}
.cite-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.cite-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.32rem 0.62rem;
}
.cite-chip i { font-size: 0.74em; }
.cite-chip--sanad { color: var(--text-soft); }
.chat-note { font-size: 0.86rem !important; color: var(--text-mute) !important; }
.product-points {
    list-style: none;
    margin: clamp(28px, 4vw, 44px) auto 0;
    padding: 0;
    max-width: 920px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}
.product-points li { border-top: 1px solid var(--border-strong); padding-top: 0.9rem; color: var(--text-soft); font-size: 0.95rem; }
.pp-k { display: block; font-family: var(--font-display); font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }

@media (max-width: 640px) {
    .product-points { grid-template-columns: 1fr; gap: 0.8rem; }
    .chat-q, .chat-a { max-width: 100%; }
}

/* ---------- Madar / sanad showcase (live demo) ---------- */
.madar-showcase {
    padding-top: 0;
    padding-bottom: clamp(56px, 8vw, 120px);
}
.madar-showcase .product-head { max-width: 820px; }
.madar-showcase .section-sub { max-width: 780px; margin-inline: auto; }

.madar-live {
    /* Match Hadith Agent product stage width */
    max-width: min(980px, 96vw);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.madar-live-window {
    box-shadow: 0 44px 130px -50px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}
.madar-live-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: nowrap;
    padding: 0.7rem 1rem;
}
.madar-live-bar .app-title { flex: 1 1 auto; min-width: 0; }
.madar-demo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}
.madar-lang-cycle,
.madar-fs-btn {
    min-width: 48px;
    padding: 6px 14px;
    border: 1px solid rgba(213, 172, 95, 0.45);
    border-radius: 999px;
    background: var(--accent, #d5ac5f);
    color: #fff;
    font-family: var(--font-ui, Inter, system-ui, sans-serif);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.madar-fs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 6px 12px;
    background: transparent;
    color: var(--text-soft, #c8c8c8);
    border-color: var(--border-strong, rgba(255, 255, 255, 0.14));
}
.madar-fs-btn:hover {
    color: var(--text, #fff);
    border-color: rgba(213, 172, 95, 0.55);
    background: rgba(213, 172, 95, 0.12);
    filter: none;
}
.madar-fs-btn .madar-fs-icon { display: block; flex-shrink: 0; }
.madar-fs-btn .madar-fs-icon--exit,
.madar-fs-btn .madar-fs-icon[hidden] { display: none; }
.madar-fs-btn .madar-fs-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.madar-lang-cycle:hover {
    filter: brightness(1.08);
    color: #fff;
}
.madar-lang-cycle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.madar-live-frame {
    position: relative;
    width: 100%;
    /* ~16:9 feel like the Hadith Agent screenshot above */
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    background: #0a0a0a;
    overflow: hidden;
}
.madar-live-frame iframe {
    display: block;
    border: 0;
    background: #0a0a0a;
    /* Scale down corpus UI so the window matches product stage while content still feels full */
    width: 125%;
    height: 125%;
    transform: scale(0.8);
    transform-origin: top left;
}

@media (max-width: 720px) {
    .madar-live-frame {
        aspect-ratio: 4 / 3;
    }
    .madar-fs-btn .madar-fs-label { display: none; }
}

/* Fullscreen demo — real Corpus Workspace feel (1:1, no inset scale) */
.madar-live.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 12000;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #0a0a0a;
}
.madar-live.is-fullscreen .madar-live-window {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}
.madar-live.is-fullscreen .madar-live-frame {
    flex: 1;
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
}
.madar-live.is-fullscreen .madar-live-frame iframe {
    width: 100%;
    height: 100%;
    transform: none;
}
.madar-live.is-fullscreen .madar-fs-btn {
    background: var(--accent, #d5ac5f);
    color: #fff;
    border-color: rgba(213, 172, 95, 0.45);
}
.madar-live.is-fullscreen .madar-fs-icon--enter { display: none !important; }
.madar-live.is-fullscreen .madar-fs-icon--exit { display: block !important; }
.madar-live.is-fullscreen .madar-fs-label { display: inline; }
body.madar-demo-fs-open {
    overflow: hidden;
}

/* Legacy gallery (unused on landing; keep for sign-in carousel styles if shared) */
.madar-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.4rem, 3vw, 2.4rem);
    max-width: min(1100px, 96vw);
    margin: 0 auto;
}
.madar-shot {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.madar-shot .app-window {
    box-shadow: 0 32px 90px -48px rgba(0, 0, 0, 0.75);
}
.madar-caption {
    margin: 0;
    padding: 0 0.2rem;
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--text-soft);
}
.madar-caption strong {
    display: block;
    margin-bottom: 0.25rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

@media (max-width: 860px) {
    .madar-gallery { grid-template-columns: 1fr; max-width: min(680px, 96vw); }
}

/* ---------- Scroll reveal (subtle, so the layered sheets lead) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Overlap sheets — each section is a sheet sliding up over the last ---------- */
.product,
.section,
.final-cta,
.footer {
    position: relative;
    background-color: var(--bg);
    border-top-left-radius: clamp(22px, 3vw, 36px);
    border-top-right-radius: clamp(22px, 3vw, 36px);
    margin-top: clamp(-48px, -3.2vw, -26px);
    box-shadow: 0 -22px 50px -28px rgba(0, 0, 0, 0.72);
}
.section-alt { background-color: var(--bg-alt); }
/* extra top padding so content clears the rounded lip + overlap */
.product, .section, .final-cta { padding-top: clamp(78px, 10vw, 150px); }

/* ---------- Parallax layers ---------- */
[data-parallax] { will-change: transform; }

/* ---------- Focus visibility ---------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
    .tech-grid { grid-template-columns: 1fr; }
    .cap-grid { grid-template-columns: repeat(2, 1fr); }
    .results-grid { grid-template-columns: 1fr; }
    .credibility-row { grid-template-columns: repeat(2, 1fr); }
    .testi-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-blocks { grid-template-columns: 1fr; gap: 1.5rem; }
    .price-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; }
    .price-card--featured { order: -1; }
}

/* ---------- Product detail pages (placeholder) ---------- */
.product-page {
    min-height: calc(100vh - 68px);
    padding: clamp(48px, 8vw, 96px) 0;
}
.product-page-head { max-width: 40rem; }
.product-page-empty {
    margin-top: clamp(32px, 5vw, 56px);
    min-height: 280px;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}

@media (max-width: 760px) {
    body { font-size: 16px; }
    .nav-links {
        position: fixed;
        inset: 68px 0 auto 0;
        flex-direction: column;
        gap: 0;
        margin: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
        transform: translateY(-150%);
        transition: transform 0.35s var(--ease);
        box-shadow: var(--shadow-md);
    }
    .nav-links.is-open { transform: translateY(0); }
    .nav-links li { width: 100%; }
    .nav-links a {
        display: block;
        padding: 0.9rem clamp(20px, 5vw, 40px);
        border-bottom: 1px solid var(--border);
    }
    .nav-submenu-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 0.9rem clamp(20px, 5vw, 40px);
        border-bottom: 1px solid var(--border);
    }
    .nav-submenu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: none;
        min-width: 0;
        width: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--bg-alt);
        padding: 0;
    }
    .nav-item.has-submenu.is-open > .nav-submenu,
    .nav-item.has-submenu:hover > .nav-submenu {
        display: block;
        transform: none;
    }
    .nav-submenu a {
        padding: 0.75rem clamp(20px, 5vw, 40px) 0.75rem calc(clamp(20px, 5vw, 40px) + 0.85rem);
        border-radius: 0;
        border-bottom: 1px solid var(--border);
    }
    .nav-burger { display: flex; }
    .nav-signin { display: none; }
    .nav-links { margin-left: 0; }
    .nav-inner { gap: 0.6rem; }
    .brand { margin-right: auto; }

    .cap-grid, .testi-grid, .footer-cols { grid-template-columns: 1fr; }
    .credibility-row { grid-template-columns: 1fr 1fr; }
    .footer-main { grid-template-columns: 1fr; }

    .sticky-cta-text { display: none; }
    .sticky-cta-inner { justify-content: center; }
    .sticky-cta-btns { width: 100%; justify-content: center; }
    .hero-cta .btn, .final-cta-inner .hero-cta .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
    .credibility-row { grid-template-columns: 1fr; }
}

/* =========================================================
   Architecture section — grounded reasoning pipeline
   ========================================================= */
.arch { position: relative; overflow: hidden; }
.arch .section-head { max-width: 860px; }
.arch .section-sub strong { color: var(--text); font-weight: 600; }

/* Diagram figure */
.arch-figure {
    margin: clamp(8px, 2vw, 20px) 0 0;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 4vw, 44px) clamp(14px, 4vw, 48px) clamp(14px, 3vw, 28px);
    box-shadow: var(--shadow-sm);
}

/* Orchestration mode switch (functional) */
.mode-controls { text-align: center; margin-bottom: clamp(22px, 3.5vw, 38px); }
.mode-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
}
.mode-btn {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.42rem 1.1rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-mute);
    cursor: pointer;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.mode-btn:hover { color: var(--text); }
.mode-btn.is-active { background: var(--accent); color: var(--on-accent); }
.mode-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin: 0.8rem 0 0;
}

/* Toggle which connector set is shown */
.arch-figure .s-only { display: none; }
.arch-figure.mode-seq .s-only { display: block; }
.arch-figure.mode-seq .m-only { display: none; }

.arch-svg { width: 100%; height: auto; display: block; max-width: 960px; margin-inline: auto; direction: ltr; }
/* Keep the diagram + the English app mockup left-to-right even when the page is RTL */
.arch-svg text { direction: ltr; unicode-bidi: isolate; }
.app-window, .arch-figure { direction: ltr; }
.arch-cap {
    margin: clamp(12px, 2vw, 22px) auto 0;
    max-width: 660px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--text-mute);
}

/* SVG element styling (driven by theme tokens) */
.arch-svg .orch-frame { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.arch-svg .orch-label { fill: var(--accent-ink); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; }
.arch-svg .orch-sub { fill: var(--text-mute); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }

.arch-svg .stage-cell { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.arch-svg .stage-cell--ai { stroke: var(--accent); stroke-width: 1.8; }
.arch-svg .stage-num { fill: var(--accent-ink); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; }
.arch-svg .stage-name { fill: var(--text); font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.arch-svg .stage-cap { fill: var(--text-mute); font-family: var(--font-mono); font-size: 11px; }
.arch-svg .stage-cap--ai { fill: var(--accent-ink); }

.arch-svg .io-lbl { fill: var(--text-soft); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; }
.arch-svg .io-lbl--accent { fill: var(--accent-ink); }

/* Supervisor node + mode toggle (multi-agent diagram) */
.arch-svg .sup-node { fill: var(--surface); stroke: var(--accent); stroke-width: 1.8; }
.arch-svg .sup-h { fill: var(--accent-ink); font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.1em; }
.arch-svg .sup-sub { fill: var(--text-mute); font-family: var(--font-mono); font-size: 11px; }
.arch-svg .ax-note { fill: var(--text-mute); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }
.arch-svg .mode-pill { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1; }
.arch-svg .mode-active { fill: var(--accent); }
.arch-svg .mode-on { fill: var(--on-accent); font-family: var(--font-mono); font-size: 12px; }
.arch-svg .mode-off { fill: var(--text-mute); font-family: var(--font-mono); font-size: 12px; }
.arch-svg .mode-label { fill: var(--text-mute); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; }

.arch-svg .found { fill: var(--surface); stroke: var(--accent); stroke-width: 1.4; }
.arch-svg .found-h { fill: var(--accent-ink); font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.14em; }
.arch-svg .found-tag { fill: var(--text-mute); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; }
.arch-svg .found-sub { fill: var(--text-soft); font-family: var(--font-sans); font-size: 12.5px; }

.arch-svg .flow { stroke: var(--accent); stroke-width: 1.6; fill: none; }
.arch-svg .flow-dash { stroke: var(--border-strong); stroke-width: 1.3; stroke-dasharray: 4 5; fill: none; }
.arch-svg .arw-fill { fill: var(--accent); }

@media (max-width: 560px) {
    .arch-figure { padding: 16px 10px 14px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .btn, .cap-card, .footer-social a { transition: none; }
    * { animation-duration: 0.001ms !important; }
}
