/* Sporting Grotesque (Lucas Le Bihan), lisensiert under SIL Open Font License 1.1.
   Lisensteksten ligger i assets/fonts/OFL.txt. */
@font-face {
  font-family: "Sporting Grotesque";
  src: url("../assets/fonts/SportingGrotesque-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Sporting Grotesque";
  src: url("../assets/fonts/SportingGrotesque-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sporting Grotesque", var(--font-body);
  --pad: clamp(1.25rem, 3vw, 3rem);
  --title-size: 1.125rem; /* overskrifter: prosjekttitler, CV-seksjoner og kontakt */
  --title-weight: 400;
  --burgundy: #521921;
  --butter: #FEFFED;
  --olive: #886F0B;
  --bg: var(--butter);
  --text: var(--burgundy);
  --muted: rgba(82, 25, 33, 0.7);
  --line: rgba(82, 25, 33, 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }
h1, h3 { font-family: var(--font-display); }

/* To kolonner: 40 / 60. Hele siden er smørgul. */
.split {
  display: grid;
  grid-template-columns: 2fr 3fr;
  min-height: 100vh;
  min-height: 100svh;
}

/* Venstre: presentasjon, står stille mens høyre side scroller */
.intro {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) * 0.5); /* © står litt lengre ned */
  color: var(--burgundy);
}

.logo { font-family: var(--font-display); font-weight: 700; text-decoration: none; }

/* Toppstilt, på linje med overskriften til høyre */
.intro-text { margin-top: 4rem; }

.download {
  margin: 3rem 0 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

/* Portrett under presentasjonen */
.intro-photo {
  display: block;
  height: min(46svh, 22rem);
  width: auto;
  margin-top: 2rem;
  aspect-ratio: 1215 / 1776;
}


.intro h1 {
  max-width: 28ch;
  margin: 0;
  font-size: clamp(1.15rem, 1.7vw, 1.6rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.copyright { margin: auto 0 0; font-family: var(--font-display); font-size: 0.9rem; color: inherit; opacity: 0.7; }

/* Høyre: meny og skiftende innhold */
.content {
  padding: 0 var(--pad) var(--pad);
}

/* Menyen blir stående øverst når innholdet scroller */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: var(--pad) 0 1rem;
  background: var(--butter);
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  font-family: var(--font-display);
}

.site-nav a { text-decoration: none; color: var(--olive); }
/* Seksjonstitler vises bare på mobil, der alt ligger på én side */
.section-title { display: none; }
.site-nav a[aria-current="page"] { color: var(--burgundy); }

.panel { padding: 3rem 0 2rem; }
.panel[hidden] { display: none; }
.panel > :first-child { margin-top: 0; }
.panel > p { max-width: 60ch; }

/* CV: to kolonner med korte rader (dato, tittel, sted) */
.cv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 3rem; align-items: start; }
.cv-col { display: flex; flex-direction: column; gap: 2.5rem; }

/* .panel gjelder også de nestede <section>-ene, så nullstill padding */
.cv-group { padding: 0; }
.cv-group h3 {
  margin: 0 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--title-size);
  font-weight: var(--title-weight);
  color: var(--olive);
}

.cv-group ul { margin: 0; padding: 0; list-style: none; }
.cv-group li { margin-bottom: 1.1rem; line-height: 1.35; }
.cv .date { display: block; margin-bottom: 0.25rem; font-size: 0.875rem; }
.cv strong { display: block; font-size: 1.0625rem; font-weight: 500; }
.cv .sub { display: block; font-weight: 400; }

/* Kontakt: store lenker */
.contact-link { display: block; margin-bottom: 2.5rem; text-decoration: none; }

/* Samme størrelse som presentasjonsteksten til venstre */
.contact-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--title-size);
  font-weight: var(--title-weight);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--burgundy);
}

.contact-sub {
  display: block;
  margin-top: 0.25rem;
  font-weight: 300;
  overflow-wrap: anywhere;
}

.cards { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.card h3 { margin-top: 0; font-size: var(--title-size); font-weight: var(--title-weight); color: var(--olive); }
.card p { color: var(--muted); }

/* Prosjektside */
.back { display: inline-block; margin-bottom: 2rem; font-family: var(--font-display); text-decoration: none; }
.detail-title { margin: 0 0 0.5rem; font-size: var(--title-size); font-weight: var(--title-weight); color: var(--olive); }
.detail-lead { margin: 0 0 0.5rem; max-width: 60ch; font-size: 1.0625rem; }
.detail-facts { margin: 0 0 1.5rem; font-size: 0.875rem; opacity: 0.7; }
#project-detail p { max-width: 60ch; }
#project-detail img { display: block; width: 100%; height: auto; margin: 1.5rem 0; }

/* Mobil: fast topplinje med navnet. Hjem er én lang side:
   presentasjon, bilde, prosjekter, CV og kontakt, hver med egen tittel. */
@media (max-width: 800px) {
  :root { --header-h: 3.5rem; }

  /* Fast stripe bak navnet, så innholdet ikke vises gjennom når man scroller */
  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--butter);
    z-index: 19;
  }

  .split {
    display: flex;
    flex-direction: column;
    padding: calc(var(--header-h) + 1.5rem) var(--pad) var(--pad);
  }

  .intro, .content { display: contents; }

  /* Ingen meny på mobil. Navnet øverst tar deg til toppen av siden. */
  .site-nav { display: none; }

  .logo {
    position: fixed;
    top: 0;
    left: var(--pad);
    height: var(--header-h);
    display: flex;
    align-items: center;
    z-index: 20;
    font-size: 0.9375rem;
  }

  .intro-text { order: 1; margin-top: 0; }
  .intro h1 { max-width: none; font-size: 1.5rem; }

  main { order: 2; }
  .panel { padding: 4.5rem 0 0; scroll-margin-top: var(--header-h); }

  .section-title {
    display: block;
    margin: 0 0 1.75rem;
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: var(--title-weight);
    line-height: 1.2;
    color: var(--burgundy);
  }

  body[data-view="panel"] .panel { padding-top: 0.5rem; }
  .cv { grid-template-columns: 1fr; gap: 2.5rem; }

  .copyright { order: 3; margin-top: auto; padding-top: 2.5rem; }

  /* Portrett på hjem-siden */
  body[data-view="home"] .intro-photo { display: block; width: min(60vw, 240px); height: auto; }
  body[data-view="panel"] .intro-text { display: none; }
}

/* Hele prosjektkortet er klikkbart (første lenke strekkes over kortet) */
.card { position: relative; }
.card a:first-of-type::after { content: ""; position: absolute; inset: 0; }

/* Egen musepeker (se js/cursor.js).
   Pekeren er tre lag som ligger oppå hverandre og sammen gjør at alt under pekeren byttes til to farger:
   1) «filter»: gjør det som ligger under om til svart/hvitt. Alt lyst (smørgul bakgrunn) blir svart,
      alt annet (burgunder og olivengrønn tekst) blir hvitt.
   2) «multiply» med smørgul: hvitt blir smørgul, svart forblir svart.
   3) «lighten» med burgunder: svart blir burgunder, smørgul forblir smørgul.
   Resultat: over smørgul bakgrunn er pekeren burgunder, over alt annet er den smørgul,
   og tekst under pekeren bytter dermed til motsatt farge, også olivengrønn. */
.has-cursor, .has-cursor a, .has-cursor button { cursor: none; }

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
}

.cursor--multiply { z-index: 1001; mix-blend-mode: multiply; }
.cursor--lighten { z-index: 1002; mix-blend-mode: lighten; }

.cursor__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cursor--filter .cursor__dot {
  -webkit-backdrop-filter: grayscale(1) brightness(0.625) contrast(12) invert(1);
  backdrop-filter: grayscale(1) brightness(0.625) contrast(12) invert(1);
}

/* Lag 2 og 3 er litt større enn lag 1, så kanten av sirkelen ikke får en mørk kant */
.cursor--multiply .cursor__dot,
.cursor--lighten .cursor__dot { width: 88px; height: 88px; margin: -44px 0 0 -44px; }

.cursor--multiply .cursor__dot { background: var(--butter); }
.cursor--lighten .cursor__dot { background: var(--burgundy); }

.cursor_active .cursor__dot { transform: scale(0.25); }
.cursor_active.cursor_hover .cursor__dot { transform: scale(0.6); }
.cursor_active.cursor_down .cursor__dot { transform: scale(0.2); }

/* Sirkel med tekst (over prosjekter og presentasjonen): helt dekkende, ingen filter */
.cursor_message.cursor--multiply, .cursor_message.cursor--lighten { display: none; }

.cursor_active.cursor_message .cursor__dot {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--burgundy);
  color: var(--butter);
  transform: scale(1);
}

.cursor_active.cursor_message.cursor_down .cursor__dot { transform: scale(0.9); }

/* Over portrettet er pekeren ensfarget burgunder, uten filter */
.cursor_solid.cursor--multiply, .cursor_solid.cursor--lighten { display: none; }

.cursor_solid.cursor--filter .cursor__dot {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--burgundy);
}

/* Nettlesere uten backdrop-filter får en enkel, ensfarget peker */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cursor--multiply, .cursor--lighten { display: none; }
  .cursor--filter .cursor__dot { background: var(--burgundy); }
}

.cursor__message {
  font-family: var(--font-display);
  font-size: 1rem;
  max-width: 2.5rem; /* smalt nok til at «Om meg» deles på to linjer */
  line-height: 1.15;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.cursor_message .cursor__message { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .cursor__dot, .cursor__message { transition: none; }
}

/* Presentasjonsteksten er en lenke til Om meg */
.intro-link { color: inherit; text-decoration: none; }
