/* ══════════════════════════════════════════════════
   main.css — Trond Martens Sivilarkitekt
   Delte tekst- og typografi-stiler for hele nettsiden
   ══════════════════════════════════════════════════ */

/* ── Variabler ── */
:root {
  --bg: #050505;
  --surface: #0a0a0a;
  --surface-elevated: #111111;
  --border: rgba(255, 255, 255, 0.06);
  --text: #f5f5f5;
  --muted: #888888;
  --muted2: #666666;
  --cream: #f0ede8;
  --cream-border: #d8d3cc;
  --cream-text: #1a1a1a;
  --cream-muted: #555555;
  --cream-label: #999999;
  --radius-lg: 1.25rem;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;

  /* Logo letter-spacing — justér herfra for å påvirke alle instanser */
  --logo-spacing-name: 0;      /* "Trond Martens" — header, hero, footer */
  --logo-spacing-sub:  0.05em; /* "Sivilarkitekt" — header, hero, footer */

  --logo-sub-scale: 0.7;    /* sub-tekst som andel av name-størrelsen — header, hero, footer */
  --logo-gap:       0.1rem; /* mellomrom mellom sub og name — header, hero, footer */
}

/* ── Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Header ── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: rgba(240, 237, 232, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--cream-border);
}

.site-header.is-scrolled .nav-toggle {
  color: #1a1a1a;
}

/* ── Navigasjon ── */
.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 0.4rem;
  color: rgba(0, 0, 0, 0.45);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #111;
}

.nav-links a.is-active {
  color: #1a1a1a;
  font-weight: 500;
}

/* ── Fullscreen nav overlay ── */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 5, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body.nav-open .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-overlay a {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: clamp(2.2rem, 9vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease, color 0.2s;
}

body.nav-open .nav-overlay a                { opacity: 1; transform: translateY(0); }
body.nav-open .nav-overlay a:nth-of-type(1) { transition-delay: 0.05s; }
body.nav-open .nav-overlay a:nth-of-type(2) { transition-delay: 0.1s; }
body.nav-open .nav-overlay a:nth-of-type(3) { transition-delay: 0.15s; }
.nav-overlay a:hover                      { color: #fff; }
.nav-overlay a.is-active                  { color: #fff; }

/* ── Seksjon-titler ── */
.section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem 4rem;
  align-items: end;
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(26, 26, 26, 0.12);
}

@media (max-width: 640px) {
  .section-head {
    grid-template-columns: 1fr;
  }
}

.section-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #999;
  margin: 0 0 1.25rem;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: #1a1a1a;
  margin: 0;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #888;
  border: 1px dashed rgba(26, 26, 26, 0.15);
  border-radius: var(--radius-lg);
}

/* ── Kort (portefølje-thumbnails) ── */
.card {
  position: relative;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  border: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.card:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.25);
  outline-offset: 3px;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover img {
  transform: scale(1.04);
}

/* ── Felles baseklasse for h1-overskrifter (serif) ── */
.serif-heading {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #1a1a1a;
}

/* ── Footer — wrapper og kolonne-layout ── */
footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.footer__inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 4rem 2rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3rem;
}

.footer__copy {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  text-align: center;
}

@media (max-width: 700px) {
  .footer__inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 3rem 1.5rem 2rem;
  }
  .footer__copy {
    padding: 1rem 1.5rem 2.5rem;
  }
}

.footer__col-label {
  display: block;
  margin-bottom: 1.25rem;
}

.footer__brand-sub {
  margin: 0 0 var(--logo-gap);
}

.footer__brand-title {
  margin: 0 0 1rem;
}

.footer__brand-meta {
  margin: 0;
}

.footer__contact p {
  margin: 0 0 0.3rem;
}

.footer__contact a {
  text-decoration: none;
  transition: color 0.2s;
}

.footer__contact .footer__address {
  color: var(--muted2);
  margin-top: 0.5rem;
}

.footer__nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer__nav a {
  text-decoration: none;
  transition: color 0.2s;
}

/* ── Footer — layout og logoer ── */
.footer__col--brand {
  display: flex;
  flex-direction: column;
}
.footer__col-logos {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.footer__col-logos .logo-wrap-item {
  width: 100px;
  height: 32px;
  display: flex;
  align-items: center;
}
.footer__col-logos .logo-wrap-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  filter: invert(1);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.footer__col-logos .logo-wrap-item img:hover { opacity: 0.6; }

.footer__logos-row {
  display: none;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  align-items: center;
  gap: 1.75rem;
}
.footer__logos-row .logo-wrap-item {
  width: 100px;
  height: 32px;
  display: flex;
  align-items: center;
}
.footer__logos-row .logo-wrap-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  filter: invert(1);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.footer__logos-row .logo-wrap-item img:hover { opacity: 0.6; }

@media (max-width: 700px) {
  .footer__col-logos { display: none; }
  .footer__logos-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .footer__logos-row .logo-wrap-item {
    width: auto;
    height: auto;
  }
  .footer__logos-row .logo-wrap-item img {
    width: auto;
    height: 32px;
    max-width: none;
    max-height: none;
  }
}

/* ── Footer — tekst ── */
.footer__copy {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted2);
}

.footer__col-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted2);
}

.footer__brand-meta {
  font-size: 0.75rem;
  color: var(--muted2);
  letter-spacing: 0.02em;
}

.footer__contact p {
  font-size: 0.85rem;
  color: var(--muted);
}

.footer__contact a {
  color: var(--muted);
}

.footer__contact a:hover {
  color: var(--text);
}

.footer__nav a {
  font-size: 0.85rem;
  color: var(--muted2);
}

.footer__nav a:hover {
  color: var(--text);
}

.footer__nav a.is-active {
  color: var(--text);
}

/* ══════════════════════════════════════════════════
   KNAPPER & INTERAKTIVE KONTROLLER
   ══════════════════════════════════════════════════ */

/* ── Pil-animasjoner ── */
@keyframes cta-bounce-right {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(2px); }
}
@keyframes cta-bounce-up {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-2px); }
}

/* ── CTA-lenker ── */
.cta-link {
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #444;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}
.cta-link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}
.cta-link:hover::after {
  width: 100%;
}
.cta-link .cta-arrow {
  display: inline-block;
  animation: cta-bounce-right 2.4s ease-in-out infinite;
}

/* ── Om-pil-animasjoner ── */
.om-arrow-bounce       { display: inline-block; animation: cta-bounce-up    2.4s ease-in-out infinite; }
.om-arrow-bounce-right { display: inline-block; animation: cta-bounce-right 2.4s ease-in-out infinite; }

/* ── Kontakt-lenker — underline-animasjon og fast pil-avstand ── */
.kontakt-hero__link {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.kontakt-hero__link-value {
  position: relative;
}
.kontakt-hero__link-value::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}
.kontakt-hero__link:hover .kontakt-hero__link-value::after {
  width: 100%;
}

/* ── Lightbox-kontroller ── */
dialog.lightbox {
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-width: min(96vw, 1200px);
  width: 100%;
}
dialog.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}
.lightbox__box {
  position: relative;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.lightbox__box img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(82vh, 900px);
  object-fit: contain;
  background: #000;
}
.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.lightbox__bar span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8125rem;
  color: var(--muted);
}
.lightbox__nav {
  display: flex;
  gap: 0.35rem;
}
.lightbox__nav button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s;
}
.lightbox__nav button:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.9);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.2s;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.1); }

/* ── Hamburger-knapp (.nav-toggle) ── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
  color: #1a1a1a;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
body.nav-open .nav-toggle                               { color: rgba(255,255,255,0.85); }
body.nav-open .nav-toggle .nav-toggle__bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
body.nav-open .nav-toggle .nav-toggle__bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle .nav-toggle__bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ── Meny-lukk (.nav-overlay__close) ── */
.nav-overlay__close {
  position: absolute;
  top: 1.25rem;
  right: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-overlay__close span {
  position: absolute;
  display: block;
  width: 22px;
  height: 1.5px;
  background: rgba(255,255,255,0.65);
  transition: background 0.2s;
}
.nav-overlay__close span:nth-child(1) { transform: rotate(45deg); }
.nav-overlay__close span:nth-child(2) { transform: rotate(-45deg); }
.nav-overlay__close:hover span        { background: #fff; }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links  { display: none; }
}

/* ══════════════════════════════════════════════════
   LOGO — "Sivilarkitekt / Trond Martens"
   Alle instanser av logo-teksten på nettsiden
   ══════════════════════════════════════════════════

   HEADER (alle sider — index, portefolje, om, kontakt):
     <a class="brand">
       <span class="brand__sub">Sivilarkitekt</span>
       <span class="brand__name">Trond Martens</span>
     </a>

   HERO + MORPH-OVERLAY (kun index.html):
     Stor hero-tittel øverst på forsiden.
     #hero-morph er JS-animasjonen som flyr opp i headeren ved scroll.
     Begge <p>/<h1> i hero og morph bruker identiske fontverdier
     og styres herfra — én endring påvirker begge.
       <p class="morph__sub">Sivilarkitekt</p>   ← hero + overlay
       <h1 class="morph__name">Trond Martens</h1> ← hero + overlay

   FOOTER (alle sider — index, portefolje, om, kontakt):
     <p class="footer__brand-sub">Sivilarkitekt</p>
     <p class="footer__brand-title">Trond Martens</p>
   ══════════════════════════════════════════════════ */

/* Delt font-family for alle header-brand-elementer */
.brand {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--logo-gap);
  line-height: 1;
  text-decoration: none;
}

/* Header — liten versjon */
.brand__sub {
  font-size: calc(var(--logo-sub-scale) * 1.3rem);
  font-weight: 300;
  color: #666;
  letter-spacing: var(--logo-spacing-sub);
  line-height: 1;
}

.brand__name {
  font-size: 1.3rem;
  font-weight: 500;
  color: #1a1a1a;
  letter-spacing: var(--logo-spacing-name);
  line-height: 1;
  white-space: nowrap;
}

/* Hero + morph-overlay — stor versjon (kun index.html) */
.morph__sub {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: calc(var(--logo-sub-scale) * clamp(2rem, 4.5vw, 5rem));
  font-weight: 300;
  color: #666;
  letter-spacing: var(--logo-spacing-sub);
}

.morph__name {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 4.5vw, 5rem);
  font-weight: 500;
  color: #1a1a1a;
  letter-spacing: var(--logo-spacing-name);
}

/* Footer — mellomstor versjon */
.footer__brand-sub {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: calc(var(--logo-sub-scale) * clamp(1.6rem, 2.3vw, 2.3rem));
  font-weight: 300;
  line-height: 1;
  color: var(--text);
  letter-spacing: var(--logo-spacing-sub);
}

.footer__brand-title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 2.3vw, 2.3rem);
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  letter-spacing: var(--logo-spacing-name);
}
