/* ============================================================
   Portfolio · frontend theme
   Nær-sort, nedtonet accent, condensed display + Inter body.
   ============================================================ */

:root {
  --bg: #f2f0eb;
  --bg-2: #eae7e0;
  --panel: #e4e1d9;
  --fg: #131210;
  --fg-dim: #55524c;
  --fg-faint: #8f8b83;
  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.26);
  --accent: #9a6a3c;
  --accent-soft: rgba(154, 106, 60, 0.12);
  --maxw: 1320px;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --display: "Archivo Expanded", "Arial Narrow", sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.muted { color: var(--fg-faint); }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.025; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter);
  transition: background 0.4s var(--ease), padding 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(242, 240, 235, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-top: 15px; padding-bottom: 15px;
  border-bottom-color: var(--line);
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 18px;
  letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center;
}
.wordmark.has-logo img { height: 30px; width: auto; display: block; }
.site-header.scrolled .wordmark.has-logo img { height: 26px; transition: height 0.4s var(--ease); }
.site-nav { display: flex; gap: 30px; }
.site-nav a {
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-dim); position: relative; padding: 4px 0; transition: color 0.3s var(--ease);
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 0;
  background: var(--accent); transition: width 0.35s var(--ease);
}
.site-nav a:hover, .site-nav a.active { color: var(--fg); }
.site-nav a.active::after, .site-nav a:hover::after { width: 100%; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--fg); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }

.site-main { position: relative; z-index: 2; }

/* ---------- Sideovergang ---------- */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.site-main { animation: pageIn 0.55s var(--ease) both; }
body.is-leaving .site-main {
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .site-main { animation: none; }
  body.is-leaving .site-main { transition: none; }
}

/* ---------- Work grid ---------- */
.work { padding: clamp(120px, 16vh, 190px) var(--gutter) clamp(80px, 12vw, 160px); max-width: var(--maxw); margin: 0 auto; }
.work-head { margin-bottom: clamp(40px, 6vw, 72px); max-width: 60ch; }
.work-heading { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 0.96; letter-spacing: -0.02em; }
.work-intro { margin-top: 18px; font-size: clamp(1rem, 1.6vw, 1.25rem); color: var(--fg-dim); line-height: 1.5; max-width: 52ch; }
.work-empty { color: var(--fg-faint); font-size: 1.1rem; }
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 4vw, 60px); }
.work-card { display: block; }
.work-media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--panel); border: 1px solid var(--line); }
.work-media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.01); transition: transform 1.1s var(--ease); }
.work-noimg { width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #e4e1d9, #e4e1d9 12px, #dcd8cf 12px, #dcd8cf 24px); }
.work-card:hover .work-media img { transform: scale(1.05); }
.work-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; padding: 20px 2px 0; }
.work-index { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--accent); letter-spacing: 0.1em; }
.work-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1; letter-spacing: -0.01em; flex: 1 1 auto; transition: color 0.3s var(--ease); }
.work-card:hover .work-title { color: var(--accent); }
.work-summary { flex: 1 1 100%; color: var(--fg-dim); font-size: 0.96rem; max-width: 52ch; }
.work-tech { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin-top: 4px; }
.work-tech li { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-faint); border: 1px solid var(--line); padding: 3px 10px; border-radius: 40px; }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Single project ---------- */
.project-hero { position: relative; min-height: 72svh; display: flex; align-items: flex-end; padding: 0 var(--gutter) clamp(40px, 6vw, 80px); overflow: hidden; }
.project-hero.no-cover { min-height: 46svh; padding-top: 140px; }
.project-cover { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(1) saturate(1.02); transform: scale(1.05); }
.project-cover-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(242, 240, 235, 0.2) 0%, rgba(242, 240, 235, 0.55) 55%, var(--bg) 100%); }
.project-hero-text { position: relative; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.project-back { display: inline-block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 20px; transition: color 0.3s var(--ease); }
.project-back:hover { color: var(--accent); }
.project-title { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(2.6rem, 8vw, 6.5rem); line-height: 0.95; letter-spacing: -0.02em; color: var(--fg); }
.project-summary { margin-top: 20px; font-size: clamp(1.05rem, 2vw, 1.4rem); color: var(--fg-dim); max-width: 60ch; }
.project-body-wrap { max-width: var(--maxw); margin: 0 auto; padding: clamp(50px, 8vw, 110px) var(--gutter); display: grid; grid-template-columns: 240px 1fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
.project-aside { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 28px; }
.aside-block h3 { font-family: var(--display); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 12px; font-weight: 700; }
.aside-tech { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.aside-tech li { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg); border: 1px solid var(--line-strong); padding: 5px 12px; border-radius: 40px; }
.aside-tech li a { display: block; color: inherit; transition: color 0.25s var(--ease); }
.aside-links .aside-tech li { transition: border-color 0.25s var(--ease); }
.aside-links .aside-tech li:hover { border-color: var(--accent); }
.aside-links .aside-tech li:hover a { color: var(--accent); }

/* ---------- Prose ---------- */
.project-body, .prose { font-size: 1.06rem; line-height: 1.75; color: #2a2824; max-width: 68ch; }
.project-body h2, .prose h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -0.01em; margin: 2em 0 0.6em; color: var(--fg); }
.project-body h3, .prose h3 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin: 1.6em 0 0.5em; color: var(--fg); }
.project-body p, .prose p { margin: 0 0 1.2em; }
.project-body a, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.project-body ul, .prose ul, .project-body ol, .prose ol { margin: 0 0 1.2em 1.2em; }
.project-body li, .prose li { margin-bottom: 0.4em; }
.project-body img, .prose img { border-radius: 4px; margin: 1.5em 0; border: 1px solid var(--line); }

/* ---------- Project gallery ---------- */
.project-gallery { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) clamp(50px, 8vw, 100px); display: grid; grid-template-columns: 1fr; gap: clamp(16px, 3vw, 40px); }
.post-gallery { max-width: 860px; padding-left: var(--gutter); padding-right: var(--gutter); padding-top: clamp(30px, 5vw, 56px); gap: clamp(20px, 3vw, 40px); }
.gallery-figure { margin: 0; }
.gallery-figure img { width: 100%; border: 1px solid var(--line); }
.gallery-figure:hover img { filter: brightness(1); }
.gallery-figure figcaption { margin-top: 10px; font-size: 13px; color: var(--fg-faint); letter-spacing: 0.02em; }
.project-foot-nav { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) clamp(70px, 10vw, 130px); }

/* ---------- Text pages ---------- */
.text-page { max-width: 860px; margin: 0 auto; padding: clamp(120px, 16vh, 200px) var(--gutter) clamp(80px, 12vw, 140px); }
.text-page.wide { max-width: var(--maxw); }
.text-head { margin-bottom: clamp(36px, 5vw, 60px); }
.text-head:has(> .eyebrow:only-child) .eyebrow { font-size: 14px; letter-spacing: 0.22em; color: var(--fg); }
.eyebrow { display: inline-block; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.text-head h1 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(2.4rem, 7vw, 5rem); line-height: 0.96; letter-spacing: -0.02em; }
.post-date { display: block; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); margin: 16px 0; }
.post-cover { margin: 0 0 clamp(30px, 5vw, 56px); }
.post-cover img { width: 100%; border: 1px solid var(--line); }

/* ---------- About layout ---------- */
.soft-rule { border: 0; align-self: center; width: 1px; height: 70%; margin: 0; background: var(--fg); opacity: 0.18; }
.text-page.has-figure { max-width: var(--maxw); }
.about-layout { display: grid; grid-template-columns: 1fr; gap: clamp(30px, 5vw, 64px); }
.text-page.has-figure .about-layout { grid-template-columns: 5fr auto 7fr; align-items: stretch; }
.about-figure { margin: 0; align-self: start; }
.about-figure img { width: 100%; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .text-page.has-figure .about-layout { grid-template-columns: 1fr; }
  .soft-rule { display: none; }
}

/* ---------- Blog list ---------- */
.post-list { list-style: none; }
.post-item { border-top: 1px solid var(--line); }
.post-item:last-child { border-bottom: 1px solid var(--line); }
.post-item a { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 30px 0; align-items: center; transition: padding-left 0.4s var(--ease); }
.post-item a:hover { padding-left: 14px; }
.post-thumb { overflow: hidden; aspect-ratio: 16/10; border: 1px solid var(--line); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.post-item a:hover .post-thumb img { transform: scale(1.05); }
.post-text time { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.post-text h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.4rem, 3vw, 2.2rem); line-height: 1; margin: 8px 0 10px; letter-spacing: -0.01em; }
.post-text p { color: var(--fg-dim); font-size: 0.96rem; max-width: 60ch; }

/* ---------- Contact form ---------- */
.contact-intro { margin-bottom: 40px; }
.contact-form { max-width: 560px; display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-dim); }
.contact-form input, .contact-form textarea { background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--fg); padding: 14px 16px; font-size: 1rem; font-family: var(--body); border-radius: 3px; transition: border-color 0.3s var(--ease); }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-alt { margin-top: 26px; color: var(--fg-dim); }
.contact-alt a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.form-note { padding: 14px 18px; border-radius: 4px; margin-bottom: 28px; font-size: 0.95rem; }
.form-note.ok { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--fg); }
.form-note.err { background: rgba(255, 90, 90, 0.08); border: 1px solid rgba(255, 90, 90, 0.4); color: #b23b3b; }

/* ---------- Buttons ---------- */
.btn-line { display: inline-block; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); border: 1px solid var(--line-strong); padding: 12px 22px; border-radius: 40px; transition: border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }
.btn-solid { align-self: flex-start; background: var(--fg); color: var(--bg); border: 0; padding: 15px 34px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; cursor: pointer; border-radius: 40px; font-family: var(--body); transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease); }
.btn-solid:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }

/* ---------- 404 ---------- */
.notfound { min-height: 70svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 0 var(--gutter); }
.notfound h1 { font-family: var(--display); font-weight: 800; font-size: clamp(4rem, 16vw, 11rem); line-height: 1; }
.notfound p { color: var(--fg-dim); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px var(--gutter); position: relative; z-index: 2; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-social { display: flex; gap: 22px; }
.footer-social a { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-dim); transition: color 0.3s var(--ease); }
.footer-social a:hover { color: var(--accent); }
.footer-copy { color: var(--fg-faint); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-inner:not(:has(.footer-social)) { justify-content: center; }
@media (max-width: 620px) {
  .footer-inner { flex-direction: column; justify-content: center; text-align: center; gap: 16px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .project-body-wrap { grid-template-columns: 1fr; }
  .project-aside { position: static; flex-direction: row; flex-wrap: wrap; gap: 28px; }
  .project-aside .aside-block { flex: 1 1 100%; }
}
@media (max-width: 720px) {
  .nav-toggle { display: flex; z-index: 60; }
  /* Når menuen er åben må headeren ikke have backdrop-filter/transform,
     ellers bliver menuens position:fixed låst til headeren i stedet for
     viewporten (og åbner kun en stribe i toppen). */
  body.nav-open .site-header,
  body.nav-open .site-header.scrolled {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom-color: transparent;
  }
  .site-nav {
    position: fixed; inset: 0;
    background: rgba(242, 240, 235, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-direction: column; justify-content: center; align-items: center; gap: 34px;
    transform: translateY(-100%);
    transition: transform 0.5s var(--ease), visibility 0.5s var(--ease);
    z-index: 55; visibility: hidden; pointer-events: none;
  }
  .site-nav a { font-size: 20px; color: var(--fg); }
  body.nav-open .site-nav { transform: translateY(0); visibility: visible; pointer-events: auto; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { transform: translateY(-7px) rotate(-45deg); }
  .work-grid { grid-template-columns: 1fr; }
  .post-item a { grid-template-columns: 1fr; gap: 14px; }
  .post-thumb { max-width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
