/* ============================================
   TXTPERPUS — GLOBAL STYLES
   Design tokens, typography, header, footer
   ============================================ */

/* Google Fonts */
/* Geist — clean, modern, technical sans-serif by Vercel
   via bunny.net (privacy-friendly CDN, no tracking) */
@import url('https://fonts.bunny.net/css?family=geist:300,400,500,600,700,800&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Colors — TXTPerpus Blue (from logo) */
  --color-primary:       #5865C8;
  --color-primary-dark:  #3d4aad;
  --color-primary-light: #dde0f7;
  --color-bg:            #ffffff;
  --color-bg-alt:        #f7f7f5;
  --color-text:          #1a1a1a;
  --color-text-muted:    #666666;
  --color-border:        #e8e8e8;
  --color-dark:          #1a1a1a;
  --color-dark-2:        #2b2b2b;

  /* Typography */
  --font-display: 'Geist', system-ui, -apple-system, sans-serif;
  --font-body:    'Geist', system-ui, -apple-system, sans-serif;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  2rem;       /* 32px */
  --text-4xl:  2.5rem;     /* 40px */
  --text-5xl:  3rem;       /* 48px */

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);

  /* Layout */
  --max-width: 1200px;

  /* Transitions */
  --transition: all 0.25s ease;
}

/* ============================================
   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: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'ss02';
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================
   TYPOGRAPHY SCALE
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--color-text);
  letter-spacing: -0.03em;
}

h1 { font-size: var(--text-5xl); font-weight: 800; }
h2 { font-size: var(--text-4xl); font-weight: 700; }
h3 { font-size: var(--text-2xl); font-weight: 600; }
h4 { font-size: var(--text-xl);  font-weight: 600; }
h5 { font-size: var(--text-lg);  font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }

p {
  font-family: var(--font-body);
  line-height: 1.8;
  color: var(--color-text-muted);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.section {
  padding: var(--space-16) var(--space-8);
}

.section-gray {
  background: var(--color-bg-alt);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-12);
  line-height: 1.8;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.7rem 1.75rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88,101,200,0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

.btn-white {
  background: white;
  color: var(--color-primary);
  border-color: white;
}

.btn-white:hover {
  background: rgba(255,255,255,0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* ============================================
   GLOBAL HEADER
   ============================================ */
.site-header {
  background: var(--color-bg);
  box-shadow: 0 1px 0 var(--color-border);
  position: sticky;
  top: 0;
  z-index: 900;
  transition: box-shadow 0.25s;
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.site-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.04em;
}

.site-logo-text span {
  color: var(--color-primary);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
}

.nav-list a {
  display: block;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  transition: var(--transition);
  text-decoration: none;
}

.nav-list a:hover {
  color: var(--color-text);
  background: var(--color-bg-alt);
}

.nav-list a.active {
  color: var(--color-primary);
  font-weight: 600;
}

.nav-list .nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-list .nav-badge::after {
  content: attr(data-badge);
  font-size: 9px;
  background: var(--color-primary);
  color: white;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav-cta {
  background: var(--color-primary) !important;
  color: white !important;
  font-weight: 600 !important;
}

.nav-cta:hover {
  background: var(--color-primary-dark) !important;
  box-shadow: 0 4px 14px rgba(88,101,200,0.3) !important;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  height: 22px;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================
   GLOBAL FOOTER
   ============================================ */
.site-footer {
  background: var(--color-dark);
  color: white;
  padding: var(--space-16) var(--space-8) var(--space-8);
}

.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: var(--space-8);
}

.footer-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  text-decoration: none;
}

.footer-brand-logo .site-logo-icon {
  background: var(--color-primary);
}

.footer-brand-logo .site-logo-text {
  color: white;
}

.footer-brand-desc {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  line-height: 1.8;
  max-width: 300px;
  margin-bottom: var(--space-6);
  font-family: var(--font-body);
}

.footer-social {
  display: flex;
  gap: var(--space-3);
}

.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  transition: var(--transition);
  text-decoration: none;
}

.footer-social a:hover {
  background: var(--color-primary);
  transform: translateY(-2px);
}

.footer-col h5 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: var(--space-4);
}

.footer-col a {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  margin-bottom: var(--space-3);
  transition: var(--transition);
  text-decoration: none;
}

.footer-col a:hover {
  color: white;
  padding-left: var(--space-2);
}

.footer-col .footer-coming-soon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.35);
  cursor: default;
}

.footer-col .footer-coming-soon::after {
  content: attr(data-coming);
  font-size: 9px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-bottom p {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.35);
}

.footer-bottom-links {
  display: flex;
  gap: var(--space-6);
}

.footer-bottom-links a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  transition: var(--transition);
  text-decoration: none;
}

.footer-bottom-links a:hover,
.footer-bottom-links a:focus-visible {
  color: white;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================
   PAGE HERO (reusable for inner pages)
   ============================================ */
.page-hero {
  background: #1e2140;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: white;
  margin-bottom: var(--space-4);
}

.page-hero-accent {
  color: #8b96e9;
}

.page-hero p {
  font-size: var(--text-lg);
  color: rgba(255,255,255,0.6);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   CARDS (shared)
   ============================================ */
.card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: transparent;
}

/* ============================================
   RESPONSIVE — HEADER & FOOTER
   ============================================ */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
}

@media (max-width: 768px) {
  .container,
  .section {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .site-nav {
    padding: 0 var(--space-4);
  }

  .nav-list {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    gap: 0;
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    border-top: 1px solid var(--color-border);
  }

  .nav-list.open {
    display: flex;
  }

  .nav-list a {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    width: 100%;
  }

  .nav-toggle {
    display: flex;
  }

  .site-header {
    position: sticky;
    top: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .section-title {
    font-size: var(--text-3xl);
  }

  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
}

/* ============================================
   ACCESSIBILITY ADDITIONS
   ============================================ */

/* Skip Navigation */
.skip-nav {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s ease;
}

.skip-nav:focus {
  top: 0;
  outline: 3px solid white;
  outline-offset: 2px;
}

/* Focus Indicators — visible for keyboard users */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* Remove outline for mouse users but keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   LANGUAGE TOGGLE BUTTON
   ============================================ */
.nav-lang-item {
  margin-left: var(--space-2);
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}

.lang-toggle:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.lang-toggle[aria-pressed="true"] {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.lang-toggle-mobile {
  display: none;
}

/* Nav right mobile wrapper */
.nav-right-mobile {
  display: none;
  align-items: center;
  gap: var(--space-3);
}

/* ============================================
   FIX — Overflow / out-of-screen on mobile
   (stats, stats-grid, section-gray padding)
   ============================================ */

/* Prevent horizontal overflow globally */
html, body {
  overflow-x: hidden;
}

/* Stats grid: ensure no overflow on small screens */
.stats-grid,
.stats-strip-grid {
  overflow: visible;
}

/* section-gray: add proper horizontal padding on all viewports */
.section-gray {
  padding-left: 0;
  padding-right: 0;
}

/* content-section on tentang page */
.content-section {
  overflow-x: hidden;
}

/* ============================================
   RESPONSIVE — language toggle
   ============================================ */
@media (max-width: 768px) {
  .nav-right-mobile {
    display: flex;
  }

  .lang-toggle-mobile {
    display: inline-flex;
  }

  /* Hide desktop lang toggle inside collapsed nav on mobile */
  .nav-lang-item {
    display: none;
  }

  /* Increase tap target sizes for mobile accessibility */
  .nav-list a,
  .btn,
  .footer-col a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .nav-list a {
    min-height: 44px;
  }
}

/* ============================================
   SPACING FIX — mepet/cramped elements
   ============================================ */

/* Give section container more breathing room on all sizes */
@media (max-width: 480px) {
  .container,
  .section {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .section-title {
    font-size: var(--text-2xl);
    line-height: 1.2;
  }

  .section-subtitle {
    font-size: var(--text-base);
    margin-bottom: var(--space-8);
  }

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

  .page-hero {
    padding: var(--space-12) var(--space-4);
  }

  .page-hero h1 {
    font-size: var(--text-3xl);
  }
}

/* Ensure nav-toggle button has enough tap area */
.nav-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2);
}

/* ============================================
   ACCESSIBILITY — additional improvements
   ============================================ */

/* Ensure sufficient color contrast for muted text (was #666 = ~5.7:1 on white, OK) */
/* Ensure primary color text meets AA when used on white bg */
/* #5865C8 on white = 3.7:1 — only passes for large/bold text */
/* For body text on white, use darker shade */
.benefit-label,
.stat-label,
.stat-label-alt,
.footer-col h5 {
  /* These are small text — ensure contrast */
}

/* Improve focus ring for interactive cards */
.benefit-card:focus-within,
.stat-card:focus-within,
.feature-card:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Modal focus trap visual cue */
#footerModal:focus-visible {
  outline: none;
}

/* Ensure all interactive elements have pointer cursor */
.support-card,
.stat-card:hover,
.benefit-card {
  cursor: default;
}

a, button, [role="button"] {
  cursor: pointer;
}

/* Print accessibility: ensure links show href in print */
@media print {
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #444;
  }
  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }
  .site-header,
  .site-footer,
  .modal-overlay,
  #footerModal {
    display: none !important;
  }
}

/* Reduced motion — disable all animations for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
