/* ============================================================
   shujan.dk — style.css
   Ét roligt, typografisk design. Orange (#FF5C00) er en signatur,
   ikke et tema: kun e-mail, link-hover og pile.
   ============================================================ */

/* ---------- Farver ---------- */
:root {
  --pg: #ffffff;
  --ink: #0f0f0f;
  --muted: #87847f;
  --faint: #b6b2ac;
  --line: rgba(0, 0, 0, .09);
  --photo: #eeebe6;
  --acc: #FF5C00;
  /* Mørkere orange til SMÅ tekster/links i light mode (WCAG-kontrast).
     Store elementer (e-mail, pile) bruger stadig --acc. */
  --acc-strong: #c94a00;
}

:root[data-theme="dark"] {
  --pg: #0c0c0c;
  --ink: #f4f2ee;
  --muted: #8b8883;
  --faint: #5a5854;
  --line: rgba(255, 255, 255, .12);
  --photo: #1c1b19;
  --acc: #FF5C00;
  /* På mørk baggrund har den klare orange rigelig kontrast */
  --acc-strong: #FF5C00;
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--pg);
  color: var(--ink);
  font-family: -apple-system, system-ui, "Segoe UI", Inter, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

/* Én smal, venstrestillet kolonne */
.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Links ---------- */
a {
  color: inherit;
  text-decoration: none;
  transition: color .25s ease;
}

/* Hover på tekstlinks bruger den kontrast-sikre orange */
a:hover { color: var(--acc-strong); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Pile er altid orange — og glider let i pilens retning ved hover */
.arrow {
  color: var(--acc);
  display: inline-block;
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}

a:hover .arrow { transform: translateX(4px); }
a:hover .arrow.back { transform: translateX(-4px); }

/* ---------- Top-nav ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0;
  font-size: 13px;
  color: var(--muted);
}

.nav a { color: var(--muted); }
.nav a:hover { color: var(--acc-strong); }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Sprogskift: to små tekst-knapper */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-toggle button {
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--faint);
  cursor: pointer;
  padding: 2px;
  transition: color .25s ease;
}

.lang-toggle button:hover { color: var(--acc-strong); }
.lang-toggle button[aria-pressed="true"] { color: var(--ink); }
.lang-toggle .sep { color: var(--faint); }

/* Tema-toggle (sol/måne) */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color .25s ease;
}

.theme-toggle:hover { color: var(--acc-strong); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Vis kun det relevante ikon */
:root[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }

/* ---------- Sektioner: meget vertikal luft ---------- */
section { margin-top: 80px; }

.section-title {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 20px;
}

/* Overskrift-række med link til højre (Udvalgt arbejde) */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.section-head .section-title { margin-bottom: 0; }

.section-head a {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Hero ---------- */
.hero { margin-top: 88px; }

.hero .role {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

/* Navnet er sidens store element (promptfolio-inspireret).
   "Karunalingam" skal kunne stå på én linje i 540px-kolonnen. */
.hero-name {
  font-size: clamp(44px, 12vw, 76px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.03em;
  overflow-wrap: normal;
}

.hero-name .word { display: inline-block; white-space: nowrap; }
.hero-name .ch { display: inline-block; }

.hero .tagline {
  margin-top: 26px;
  font-size: 17px;
  line-height: 1.6;
  max-width: 30em;
}

.hero .meta {
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.hero .meta .sep { color: var(--faint); padding: 0 4px; }
.hero .meta a { color: var(--muted); }

/* ---------- Redaktionelt portræt ---------- */
.portrait {
  margin-top: 56px;
}

.portrait .frame {
  /* Kvadratisk: portrættet er 1:1 og vises ubeskåret */
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--photo);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Om ---------- */
.about p + p {
  margin-top: 16px;
  color: var(--muted);
}

/* ---------- Erfaring / Uddannelse ---------- */
.xp-row {
  border-top: .5px solid var(--line);
  padding: 18px 0;
}

.xp-row:last-of-type { border-bottom: .5px solid var(--line); }

.xp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.xp-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.xp-years {
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
}

.xp-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 2px;
}

.cv-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 14px;
  color: var(--acc-strong);
}

.cv-link:hover { color: var(--acc-strong); opacity: .8; }

/* ---------- Udvalgt arbejde ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.work-grid figure { margin: 0; }

.work-grid .tile {
  display: block;
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  background: var(--photo);
}

.work-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}

/* Blid billed-zoom ved hover */
.work-grid a.tile:hover img,
.work-grid a.tile:focus-visible img {
  transform: scale(1.03);
}

/* Krydsfade-rotation: JS gør feltet til .rotator og stabler to lag,
   der blødt toner over i hinanden. Uden JS vises blot ét statisk foto. */
.work-grid .tile.rotator img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}

.work-grid .tile.rotator img.show { opacity: 1; }

.work-grid figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  transition: opacity .5s ease;
}

.work-grid figcaption.fade { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .work-grid .tile.rotator img { transition: none; }
  .work-grid figcaption { transition: none; }
}

/* ---------- Projekter ---------- */
.project-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: .5px solid var(--line);
  padding: 18px 0;
  color: inherit;
}

.project-row:last-of-type { border-bottom: .5px solid var(--line); }

.project-row .p-title {
  font-size: 15px;
  font-weight: 500;
}

.project-row .p-desc {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

a.project-row:hover .p-title { color: var(--acc-strong); }

.project-row.coming { color: var(--muted); }
.project-row.coming .p-title { font-weight: 400; font-size: 14px; color: var(--muted); }

/* ---------- Kontakt ---------- */
.contact-line {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.4;
}

.contact-email {
  display: inline-block;
  margin-top: 10px;
  font-size: 17px;
  color: var(--acc);
}

.contact-email:hover { opacity: .8; }

.contact-links {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.contact-links a { color: var(--muted); }
.contact-links .sep { color: var(--faint); padding: 0 4px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 80px;
  padding: 32px 0 48px;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- Intro-loader (hero) ----------
   Promptfolio-sekvensen:
   1. Et overlay i sidens baggrundsfarve dækker alt; navnet står
      vertikalt centreret i viewporten og toner ind bogstav for
      bogstav (blur + fade, forskudt pr. bogstav).
   2. Navnet glider op på sin plads i hero'en, overlayet fader væk,
      og nav, role, tagline og meta toner ind forskudt.
   Alt styres af main.js: overlayet oprettes KUN dér (så siden er
   normal uden JS og ved prefers-reduced-motion). --reveal sættes af
   JS til tidspunktet hvor navnet begynder at glide op. */
@keyframes intro-fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes intro-ch {
  from { opacity: 0; filter: blur(5px); }
  to   { opacity: 1; filter: blur(0); }
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--pg);
}

body.intro-active { overflow: hidden; }
body.intro-active .nav { opacity: 0; }

body.intro-reveal .intro-overlay {
  opacity: 0;
  transition: opacity .7s ease;
  pointer-events: none;
}

body.intro-reveal .nav {
  animation: intro-fade .8s cubic-bezier(.22, 1, .36, 1) .35s both;
}

/* Navnet ligger over overlayet og glider på plads når main.js
   nulstiller dets transform */
.intro-run .hero-name {
  position: relative;
  z-index: 51;
  transition: transform .95s cubic-bezier(.72, 0, .2, 1);
}

.intro-run .role,
.intro-run .tagline,
.intro-run .meta {
  opacity: 0;
  animation: intro-fade .8s cubic-bezier(.22, 1, .36, 1) both;
}

.intro-run .role    { animation-delay: calc(var(--reveal, 2s) + .55s); }
.intro-run .tagline { animation-delay: calc(var(--reveal, 2s) + .7s); }
.intro-run .meta    { animation-delay: calc(var(--reveal, 2s) + .85s); }

/* --i sættes pr. bogstav i main.js */
.intro-run .hero-name .ch {
  opacity: 0;
  animation: intro-ch .4s cubic-bezier(.96, -.02, .38, 1.01) both;
  animation-delay: calc(.3s + var(--i) * 60ms);
}

/* Kort intro (resten af sessionen): ingen loader/centrering —
   kun en hurtig bogstav-fade og tidlige indtoninger */
.intro-run.intro-short .hero-name .ch {
  animation-delay: calc(.1s + var(--i) * 30ms);
}

.intro-run.intro-short .role    { animation-delay: .1s; }
.intro-run.intro-short .tagline { animation-delay: .5s; }
.intro-run.intro-short .meta    { animation-delay: .65s; }

@media (prefers-reduced-motion: reduce) {
  .intro-overlay { display: none; }
  .intro-run .role,
  .intro-run .tagline,
  .intro-run .meta,
  .intro-run .hero-name .ch {
    opacity: 1;
    animation: none;
  }
  .intro-run .hero-name { transition: none; }
  body.intro-active { overflow: auto; }
  body.intro-active .nav { opacity: 1; }
  /* Ingen hover-bevægelser */
  .arrow,
  .work-grid img,
  .gallery img { transition: none; }
  a:hover .arrow,
  a:hover .arrow.back,
  .work-grid a.tile:hover img,
  .gallery .item:hover img { transform: none; }
}

/* ---------- Scroll-reveal ----------
   Elementer glider blidt ind ved scroll.
   Deaktiveres helt ved prefers-reduced-motion. */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s ease-out, transform .8s ease-out;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Portfolio-side
   ============================================================ */

.page-title {
  margin-top: 72px;
}

.page-title h1 {
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -.015em;
}

.page-title p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

/* Kategori-filtre */
.filters {
  display: flex;
  gap: 20px;
  margin-top: 40px;
  font-size: 13px;
}

.filters button {
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
  transition: color .25s ease;
}

.filters button:hover { color: var(--acc-strong); }
.filters button[aria-pressed="true"] { color: var(--ink); }

/* Galleri */
.gallery {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.gallery .item {
  margin: 0;
  cursor: zoom-in;
  border: none;
  background: none;
  padding: 0;
  display: block;
  width: 100%;
}

.gallery .item.hidden { display: none; }

.gallery .ph {
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  background: var(--photo);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}

.gallery .item:hover img,
.gallery .item:focus-visible img {
  transform: scale(1.03);
}

@media (max-width: 420px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 84vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox button {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, .75);
  cursor: pointer;
  font-size: 15px;
  padding: 12px;
  transition: color .25s ease;
}

.lightbox button:hover { color: var(--acc); }

.lb-close { top: 16px; right: 20px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }

.lb-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(255, 255, 255, .65);
}

/* Video-sektion */
.video-wrap {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--photo);
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: var(--photo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}

.video-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
