/* ============ H5 — Helge Hannisdal ============ */
:root {
  --bg: #07060a;
  --bg-soft: #0d0b12;
  --fg: #f2efe9;
  --muted: rgba(242, 239, 233, 0.55);
  --faint: rgba(242, 239, 233, 0.28);
  --line: rgba(242, 239, 233, 0.12);
  --accent: #ff5c1a;
  --accent-soft: #ff9a4d;
  --accent-rgb: 255, 92, 26;
  --accent-soft-rgb: 255, 154, 77;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- grain ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 200;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ---------- cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 300;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor-dot {
  width: 8px; height: 8px;
  background: var(--accent-soft);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1px solid rgba(var(--accent-soft-rgb), 0.5);
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.cursor-ring.is-hover {
  width: 64px; height: 64px;
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-soft-rgb), 0.9);
}
@media (hover: none), (max-width: 768px) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- preloader ---------- */
.preloader {
  position: fixed; inset: 0;
  z-index: 400;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
.preloader-count {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--fg);
}
.preloader-bar {
  width: min(280px, 60vw);
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.preloader-bar::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.preloader-label {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2rem;
  padding: 1.4rem clamp(1.25rem, 4vw, 3rem);
  mix-blend-mode: difference;
}
.nav-logo { display: flex; align-items: center; }
.nav-logo img { height: 32px; width: auto; display: block; }
.nav-links {
  display: flex;
  gap: 2rem;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.nav-links a { color: #fff; position: relative; padding: 0.25rem 0; }
.nav-links a::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- webgl ---------- */
.webgl-wrap {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}
#webgl { width: 100%; height: 100%; display: block; }

main { position: relative; z-index: 1; }

/* ---------- hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(2rem, 6vh, 4.5rem);
  position: relative;
}
.hero-logo {
  width: clamp(150px, 18vw, 250px);
  height: auto;
  margin-bottom: clamp(1.2rem, 3vh, 2rem);
  opacity: 0.95;
}
.hero-kicker {
  font-size: clamp(0.65rem, 1vw, 0.8rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 1.2rem;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.2rem, 13.5vw, 12.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}
.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.hero-title .char {
  display: inline-block;
  will-change: transform;
}
.hero-title .line:nth-child(2) {
  -webkit-text-stroke: 1.5px rgba(242, 239, 233, 0.85);
  color: transparent;
}
.hero-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  margin-top: clamp(1.5rem, 4vh, 3rem);
  flex-wrap: wrap;
}
.hero-sub {
  max-width: 30rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  font-weight: 300;
}
.hero-sub strong { color: var(--fg); font-weight: 500; }
.hero-scroll {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.hero-scroll .scroll-line {
  width: 1px; height: 48px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.hero-scroll .scroll-line::after {
  content: "";
  position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%;
  background: var(--accent);
  animation: scrolldown 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes scrolldown {
  to { top: 110%; }
}

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 1.1rem 0;
  background: var(--bg);
}
.marquee-track {
  display: flex;
  width: max-content;
}
.marquee-canvas {
  display: block;
  width: 100%;
  height: clamp(1.5rem, 2.4vw, 2.1rem);
}
.marquee.has-canvas .marquee-track { display: none; }
.marquee-track span {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: rgba(242, 239, 233, 0.45);
  padding-right: 1.2em;
}
.marquee-track span em {
  font-style: normal;
  color: var(--accent);
  padding-right: 1.2em;
}

/* ---------- sections ---------- */
.section {
  padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3rem);
  max-width: 90rem;
  margin: 0 auto;
  position: relative;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 18em;
}
.section-title .accent { color: var(--accent-soft); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.about-photo {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 4 / 5;
}
.about-photo img {
  position: absolute;
  inset: -12% 0;
  width: 100%;
  height: 124%;
  object-fit: cover;
  object-position: center 22%;
  filter: grayscale(35%) contrast(1.05);
}
.about-photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(7, 6, 10, 0.55));
}
.about-copy p {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 300;
  margin-bottom: 1.4em;
  max-width: 36em;
}
.about-copy p strong { color: var(--fg); font-weight: 500; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: clamp(3rem, 8vh, 5rem);
}
.stat {
  background: var(--bg);
  padding: clamp(1.4rem, 3vw, 2.4rem) clamp(1rem, 2vw, 2rem);
}
.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.stat-suffix { color: var(--accent-soft); }
.stat-label {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- portfolio ---------- */
.work-note {
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  font-weight: 300;
}
.work-list {
  border-top: 1px solid var(--line);
  margin-top: clamp(2rem, 5vh, 3.5rem);
}
.work-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) minmax(0, 22rem) 7rem 3rem;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.2rem, 2.5vw, 1.9rem) 0.5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding-left 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.work-row::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.work-row:hover { padding-left: 1.4rem; }
.work-row:hover::before { opacity: 1; }
.work-idx {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.work-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(242, 239, 233, 0.55);
  transition: color 0.35s ease, -webkit-text-stroke-color 0.35s ease;
  overflow-wrap: anywhere;
}
.work-row:hover .work-name {
  color: var(--fg);
  -webkit-text-stroke-color: transparent;
}
.work-meta { min-width: 0; }
.work-role {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}
.work-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.25rem;
}
.work-tag {
  justify-self: start;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  white-space: nowrap;
}
.work-tag.active { border-color: rgba(74, 222, 128, 0.35); color: #4ade80; }
.work-tag.exited { border-color: rgba(var(--accent-soft-rgb), 0.35); color: var(--accent-soft); }
.work-arrow {
  color: var(--accent-soft);
  opacity: 0;
  transform: translate(-8px, 8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  justify-self: end;
  display: flex;
  align-items: center;
}
.work-arrow svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}
.work-row.is-static .work-arrow { display: none; }
a.work-row:hover .work-arrow { opacity: 1; transform: translate(0, 0); }

/* ---------- photos ---------- */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(2rem, 5vh, 3.5rem);
}
.photo-card { position: relative; }
.photo-frame {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 1;
  cursor: pointer;
}
.photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), filter 0.8s ease;
  filter: grayscale(25%);
}
.photo-frame:hover img { transform: scale(1.05); filter: grayscale(0%); }
.photo-frame::after {
  content: "View ↗";
  position: absolute;
  right: 1rem; bottom: 1rem;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(7, 6, 10, 0.7);
  padding: 0.5rem 0.9rem;
  border-radius: 99px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.photo-frame:hover::after { opacity: 1; transform: translateY(0); }
.photo-credit {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--faint);
}
.photo-credit a {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  transition: color 0.3s ease;
}
.photo-credit a:hover { color: var(--accent-soft); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(5rem, 14vh, 10rem) clamp(1.25rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.footer-glow {
  position: absolute;
  left: 50%; bottom: -40%;
  width: 80vw; height: 80vw;
  max-width: 900px; max-height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.16), transparent 60%);
  pointer-events: none;
}
.footer-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 1.5rem;
}
.footer-cta {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9.5vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(242, 239, 233, 0.8);
  transition: color 0.45s ease, -webkit-text-stroke-color 0.45s ease;
}
.footer-cta:hover { color: var(--fg); -webkit-text-stroke-color: transparent; }
.footer-socials {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin: clamp(2.5rem, 6vh, 4rem) 0 3rem;
}
.footer-socials a {
  width: 52px; height: 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.35s ease, border-color 0.35s ease, transform 0.35s ease;
}
.footer-socials a:hover {
  color: var(--accent-soft);
  border-color: rgba(var(--accent-soft-rgb), 0.5);
  transform: translateY(-4px);
}
.footer-socials svg { width: 20px; height: 20px; }
.footer-base {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 350;
  background: rgba(4, 3, 7, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal img {
  max-height: 74vh;
  max-width: 100%;
  width: auto;
  border-radius: 4px;
}
.modal-actions { display: flex; gap: 1rem; }
.modal-btn {
  background: var(--fg);
  color: var(--bg);
  border: none;
  padding: 0.85rem 1.8rem;
  border-radius: 99px;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.3s ease;
}
.modal-btn:hover { background: var(--accent-soft); color: #fff; }
.modal-btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.modal-btn.ghost:hover { background: transparent; color: var(--fg); border-color: var(--fg); }

/* ---------- contact page ---------- */
.contact-wrap {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 90rem;
  margin: 0 auto;
  padding: clamp(7rem, 16vh, 10rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 8vh, 5rem);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
  position: relative;
  z-index: 1;
}
.contact-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.contact-title .outline {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(242, 239, 233, 0.8);
}
.contact-note {
  margin-top: 1.8rem;
  color: var(--muted);
  font-weight: 300;
  max-width: 26em;
}
.contact-note small { display: block; margin-top: 0.6rem; color: var(--faint); font-size: 0.8rem; }
.contact-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent-soft);
}
.contact-back:hover { color: var(--fg); }
.form { display: flex; flex-direction: column; gap: 1.6rem; }
.field { position: relative; }
.field label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 300;
  padding: 0.6rem 0 0.8rem;
  outline: none;
  border-radius: 0;
  transition: border-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}
.field select { cursor: pointer; }
.field select option { background: var(--bg-soft); color: var(--fg); }
.field textarea { resize: none; min-height: 7rem; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent-soft); }
.form-status {
  display: none;
  padding: 0.9rem 1.1rem;
  border-radius: 4px;
  font-size: 0.88rem;
}
.form-status.ok { display: block; background: rgba(74, 222, 128, 0.08); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.25); }
.form-status.err { display: block; background: rgba(248, 113, 113, 0.08); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.25); }
.form-submit {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 1.05rem 2.6rem;
  border-radius: 99px;
  font-size: 0.74rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.3s ease, transform 0.3s ease;
}
.form-submit:hover { background: var(--accent-soft); transform: translateY(-2px); }
.form-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.hp { display: none !important; }

/* ---------- reveal helpers ---------- */
[data-reveal] { opacity: 0; transform: translateY(40px); }
.no-js [data-reveal], .reduced-motion [data-reveal] { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 26rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .work-row {
    grid-template-columns: 2.2rem minmax(0, 1fr) auto;
    grid-template-areas:
      "idx name tag"
      ".   meta arrow";
    row-gap: 0.5rem;
    gap: 0.9rem;
  }
  .work-idx { grid-area: idx; }
  .work-name { grid-area: name; }
  .work-meta { grid-area: meta; }
  .work-tag { grid-area: tag; justify-self: end; }
  .work-arrow { grid-area: arrow; opacity: 1; transform: none; }
  a.work-row:hover { padding-left: 0.5rem; }
  .contact-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .photos-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 1.2rem; }
  .hero-bottom { flex-direction: column; align-items: flex-start; }
  .footer-base { justify-content: center; text-align: center; }
}

/* Touch devices have no hover to reveal the names — show them filled. */
@media (hover: none) {
  .work-name {
    color: rgba(242, 239, 233, 0.92);
    -webkit-text-stroke-color: transparent;
  }
  .work-arrow { color: var(--accent-soft); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .grain, .hero-scroll .scroll-line::after { animation: none !important; }
  * { transition-duration: 0.01ms !important; }
}
