/* Basic Element Defaults (apply global tokens) */
body {
  font-family: var(--bricks-font-family-base);
  font-size: var(--bricks-font-size-base);
  line-height: var(--bricks-line-height-base);
  background: var(--bricks-color-bg);
  color: var(--bricks-color-text);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--bricks-font-family-heading);
  font-weight: 700;
  margin-bottom: 0.5em;
  color: var(--bricks-color-text);
}

h1 {
  font-size: 2.25rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.75rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.5rem;
  line-height: 1.3;
}

h4 {
  font-size: 1.25rem;
  line-height: 1.4;
}

h5 {
  font-size: 1.125rem;
  line-height: 1.5;
}

h6 {
  font-size: 1rem;
  line-height: 1.5;
}

/* Button Styles */
.button-primary {
  background: var(--bricks-color-primary);
  color: var(--bricks-color-text-on-primary);
  padding: 0.5em 1em;
  border: none;
  border-radius: var(--bricks-radius-sm);
  box-shadow: var(--bricks-shadow-sm);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.button-primary:hover {
  filter: brightness(1.1);
  /* Slight brighten on hover */
}

.button-secondary {
  background: transparent;
  color: var(--bricks-color-button-secondary);
  border: 2px solid var(--bricks-color-button-secondary);
  padding: 0.5em 1em;
  border-radius: var(--bricks-radius-sm);
  cursor: pointer;
  text-align: center;
}

.button-secondary:hover {
  background: rgba(255,
      255,
      255,
      0.1);
  /* Hover: add slight visible hint (10% white) in dark; will be 10% black in light due to invert filter below */
}

/* Adjust secondary hover for light theme (10% black overlay) */
[data-theme="light"] .button-secondary:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Section Styles */
.section-base {
  background: var(--bricks-color-bg);
  color: var(--bricks-color-text);
  padding: var(--bricks-space-5) 0;
}

.section-alt {
  background: var(--bricks-color-surface);
  color: var(--bricks-color-text);
  padding: var(--bricks-space-5) 0;
}

.section-hero {
  background: var(--bricks-color-primary);
  color: var(--bricks-color-text-on-primary);
  padding: var(--bricks-space-6) 0 var(--bricks-space-5);
  /* A hero could include additional styling like background-image or overlay if needed */
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

.header-base {
  background: var(--bricks-color-surface);
  color: var(--bricks-color-text);
  padding: var(--bricks-space-3) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .header-base {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--bricks-space-4);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--bricks-space-2);
  text-decoration: none;
  color: var(--bricks-color-text);
  font-weight: 700;
  font-size: 1.25rem;
}

.site-logo:hover {
  color: var(--bricks-color-primary);
}

.site-logo img {
  height: 40px;
  width: auto;
}

/* Navigation */
.nav-main {
  display: flex;
  align-items: center;
  gap: var(--bricks-space-4);
}

.nav-main ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--bricks-space-4);
}

.nav-link {
  color: var(--bricks-color-text);
  text-decoration: none;
  font-weight: 500;
  padding: var(--bricks-space-2) 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--bricks-color-primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--bricks-color-primary);
  transition: width 0.2s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Header Actions (right side) */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--bricks-space-3);
}

/* Theme Toggle Button */
.theme-toggle {
  background: transparent;
  border: none;
  color: var(--bricks-color-text);
  cursor: pointer;
  padding: var(--bricks-space-2);
  border-radius: var(--bricks-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--bricks-color-text);
  cursor: pointer;
  padding: var(--bricks-space-2);
  font-size: 1.5rem;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .nav-main {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--bricks-color-surface);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--bricks-space-6) var(--bricks-space-4);
    transition: right 0.3s ease;
    box-shadow: var(--bricks-shadow-lg);
    z-index: 1001;
  }

  .nav-main.is-open {
    right: 0;
  }

  .nav-main ul {
    flex-direction: column;
    width: 100%;
    gap: var(--bricks-space-2);
  }

  .nav-link {
    display: block;
    padding: var(--bricks-space-3) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
  }

  [data-theme="light"] .nav-link {
    border-bottom-color: rgba(0, 0, 0, 0.1);
  }

  .mobile-menu-toggle {
    display: flex;
  }
}

/* Mobile Menu Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.mobile-overlay.is-open {
  display: block;
}

/* ========================================
   FOOTER
   ======================================== */

.footer-base {
  background: var(--bricks-color-surface);
  color: var(--bricks-color-text);
  padding: var(--bricks-space-6) 0 var(--bricks-space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .footer-base {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--bricks-space-4);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--bricks-space-5);
  margin-bottom: var(--bricks-space-5);
}

.footer-col h4 {
  color: var(--bricks-color-text);
  margin-bottom: var(--bricks-space-3);
  font-size: 1rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: var(--bricks-space-2);
}

.footer-links a {
  color: var(--bricks-color-text-alt);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--bricks-color-primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--bricks-space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  gap: var(--bricks-space-3);
}

[data-theme="light"] .footer-bottom {
  border-top-color: rgba(0, 0, 0, 0.1);
}

.footer-copyright {
  color: var(--bricks-color-text-alt);
  font-size: 0.875rem;
}

.footer-social {
  display: flex;
  gap: var(--bricks-space-3);
}

.footer-social a {
  color: var(--bricks-color-text-alt);
  font-size: 1.25rem;
  transition: color 0.2s ease;
}

.footer-social a:hover {
  color: var(--bricks-color-primary);
}

/* Card Component */
.card {
  background: var(--bricks-color-surface);
  color: var(--bricks-color-text);
  padding: var(--bricks-space-4);
  border-radius: var(--bricks-radius-md);
  box-shadow: var(--bricks-shadow-sm);
  /* In light mode, surface is white with a small shadow; in dark mode, it's dark with a very subtle shadow */
}

/* Typography Utility Classes */
.text-lead {
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 400;
}

.text-small {
  font-size: 0.875rem;
  line-height: 1.5;
}

.text-muted {
  color: var(--bricks-color-text-alt);
}

.heading-1,
.heading-2,
.heading-3,
.heading-4 {
  font-family: var(--bricks-font-family-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--bricks-color-text);
  margin-bottom: 0.5em;
}

.heading-1 {
  font-size: 2.25rem;
}

.heading-2 {
  font-size: 1.75rem;
}

.heading-3 {
  font-size: 1.5rem;
}

.heading-4 {
  font-size: 1.25rem;
}

/* (Heading classes let you apply heading styles to any element. They roughly map h1-h4 sizes.) */

/* Dyslexia-Friendly Mode (optional utility - apply to <body> or container) */
.dyslexia-mode {
  letter-spacing: 0.35ch;
  word-spacing: 1.225ch;
  /* ~3.5x letter-spacing */
  font-variant-ligatures: none;
  /* disable ligatures that can confuse readers */
}

/* (When .dyslexia-mode is added, it increases spacing between letters and words to reduce crowding, improving readability for some users. Use this class on a parent element or the body tag to enable it site-wide.) */