/* Faral website. Tokens mirror apps/web/src/app.css in the faral.io repo. */

@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --bg: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-tertiary: #eef0f4;
  --text: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;
  --accent: #5E5ADB;
  --accent-hover: #4E4ACB;
  --accent-subtle: rgba(94, 90, 219, 0.08);
  --on-accent: #ffffff;
  --success: #059669;
  --warning: #b45309;
  --nav-bg: rgba(255, 255, 255, 0.9);
  --radius: 2px;
  --font-sans: 'Switzer', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e14;
    --bg-secondary: #13161e;
    --bg-tertiary: #1c2030;
    --text: #e8eaf0;
    --text-secondary: #a3a8b8;
    --text-tertiary: #8b90a0;
    --border: #252938;
    --border-subtle: #1c2030;
    --accent: #8E8AFF;
    --accent-hover: #A8A5FF;
    --accent-subtle: rgba(142, 138, 255, 0.1);
    --on-accent: #0c0e14;
    --success: #34d399;
    --warning: #fbbf24;
    --nav-bg: rgba(12, 14, 20, 0.9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0e14;
  --bg-secondary: #13161e;
  --bg-tertiary: #1c2030;
  --text: #e8eaf0;
  --text-secondary: #a3a8b8;
  --text-tertiary: #8b90a0;
  --border: #252938;
  --border-subtle: #1c2030;
  --accent: #8E8AFF;
  --accent-hover: #A8A5FF;
  --accent-subtle: rgba(142, 138, 255, 0.1);
  --on-accent: #0c0e14;
  --success: #34d399;
  --warning: #fbbf24;
  --nav-bg: rgba(12, 14, 20, 0.9);
  color-scheme: dark;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text-secondary);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--text); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 0.875em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 200;
  padding: 0.5rem 1rem; background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 0.5rem; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 32px; } }
.prose { max-width: 640px; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 24px; height: 24px; display: block; }

.nav-links { display: flex; align-items: center; gap: 0.25rem; list-style: none; }
.nav-links a {
  display: block; padding: 0.35rem 0.65rem;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  border-radius: var(--radius);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--bg-tertiary); text-decoration: none; }

.nav-right { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-secondary); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-tertiary); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.menu-btn { display: none; }

.mobile-menu { display: none; border-top: 1px solid var(--border); padding: 0.5rem 16px 0.75rem; }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: 0.65rem 0.5rem; color: var(--text-secondary); font-weight: 500; }

@media (max-width: 760px) {
  .nav-links, .nav-right .btn { display: none; }
  .menu-btn { display: inline-flex; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 40px; padding: 0.5rem 1.1rem;
  font: 600 0.9rem/1 var(--font-sans);
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-sm { min-height: 32px; padding: 0.35rem 0.8rem; font-size: 0.825rem; }

/* ── Sections ── */
section { padding: 4.5rem 0; border-top: 1px solid var(--border); }
section.alt { background: var(--bg-secondary); }

.eyebrow { font-size: 0.8rem; font-weight: 600; color: var(--accent); margin-bottom: 0.75rem; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1.25rem; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin-bottom: 0.9rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
p + p { margin-top: 0.9rem; }
.lead { font-size: 1.125rem; color: var(--text-secondary); }
.section-intro { max-width: 640px; margin-bottom: 2.5rem; }
.muted { color: var(--text-tertiary); font-size: 0.9rem; }

/* ── Hero ── */
.hero { padding: 6rem 0 4.5rem; border-top: none; }
.hero h1 { max-width: 760px; }
.hero .lead { max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 1.25rem; }
.hero-note { font-size: 0.9rem; color: var(--text-tertiary); }

.screenshot {
  margin-top: 3.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-secondary);
}
.screenshot img { display: block; width: 100%; height: auto; }
.screenshot .shot-dark { display: none; }
:root[data-theme="dark"] .screenshot .shot-dark { display: block; }
:root[data-theme="dark"] .screenshot .shot-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .screenshot .shot-dark { display: block; }
  :root:not([data-theme="light"]) .screenshot .shot-light { display: none; }
}

/* ── Grids ── */
.grid { display: grid; gap: 2rem 2.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.principle { border-top: 2px solid var(--accent); padding-top: 1rem; }
.principle p { font-size: 0.95rem; }

/* ── Product list ── */
.products { border-top: 1px solid var(--border); }
.product {
  display: grid; grid-template-columns: 9rem 1fr auto; gap: 0.5rem 1.5rem; align-items: baseline;
  padding: 1.1rem 0; border-bottom: 1px solid var(--border);
}
.product h3 { margin: 0; }
.product p { font-size: 0.95rem; }
@media (max-width: 640px) {
  .product { grid-template-columns: 1fr auto; }
  .product p { grid-column: 1 / -1; grid-row: 2; }
}

.status {
  display: inline-block; white-space: nowrap;
  font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-secondary);
}
.status-available { color: var(--success); border-color: currentColor; }
.status-early { color: var(--warning); border-color: currentColor; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text); background: var(--bg-secondary); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td:first-child { color: var(--text); font-weight: 500; white-space: nowrap; }

/* ── Lists ── */
.checklist { list-style: none; }
.checklist li { position: relative; padding-left: 1.5rem; margin-bottom: 0.6rem; }
.checklist li::before {
  content: ''; position: absolute; left: 0.2rem; top: 0.65em;
  width: 6px; height: 6px; background: var(--text-tertiary); border-radius: 50%;
}
.checklist strong { color: var(--text); font-weight: 600; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.6rem 2rem; }
dl.facts dt { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { dl.facts { grid-template-columns: 1fr; gap: 0.15rem; } dl.facts dd { margin-bottom: 0.75rem; } }

pre.tree {
  font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.7;
  padding: 1.25rem; overflow-x: auto;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
}

details.faq { border-bottom: 1px solid var(--border); }
details.faq summary { cursor: pointer; padding: 1rem 0; color: var(--text); font-weight: 600; list-style-position: outside; }
details.faq p { padding-bottom: 1rem; max-width: 640px; }

/* ── Page-level nav for long pages ── */
.toc { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; }
.toc a { font-size: 0.85rem; padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-secondary); }
.toc a:hover { color: var(--text); background: var(--bg-tertiary); text-decoration: none; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0 2rem; background: var(--bg-secondary); font-size: 0.9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.footer-grid h4 { font-size: 0.85rem; margin-bottom: 0.6rem; }
.footer-grid a { display: block; color: var(--text-secondary); padding: 0.15rem 0; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--text-tertiary); font-size: 0.85rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ── Utilities ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.note { margin-top: 1.25rem; max-width: 640px; }
.footer-tagline { margin-top: 0.6rem; max-width: 300px; }
.page-section h2 { margin-bottom: 0.75rem; }
.page-section .prose > * + h3 { margin-top: 1.75rem; }
.page-section .table-wrap, .page-section pre.tree, .page-section dl.facts { margin-top: 1.5rem; }
table.breach td:first-child { white-space: normal; width: 32%; }
@media (max-width: 640px) { table.breach td:first-child { width: 40%; } }
