:root {
  --pf-accent: var(--accent);
  --pf-reading: #c3d4d1;
  --cv-dashboard-max-width: 1500px;
}

.hero .hero-subtitle {
  color: var(--pf-reading);
  margin-bottom: 0;
  max-width: 760px;
}

.hero .hero-subtitle strong {
  color: var(--text);
  font-family: var(--pf-sans);
  font-weight: 600;
}

.cv-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(4px, calc(4vw - 28px), 26px);
  width: 100%;
}
.cv-hero-main h1 {
  font: 800 clamp(48px, 6.2vw, 88px)/.99 var(--pf-sans);
  letter-spacing: -.044em;
}
.cv-pdf-icon { width: 16px; height: 16px; flex: none; }
.cv-hero-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 24px;
}
.cv-hero-identity .hero-photo {
  width: clamp(48px, 4.5vw, 64px);
  height: clamp(48px, 4.5vw, 64px);
  margin: 0;
}
.cv-hero-identity .hero-eyebrow { margin: 0; }
.hero-contact.cv-hero-contact {
  flex-direction: row;
  gap: 4px 20px;
  margin: 0;
  font-style: normal;
}
.cv-hero-contact a { color: var(--text); text-decoration: none; }
.cv-hero-contact a:hover { color: var(--accent); text-decoration: underline; }
.cv-downloads { margin-top: clamp(22px, 2.5vw, 34px); }
.cv-download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}
.cv-download-buttons .pf-action { max-width: 100%; }

@media (max-width: 520px) {
  .cv-download-buttons .pf-action { flex: 1 0 100%; }
}

@media (max-width: 680px) {
  .cv-hero-main h1 { font-size: clamp(37px, 10.9vw, 56px); }
}

.cv-case-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--accent);
  font: 600 14px/1.4 var(--pf-sans);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cv-case-link:hover {
  color: var(--text);
}

.cv-case-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.cv-case-status {
  display: block;
  margin-top: 12px;
  color: var(--pf-reading);
  font: 500 13px/1.4 var(--pf-sans);
}

.role-card .pf-card-icon {
  margin-bottom: 16px;
}

.role-card .role-desc,
.exp-card .exp-desc,
.project-card .project-body,
.about-body,
.deliverable-list li {
  color: var(--pf-reading);
}

.experience-slide .exp-grid {
  gap: 24px;
  margin-top: 58px;
}
.experience-slide .exp-card {
  padding-block: 32px;
}
@media (max-width: 600px) {
  .experience-slide .exp-grid { gap: 18px; margin-top: 38px; }
  .experience-slide .exp-card { padding-block: 24px; }
}

.cv-languages {
  display: block;
  margin-top: 12px;
  font: 500 14px/1.5 var(--pf-sans);
}

#kontakt > .cv-end-grid { width: 100%; }

@media screen and (min-width: 1081px) {
  body[data-project="cv"] {
    --cv-content-gutter: max(calc(10vw + 6px), calc((100% - var(--cv-dashboard-max-width)) / 2));
  }

  #main-content > .slide,
  #main-content > .pf-next {
    padding-inline: var(--cv-content-gutter);
  }

  #kort-fortalt > div { padding-inline: 0; }
  .pf-next > .cv-end-grid { width: 100%; }
}

#om .about-grid { row-gap: clamp(20px, 2.2vw, 32px); }
#om p.about-body {
  margin: 0;
  font-size: clamp(18px, 1.48vw, 22px);
  line-height: 1.55;
  text-wrap: pretty;
}

#main-content :is(
  .stat-card, .role-card, .exp-card, .client-category, .client-entry, .project-card,
  .framework-card, .tool-box, .value-small-card, .value-center-card,
  .value-ai-card, .value-foundation, .looking-card, .testimonial-card,
  .contact-item, .dashboard-card, .pf-project-tile, .pf-action
) {
  --cv-card-accent: var(--tile-accent, var(--accent));
  transition: border-color 240ms ease, box-shadow 320ms ease, translate 240ms ease,
    background-color 240ms ease, opacity 650ms ease, transform 650ms ease;
}

@media (hover: hover) {
  #main-content :is(
    .stat-card, .role-card, .exp-card, .client-category, .client-entry, .project-card,
    .framework-card, .tool-box, .value-small-card, .value-center-card,
    .value-ai-card, .value-foundation, .looking-card, .testimonial-card,
    .contact-item, .dashboard-card, .pf-project-tile, .pf-action
  ):hover:not(:has(.client-entry:hover)) {
    position: relative;
    z-index: 1;
    border-color: color-mix(in srgb, var(--cv-card-accent) 60%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--cv-card-accent) 18%, transparent),
      0 0 24px color-mix(in srgb, var(--cv-card-accent) 16%, transparent);
    translate: 0 -2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #main-content :is(
    .stat-card, .role-card, .exp-card, .client-category, .client-entry, .project-card,
    .framework-card, .tool-box, .value-small-card, .value-center-card,
    .value-ai-card, .value-foundation, .looking-card, .testimonial-card,
    .contact-item, .dashboard-card, .pf-project-tile, .pf-action
  ) {
    transition: none;
    translate: none !important;
  }
}

.client-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
  width: 100%;
  margin-top: clamp(34px, 4vw, 56px);
}
.client-category {
  min-width: 0;
  padding: clamp(20px, 2.5vw, 36px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.client-category-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  color: var(--text);
  font: 700 17px/1.3 var(--pf-sans);
}
.client-category-icon {
  box-sizing: content-box;
  flex: none;
  width: 23px;
  height: 23px;
  padding: 9px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
}
.client-list {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.client-entry {
  display: grid;
  grid-template-columns: 2px minmax(0, 1fr);
  gap: 3px 12px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #ffffff06;
  overflow-wrap: anywhere;
}
.client-entry::before {
  grid-area: 1 / 1 / span 2 / 2;
  align-self: stretch;
  width: 2px;
  margin-block: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .48;
  content: '';
}
.client-entry:hover { background: #ffffff0b; }
.client-entry:hover::before { opacity: 1; }
.client-name {
  color: var(--text);
  font: 600 14px/1.4 var(--pf-sans);
}
.client-role { color: var(--accent); font: 400 14px/1.6 var(--pf-sans); }

#main-content .pf-next-actions {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 100%;
}
@media (max-width: 700px) {
  .client-categories { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 520px) {
  #main-content .pf-next-actions { display: grid; grid-template-columns: 1fr; }
}

#om.slide { overflow: visible; }

.cv-scroll-cue {
  position: absolute;
  top: 0;
  z-index: 2;
  left: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
}
.cv-scroll-cue:is(:hover, :focus-visible) {
  border-color: var(--accent);
  box-shadow: 0 0 22px var(--accent-glow);
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .cv-scroll-cue { transition: translate 240ms ease, box-shadow 320ms ease, border-color 240ms ease; }
  .cv-scroll-cue svg { animation: cv-scroll-nudge 3s ease-in-out infinite; }
  .cv-scroll-cue:is(:hover, :focus-visible) { translate: 0 -2px; }
}
@keyframes cv-scroll-nudge {
  0%, 58%, 100% { translate: 0 0; }
  74% { translate: 0 3px; }
}
#topp.hero {
  min-height: calc(100vh - 36px);
  padding-bottom: clamp(32px, calc(7vw - 32px), 68px);
}
@media (max-width: 600px) {
  #topp.hero { min-height: auto; }
}
@media print {
  .cv-scroll-cue { display: none; }
}

@media (min-width: 1081px) {
  .hero .hero-subtitle {
    font-size: clamp(22px, calc(22px + (100vw - 1280px) / 43), 24px) !important;
  }

  #om .about-grid {
    grid-template-areas: "heading stats" "left-copy right-copy";
    align-items: start;
  }
  #om .about-left { grid-area: heading; align-self: center; }
  #om .about-detail { grid-area: stats; }
  #om .about-copy-left { grid-area: left-copy; }
  #om .about-copy-right { grid-area: right-copy; }
}

@media screen and (min-width: 1081px) and (max-height: 820px) {
  #topp.hero {
    min-height: calc(100svh - 120px);
    padding-top: clamp(48px, 7svh, 58px);
  }
}

@media screen and (min-width: 821px) and (max-height: 820px) {
  .cv-hero-main h1 { font-size: clamp(46px, min(6.2vw, 9.6svh), 88px); }
}

.cv-paper-model {
  position: relative;
  inset-inline-start: calc(-1 * clamp(48px, 5.8vw, 88px));
  inset-block-start: 40px;
  isolation: isolate;
  justify-self: center;
  align-self: center;
  width: min(560px, calc((100vw - 96px - clamp(36px, 6vw, 92px)) * .4533));
  scale: 1.14;
  aspect-ratio: 1;
  mask-composite: intersect;
  mask-image:
    radial-gradient(ellipse 65% 60% at 60% 47%, #000 28%, #000d 49%, #0006 76%, transparent),
    radial-gradient(ellipse 75% 70% at 43% 57%, #000 37%, #0009 70%, transparent),
    linear-gradient(103deg, transparent, #000 27%, #000 72%, transparent 95%),
    linear-gradient(90deg, transparent, #000 17%, #000 81%, transparent 97%),
    linear-gradient(180deg, transparent, #000 22%, #000 76%, transparent);
}
.cv-paper-model img { display: block; width: 100%; height: auto; }
.cv-paper-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.cv-paper-light::before,
.cv-paper-light::after {
  position: absolute;
  inset: 0;
  content: '';
}
.cv-paper-light::before {
  background: radial-gradient(ellipse 25% 23% at 77% 38%, #ffc87d55, transparent);
}
.cv-paper-light::after {
  background: radial-gradient(ellipse at 50% 8%, #ffdca74d, #ffc87d24 43%, transparent 73%);
  inset: 17.6% auto auto 75.5%;
  width: 48%;
  height: 68%;
  clip-path: polygon(48% 0, 52% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
  transform: translateX(-50%) rotate(var(--cv-lamp-angle, 24deg)) scaleY(var(--cv-lamp-reach, .7));
  opacity: 0;
}
.cv-paper-spot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--cv-spot-x, 50%) var(--cv-spot-y, 50%), #ffe0ad55, #ffc87d1c 16%, transparent 31%);
  mix-blend-mode: screen;
  opacity: 0;
}
.cv-paper-note,
.cv-paper-note > span {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cv-paper-note > span {
  background: url("cv-arbeidstavle.jpg.webp") center / 100% 100% no-repeat;
  clip-path: var(--note-outline);
  transform-origin: var(--note-pivot);
  opacity: 0;
}
.cv-paper-note-listen {
  --note-outline: polygon(30.3% 40.1%, 36.9% 38.4%, 38.35% 43.7%, 37.3% 45.25%, 31.8% 46.7%);
  --note-pivot: 33.6% 39.3%;
}
.cv-paper-note-problem {
  --note-outline: polygon(40.9% 42.9%, 47.4% 41.35%, 49.85% 42.95%, 50.85% 49.35%, 42.25% 51.45%);
  --note-pivot: 44.15% 42.1%;
}
.cv-paper-note-chart {
  --note-outline: polygon(54.45% 37.15%, 55.55% 36.6%, 59.65% 37.25%, 59.15% 42.55%, 53.8% 41.75%);
  --note-pivot: 57% 37%;
}
.cv-paper-note-sketch {
  --note-outline: polygon(31.9% 49.45%, 33.2% 48.7%, 38% 49.45%, 37.2% 55.9%, 31.15% 55%);
  --note-pivot: 35.3% 49%;
}
.cv-paper-note-ai {
  --note-outline: polygon(51.35% 49.65%, 59.05% 48.25%, 60.3% 55.1%, 59.3% 56.45%, 52.75% 57.55%);
  --note-pivot: 55% 49%;
}
@media (min-width: 1200px) {
  .cv-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24%);
    column-gap: clamp(24px, 3vw, 56px);
  }
  .cv-hero-contact { grid-column: 1 / -1; }
}
@media (min-width: 1200px) and (max-height: 820px) {
  .cv-paper-model { max-width: 510px; }
}
@media (max-width: 1199px), print {
  .cv-paper-model { display: none; }
}
@media screen and (prefers-reduced-motion: no-preference) {
  .cv-paper-model {
    translate: 0 var(--cv-paper-scroll, 0px);
    transition: translate 420ms ease-out;
  }
  .cv-paper-light::before {
    translate: calc(var(--cv-paper-scroll, 0px) * -.65) 0;
    transition: translate 420ms ease-out;
    animation: cv-lamp-glow 9s ease-in-out infinite alternate;
  }
  .cv-paper-light::after { transition: opacity 450ms ease, transform 300ms ease-out; }
  .cv-paper-model:hover .cv-paper-light::after { opacity: .68; }
  .cv-paper-spot { transition: opacity 360ms ease; }
  .cv-paper-model:hover .cv-paper-spot { opacity: .65; }
  .cv-paper-note::before {
    position: absolute;
    inset: 0;
    clip-path: var(--note-outline);
    pointer-events: auto;
    content: '';
  }
  .cv-paper-note > span {
    transition: opacity 160ms ease, transform 370ms ease-out, filter 370ms ease-out;
  }
  .cv-paper-note:hover > span {
    opacity: 1;
    transform: perspective(440px) rotateX(-17deg) scaleY(1.12);
    filter: brightness(1.16);
  }
  @keyframes cv-lamp-glow {
    from { opacity: .25; }
    to { opacity: 1; }
  }
}

#main-content :is(.role-title, .exp-role, .client-category-label) { font-size: 20px; }
#main-content :is(.role-desc, .exp-desc) { font-size: 16px; }
@media (max-width: 600px) {
  #main-content :is(.role-title, .exp-role, .client-category-label) { font-size: 17px; }
}

.cv-portrait-trigger {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: zoom-in;
}
.cv-portrait-trigger:hover .hero-photo { border-color: var(--accent); }
.cv-portrait-trigger .hero-photo { display: block; }
.cv-portrait-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  background: var(--bg);
}
.cv-portrait-dialog::backdrop { background: #080c12da; }
.cv-portrait-dialog img {
  display: block;
  width: min(72vw, 72dvh, 400px);
  height: auto;
}
.cv-portrait-dialog form { position: absolute; top: 10px; right: 10px; }
.cv-portrait-dialog button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

@media (min-width: 1101px) {
  #kort-fortalt .timeline-step { padding-top: 38px !important; }
}

/* Use the vertical rhythm of the Aschehoug and NORCCIS case sections. */
@media screen {
  #main-content {
    --cv-section-space: clamp(88px, 10vw, 152px);
  }

  #main-content > .slide,
  #main-content > .pf-next,
  #main-content > #topp.hero {
    min-height: 0;
    padding-block: var(--cv-section-space);
  }

  #main-content > .slide > :last-child {
    margin-bottom: 0;
  }
}

@media screen and (max-width: 640px) {
  #main-content {
    --cv-section-space: 72px;
  }
}
