/* ==========================================================================
   Base Styles — Reset, Typography, Layout
   ========================================================================== */

/* ---- Font Faces (variable fonts, self-hosted) ---- */
@font-face {
  font-family: 'Source Sans 3';
  src: url('../assets/fonts/source-sans-3-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-latin.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

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

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

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

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

a:hover {
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

/* ---- Focus Visible ---- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Typography Scale ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: 700;
  color: var(--color-heading);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

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

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

p:last-child {
  margin-bottom: 0;
}

small {
  font-size: var(--text-sm);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface-alt);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
}

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

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

/* ---- Utility Classes ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.font-ui     { font-family: var(--font-ui); }
.font-display { font-family: var(--font-display); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
}

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

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

.btn--secondary:hover {
  background-color: var(--color-surface-alt);
  text-decoration: none;
}

.btn--accent {
  background-color: var(--color-accent);
  color: #FFFFFF;
}

.btn--accent:hover {
  background-color: var(--color-accent-hover);
  text-decoration: none;
}

.btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
}

.btn--lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-base);
}

/* ---- Page Layout ---- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page__main {
  flex: 1;
}

/* ---- Section Spacing ---- */
.section {
  padding-block: var(--space-3xl);
}

.section--sm {
  padding-block: var(--space-2xl);
}

/* ---- Card ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

/* ---- Responsive ---- */
@media (max-width: 1023px) {
  :root {
    --text-4xl: 2rem;
    --text-3xl: 1.625rem;
    --text-5xl: 2.5rem;
  }
}

@media (max-width: 767px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-5xl: 2rem;
    --space-3xl: 2.5rem;
  }

  .container {
    padding-inline: var(--space-md);
  }
}
