/* ============================================================
   Knut Trøim — Portfolio
   Design tokens pulled from Figma variables
   ============================================================ */

:root {
  /* Colors */
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-1: #e8ecf2;
  --surface-2: #c8d1e0;
  --fg: #191919;
  --fg-subtle: #434343;
  --fg-teal: #0d262e;
  --border: #d6d6d6;
  --border-light: #e6e6e6;
  --tag: #7266fd;
  --tag-soft: #b4a5fd;
  --muted: rgba(0, 0, 0, 0.5);
  --muted-2: rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(255, 255, 255, 0.85);

  /* Figma-UI palette (for the interactive hero) */
  --fg-color-icon: #000000e5;
  --fg-color-text: #000000e5;
  --fg-color-text-secondary: #00000080;
  --fg-color-text-tertiary: #0000004d;
  --fg-color-bg: #ffffff;
  --fg-color-bg-secondary: #f5f5f5;
  --fg-color-bg-hover: #f5f5f5;
  --fg-color-border: #e6e6e6;
  --fg-color-border-translucent: #0000001a;
  --fg-color-component: #8638e5;
  --fg-color-brand: #0d99ff;
  --fg-color-onbrand: #ffffff;
  --fg-canvas: #f5f5f5;
  --fg-yellow: #ffcd29;

  /* Typography */
  --font-head: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --maxw: 906px;
  --pad: 24px;
  --radius-card: 16px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.section {
  padding: 80px 0;
}

/* ---------- Type ---------- */
h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 300;
  margin: 0;
  letter-spacing: -1px;
  color: var(--fg);
  /* last-resort break so a long single word can never widen the page */
  overflow-wrap: break-word;
}

.h1,
h1 {
  /* min was 48px, which never shrank enough for long titles like
     "Krigseilerregisteret" on a phone and pushed the page sideways */
  font-size: clamp(34px, 8vw, 64px);
  line-height: 1;
  font-weight: 400;
}

.h2,
h2 {
  font-size: clamp(34px, 8vw, 64px);
  line-height: 1;
  font-weight: 400;
}


.h3,
h3 {
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.05;
  font-weight: 400;
}

.lead {
  font-size: clamp(16px, 2.4vw, 18px);
  line-height: 1.45;
  color: var(--fg-subtle);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  color: var(--tag);
  letter-spacing: -0.4px;
}

/* ---------- Scroll reveal ---------- */
/* .js is set by an inline script in <head>; without JS nothing is ever hidden */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 1.4s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
  }
  .js .reveal.is-visible {
    transition: none;
  }
}

/* ---------- Frosted blur along the bottom edge of the viewport ---------- */
/* Same recipe as the frosted nav at the top (and as sanna.no's header): one
   flat blur radius rather than a multi-step ramp. The mask only fades the
   layer out upward so it has no hard top edge — the blur itself stays even.
   Note: opacity/filter on this element would make it a backdrop root and kill
   the blur. A mask on the element itself is fine; on a parent it is not. */
.page-blur {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  z-index: 90;
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 32%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, #000 32%, transparent 100%);
}

/* ---------- Tag / pill ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 9999px;
  background: var(--tag);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 35px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--fg-subtle);
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--surface-1);
  border-color: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(11px);
  backdrop-filter: blur(11px);
  border-bottom: 1px solid var(--border-light);
}

.nav__inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav__logo .sep {
  color: var(--muted-2);
  font-weight: 400;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 36px;
}

.nav__link {
  font-size: 16px;
  color: var(--fg);
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.nav__link:hover {
  opacity: 1;
}

.nav__link.is-active {
  font-weight: 600;
  opacity: 1;
}

.nav__icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

.nav__icon svg {
  width: 18px;
  height: 18px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 64px 0 40px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.footer__sign {
  width: 170px;
  margin: 0 auto 28px;
  opacity: 0.9;
}

.footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 28px;
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

.footer__link svg {
  width: 18px;
  height: 18px;
}

.footer__copy {
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .nav__links {
    gap: 18px;
  }
  .nav__link {
    font-size: 14px;
  }
  .section {
    padding: 56px 0;
  }
  .footer__links {
    gap: 24px;
  }
}

/* Touch targets: on a phone these are all ~21–32px tall, well under the ~44px
   that is comfortable for a thumb. Padding grows the hit area without
   changing how any of it looks. */
@media (max-width: 720px) {
  .nav__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .nav__icon {
    width: 44px;
    height: 44px;
    margin-right: -8px; /* keep the row visually flush with the edge */
  }
  .footer__link {
    min-height: 44px;
  }
}
