/*
 * Shared light/dark theme for OrcheStream's public pages (landing, FAQ, info,
 * onboarding). Defines the CSS variable contract plus the header/footer/logo/
 * theme-toggle shell every page builds on. Page-specific layout (hero, forms,
 * cards, sidebars) stays in each page's own <style> block.
 *
 * Pairs with /static/js/theme.js, which applies data-theme and wires up
 * .theme-toggle-btn. Toggle state persists via localStorage key
 * "orchestream-theme".
 */

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

:root, [data-theme="light"] {
  color-scheme: light;
  --bg-primary:   #f8fafc;
  --bg-secondary: #ffffff;
  --bg-elevated:  #ffffff;
  --bg-muted:     #f1f5f9;
  --bg-accent:    rgba(0, 201, 196, .08);

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #5b6474;
  --text-accent:    #007a77;
  --focus-ring:     #007a77;

  --border-default: #e2e8f0;
  --border-subtle:  #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 48px rgba(15, 23, 42, .12);

  --accent-teal: #00c9c4;
  --accent-teal-text: #0a0e14;
  --success: #10b981;
  --danger:  #ef4444;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary:   #0a0e14;
  --bg-secondary: #111827;
  --bg-elevated:  #1a2332;
  --bg-muted:     #151d2b;
  --bg-accent:    rgba(0, 201, 196, .1);

  --text-primary:   #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #94a3b8;
  --text-accent:    #00d4cf;
  --focus-ring:     #00d4cf;

  --border-default: #1e293b;
  --border-subtle:  #151d2b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, .5);

  --accent-teal: #00c9c4;
  --accent-teal-text: #0a0e14;
  --success: #10b981;
  --danger:  #ef4444;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-primary:   #0a0e14;
    --bg-secondary: #111827;
    --bg-elevated:  #1a2332;
    --bg-muted:     #151d2b;
    --bg-accent:    rgba(0, 201, 196, .1);

    --text-primary:   #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted:     #94a3b8;
    --text-accent:    #00d4cf;
    --focus-ring:     #00d4cf;

    --border-default: #1e293b;
    --border-subtle:  #151d2b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .5);

    --accent-teal: #00c9c4;
    --accent-teal-text: #0a0e14;
  }
}

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font: inherit; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.font-display { font-family: 'Changa One', system-ui, sans-serif; font-weight: 400; }
.text-accent { color: var(--text-accent); }

.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus-visible {
  position: fixed; left: 1rem; top: 1rem; z-index: 200;
  width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal;
  border-radius: .5rem; background: var(--accent-teal); padding: .5rem 1rem;
  font-size: .875rem; font-weight: 600; color: var(--accent-teal-text); box-shadow: var(--shadow-lg);
}

/* ── Theme-aware logo/icon swap: give one element .theme-light-only and its
   counterpart .theme-dark-only to swap assets between themes. ── */
.theme-light-only { display: inline-block; }
.theme-dark-only  { display: none; }
[data-theme="dark"] .theme-light-only { display: none; }
[data-theme="dark"] .theme-dark-only  { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light-only { display: none; }
  :root:not([data-theme="light"]) .theme-dark-only  { display: inline-block; }
}

/* ── Header shell ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border-default);
  background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 72rem; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo img { height: 2rem; width: auto; }

.main-nav { display: none; align-items: center; gap: 2rem; }
.main-nav a { font-size: .875rem; font-weight: 500; text-decoration: none; color: var(--text-secondary); }
.main-nav a:hover, .main-nav a:focus-visible { color: var(--text-accent); }
@media (min-width: 768px) { .main-nav { display: flex; } }

.header-actions { display: flex; align-items: center; gap: .75rem; }
.theme-toggle-btn {
  display: flex; height: 2.25rem; width: 2.25rem; align-items: center; justify-content: center;
  border-radius: .5rem; border: 1px solid var(--border-default); background: var(--bg-muted);
  color: var(--text-secondary); cursor: pointer; transition: border-color .15s;
}
.theme-toggle-btn:hover { border-color: rgba(0, 201, 196, .4); }
.theme-toggle-btn svg { height: 1rem; width: 1rem; }
.theme-toggle-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }

.header-signin { display: none; font-size: .875rem; font-weight: 500; text-decoration: none; color: var(--text-secondary); }
.header-signin:hover { color: var(--text-accent); }
.header-cta {
  border-radius: .5rem; background: var(--accent-teal); padding: .5rem 1rem;
  font-size: .875rem; font-weight: 600; color: var(--accent-teal-text); text-decoration: none; transition: opacity .15s;
  display: inline-block;
}
.header-cta:hover { opacity: .9; }
@media (min-width: 640px) { .header-signin { display: inline; } }

/* ── Shared marketing-page section layout ── */
.section { padding: 6rem 0; }
.section-inner { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.section-intro { max-width: 42rem; margin: 0 auto; text-align: center; }
.eyebrow { margin: 0; font-size: .875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-accent); }
.section-title { margin: .75rem 0 0; font-size: 1.875rem; }
.section-desc { margin: 1rem 0 0; font-size: 1.125rem; color: var(--text-secondary); }
@media (min-width: 768px) { .section-title { font-size: 2.25rem; } }

.bg-muted { background: var(--bg-muted); }

/* ── Feature card grid ── */
.features-grid { margin-top: 4rem; display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.feature-card {
  height: 100%; border-radius: 1rem; border: 1px solid var(--border-default); background: var(--bg-elevated);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.feature-card:hover { border-color: rgba(0, 201, 196, .4); box-shadow: var(--shadow-md); }
.feature-icon {
  margin-bottom: 1rem; display: flex; height: 3rem; width: 3rem; align-items: center; justify-content: center;
  border-radius: .75rem; background: var(--bg-accent); font-size: 1.5rem;
}
.feature-card h3 { margin: 0; font-size: 1.125rem; }
.feature-card p { margin: .5rem 0 0; font-size: .875rem; line-height: 1.6; color: var(--text-secondary); }
@media (min-width: 640px)  { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Numbered step grid ── */
.steps-grid { margin-top: 3.5rem; display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.step-card { height: 100%; border-radius: 1rem; border: 1px solid var(--border-default); background: var(--bg-elevated); padding: 1.5rem; }
.step-num {
  margin-bottom: 1rem; display: flex; height: 2.5rem; width: 2.5rem; align-items: center; justify-content: center;
  border-radius: .75rem; background: var(--accent-teal); font-size: 1.125rem; color: var(--accent-teal-text);
}
.step-card h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.step-card p { margin: .5rem 0 0; font-size: .875rem; color: var(--text-secondary); line-height: 1.6; }
@media (min-width: 640px)  { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Hero action buttons (larger than .header-cta; used for primary marketing CTAs) ── */
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-lg {
  display: inline-block; border-radius: .5rem; background: var(--accent-teal); color: var(--accent-teal-text);
  padding: .8rem 1.75rem; font-size: 1rem; font-weight: 600; text-decoration: none; transition: opacity .15s;
}
.btn-lg:hover { opacity: .9; }
.btn-lg-outline {
  display: inline-block; border-radius: .5rem; background: transparent; border: 1.5px solid var(--border-default);
  color: var(--text-primary); padding: .8rem 1.75rem; font-size: 1rem; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s;
}
.btn-lg-outline:hover { border-color: rgba(0, 201, 196, .5); background: var(--bg-accent); }

/* ── Screenshot / video placeholder blocks ── */
.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.screenshot-placeholder {
  background: var(--bg-muted); border: 2px dashed var(--border-default); border-radius: .75rem;
  aspect-ratio: 16 / 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem;
  color: var(--text-muted); font-size: .875rem;
}
.screenshot-placeholder svg { opacity: .5; }
.screenshot-caption { text-align: center; font-size: .82rem; color: var(--text-secondary); margin-top: .6rem; }

.video-placeholder {
  width: 100%; max-width: 720px; aspect-ratio: 16 / 9;
  background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 1rem; margin: 2.5rem auto 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; color: var(--text-muted); font-size: .95rem;
}
.play-btn {
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent-teal);
  display: flex; align-items: center; justify-content: center;
}
.play-btn svg { margin-left: 3px; color: var(--accent-teal-text); }

/* ── Footer shell ── */
.site-footer { border-top: 1px solid var(--border-default); background: var(--bg-secondary); padding: 3rem 0; }
.footer-inner { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.footer-top { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2rem; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
.footer-nav a { font-size: .875rem; text-decoration: none; color: var(--text-secondary); }
.footer-nav a:hover, .footer-nav a:focus-visible { color: var(--text-accent); }
.footer-actions { display: flex; align-items: center; gap: .75rem; }
.footer-bottom {
  margin-top: 2.5rem; border-top: 1px solid var(--border-subtle); padding-top: 2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: .875rem; color: var(--text-muted); text-align: center;
}
.footer-bottom a { text-decoration: none; color: inherit; }
.footer-bottom a:hover { color: var(--text-accent); }
.footer-links { display: flex; gap: 1.5rem; }
@media (min-width: 768px) {
  .footer-top { flex-direction: row; }
  .footer-bottom { flex-direction: row; }
}

/* ── Centered card / form pages (profile setup, provider connect, etc.) ── */
.center-main {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.form-card {
  background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 1rem;
  box-shadow: var(--shadow-md); padding: 2rem; width: 100%; max-width: 27rem;
}
.form-card h2 { margin: 0 0 .4rem; font-size: 1.25rem; }
.form-card .subtitle { margin: 0 0 1.75rem; font-size: .9rem; color: var(--text-secondary); }

.field { margin-bottom: 1.1rem; }
.field:last-of-type { margin-bottom: 0; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-secondary); }
.field .req { color: var(--danger); margin-left: .15rem; }
.field .hint { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: .55rem .7rem; border-radius: .5rem; border: 1.5px solid var(--border-default);
  background: var(--bg-muted); color: var(--text-primary); font-size: .9rem; font-family: inherit;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus { border-color: var(--accent-teal); outline: none; box-shadow: 0 0 0 3px rgba(0, 201, 196, .2); }
input.invalid { border-color: var(--danger); }

.btn-primary {
  width: 100%; border: none; border-radius: .5rem; background: var(--accent-teal); color: var(--accent-teal-text);
  padding: .65rem 1.25rem; font-size: .95rem; font-weight: 600; cursor: pointer; transition: opacity .15s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-outline {
  border: 1.5px solid var(--border-default); border-radius: .5rem; background: transparent; color: var(--text-secondary);
  padding: .65rem 1.25rem; font-size: .95rem; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s;
}
.btn-outline:hover { border-color: var(--text-muted); color: var(--text-primary); }

.btn-danger {
  border: none; border-radius: .5rem; background: rgba(239, 68, 68, .12); color: var(--danger);
  padding: .65rem 1.25rem; font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: rgba(239, 68, 68, .2); }

.form-msg { text-align: center; font-size: .875rem; margin-top: .875rem; min-height: 1.4em; }
.form-msg.success { color: var(--success); }
.form-msg.error   { color: var(--danger); }

.loading-text { text-align: center; color: var(--text-muted); font-size: .9rem; padding: 1rem 0; }
