/* ==========================================================================
   Base Stylesheet — Clearwork Guides
   Reset, element defaults, layout, grid, header, footer, buttons, utilities.
   All values reference tokens defined in tokens.css.
   ========================================================================== */


/* ==========================================================================
   1. Reset
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

ul,
ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}


/* ==========================================================================
   2. Base Element Styles
   ========================================================================== */

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;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-light);
}

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

::selection {
  background: var(--accent);
  color: var(--bg);
}

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


/* ==========================================================================
   3. Typography Defaults
   ========================================================================== */

.text-hero {
  font-size: var(--text-hero);
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
}

.text-display {
  font-size: var(--text-5xl);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
}

h1 {
  font-size: var(--text-4xl);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--text-3xl);
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: var(--text-2xl);
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--text-xl);
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
}

p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
}

.text-muted {
  color: var(--text-muted);
}

.text-light {
  color: var(--text-light);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}


/* ==========================================================================
   4. Layout — Container & Section
   ========================================================================== */

.container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

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

.section--compact {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section--spacious {
  padding-top: var(--space-20);
  padding-bottom: var(--space-20);
}

/* Light-background section (alternating bands) */
.section--light {
  background: var(--bg-light);
  color: var(--bg);
}

.section--light h1,
.section--light h2,
.section--light h3,
.section--light h4 {
  color: var(--bg);
}

.section--light p,
.section--light .text-muted {
  color: var(--text-muted);
}

/* Explicit dark section (for contrast clarity) */
.section--dark {
  background: var(--bg);
}


/* ==========================================================================
   5. Grid System
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--space-6);
}

/* 2-column grid */
.grid--2col {
  grid-template-columns: 1fr;
}

/* 3-column grid */
.grid--3col {
  grid-template-columns: 1fr;
}

/* 4-column grid */
.grid--4col {
  grid-template-columns: 1fr;
}

/* Product cards grid */
.grid--products {
  grid-template-columns: 1fr;
}

/* Pricing cards grid */
.grid--pricing {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  grid-template-columns: 1fr;
}

/* Responsive breakpoints — md (768px) */
@media (min-width: 768px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }

  .grid--2col {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--3col {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--4col {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--products {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--pricing {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive breakpoints — lg (1024px) */
@media (min-width: 1024px) {
  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }

  .section--spacious {
    padding-top: 7rem;
    padding-bottom: 7rem;
  }

  .grid--3col {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid--4col {
    grid-template-columns: repeat(4, 1fr);
  }

  .grid--products {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid--pricing {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}


/* ==========================================================================
   6. Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-base);
}

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

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  transition: opacity var(--transition-fast);
}

.site-logo:hover {
  opacity: 0.8;
  color: var(--text);
}

/* Logo mark (icon square) */
.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  font-size: var(--text-sm);
  color: var(--bg);
}

/* Header right-side actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Language toggle */
.lang-toggle {
  display: flex;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border);
}

.lang-btn {
  padding: 6px 14px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.lang-btn:hover:not(.active) {
  color: var(--text);
}


/* ==========================================================================
   7. Footer
   ========================================================================== */

.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-top: var(--space-16);
  padding-bottom: var(--space-8);
}

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

/* Footer brand column */
.footer-brand {
  margin-bottom: var(--space-6);
}

.footer-brand .site-logo {
  margin-bottom: var(--space-3);
}

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

/* Footer link columns */
.footer-col h4 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--text);
}

/* Footer bottom bar */
.footer-bottom {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--text-light);
}

.footer-bottom a {
  color: var(--text-muted);
}


/* ==========================================================================
   8. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  line-height: 1;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary — solid accent */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

/* Secondary — outline */
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* Ghost — text only */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
  padding: 12px 16px;
}

.btn-ghost:hover {
  color: var(--accent);
}

/* Size variants */
.btn-lg {
  padding: 16px 32px;
  font-size: var(--text-lg);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--text-sm);
}

/* Pill shape */
.btn-pill {
  border-radius: var(--radius-full);
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover,
.btn.disabled:hover {
  transform: none;
  box-shadow: none;
}


/* ==========================================================================
   9. Utility Classes
   ========================================================================== */

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* Margin top */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

/* Margin bottom */
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

/* Horizontal centering */
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Flex helpers */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4          { gap: var(--space-4); }
.gap-6          { gap: var(--space-6); }

/* Screen-reader only — accessible hiding */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
