/* Self-hosted variable fonts (latin), no requests to Google */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-var.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-var.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }

/* Daniel Portfolio Theme. Tokens match design-tokens.md in the static repo. */
:root {
  --c-ink: #1A1F1A;
  --c-paper: #F4F1EA;
  --c-accent: #2F6B4F;
  --c-highlight: #D9A441;
  --c-muted: #4E544E;
  --c-line: #DAD4C7;

  --f-head: "Schibsted Grotesk", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;

  --fs-h1: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
  --fs-h2: clamp(1.875rem, 1.4rem + 1.9vw, 2.75rem);
  --fs-h3: clamp(1.25rem, 1.2rem + 0.2vw, 1.375rem);
  --fs-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --fs-small: 0.875rem;

  --s-1: 8px; --s-2: 16px; --s-3: 24px; --s-4: 40px; --s-5: 64px; --s-6: 96px;
  --radius: 4px;
  --max: 1200px;
  --section-y: var(--s-6); --section-x: var(--s-3);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--c-paper);
  color: var(--c-ink);
  font: 400 var(--fs-body)/1.6 var(--f-body);
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--f-head); margin: 0 0 var(--s-2); }
h1 { font-size: var(--fs-h1); line-height: 1.05; font-weight: 500; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; }
h3, h4 { font-size: var(--fs-h3); line-height: 1.3; font-weight: 500; }
p { margin: 0 0 var(--s-2); }
a { color: var(--c-accent); }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: var(--s-2); top: var(--s-2); z-index: 10; background: var(--c-ink); color: var(--c-paper); padding: var(--s-1) var(--s-2); }

/* Layout primitives */
.section { padding: var(--section-y) var(--section-x); }
.section[id] { scroll-margin-top: 80px; } /* clear the sticky header on anchor jumps */
/* Arrival: the linked section's heading fades up while the page scrolls to it */
@media (prefers-reduced-motion: no-preference) {
  .section:target .section-head, .section:target .col--text { animation: arrive 0.7s ease-out 0.2s both; }
}
@keyframes arrive { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.container { max-width: var(--max); margin: 0 auto; }
.row { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.row--center { align-items: center; }
.row--between { justify-content: space-between; }
.row--gap-sm { gap: var(--s-2); }
.row--cards { gap: var(--s-3); }
.row--cards > * { flex: 1 1 260px; }
.row--cards-2 > * { flex-basis: 420px; }
.row--cards-2 > .card--wide { flex-basis: 100%; }
.col { flex: 1 1 400px; min-width: 0; }
.col--media { flex: 0 1 440px; }
.section-head { margin-bottom: var(--s-4); }

/* Sections */
.section--header { padding-block: var(--s-2); border-bottom: 1px solid var(--c-line); background: var(--c-paper); position: sticky; top: 0; z-index: 5; }
.section--alt { background: #EBE6DA; }
.section--tight { padding-block: var(--s-5); }
.section--dark { background: var(--c-ink); color: var(--c-paper); }
.section--dark .eyebrow { color: var(--c-highlight); }
.section--footer { padding-block: var(--s-3); border-top: 1px solid var(--c-line); }

/* Components */
.eyebrow { font-size: 0.9375rem; font-weight: 600; letter-spacing: 0; color: var(--c-accent); margin-bottom: var(--s-1); }
.lead { font-size: 1.15em; color: var(--c-muted); }

.btn { display: inline-block; background: var(--c-accent); color: var(--c-paper); font: 600 1rem/1 var(--f-body); text-decoration: none; padding: 16px 28px; border: 2px solid var(--c-accent); border-radius: var(--radius); cursor: pointer; }
.btn:hover { background: #24543D; border-color: #24543D; }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: transparent; padding-inline: 8px; text-decoration: underline; text-underline-offset: 4px; }
.btn--ghost:hover { background: transparent; color: var(--c-accent); border-color: transparent; }
.btn--small { padding: 10px 20px; }

.brand { display: flex; align-items: center; gap: var(--s-1); font: 700 1.125rem var(--f-head); color: inherit; text-decoration: none; }
/* Avatar isn't square: a fixed 44px circle that crops (cover) instead of turning into an oval */
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; object-fit: cover; object-position: top; }

.nav { display: flex; align-items: center; gap: var(--s-3); }
.nav a:not(.btn) { color: var(--c-ink); text-decoration: none; font-weight: 600; }
.nav a:not(.btn):hover { color: var(--c-accent); }
.nav-toggle { display: none; font: 600 1rem var(--f-body); background: none; border: 2px solid var(--c-ink); border-radius: var(--radius); padding: 8px 16px; cursor: pointer; color: var(--c-ink); }

.photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; border-radius: var(--radius); }

.card { background: #fff; border: 1px solid var(--c-ink); border-radius: var(--radius); padding: var(--s-4); margin: 0; }
.card__num { display: block; font: 700 var(--fs-small) var(--f-head); color: var(--c-accent); margin-bottom: var(--s-2); }

.steps { list-style: none; padding: 0; margin: 0; }
.step { border-top: 2px solid var(--c-highlight); padding-top: var(--s-3); }
.step__num { display: block; font: 700 2.5rem/1 var(--f-head); color: var(--c-highlight); margin-bottom: var(--s-2); }
.step p { color: #D8D6D2; }

.stat__num { font: 700 var(--fs-h2)/1 var(--f-head); color: var(--c-accent); margin-bottom: var(--s-1); }
.stat p:last-child { color: var(--c-muted); margin: 0; }

.project-groups { display: flex; flex-direction: column; gap: var(--s-5); }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-2); margin: 0 0 var(--s-3); padding-bottom: var(--s-1); border-bottom: 2px solid var(--c-ink); }
.toolkit .group-title { margin-bottom: var(--s-2); }

.filters { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); }
.filter-label { width: 64px; font-size: var(--fs-small); font-weight: 600; color: var(--c-muted); }
.chip { font: 600 var(--fs-small)/1 var(--f-body); color: var(--c-ink); background: #fff; border: 1px solid #8A8780; border-radius: var(--radius); padding: 12px 16px; cursor: pointer; }
.chip:hover { border-color: var(--c-ink); }
.chip[aria-pressed="true"] { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
/* Era row reads as tabs: one at a time */
.chip[data-era] { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 4px; margin-right: var(--s-1); color: var(--c-muted); }
.chip[data-era]:hover { color: var(--c-ink); }
.chip[data-era][aria-pressed="true"] { background: none; color: var(--c-ink); border-bottom-color: var(--c-accent); }
.filter-status { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; font-size: var(--fs-small); color: var(--c-muted); }
.filter-empty { margin: 0; font-weight: 600; }
.link-btn { font: inherit; font-weight: 600; color: var(--c-accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.group-title { font-weight: 700; margin: 0; }
.group-sub { margin: 0; color: var(--c-muted); font-size: var(--fs-small); }

.card__tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 var(--s-2); padding: 0; }
.card__tags li { font-size: var(--fs-small); font-weight: 600; color: var(--c-accent); border: 1px solid var(--c-accent); border-radius: var(--radius); padding: 2px 10px; }
.card__tagline { color: var(--c-accent); }
/* Me / AI split: quiet paper tint so it reads as a footnote, not a callout */
.card__ai { font-size: var(--fs-small); color: var(--c-muted); background: var(--c-paper); border-radius: var(--radius); padding: var(--s-1) 12px; }
.card__ai strong { color: var(--c-accent); }
.thumbs { display: flex; flex-wrap: wrap; gap: var(--s-1); list-style: none; margin: 0 0 var(--s-2); padding: 0; }
.thumbs a { display: block; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
.thumbs a:hover { border-color: var(--c-ink); }
.thumbs img { width: 64px; height: 64px; object-fit: cover; object-position: top; }

.lightbox { padding: 0; border: 0; border-radius: var(--radius); background: var(--c-ink); color: var(--c-paper); max-width: min(92vw, 1000px); }
.lightbox::backdrop { background: rgb(20 20 26 / 0.85); }
.lightbox__inner { margin: 0; }
.lightbox img { max-width: 100%; max-height: 78vh; margin: 0 auto; object-fit: contain; }
.lightbox__bar { display: flex; align-items: center; gap: var(--s-1); padding: var(--s-2); }
.lightbox__caption { flex: 1; font-size: var(--fs-small); }

.card__links { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin: 0; font-weight: 600; }
.card p:last-child { margin-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.tags li { font-size: var(--fs-small); font-weight: 600; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); padding: 4px 12px; }

.facts { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.facts strong { display: block; font-size: var(--fs-small); color: var(--c-accent); }

.contact-cta { align-items: center; margin-bottom: var(--s-3); }
.contact-email { margin: 0; font-size: var(--fs-small); color: var(--c-muted); }
.contact-email span { color: var(--c-ink); font-weight: 600; user-select: all; } /* one click selects the whole address */

.footer-copy { margin: 0; font-size: var(--fs-small); color: var(--c-muted); }

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
  :root { --section-y: var(--s-5); }
  .col--media { flex-basis: 360px; max-width: 380px; } /* stacked photo stays about half a screen tall */
  .row--quad > * { flex-basis: calc(50% - var(--s-3)); } /* 2×2 instead of 3+1 */
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding-top: var(--s-2); }
  .nav.is-open { display: flex; }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
  :root { --section-x: var(--s-2); }
  .row { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .row--gap-sm { flex-direction: row; }
  .section--header .row { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .col, .col--media { flex: 1 1 auto; }
  .row--cards > *, .row--cards-2 > * { flex-basis: auto; } /* stacked: basis would become a min height */
  .card { padding: var(--s-3); }
}

/* ------------------------------------------------------------------ */
/* WordPress                                                          */
/* ------------------------------------------------------------------ */

/* Keep the sticky header below the admin bar when logged in */
.admin-bar .section--header { top: 32px; }
@media (max-width: 782px) { .admin-bar .section--header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .section--header { top: 0; } } /* the admin bar scrolls away here */
.nav a[aria-current="page"] { color: var(--c-accent); }

.container--narrow { max-width: 720px; }
.container--blog { max-width: 960px; }
.page-title { margin: 0; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.post-meta { margin: 0 0 var(--s-1); font-size: var(--fs-small); color: var(--c-muted); }

/* Blog list */
.post-list { display: flex; flex-direction: column; gap: var(--s-3); }
.post-card { display: flex; background: #fff; border: 1px solid var(--c-ink); border-radius: var(--radius); overflow: hidden; }
.post-card__media { flex: 0 0 38%; display: block; min-height: 240px; text-decoration: none; }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__cover { display: flex; flex-direction: column; justify-content: flex-end; gap: var(--s-1); height: 100%; padding: var(--s-3); background: var(--c-ink); color: var(--c-paper); }
.post-card__cover-cat { font-size: var(--fs-small); font-weight: 600; color: var(--c-highlight); }
.post-card__cover-title { font: 500 1.5rem/1.15 var(--f-head); letter-spacing: -0.01em; }
.post-card__body { display: flex; flex-direction: column; justify-content: center; padding: var(--s-4); }
.post-card__title { margin: 0 0 var(--s-1); font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); line-height: 1.2; }
.post-card__title a { color: var(--c-ink); text-decoration: none; }
.post-card__title a:hover { color: var(--c-accent); }
.post-card__excerpt { margin: 0; color: var(--c-muted); }
.post-empty { color: var(--c-muted); }
.pagination { margin-top: var(--s-4); }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: var(--s-1); align-items: center; }
.pagination .page-numbers { padding: 8px 12px; border: 1px solid var(--c-line); border-radius: var(--radius); background: #fff; color: var(--c-ink); text-decoration: none; font-weight: 600; }
.pagination .page-numbers.current { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* Single post and pages */
.entry__header { margin-bottom: var(--s-4); }
.entry__title { margin-bottom: var(--s-2); font-size: clamp(2.25rem, 1.5rem + 2.6vw, 3.25rem); }
.entry__cover { max-width: 960px; margin: 0 auto var(--s-4); }
.entry__cover img { width: 100%; border-radius: var(--radius); }
.entry__cover figcaption { margin-top: var(--s-1); font-size: var(--fs-small); color: var(--c-muted); }

.entry__content { line-height: 1.7; }
.entry__content > * { margin: 0 0 1.25em; }
.entry__content > :last-child { margin-bottom: 0; }
.entry__content h2 { margin: 2em 0 0.5em; font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); }
.entry__content h3, .entry__content h4 { margin: 1.75em 0 0.5em; font-weight: 600; }
.entry__content h2 strong, .entry__content h3 strong, .entry__content h4 strong { font-weight: inherit; }
.entry__content a { text-underline-offset: 3px; }
.entry__content ul, .entry__content ol { padding-left: 1.4em; }
.entry__content li + li { margin-top: 0.4em; }
.entry__content .wp-block-group > * { margin: 0 0 1em; }
.entry__content .wp-block-group > :last-child { margin-bottom: 0; }

.entry__content blockquote { margin: 1.5em 0; padding: var(--s-2) var(--s-3); background: #fff; border-left: 4px solid var(--c-accent); border-radius: 0; }
.entry__content blockquote p { margin: 0 0 0.5em; }
.entry__content blockquote cite { display: block; font-style: normal; font-size: var(--fs-small); color: var(--c-muted); }

.entry__content code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 0.875em; background: #EBE6DA; padding: 0.1em 0.35em; border-radius: 3px; }
.entry__content pre { margin: 1.5em 0; padding: var(--s-2) var(--s-3); background: var(--c-ink); color: #ECEAE4; border: 0; border-radius: var(--radius); overflow-x: auto; font-size: 0.9375rem; line-height: 1.6; }
.entry__content pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }

.entry__content figure { margin: 2em 0; }
.entry__content img { border-radius: var(--radius); }
.entry__content figcaption { margin-top: var(--s-1); font-size: var(--fs-small); color: var(--c-muted); text-align: left; }
.entry__content .alignwide { width: min(960px, calc(100vw - 2 * var(--section-x))); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.entry__content .alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.entry__content .alignfull img { border-radius: 0; }
.entry__content hr, .entry__content .wp-block-separator { border: 0; border-top: 1px solid var(--c-line); margin: 2.5em 0; }
.entry__content table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
/* .wp-block-table in the selectors: WordPress core draws a full grid and a 3px header line otherwise */
.entry__content .wp-block-table thead { border-bottom: 2px solid var(--c-ink); }
.entry__content .wp-block-table th, .entry__content .wp-block-table td, .entry__content th, .entry__content td { padding: 8px 12px; border: 0; border-bottom: 1px solid var(--c-line); text-align: left; }
.entry__content th { font-weight: 600; }

.entry__footer { margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--c-line); display: flex; flex-direction: column; gap: var(--s-3); }
.entry__footer .tags a { color: var(--c-ink); text-decoration: none; }
.entry__footer .tags a:hover { color: var(--c-accent); }
.entry__nav { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-weight: 600; }

@media (max-width: 767px) {
  .post-card { flex-direction: column; }
  .post-card__media { flex-basis: auto; min-height: 180px; }
  .post-card__body { padding: var(--s-3); }
  .entry__content pre { margin-inline: calc(-1 * var(--section-x)); border-radius: 0; } /* code runs edge to edge on phones */
}
