/*
Theme Name: Karsten Sommer
Theme URI: https://karstensommer.dk
Author: Karsten Sommer
Author URI: https://karstensommer.dk
Description: Hand-coded, dependency-free personal theme for karstensommer.dk — a warm, editorial identity for presentation, CV and reflections, plus a blog. Content is edited in wp-admin; the theme provides the design. Light & dark aware.
Version: 2.2.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: karsten-sommer
*/

/* ============================================================
   Design tokens — "Sommer": warm, sunlit, editorial
   ============================================================ */
:root {
  /* cool, clean surfaces */
  --paper:      #f4f7fc;   /* page background */
  --paper-2:    #e9effb;   /* alt sections */
  --card:       #ffffff;   /* raised surfaces */

  /* ink — deep navy */
  --ink:        #0f1830;   /* headings */
  --ink-soft:   #33405c;   /* body */
  --muted:      #67738f;   /* meta / secondary */

  /* hairlines */
  --line:       #dce4f3;
  --line-strong:#c2cee8;

  /* vivid blue family + cyan & violet pops */
  --accent:     #2563eb;   /* royal blue */
  --accent-dk:  #1b4ed1;
  --accent-2:   #06b6d4;   /* cyan */
  --accent-3:   #7c3aed;   /* violet */
  --accent-soft:#e4edff;

  /* signature gradients */
  --grad:      linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  --grad-cool: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

  /* glow tints for the hero */
  --glow-warm:  rgba(37, 99, 235, .42);
  --glow-cool:  rgba(124, 58, 237, .30);

  /* type */
  --display: "Fraunces", "Newsreader", Georgia, "Times New Roman", serif;
  --sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* metrics */
  --maxw: 1180px;
  --measure: 66ch;
  --radius: 12px;
  --radius-lg: 20px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,24,48,.06), 0 4px 14px rgba(37,99,235,.07);
  --shadow:    0 2px 6px rgba(15,24,48,.08), 0 18px 44px rgba(37,99,235,.14);
  --ease: cubic-bezier(.2,.7,.2,1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #0a1020;
    --paper-2:    #0e1730;
    --card:       #121c34;
    --ink:        #eef3ff;
    --ink-soft:   #c3cce6;
    --muted:      #8893b3;
    --line:       #1e2a46;
    --line-strong:#2c3a5e;
    --accent:     #5b8cff;
    --accent-dk:  #84a6ff;
    --accent-2:   #22d3ee;
    --accent-3:   #a78bfa;
    --accent-soft:#15233f;
    --glow-warm:  rgba(91, 140, 255, .32);
    --glow-cool:  rgba(167, 139, 250, .24);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.4);
    --shadow:    0 2px 6px rgba(0,0,0,.55), 0 22px 50px rgba(0,0,0,.6);
  }
  .hero__portrait, .featured img { filter: brightness(.95); }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* tactile film grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9000;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::after { opacity: .055; } }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-optical-sizing: auto;
  color: var(--ink);
  font-weight: 420;
  line-height: 1.08;
  letter-spacing: -.018em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2.3rem, 5.2vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.35rem; letter-spacing: -.01em; }

p { margin: 0 0 1.1em; }

a { color: var(--accent); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--accent-dk); }

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

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

blockquote {
  margin: 1.8rem 0;
  padding: .2rem 0 .2rem 1.5rem;
  border-left: 3px solid var(--accent);
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink);
}

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
pre {
  background: #0d1730; color: #eef3ff;
  padding: 1.1rem 1.3rem; border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow-sm);
}
code { background: var(--accent-soft); color: var(--accent-dk); padding: .12em .4em; border-radius: 5px; }
pre code { background: none; padding: 0; color: inherit; }

::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ============================================================
   Reading progress (single posts / pages)
   ============================================================ */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 200; transition: width .1s linear;
}

/* ============================================================
   Layout
   ============================================================ */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.narrow { max-width: 780px; }

.section { padding: 92px 0; }
.section--tight { padding: 60px 0; }
.section--paper { background: var(--paper-2); }
.section--dark { background: #0b1326; color: #c3cce6; }
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 10px 16px; z-index: 300; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ============================================================
   Header / nav
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  border-bottom-color: var(--line);
  box-shadow: 0 6px 24px rgba(26,23,19,.06);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 72px;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--display); font-optical-sizing: auto;
  font-size: 1.3rem; font-weight: 500; color: var(--ink);
  letter-spacing: -.015em;
}
.brand::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex: 0 0 auto;
}
.brand:hover { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 2rem; }
.nav__list, .site-footer__nav-list { display: flex; align-items: center; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  position: relative; color: var(--ink-soft);
  font-size: .95rem; font-weight: 500; padding: 4px 0;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .32s var(--ease);
}
.nav a:hover { color: var(--accent); }
.nav a:hover::after,
.nav .current-menu-item > a::after,
.nav .current_page_item > a::after { transform: scaleX(1); }
.nav .current-menu-item > a, .nav .current_page_item > a { color: var(--accent); }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  padding: 8px; color: var(--ink);
}
.nav-toggle svg { width: 26px; height: 26px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--grad); color: #fff;
  padding: .8rem 1.5rem; border-radius: var(--pill);
  font-weight: 600; font-size: .95rem; letter-spacing: .01em;
  border: 0;
  box-shadow: 0 6px 18px rgba(37,99,235,.28);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .18s var(--ease);
}
.btn:hover { filter: brightness(1.08) saturate(1.06); color: #fff; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37,99,235,.4); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--line-strong); box-shadow: none; filter: none; }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-dk); border-color: var(--accent); filter: none; transform: translateY(-2px); }

/* ============================================================
   Hero (front page)
   ============================================================ */
.hero { position: relative; isolation: isolate; overflow: clip; padding: clamp(56px, 9vw, 116px) 0 clamp(52px, 7vw, 88px); }
.hero::before {
  content: ""; position: absolute; z-index: -1;
  right: -8%; top: -22%; width: 62vw; height: 62vw;
  max-width: 760px; max-height: 760px;
  background: radial-gradient(circle at 50% 50%, var(--glow-warm), transparent 62%);
  filter: blur(14px);
  animation: drift 16s ease-in-out infinite alternate;
}
.hero::after {
  content: ""; position: absolute; z-index: -1;
  left: -14%; bottom: -28%; width: 46vw; height: 46vw;
  max-width: 560px; max-height: 560px;
  background: radial-gradient(circle at 50% 50%, var(--glow-cool), transparent 64%);
  filter: blur(16px);
  animation: drift 20s ease-in-out -4s infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-4%, 5%) scale(1.08); }
}

.hero__grid {
  display: grid; grid-template-columns: 1.25fr .85fr;
  gap: clamp(40px, 6vw, 72px); align-items: center;
}
.hero__kicker {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--sans); text-transform: uppercase;
  letter-spacing: .2em; font-size: .76rem; font-weight: 600;
  color: var(--accent-2); margin: 0 0 1.4rem;
}
.hero__kicker::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 60%, transparent);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 55%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 {
  font-size: clamp(2.9rem, 8.5vw, 5.6rem);
  font-weight: 380; line-height: .98; letter-spacing: -.025em;
  margin: 0 0 1rem;
}
.hero__lead {
  font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-soft);
  max-width: 50ch; line-height: 1.55;
}
.hero__actions { margin-top: 2rem; display: flex; gap: .8rem; flex-wrap: wrap; }

.hero__media { position: relative; }
.hero__media::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px;
  border: 1.5px solid var(--accent); border-radius: var(--radius-lg);
  z-index: 0; opacity: .65;
}
.hero__portrait {
  position: relative; z-index: 1;
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  aspect-ratio: 4/5; object-fit: cover; width: 100%;
}
.hero__portrait--placeholder {
  display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 30% 20%, #bdd2ff 0%, transparent 55%),
    linear-gradient(150deg, var(--accent) 0%, var(--accent-3) 100%);
  color: #fff; font-family: var(--display); font-weight: 500;
  font-size: clamp(3rem, 8vw, 5rem); letter-spacing: .02em;
}

/* ============================================================
   Front-page content blocks
   ============================================================ */
.lede { font-family: var(--display); font-size: 1.45rem; color: var(--ink); line-height: 1.5; }

.entry-content { max-width: var(--measure); font-size: 1.06rem; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { margin-top: 2.4rem; }
.entry-content h3 { margin-top: 1.8rem; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; margin: 0 0 1.1em; }
.entry-content li { margin-bottom: .4em; }
.entry-content li::marker { color: var(--accent); }
.entry-content img { border-radius: var(--radius); margin: 1.6rem 0; box-shadow: var(--shadow-sm); }
.entry-content a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.entry-content a:hover { text-decoration-color: var(--accent); }
.entry-content > p:first-of-type::first-letter {
  font-family: var(--display); font-weight: 500;
  float: left; font-size: 3.4em; line-height: .78;
  padding: .06em .12em 0 0; color: var(--accent);
}

/* ============================================================
   Section heading / eyebrow
   ============================================================ */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2.6rem; flex-wrap: wrap; }
.section-head__link { font-weight: 600; font-size: .95rem; white-space: nowrap; }
.section-head__link:hover { text-decoration: none; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .76rem; font-weight: 600; color: var(--accent);
  margin: 0 0 .8rem;
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px;
}

/* ============================================================
   Post list / cards
   ============================================================ */
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px; }
.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 30px 30px 32px;
  display: flex; flex-direction: column;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
  transform: scaleY(0); transform-origin: top;
  transition: transform .28s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card:hover::before { transform: scaleY(1); }
.card__meta { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; margin-bottom: .7rem; }
.card__meta a { color: var(--muted); }
.card__meta a:hover { color: var(--accent); }
.card__title { font-size: 1.35rem; margin-bottom: .55rem; line-height: 1.2; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--accent); }
.card__excerpt { color: var(--ink-soft); font-size: .98rem; margin-bottom: 1.2rem; }
.card__more { margin-top: auto; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.card__more::after { content: "→"; transition: transform .22s var(--ease); }
.card:hover .card__more::after { transform: translateX(4px); }

/* ============================================================
   Single post / page article
   ============================================================ */
.article-head { position: relative; padding: clamp(64px, 8vw, 100px) 0 28px; }
.article-head .meta { color: var(--muted); font-size: .92rem; margin-top: .8rem; }
.article-head .meta a { color: var(--muted); }
.article-head .meta a:hover { color: var(--accent); }
.article-body { padding-bottom: 92px; }
.featured { margin: 8px 0 40px; }
.featured img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.post-nav { display: flex; justify-content: space-between; gap: 1.5rem; border-top: 1px solid var(--line); padding-top: 1.6rem; margin-top: 2.8rem; font-size: .95rem; }
.post-nav a { font-weight: 600; max-width: 46%; }
.post-nav a:hover { text-decoration: none; }

.taglist { margin-top: 2.2rem; font-size: .9rem; }
.taglist a { display: inline-block; background: var(--accent-soft); color: var(--accent-dk); padding: .25em .8em; border-radius: var(--pill); margin: 0 .35em .45em 0; font-weight: 500; }
.taglist a:hover { text-decoration: none; background: var(--accent); color: #fff; }

/* ============================================================
   Comments
   ============================================================ */
.comments { max-width: var(--measure); margin-top: 3.4rem; padding-top: 2.4rem; border-top: 1px solid var(--line); }
.comments ol { list-style: none; padding: 0; }
.comment { border-top: 1px solid var(--line); padding: 1.3rem 0; }
.comment:first-child { border-top: 0; }
.comment .author { font-weight: 600; color: var(--ink); }
.comment .date { color: var(--muted); font-size: .85rem; }
.comment-form input[type=text],
.comment-form input[type=email],
.comment-form input[type=url],
.comment-form textarea { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
input[type=text], input[type=email], input[type=url], input[type=search],
textarea, select {
  font-family: var(--sans); font-size: 1rem;
  padding: .75rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { font-weight: 600; font-size: .92rem; color: var(--ink); display: block; margin-bottom: .4rem; }
.field { margin-bottom: 1.2rem; }

.notice { padding: .95rem 1.15rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: .95rem; }
.notice--ok { background: #e7f1ea; color: #1e4d33; }
.notice--err { background: #f7e7e7; color: #7a2b2b; }

/* Contact form (shortcode [ks_kontaktformular]) */
.contact-form { max-width: 580px; margin-top: 1.5rem; }
.contact-form .field { margin-bottom: 1.1rem; }
.contact-form input[type=text],
.contact-form input[type=email],
.contact-form textarea { width: 100%; }
.contact-form textarea { min-height: 168px; resize: vertical; }
.contact-form .btn { margin-top: .4rem; cursor: pointer; }
.contact-form .ks-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 3.4rem; }
.pagination .page-numbers {
  padding: .55rem .95rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink-soft); background: var(--card); transition: all .15s var(--ease);
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { position: relative; overflow: hidden; background: #0b1326; color: #aab4cf; padding: clamp(60px, 8vw, 96px) 0 44px; }
.site-footer::before {
  content: ""; position: absolute; right: -6%; top: -40%;
  width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(37,99,235,.36), transparent 62%);
  filter: blur(8px); pointer-events: none;
}
.site-footer::after {
  content: ""; position: absolute; left: -8%; bottom: -50%;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(124,58,237,.28), transparent 64%);
  filter: blur(10px); pointer-events: none;
}
.site-footer a { color: #dce4f6; }
.site-footer a:hover { color: #fff; }
.site-footer__grid { position: relative; display: flex; justify-content: space-between; gap: 2.5rem; flex-wrap: wrap; align-items: flex-start; }
.site-footer__brand { font-family: var(--display); font-optical-sizing: auto; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 420; color: #fff; letter-spacing: -.02em; line-height: 1.05; }
.site-footer__nav { display: flex; }
.site-footer__nav-list { gap: 1.4rem; flex-wrap: wrap; }
.site-footer__nav a { color: #aab4cf; font-size: .95rem; }
.site-footer__nav a:hover { color: #fff; }
.site-footer__legal { position: relative; margin-top: 2.8rem; font-size: .82rem; color: #76819e; border-top: 1px solid #1c2746; padding-top: 1.5rem; }

/* ============================================================
   Reveal animation (staggered)
   ============================================================ */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero::before, .hero::after, .hero__kicker::before { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__media { max-width: 360px; }
  .hero__media::before { inset: 14px -14px -14px 14px; }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .section { padding: 64px 0; }
  .entry-content > p:first-of-type::first-letter { font-size: 2.8em; }
  .nav { display: none; }
  .nav--open {
    display: flex; flex-direction: column; align-items: flex-start;
    position: absolute; top: 72px; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 1.2rem 28px 1.6rem; gap: 0; box-shadow: var(--shadow);
  }
  .nav--open .nav__list { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
  .nav--open .nav__list li { width: 100%; border-top: 1px solid var(--line); }
  .nav--open .nav__list li:first-child { border-top: 0; }
  .nav--open a { display: block; width: 100%; padding: .85rem 0; }
  .nav--open a::after { display: none; }
  .nav-toggle { display: inline-flex; }
  .post-nav { flex-direction: column; gap: .8rem; }
  .post-nav a { max-width: 100%; }
}
