/*
 * Shared by every page: tokens (palette "Luigi", light and dark), reset, nav,
 * section shell, chips and footer. Page-specific layout stays inline in each
 * page's <style>, which loads after this file and may override it.
 */

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

/*
 * Palette "Luigi": cream #ffe3b3 → lime #c2dd6c → green #79ce67 → deep green #30b155,
 * on deep forest green. Fills use the palette greens with dark text (white on these
 * greens fails contrast); text-colored accents use --accent-text, a deeper green
 * in light mode, so links and labels stay readable on light surfaces.
 */
:root {
  --cream: #ffe3b3;
  --lime: #c2dd6c;
  --green: #79ce67;
  --green-deep: #30b155;
  --brand-gradient: linear-gradient(90deg, var(--cream), var(--lime), var(--green), var(--green-deep));
  --ink: #0b2214;
  --ink-2: #1c4a2a;
  --accent: #30b155;
  --accent-hover: #79ce67;
  --accent-text: #1f7a3a;
  --on-accent: #10230f;
  --on-dark: #fbf8f1;
  --on-dark-muted: #c9cfc2;
  --on-dark-accent: #c2dd6c;
  --focus: var(--accent-text);
  --text: #262b24;
  --heading: #1a1f1a;
  --muted: #5a6356;
  --bg: #faf7ef;
  --surface: #ffffff;
  --border: #e8e3d5;
  --chip-bg: #edf5d3;
  --chip-text: #2f6b25;
  --status-bg: #ffe3b3;
  --status-text: #6b4200;
  --nav-bg: rgba(255, 253, 248, 0.92);
  --footer-bg: #0b2214;
  --footer-text: #a3b8a7;
  --shadow: rgba(11, 34, 20, 0.08);
  --radius: 12px;
}

/* Dark tokens are repeated: once for the OS preference, once for an explicit override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #79ce67;
    --accent-hover: #c2dd6c;
    --accent-text: #79ce67;
    --text: #e4ebe2;
    --heading: #f6f3e9;
    --muted: #a3b4a6;
    --bg: #0c1810;
    --surface: #122319;
    --border: #22382a;
    --chip-bg: rgba(121, 206, 103, 0.16);
    --chip-text: #c2dd6c;
    --status-bg: rgba(255, 227, 179, 0.14);
    --status-text: #ffe3b3;
    --nav-bg: rgba(12, 24, 16, 0.9);
    --footer-bg: #06100a;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --accent: #79ce67;
  --accent-hover: #c2dd6c;
  --accent-text: #79ce67;
  --text: #e4ebe2;
  --heading: #f6f3e9;
  --muted: #a3b4a6;
  --bg: #0c1810;
  --surface: #122319;
  --border: #22382a;
  --chip-bg: rgba(121, 206, 103, 0.16);
  --chip-text: #c2dd6c;
  --status-bg: rgba(255, 227, 179, 0.14);
  --status-text: #ffe3b3;
  --nav-bg: rgba(12, 24, 16, 0.9);
  --footer-bg: #06100a;
  --shadow: rgba(0, 0, 0, 0.4);
}

html { scroll-padding-top: 72px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* <picture> only chooses the file; the <img> inside keeps its place in the layout. */
picture { display: contents; }

.icon { width: 1.5rem; height: 1.5rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 200;
  background: var(--accent); color: var(--on-accent); padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ── NAV ── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 2rem; min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-logo { font-size: 1.2rem; font-weight: 700; color: var(--heading); text-decoration: none; letter-spacing: -0.5px; }
.nav-logo span { color: var(--accent-text); }
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.95rem; font-weight: 500; }
/* The CTA is a filled button: accent text would vanish on its accent background. */
.nav-links a:not(.nav-cta):hover, .nav-links a:not(.nav-cta)[aria-current] { color: var(--accent-text); }
.nav-links .nav-cta { background: var(--accent); color: var(--on-accent); padding: 0.45rem 1.1rem; border-radius: 8px; }
.nav-links .nav-cta:hover { background: var(--accent-hover); color: var(--on-accent); }

/* ── SECTION SHELL ── */
.section { padding: 5rem 2rem; }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 0.5rem; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; color: var(--heading); letter-spacing: -0.5px; margin-bottom: 1rem; }
.section-sub { color: var(--muted); font-size: 1.05rem; max-width: 580px; margin-bottom: 3rem; }

/* ── BUTTONS ── */
.btn-primary, .btn-secondary {
  display: inline-block; padding: 0.75rem 1.8rem; border-radius: 8px; font-size: 1rem; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
/* Secondary is drawn for dark backgrounds (hero, page heads). */
.btn-secondary { background: rgba(255, 255, 255, 0.1); color: var(--on-dark); border: 1px solid rgba(255, 255, 255, 0.25); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.18); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ── CHIPS ── */
.badge { background: var(--chip-bg); color: var(--chip-text); font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.8rem; border-radius: 99px; }

/* ── ASSIGNMENTS (home: selected, /uppdrag/: all) ── */
.assignments { list-style: none; border-top: 1px solid var(--border); }
.assignment {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 0.5rem 2rem;
  padding: 1.75rem 0; border-bottom: 1px solid var(--border);
}
.assignment-years { color: var(--muted); font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 0.15rem; }
.assignment-body { display: flex; flex-direction: column; gap: 0.5rem; max-width: 720px; }
.assignment h3 { font-size: 1.15rem; font-weight: 700; color: var(--heading); line-height: 1.3; }
.assignment-client { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.assignment-body > p:not(.assignment-client), .assignment-body li { color: var(--muted); }
.assignment-tech { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin-top: 0.25rem; }
.more-link {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 2rem;
  font-weight: 600; text-decoration: none;
}
.more-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── FOOTER ── */
footer { background: var(--footer-bg); color: var(--footer-text); text-align: center; padding: 1.8rem 2rem; font-size: 0.88rem; }
footer a { color: var(--footer-text); }
footer a:hover { color: var(--on-dark); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .section { padding: 3.5rem 1rem; }
  .assignment { grid-template-columns: 1fr; }
}
/*
 * Narrow screens: keep every nav link reachable by wrapping instead of hiding
 * them. The wrapped menu is two rows tall, so it scrolls away with the page
 * rather than covering a seventh of the screen; the hero and contact sections
 * carry their own call to action.
 */
@media (max-width: 560px) {
  .site-nav { position: relative; }
  .nav-inner { padding: 0.6rem 1rem; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
  .nav-links { gap: 0.4rem 0.85rem; flex-wrap: wrap; justify-content: center; }
  .nav-links a { font-size: 0.875rem; }
  /* WCAG 2.2 target size: at least 24px tall. */
  .nav-links a:not(.nav-cta) { display: inline-block; padding: 0.35rem 0; }
  .nav-links .nav-cta { display: inline-block; padding: 0.35rem 0.75rem; }
  html { scroll-padding-top: 0; }
}
