/* ============================================================
   NILSTROMAB – GEMENSAMT TEMA
   Dark academia: pergament, bärnstensguld, djup charcoal
   Fonter: IM Fell English (display), Cinzel (rubrik), IBM Plex (brödtext)
   Alla projekt laddar denna fil först och kan sedan lägga till
   projekt-specifika regler med egna accentfärger.
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Cinzel:wght@400;600;700&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root,
[data-theme='light'] {
  --color-bg: #f5f2ec;
  --color-surface: #f9f7f2;
  --color-surface-2: #fdfcfa;
  --color-surface-offset: #ede9e0;
  --color-divider: #d4cfc4;
  --color-border: #c8c1b4;

  --color-text: #1e1b14;
  --color-text-muted: #6b6457;
  --color-text-faint: #63625a;

  --color-primary: #a06a00;
  --color-primary-hover: #7d5000;
  --color-primary-highlight: #f0e2c2;
  --color-primary-soft: color-mix(in oklch, var(--color-primary) 12%, transparent);

  --color-accent: #a06a00;
  --color-accent-soft: color-mix(in oklch, var(--color-accent) 12%, transparent);

  --color-success: #2d7a3f;
  --color-warning: #c17800;
  --color-error: #b52626;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
  --content-default: 1100px;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);

  --font-body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --font-display: 'IM Fell English', Georgia, serif;
  --font-heading: 'Cinzel', Georgia, serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

[data-theme='dark'] {
  --color-bg: #141210;
  --color-surface: #1a1814;
  --color-surface-2: #201d19;
  --color-surface-offset: #181512;
  --color-divider: #2a2620;
  --color-border: #38342d;

  --color-text: #d8d2c8;
  --color-text-muted: #857e74;
  --color-text-faint: #857d70;

  --color-primary: #c88a20;
  --color-primary-hover: #e0a030;
  --color-primary-highlight: #3a2e12;

  --color-success: #4aaa62;
  --color-warning: #d89a30;
  --color-error: #e05050;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* --- Bas --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16, 4rem);
}
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.65;
}
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
h1,h2,h3,h4 { text-wrap: balance; }
p, li { text-wrap: pretty; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a, button { transition: color var(--transition), background var(--transition), border-color var(--transition); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
@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;
  }
}

/* Skippa-lank for tangentbordsanvandare */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--color-primary);
  color: #141210;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-md) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* --- Gemensam sajt-header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--text-sm, 0.75rem) 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.header-brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 30% 10%, #f5e2b0 0, var(--color-primary) 55%, #141210 100%);
  display: grid; place-items: center;
  box-shadow: 0 0 24px color-mix(in oklch, var(--color-primary) 45%, transparent);
  flex-shrink: 0;
}
.logo-mark span { font-weight: 700; font-size: 1rem; color: #141210; font-family: var(--font-heading); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--color-text);
}
.brand-sub { font-size: var(--text-xs); color: var(--color-text-muted); }
.header-nav { display: flex; gap: 1.25rem; margin-left: auto; }
.header-nav a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.header-nav a:hover { color: var(--color-text); text-decoration: none; }
.header-nav a[aria-current="page"] { color: var(--color-primary); }
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  flex-shrink: 0;
  font-size: 1.1rem;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-offset); }

/* --- Gemensam footer --- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 3rem 1.5rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
}
.footer-brand .brand-title { font-size: var(--text-lg); display: block; margin-bottom: 0.5rem; }
.footer-sub { font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: flex-end; }
.footer-links a { font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-links a:hover { color: var(--color-primary); }
@media (max-width: 800px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
}

/* --- Gemensamma kort (projekt etc.) --- */
.card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* --- Ljus/mörk-toggle (gemensam) --- */
.init-theme {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
}
