/**
 * Theme Base Styles: Design tokens, typography, layout, accessibility
 * Olivier Sauvage — B2Biz
 */

:root {
  /* Brand colors */
  --os-primary-blue: #0691E2;
  --os-primary-purple: #9652DF;
  --os-pale-blue: #EAF7FE;
  --os-pale-purple: #F4EEFC;
  --os-dark: #262626;
  --os-mid-grey: #5D6773;
  --os-light-grey: #F8FAFC;
  --os-border: #E2E8F0;
  --os-accent-red: #E11D48;
  --os-white: #FFFFFF;

  /* Typography */
  --os-font-heading: 'Alumni Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --os-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --os-space-xs: 0.25rem;
  --os-space-sm: 0.5rem;
  --os-space-md: 1rem;
  --os-space-lg: 1.5rem;
  --os-space-xl: 2rem;
  --os-space-2xl: 3rem;
  --os-space-3xl: 4rem;

  /* Borders & Radius */
  --os-radius-card: 20px;
  --os-radius-btn: 8px;
  --os-radius-pill: 8px;
  --os-shadow-subtle: none;
  --os-shadow-card: none;

  /* Layout */
  --os-container-max: 1240px;
  --os-container-article: 840px;
  --os-header-height: 80px;
  --os-mobile-nav-height: 64px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--os-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--os-dark);
  background-color: var(--os-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Padding on mobile to prevent content being hidden under fixed bottom nav */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(var(--os-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }
}

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

/* Typography Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--os-font-heading);
  font-weight: 700;
  line-height: 1.15;
  color: var(--os-dark);
  margin-top: 0;
  margin-bottom: var(--os-space-md);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.75rem); }
h2 { font-size: clamp(2rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
  margin-top: 0;
  margin-bottom: var(--os-space-md);
}

a {
  color: var(--os-primary-blue);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: #026ca8;
}

/* Focus outline for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--os-primary-blue);
  outline-offset: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -9999px;
  left: var(--os-space-md);
  background: var(--os-dark);
  color: var(--os-white);
  padding: var(--os-space-sm) var(--os-space-md);
  z-index: 999999;
  border-radius: var(--os-radius-btn);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--os-space-md);
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* Containers */
.os-container {
  width: 100%;
  max-width: var(--os-container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--os-space-lg);
  padding-right: var(--os-space-lg);
}

.os-container-narrow {
  width: 100%;
  max-width: var(--os-container-article);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--os-space-lg);
  padding-right: var(--os-space-lg);
}

.os-main-content {
  flex: 1 0 auto;
  padding-top: var(--os-space-xl);
  padding-bottom: var(--os-space-3xl);
}
