/* ============================================================
   Johan Beck-Norén — site.css
   Clean, minimal portfolio theme. Light by default, dark via
   prefers-color-scheme. No build step, no JS required.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --text: #1a1d23;
  --text-muted: #5b6270;
  --border: #e4e7eb;
  --accent: #2f6feb;
  --accent-hover: #1d55c4;
  --accent-soft: #eaf1fe;
  --card-bg: #ffffff;
  --card-border: #e4e7eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.06), 0 8px 16px rgba(16, 24, 40, 0.08);
  --radius: 10px;
  --max-width: 760px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --bg-subtle: #171b22;
    --text: #e7e9ee;
    --text-muted: #9aa1ae;
    --border: #262b34;
    --accent: #6ea2ff;
    --accent-hover: #8fb6ff;
    --accent-soft: #1a2740;
    --card-bg: #171b22;
    --card-border: #262b34;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover, a:focus-visible { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em 0;
}

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

/* ---------- Layout shell ---------- */

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 40px 0 28px 0;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--accent); text-decoration: none; }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
}
.site-nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-subtle); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 8px 0;
  text-align: center;
}

.hero .tagline {
  color: var(--text);
  font-weight: 600;
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  letter-spacing: -0.01em;
  margin: 0;
}

.hero-divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: var(--max-width);
  margin: 40px auto;
}

/* ---------- Employer badges ---------- */

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 4px 0;
}

.badge {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
}

/* ---------- Main content ---------- */

main { padding: 8px 0 64px 0; }
main::after { content: ""; display: table; clear: both; }

main h2 {
  font-size: 1.3rem;
  margin-top: 2.2em;
}
main h2:first-child { margin-top: 0; }

main h4 {
  font-size: 1.05rem;
  margin-top: 1.8em;
}

.section-photo {
  float: right;
  width: 220px;
  border-radius: var(--radius);
  margin: 4px 0 16px 24px;
  box-shadow: var(--shadow);
}

.about-photo { margin-top: 1.6em; }

@media (max-width: 560px) {
  .section-photo { float: none; width: 100%; margin: 0 0 16px 0; }
}

/* ---------- Portfolio card grid ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.project-card a.thumb { display: block; background: var(--bg-subtle); }
.project-card a.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.project-card .card-body { padding: 16px 18px 20px 18px; }

.project-card h4 { margin: 0 0 4px 0; font-size: 1.02rem; }

.meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.project-card p { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 10px; }

.project-card .read-more { font-size: 0.88rem; font-weight: 500; }

/* ---------- Project detail pages ---------- */

.project-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}
.project-images a { border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.project-images img { height: 140px; width: auto; max-width: 100%; }

.project-report {
  display: inline-block;
  margin: 4px 0 20px 0;
  font-weight: 500;
}

/* ---------- CV ---------- */

.cv-entry {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 4px 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.cv-entry:first-of-type { padding-top: 8px; }
.cv-entry:last-of-type { border-bottom: none; }

.cv-entry .when { color: var(--text-muted); font-size: 0.88rem; font-weight: 500; }
.cv-entry .where { font-weight: 650; margin-top: 2px; }
.cv-entry .role { color: var(--text-muted); font-size: 0.92rem; }
.cv-entry .desc { margin: 2px 0 0 0; font-size: 0.96rem; }

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 10px 0 0 0;
  padding: 0;
}
.tech-tags li {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

@media (max-width: 560px) {
  .cv-entry { grid-template-columns: 1fr; gap: 6px; }
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px 32px;
  margin-top: 16px;
}
.skills-grid ul { list-style: none; margin: 0; padding: 0; }
.skills-grid li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.skills-grid li:last-child { border-bottom: none; }

.cv-footnote { margin-top: 32px; color: var(--text-muted); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 48px 0;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header { padding: 28px 0 20px 0; }
  .hero { padding: 32px 0 4px 0; }
  main { padding: 4px 0 48px 0; }
}
