/* ==========================================================================
   corebuffer.com — site styles
   Built on the shared Corebuffer design system (assets/design-system/, vendored
   from corebuffer/ui-design-system; never edit those files by hand).
   Every page links fonts.css and tokens.css before this file, so every
   colour, radius, shadow, font and duration below is a design-system token.
   Light by default; dark follows the OS, and data-theme on <html> overrides.
   ========================================================================== */

:root {
  /* Layout only: the site's own measurements, not a palette. */
  --max-width: 1240px;
  --header-height: 72px;
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--on-bg);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-color: var(--bg);
  -webkit-overflow-scrolling: touch;
}

a { color: var(--link); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

/* Background Network Mesh / Subtle Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  transform: translateZ(0);
  will-change: transform;
}

/* Vignette Gradient */
.bg-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 15%, transparent 20%, var(--bg) 90%);
  pointer-events: none;
  z-index: -1;
  transform: translateZ(0);
  will-change: transform;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-24);
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--on-surface);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: var(--sp-16);
}

h3 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-8);
}

p {
  color: var(--on-surface-variant);
  font-size: 1.05rem;
  line-height: 1.7;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-ink) 30%, var(--tertiary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Buttons: 10px controls, sentence-case, weight 600, flat. */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  min-height: 44px;
  font: var(--t-label-l);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0 var(--sp-24);
  border-radius: var(--r-md);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Filled */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--on-primary) calc(var(--sl-hover) * 100%), var(--primary));
}

/* Outlined */
.btn-secondary {
  background: transparent;
  color: var(--primary-ink);
  border-color: var(--outline);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--primary) calc(var(--sl-hover) * 100%), transparent);
}

/* Tonal (tertiary) */
.btn-glow-cyan {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.btn-glow-cyan:hover {
  background: color-mix(in srgb, var(--on-tertiary-container) calc(var(--sl-hover) * 100%), var(--tertiary-container));
}

.btn:disabled {
  background: color-mix(in srgb, var(--on-surface) calc(var(--disabled-container) * 100%), transparent);
  color: color-mix(in srgb, var(--on-surface) calc(var(--disabled-content) * 100%), transparent);
  border-color: transparent;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--sp-16);
  font-size: 0.875rem;
}

/* Status pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-4) var(--sp-12);
  border-radius: var(--r-full);
  font: var(--t-label-m);
  letter-spacing: 0.03em;
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.badge-amber {
  background: var(--warning-container);
  color: var(--on-warning-container);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Header & Nav */
.header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transform: translateZ(0);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  text-decoration: none;
  color: var(--on-surface);
}

.brand-logo {
  width: 36px;
  height: 36px;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  color: var(--on-surface);
}

.brand-sub {
  font: var(--t-label-s);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color var(--dur-fast) var(--ease);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--on-surface);
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-md);
  cursor: pointer;
}

/* Hero Section */
.hero {
  padding: 80px 0 60px;
  position: relative;
}

.hero-title {
  max-width: 680px;
}

.hero-desc {
  max-width: 600px;
  font-size: 1.15rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-16);
  margin-top: 10px;
}

/* Inside a tinted state box every line takes the box's on-container colour. */

.pulse-ring {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: currentColor;
  animation: pulseDot 1.6s infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.footer {
  background: var(--surface-c);
  border-top: 1px solid var(--border);
  padding: 80px 0 40px;
  color: var(--on-surface-variant);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-32);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-bottom a {
  color: var(--on-surface-variant);
}

@media (max-width: 992px) {
  .coresec-product-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 768px) {
  /* Disable heavy background canvas animation on mobile for 60fps smooth scrolling */
  #bg-canvas {
    display: none !important;
  }

  /* Header & Navigation Drawer */
  .header-actions .btn {
    display: none;
  }

  /* The drawer floats over the page. */
  .nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    padding: var(--sp-24);
    gap: 18px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--elev-2);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  }

  .nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-link {
    font-size: 1.05rem;
    padding: 6px 0;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Spacing & Layout */
  .hero {
    padding: var(--sp-48) 0 var(--sp-24);
  }

  .feature-cards-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-16);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--sp-16);
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--layout-gutter);
  }

  h1 {
    font-size: 2.1rem;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  h2 {
    font-size: 1.65rem;
    line-height: 1.25;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }

  .platform-install-card {
    padding: var(--sp-20) var(--sp-16);
  }

  .brand-name {
    font-size: 1.15rem;
  }
}

/* Legal pages (privacy.html, terms.html): plain reading layout, no JavaScript needed. */
.legal-main {
  flex: 1;
  padding: 56px 20px 72px;
  position: relative;
  z-index: 1;
}
.legal {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(24px, 5vw, 48px);
  color: var(--on-surface-variant);
  line-height: 1.7;
}
.legal h1 {
  color: var(--on-surface);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.legal h2 {
  color: var(--on-surface);
  font-size: 1.2rem;
  margin: 32px 0 8px;
}
.legal p, .legal ul { margin: 0 0 14px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--primary-ink); text-decoration: underline; text-underline-offset: 2px; }
.legal strong { color: var(--on-surface); }
.legal .legal-meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; }
.legal .legal-summary {
  background: var(--surface-c-low);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 0 0 8px;
}
.legal .legal-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.legal th, .legal td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--border);
}
.legal th { color: var(--on-surface); font-weight: 600; }
.footer-bottom a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-bottom a:hover { color: var(--on-surface); }

/* ==========================================================================
   HOME (simple layout: hero, one product card, one-line footer)
   ========================================================================== */
.home-hero {
  padding: 120px 0 72px;
  text-align: center;
}

.home-hero .hero-title {
  max-width: 980px;
}

.home-hero .hero-title,
.home-hero .hero-desc {
  margin-left: auto;
  margin-right: auto;
}

.home-hero .hero-desc {
  margin-top: var(--sp-20);
}

.home-hero .hero-cta {
  justify-content: center;
  margin-top: var(--sp-32);
}

.home-product {
  padding: 24px 0 112px;
}

.home-product-card {
  max-width: 880px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 48px;
}

.home-product-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.home-product-logo {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.home-product-head h2 {
  font-size: 2rem;
  margin: 0;
}

.home-product-head p {
  margin: 4px 0 0;
  font-size: 1.1rem;
  color: var(--on-surface-variant);
}

.home-points {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 40px;
  margin: 40px 0;
  padding: 0;
}

.home-points b {
  display: block;
  color: var(--on-surface);
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.home-points li {
  color: var(--on-surface-variant);
  line-height: 1.6;
}

.home-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-16);
}

.home-product-note {
  margin: var(--sp-20) 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.page-hero-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--sp-20);
  display: block;
}

.home-product + .home-product {
  padding-top: 0;
}

.home-product.is-tight {
  padding-bottom: 32px;
}

.card-title {
  font-size: 1.75rem;
  margin: 0;
}

.home-product-card .card-title + .home-points {
  margin: 28px 0 0;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.download-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.download-item b {
  font-size: 1.15rem;
  color: var(--on-surface);
}

.download-item span {
  color: var(--on-surface-variant);
}

.download-item .btn {
  margin-top: 14px;
  justify-content: center;
}

.download-item .btn span {
  color: inherit;
}

.download-item small {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.home-footer {
  padding: 32px 0;
}

.home-footer .footer-bottom {
  border-top: none;
  padding-top: 0;
}

.home-footer-links {
  display: flex;
  gap: 20px;
}

@media (max-width: 768px) {
  .home-hero { padding: 72px 0 48px; }
  .home-product { padding: 8px 0 72px; }
  .home-product-card { padding: 28px 22px; }
  .home-points { grid-template-columns: 1fr; gap: 22px; margin: 28px 0; }
  .home-product-actions .btn { flex: 1 1 auto; justify-content: center; }
  .download-grid { grid-template-columns: 1fr; }
  .home-product.is-tight { padding-bottom: 24px; }
  .home-hero .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
}

/* CoreSec page details: facts row, icons, steps, questions */
.hero-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: var(--sp-24) 0 0;
  padding: 0;
}

.hero-facts li {
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 0.9rem;
  font-weight: 600;
}

.home-points.has-icons li {
  position: relative;
  padding-left: 52px;
}

.point-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  padding: 7px;
  border-radius: var(--r-sm);
  background: var(--primary-container);
  color: var(--primary-ink);
}

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 28px 0 0;
  padding: 0;
}

.steps li {
  counter-increment: step;
  color: var(--on-surface-variant);
  line-height: 1.6;
}

.steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.steps b {
  display: block;
  color: var(--on-surface);
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.faq {
  margin-top: 20px;
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq details:last-child {
  border-bottom: none;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 32px 18px 0;
  position: relative;
  font-weight: 600;
  color: var(--on-surface);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--primary-ink);
}

.faq details[open] summary::after {
  content: '\2212';
}

.faq details p {
  margin: 0 0 18px;
  color: var(--on-surface-variant);
  line-height: 1.65;
}

@media (max-width: 768px) {
  .steps { grid-template-columns: 1fr; gap: 24px; }
}
