/* base.css — design tokens, reset, typografi-defaulter, @font-face */

/* ─── Fonts ─────────────────────────────────────────────────── */
/* Brödtext: system-ui (OS-native — San Francisco på Mac, Segoe UI på
   Windows, Roboto på Android). Ingen nedladdning.
   Rubriker: Poppins (egenhostad nedan). */

@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/poppins-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/poppins-500.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/poppins-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/poppins-700.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/poppins-800.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ─── Design tokens ────────────────────────────────────────── */

:root {
  /* Färger — primära */
  --color-navy: #393d52;
  --color-beige: #faf6ef;
  --color-gold: #feba0b;

  /* Färger — text */
  --color-text-main: #393d52;
  --color-text-muted: #6a6a79;
  --color-text-inverted: #ffffff;

  /* Färger — ytor */
  --color-bg-base: #f9f6f1;
  --color-bg-card: rgba(255, 255, 255, 0.92);
  --color-border-subtle: rgba(0, 0, 0, 0.06);

  /* Guld-varianter */
  --color-gold-primary: #feba0b;
  --color-gold-hover: #e5a800;
  --color-gold-light: #ffe07a;
  --color-gold-dark: #9a6b00;
  --color-gold-tint: #fef3d6;

  /* Semantiska */
  --color-success: #22c55e;
  --color-success-bg: #f0fdf4;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-info: #3b82f6;

  /* Rollfärger */
  --color-role-su-bg: #f0f0f2;
  --color-role-su-text: #52525b;
  --color-role-owner-bg: #fdf2f2;
  --color-role-owner-text: #9f1239;

  /* Typografi */
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --font-size-h1: clamp(2rem, 5vw + 1rem, 2.5rem);
  --font-size-h2: clamp(1.5rem, 3vw + 0.5rem, 1.875rem);
  --font-size-h3: clamp(1.25rem, 2vw + 0.5rem, 1.375rem);
  --font-size-h4: clamp(1.0625rem, 1.5vw + 0.25rem, 1.125rem);
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;
  --font-size-xs: 0.75rem;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;

  /* Spacing (8px grid) */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.10);

  /* Maxbredder */
  --max-width-content: 1000px;
  --max-width-page: 1200px;
  --max-width-narrow: 560px;

  /* Touch target (WCAG) */
  --touch-target: 44px;

  /* Transitions */
  --transition-fast: 0.15s ease;
}

/* ─── Reset ────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  color: var(--color-text-main);
  background: var(--color-bg-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-md) 0;
  color: var(--color-navy);
}

h1 { font-size: var(--font-size-h1); font-weight: var(--weight-heavy); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); font-weight: var(--weight-semibold); }
h4 { font-size: var(--font-size-h4); font-weight: var(--weight-semibold); }

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

a {
  color: var(--color-navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-gold-dark);
}

ul, ol {
  margin: 0 0 var(--space-md) 0;
  padding-left: var(--space-lg);
}

strong {
  font-weight: var(--weight-semibold);
}

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

button {
  font-family: inherit;
  font-size: inherit;
}

/* ─── Tillgänglighet ───────────────────────────────────────── */

*:focus-visible {
  outline: 2px solid var(--color-gold-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

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

.skip-link {
  position: absolute;
  top: -48px;
  left: 0;
  background: var(--color-navy);
  color: var(--color-text-inverted);
  padding: var(--space-sm) var(--space-md);
  z-index: 100;
  text-decoration: none;
  font-weight: var(--weight-medium);
}

.skip-link:focus {
  top: 0;
  color: var(--color-text-inverted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
