/* ============================================
   Trewix Design System — Light first
   ============================================ */

:root {
  /* Brand */
  --primary: #E14E1F;
  --primary-hover: #C8431A;
  --primary-active: #A83916;
  --primary-highlight: #FFE3D8;

  /* Surface */
  --bg: #FAFAFB;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --surface-offset: #EBECEF;

  /* Text */
  --text: #16181D;
  --text-muted: #666B74;
  --text-faint: #A0A5AE;
  --text-inverse: #FAFAFA;

  /* Border */
  --border: rgba(0, 0, 0, 0.12);
  --divider: rgba(0, 0, 0, 0.08);

  /* Semantic */
  --success: #16A34A;
  --warning: #CA8A04;
  --error: #DC2626;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.2;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #FE6B40;
    --primary-hover: #F0562B;
    --primary-active: #D8481F;
    --primary-highlight: #3A231B;

    --bg: #14161C;
    --surface: #1A1D23;
    --surface-2: #20242B;
    --surface-offset: #262A32;

    --text: #F2F3F5;
    --text-muted: #9DA3AD;
    --text-faint: #6A707B;
    --text-inverse: #0D0F13;

    --border: rgba(255, 255, 255, 0.12);
    --divider: rgba(255, 255, 255, 0.08);

    --success: #22C55E;
    --warning: #F5B40B;
    --error: #EF4444;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
  }
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: 700;
  color: var(--text);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
  margin-bottom: var(--sp-4);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--surface-2);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--sp-6);
}

pre code {
  background: none;
  padding: 0;
}

/* ============================================
   Layout
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container--narrow {
  max-width: 800px;
}

.section {
  padding: var(--sp-20) 0;
}

.section--alt {
  background: var(--surface);
}

/* ============================================
   Navigation
   ============================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  backdrop-filter: blur(12px);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.nav__brand:hover {
  color: var(--text);
}

.nav__logo {
  height: 32px;
  width: 32px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  list-style: none;
}

.nav__links a {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.15s;
}

.nav__links a:hover {
  color: var(--primary);
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: var(--sp-2);
}

.nav__toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .nav__toggle {
    display: block;
  }

  .nav__links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: var(--sp-4) var(--sp-6);
    gap: var(--sp-4);
    border-bottom: 1px solid var(--divider);
    box-shadow: var(--shadow-md);
  }

  .nav__links.is-open {
    display: flex;
  }
}

/* ============================================
   Hero
   ============================================ */

.hero {
  padding: var(--sp-24) 0 var(--sp-20);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--primary-highlight) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}

.hero__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--sp-6);
  position: relative;
}

.hero__title span {
  color: var(--primary);
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto var(--sp-10);
  line-height: var(--leading-relaxed);
}

.hero__actions {
  display: flex;
  gap: var(--sp-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn--primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn--primary:hover {
  background: var(--primary-hover);
  color: var(--text-inverse);
}

.btn--primary:active {
  background: var(--primary-active);
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn--outline:hover {
  background: var(--primary-highlight);
  color: var(--primary);
}

.btn--lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--text-lg);
}

.btn--store {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--text-lg);
  gap: var(--sp-3);
}

.btn--store svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 480px) {
  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .btn--store {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}

/* ============================================
   Features
   ============================================ */

.features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

@media (max-width: 900px) {
  .features__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .features__grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  transition: box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  background: var(--primary-highlight);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
  color: var(--primary);
}

.feature-card__icon svg {
  width: 24px;
  height: 24px;
}

.feature-card__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.feature-card__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.feature-card__badge {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: var(--primary);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ============================================
   Problem / Pain Points
   ============================================ */

.pain-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
}

@media (max-width: 768px) {
  .pain-points {
    grid-template-columns: 1fr;
  }
}

.pain-point {
  text-align: center;
}

.pain-point__icon {
  font-size: 2rem;
  margin-bottom: var(--sp-4);
}

.pain-point__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.pain-point__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================
   How It Works
   ============================================ */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
  counter-reset: step;
}

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

.step {
  text-align: center;
  counter-increment: step;
  position: relative;
}

.step__number {
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 auto var(--sp-5);
}

.step__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.step__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================
   Offline Section
   ============================================ */

.offline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-12);
  align-items: center;
}

@media (max-width: 768px) {
  .offline {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.offline__visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.offline__diagram {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  text-align: center;
  border: 1px solid var(--border);
}

.offline__diagram svg {
  width: 200px;
  height: 160px;
  margin-bottom: var(--sp-4);
}

.offline__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================
   Download CTA
   ============================================ */

.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--text-inverse);
  padding: var(--sp-16) 0;
  text-align: center;
}

.cta-banner h2 {
  color: var(--text-inverse);
  margin-bottom: var(--sp-4);
}

.cta-banner p {
  color: rgba(255,255,255,0.85);
  font-size: var(--text-lg);
  margin-bottom: var(--sp-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.cta-banner .btn--outline {
  color: var(--text-inverse);
  border-color: rgba(255,255,255,0.4);
}

.cta-banner .btn--outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--text-inverse);
  color: var(--text-inverse);
}

/* ============================================
   Footer
   ============================================ */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--divider);
  padding: var(--sp-10) 0;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.footer__logo {
  height: 24px;
  width: 24px;
}

.footer__links {
  display: flex;
  gap: var(--sp-6);
  list-style: none;
}

.footer__links a {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.footer__links a:hover {
  color: var(--primary);
}

.footer__copy {
  font-size: var(--text-sm);
  color: var(--text-faint);
}

/* ============================================
   Guide Layout
   ============================================ */

.guide-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-10);
  padding: var(--sp-10) 0;
}

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }
}

.guide-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.guide-sidebar__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-4);
}

.guide-nav {
  list-style: none;
}

.guide-nav__item {
  margin-bottom: var(--sp-1);
}

.guide-nav__link {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.guide-nav__link:hover {
  color: var(--primary);
  background: var(--primary-highlight);
}

.guide-nav__link.is-active {
  color: var(--primary);
  background: var(--primary-highlight);
  font-weight: 600;
}

.guide-content {
  max-width: 720px;
  padding-bottom: var(--sp-16);
}

.guide-content h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--sp-4);
}

.guide-content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--divider);
}

.guide-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
}

.guide-content ul, .guide-content ol {
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-6);
}

.guide-content li {
  margin-bottom: var(--sp-2);
  line-height: var(--leading-relaxed);
}

/* ============================================
   Guide Next button
   ============================================ */

.guide-next {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-12);
  padding: var(--sp-4) var(--sp-5);
  background: var(--primary-highlight);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.guide-next:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.guide-next__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.guide-next__title {
  font-weight: 600;
  font-size: var(--text-base);
}

.guide-next__arrow {
  margin-left: auto;
  font-size: var(--text-xl);
  color: var(--primary);
  transition: transform var(--transition-fast);
}

.guide-next:hover .guide-next__arrow {
  transform: translateX(4px);
}

/* ============================================
   Callout / Tip
   ============================================ */

.callout {
  background: var(--primary-highlight);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-6) 0;
}

.callout__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--sp-1);
}

.callout p {
  margin-bottom: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================
   Section Headers
   ============================================ */

.section-header {
  text-align: center;
  margin-bottom: var(--sp-12);
}

.section-header__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-3);
}

.section-header__title {
  margin-bottom: var(--sp-4);
}

.section-header__desc {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
