/*
 * InLynq application layout.
 *
 * The design system (tokens.css + bundle.css, copied verbatim from
 * InLynq-Design-System/) owns every component. This file only adds the page
 * scaffolding the static screens assumed: the responsive dashboard shell, the
 * single responsive public profile, builder split view, creator forms,
 * dialogs and toasts. Everything uses design tokens; nothing here restyles an
 * `iq-` component. Prefixes: `app-` (product chrome), `pf-` (public profile).
 */

html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
[hidden] { display: none !important; }
.app-hide-sm { }
@media (max-width: 767px) { .app-hide-sm { display: none !important; } [data-mobile-only] { display: inline-flex !important; } }

/* ---------- Marketing chrome ---------- */
.app-mtop { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--surface-0); padding: 0 clamp(16px, 4vw, 40px); }
.app-mfoot { padding: 32px clamp(16px, 4vw, 40px); border-top: 1px solid var(--border-subtle); max-width: 1200px; margin: 0 auto; gap: 24px; }
.app-section { padding: 96px clamp(16px, 4vw, 40px); max-width: 1200px; margin: 0 auto; }
@media (max-width: 767px) { .app-section { padding: 64px 16px; } }

/* ---------- Auth ---------- */
.app-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px 16px; background: var(--surface-0); }
.app-auth-card { width: 100%; max-width: 440px; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.app-auth-card h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; }
.app-auth-below { font-size: 14px; color: var(--ink-3); }
@media (max-width: 480px) { .app-auth-card { padding: 24px; } }

/* ---------- Dashboard shell ---------- */
.app-shell { display: flex; min-height: 100vh; background: var(--surface-0); }
.app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-sidebar a.iq-side-item { text-decoration: none; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { position: sticky; top: 0; z-index: var(--z-sticky); padding: 0 32px; }
.app-content { padding: 32px; flex: 1; }
.app-banners { display: flex; flex-direction: column; gap: 8px; padding: 0 32px; }
.app-banners:not(:empty) { padding-top: 16px; }
.app-tabbar { display: none; }
.app-avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.app-menu-wrap { position: relative; }
.app-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown); animation: iq-rise .12s cubic-bezier(.3,.7,.4,1); }
.app-menu .iq-menu-item { text-decoration: none; font-size: 14px; }
.app-pagehead { justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; }
.app-narrow { max-width: 760px; }

@media (max-width: 1023px) {
  .app-sidebar { display: none; }
  .app-topbar { padding: 0 16px; gap: 8px; }
  .app-content { padding: 24px 16px 96px; }
  .app-banners { padding: 0 16px; }
  .app-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .app-tabbar a { text-decoration: none; }
}

/* Responsive grids used across dashboard screens */
.app-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.app-grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.app-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.app-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.app-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
@media (max-width: 1023px) {
  .app-grid-4 { grid-template-columns: 1fr 1fr; }
  .app-grid-main, .app-grid-2 { grid-template-columns: 1fr; }
  .app-grid-3 { grid-template-columns: 1fr 1fr; }
  .app-grid-main > .app-side-first { order: -1; }
}
@media (max-width: 640px) { .app-grid-3 { grid-template-columns: 1fr; } }

/* Creator forms: 220px description column + field grid (design: Company creator) */
.app-creator { display: grid; grid-template-columns: 1fr 320px; gap: 48px; align-items: start; }
.app-creator-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 12px; }
.app-formgroup { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 32px 0; border-top: 1px solid var(--border-subtle); }
.app-formgroup h3 { margin: 0; font-size: 15px; font-weight: 600; }
.app-formgroup p { margin: 4px 0 0; font-size: 13px; line-height: 20px; }
.app-formactions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 24px; border-top: 1px solid var(--border-subtle); }
@media (max-width: 1023px) { .app-creator { grid-template-columns: 1fr; } .app-creator-aside { position: static; order: -1; } }
@media (max-width: 767px) { .app-formgroup { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; } }

/* List rows in dashboard (metrics, links, testimonials) */
.app-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-1); flex-wrap: nowrap; }
.app-row .grow { flex: 1; min-width: 0; }
.app-row-title { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row form { margin: 0; }
.app-inline-form { display: inline; margin: 0; }

/* Mobile tables collapse into stacked cards (design: Table) */
@media (max-width: 640px) {
  .app-stack-table thead { display: none; }
  .app-stack-table, .app-stack-table tbody, .app-stack-table tr, .app-stack-table td { display: block; width: 100%; }
  .app-stack-table tr { border-bottom: 1px solid var(--border-subtle); padding: 8px 0; }
  .app-stack-table td { border: 0; padding: 4px 16px; text-align: left !important; }
  .app-stack-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink-3); }
}

/* ---------- Dialogs & toasts ---------- */
.app-dialog { border: 0; padding: 16px; background: transparent; max-width: 100vw; width: 100%; }
.app-dialog::backdrop { background: var(--overlay); }
.app-dialog .iq-modal { margin: 0 auto; }
.app-dialog[open] { display: grid; place-items: center; min-height: 100%; position: fixed; inset: 0; max-height: 100vh; }
@media (max-width: 640px) {
  .app-dialog[open] { place-items: end center; padding: 0; }
  .app-dialog .iq-modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-width: 100% !important; }
  .app-dialog .iq-modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; }
}
.app-toasts { position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
@media (max-width: 1023px) { .app-toasts { right: 16px; left: 16px; top: 16px; bottom: auto; align-items: center; } }
.app-toasts .iq-toast { transition: opacity .3s, transform .3s; }
.app-toasts .iq-toast.is-leaving { opacity: 0; transform: translateY(8px); }

/* ---------- Checkout ---------- */
.app-step-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 1.5px solid var(--border-strong); color: var(--ink-3); }
.app-stepper li { color: var(--ink-3); }
.app-stepper li.is-done .app-step-dot { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.app-stepper li.is-current { color: var(--ink); }
.app-stepper li.is-current .app-step-dot { border-color: var(--brand-600); color: var(--brand-600); }
.app-stepper li.is-done { color: var(--ink); }
.app-checkout { max-width: 1040px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 40px); display: grid; grid-template-columns: 1fr 380px; gap: 48px; align-items: start; }
.app-plan-option { padding: 18px 20px; display: flex; gap: 14px; align-items: center; cursor: pointer; }
.app-plan-option:has(input:checked) { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-50); }
@media (max-width: 900px) { .app-checkout { grid-template-columns: 1fr; } .app-checkout > aside { position: static !important; } }

/* ---------- Builder (design: Profile builder) ---------- */
.app-builder { display: flex; min-height: calc(100vh - 64px); margin: -32px; }
.app-builder-editor { width: 440px; flex: none; border-right: 1px solid var(--border-subtle); background: var(--surface-1); display: flex; flex-direction: column; }
.app-builder-panel { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.app-builder-preview { flex: 1; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; padding: 24px; gap: 16px; min-width: 0; position: sticky; top: 64px; height: calc(100vh - 64px); }
.app-builder-frame { width: 390px; max-width: 100%; flex: 1; transition: width .35s cubic-bezier(.3,.7,.4,1), border-radius .35s; }
.app-builder-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--surface-0); }
.app-builder-frame.is-desktop { width: 100%; border-radius: 16px; }
.app-builder-frame:not(.is-desktop) { padding-top: 40px; }
.app-builder-frame.is-desktop::before { display: none; }
.app-builder-frame.iq-device::before { top: 10px; }
.app-builder-frame iframe { padding-top: 0; }
.app-builder-mobile-tabs { display: none; }
.iq-dragrow .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iq-dragrow.is-keyboard-lifted { box-shadow: var(--shadow-md); border-color: var(--brand-600); }
@media (max-width: 1023px) {
  .app-builder { margin: -24px -16px; flex-direction: column; }
  .app-builder-editor { width: 100%; border-right: 0; }
  .app-builder-preview { position: static; height: 80vh; }
  .app-builder-mobile-tabs { display: block; padding: 0 16px; background: var(--surface-1); border-bottom: 1px solid var(--border-subtle); }
  .app-builder[data-tab="edit"] .app-builder-preview { display: none; }
  .app-builder[data-tab="preview"] .app-builder-editor { display: none; }
}

/* ---------- Public profile ---------- */
.pf { background: var(--surface-0); }
.pf-page { background: var(--surface-0); min-height: 100vh; }
.pf-preview-bar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 16px; font-size: 12px; font-weight: 500; background: var(--info-50); color: var(--info-600); }
.pf-demo { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; font-size: 13px; color: var(--ink-2); background: var(--warning-50); flex-wrap: wrap; text-align: center; }
.pf-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; position: sticky; top: 0; z-index: var(--z-sticky); background: var(--surface-0); border-bottom: 1px solid var(--border-subtle); }
.pf-top-url, .pf-top-copy, .pf-top-growth { display: none !important; }
.pf-layout { padding: 24px 16px 32px; display: flex; flex-direction: column; gap: 48px; }
.pf-aside { display: flex; flex-direction: column; gap: 32px; }
.pf-main { display: flex; flex-direction: column; gap: 48px; min-width: 0; }
.pf-desktop { display: none !important; }
.pf-header { display: flex; flex-direction: column; gap: 16px; }
.pf-avatar { --s: 96px; }
.pf-name { margin: 0; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.03em; }
.pf-bio { margin: 8px 0 0; font-size: 16px; line-height: 24px; max-width: 44ch; }
.pf-cta { --h: 48px; padding: 0 24px; font-size: 15px; }
.pf-cta-main { flex: 1; }
.pf-about p { margin: 0 0 16px; font-size: 17px; line-height: 28px; color: var(--ink-2); max-width: 64ch; }
.pf-about p:last-child { margin-bottom: 0; }
.pf-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.pf-grid > a.iq-card { color: inherit; text-decoration: none; }
.pf-scroller { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pf-scroller::-webkit-scrollbar { display: none; }
.pf-scroller-item { flex: 0 0 85%; scroll-snap-align: start; }
.pf-scroller-item > a { color: inherit; text-decoration: none; }
.pf-foot { justify-content: space-between; padding: 24px 0 8px; border-top: 1px solid var(--border-subtle); }
.pf-linkbtn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; cursor: pointer; }
.pf-linkbtn:hover { color: var(--ink); }
.pf-bottombar { transition: transform .25s cubic-bezier(.3,.7,.4,1); }
.pf-bottombar.is-away { transform: translateY(110%); }
.pf-index a { color: var(--ink-3); text-decoration: none; }
.pf-index a.is-active, .pf-index a:hover { color: var(--ink); }

@media (min-width: 768px) {
  .pf-grid-2, .pf-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .pf-scroller { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; overflow: visible; margin: 0; padding: 0; }
  .pf-bottombar { display: none !important; }
}

@media (min-width: 1024px) {
  .pf-top { position: static; padding: 16px 40px; }
  .pf-top-handle, .pf-top-share { display: none !important; }
  .pf-top-url, .pf-top-copy, .pf-top-growth { display: inline-flex !important; }
  .pf-layout { max-width: 1120px; margin: 0 auto; padding: 64px 40px; display: grid; grid-template-columns: 320px 1fr; gap: 80px; align-items: start; }
  .pf-aside { position: sticky; top: 32px; }
  .pf-main { gap: 64px; }
  .pf-desktop { display: flex !important; }
  .pf-avatar { --s: 120px; }
  .pf-name { font-size: 40px; line-height: 44px; }
  .pf-bio { font-size: 18px; line-height: 28px; }
  .pf-cta { --h: 40px; padding: 0 16px; font-size: 14px; }
  .pf-cta-main { flex: none; }
  .pf-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Theme options (all values come from tokens) */
.pf-page[data-font="serif"] .pf-h { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.01em; }
.pf-page[data-font="serif"] .pf-name { font-size: 40px; }
.pf-page[data-font="serif"] .iq-sec-head h2 { font-size: 30px; }
.pf-page[data-font="mono"] .pf-h { font-family: var(--font-mono); font-weight: 500; letter-spacing: -.04em; }
.pf-page[data-cards="flat"] .iq-card { border-color: transparent; background: var(--surface-2); }
.pf-page[data-layout="compact"] .pf-main { gap: 32px; }
@media (min-width: 1024px) { .pf-page[data-layout="compact"] .pf-main { gap: 48px; } }
@media (min-width: 1024px) { .pf-page[data-font="serif"] .pf-name { font-size: 52px; line-height: 56px; } }

/* ---------- Discovery ---------- */
.app-discover { display: flex; gap: 40px; align-items: flex-start; margin-top: 8px; }
.app-discover-filters { width: 240px; flex: none; }
.app-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.app-chips .iq-social { white-space: nowrap; text-decoration: none; }
.app-chips .iq-social.is-active { background: var(--surface-inverse); color: var(--ink-inverse); border-color: transparent; }
.app-filters-toggle { display: none !important; }
@media (max-width: 1023px) {
  .app-discover { flex-direction: column; }
  .app-discover-filters { display: none; width: 100%; }
  .app-discover-filters.is-open { display: flex; }
  .app-filters-toggle { display: inline-flex !important; }
}

/* ---------- Landing ---------- */
.app-hero { padding: 80px clamp(16px, 4vw, 40px) 96px; max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
.app-hero h1 { margin: 0; font-size: 80px; line-height: 80px; letter-spacing: -.025em; }
.app-display-lg { font-size: 52px; line-height: 56px; letter-spacing: -.015em; }
.app-split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.app-cta-slab { max-width: 1200px; margin: 0 auto; border-radius: var(--radius-xl); background: var(--brand-600); color: var(--on-brand); padding: 72px 64px; display: flex; justify-content: space-between; align-items: center; gap: 40px; }
.app-faq summary::-webkit-details-marker { display: none; }
.app-faq[open] summary .iq-icon { transform: rotate(45deg); }
.app-faq summary .iq-icon { transition: transform .15s; }
@media (max-width: 1023px) {
  .app-hero { grid-template-columns: 1fr; padding-top: 48px; gap: 48px; }
  .app-hero h1 { font-size: 44px; line-height: 48px; }
  .app-display-lg { font-size: 36px; line-height: 40px; }
  .app-split { grid-template-columns: 1fr; gap: 40px; }
  .app-cta-slab { flex-direction: column; align-items: flex-start; padding: 48px 24px; }
  .app-hero-device { transform: scale(.88); transform-origin: top center; }
}

/* Utilities that keep inline styles out of templates where they repeat */
.app-card-pad { padding: 24px; }
.app-text-right { text-align: right; }
.app-link-reset { color: inherit; text-decoration: none; }
.app-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 1024px) {
  .app-grid-main.cols-14-10 { grid-template-columns: 1.4fr 1fr; }
  .app-grid-main.cols-10-14 { grid-template-columns: 1fr 1.4fr; }
}
