/**
 * lovstrom.no – landing page styles.
 *
 * One hand-written stylesheet, no framework and no build step.
 * Class names follow BEM: block, block__element, block--modifier.
 * State classes set by site.js are prefixed with "is-".
 *
 * Contents
 *  1. Fonts
 *  2. Design tokens
 *  3. Base
 *  4. Layout
 *  5. Components
 *  6. Sections
 *  7. Small screens
 *  8. Print
 */

/* ==========================================================================
   1. Fonts
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-weight: 200 800;
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: Geist;
  font-weight: 100 900;
  src: url("fonts/geist.woff2") format("woff2");
  font-display: swap;
}

/* ==========================================================================
   2. Design tokens
   ========================================================================== */

:root {
  /* Colors: black, white, neutral greys and one yellow accent */
  --color-white: #fff;
  --color-black: #0a0a0a;
  --color-accent: #ffd60a;
  --color-background: var(--color-white);
  --color-surface: #f3f4f6;
  --color-surface-dark: #171717;
  --color-text: var(--color-black);
  --color-text-inverse: #fafafa;
  --color-muted: #4b5563;
  --color-muted-inverse: #b3b3b3;
  --color-border: #d1d5db;
  --color-border-dark: #333;
  --color-border-inverse: #8a8a8a;

  /* Typography */
  --font-heading: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Geist", system-ui, sans-serif;

  /* Shape and motion */
  --radius-pill: 999px;
  --radius-card: 20px;
  --transition-fast: 0.15s;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Layout */
  --container-width: 1080px;
  --container-gutter: 24px;
  --header-offset: 88px;
}

/* ==========================================================================
   3. Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-offset);
}

/* The page behind an open mobile menu must not scroll */
html:has(.menu[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-surface);
  /* stylelint-disable-next-line property-no-vendor-prefix -- still required by Safari on iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--color-black);
}

/* Sections that site.js focuses after an in-page link do not show a focus ring */
[tabindex="-1"]:focus-visible {
  outline: 0;
  box-shadow: none;
}

/* ==========================================================================
   4. Layout
   ========================================================================== */

.container {
  max-width: var(--container-width);
  padding-right: var(--container-gutter);
  padding-left: var(--container-gutter);
  margin: 0 auto;
}

/* ==========================================================================
   5. Components
   ========================================================================== */

/* SVG sprite: holds symbols only and takes up no space
   ========================================================================== */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Skip link: visible only when focused with the keyboard
   ========================================================================== */

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--color-black);
  text-decoration: none;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
}

.skip-link:focus {
  top: 12px;
}

/* Logo: the word mark, with each "ø" drawn as a ring with a lightning bolt
   ========================================================================== */

.logo {
  display: flex;
  align-items: baseline;
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: none;
}

.logo__o {
  width: 38px;
  height: 38px;
  margin: 0 -5px;
  transform: translateY(8px);
}

.logo-o__ring {
  fill: none;
  stroke: currentcolor;
  stroke-width: 15;
}

.logo-o__bolt {
  fill: var(--color-accent);
}

/* Site header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

/* Site navigation (wide screens)
   ========================================================================== */

.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-nav__link {
  padding: 10px 14px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-pill);
}

.site-nav__link:hover {
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 6px;
}

.site-nav__link--button {
  padding: 10px 18px;
  color: var(--color-white);
  background: var(--color-black);
  transition: color var(--transition-fast);
}

.site-nav__link--button:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* Mobile menu: a <details> element that covers the screen below the header
   ========================================================================== */

.menu {
  display: none;
}

.menu__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  list-style: none;
  border-radius: 10px;
}

.menu__toggle::-webkit-details-marker {
  display: none;
}

.menu__toggle:hover {
  background: var(--color-surface);
}

.menu__icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--color-text);
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* Show the hamburger when closed (or closing) and the cross when open */
.menu__icon--close,
.menu[open] .menu__icon--open,
.menu.is-closing .menu__icon--close {
  display: none;
}

.menu[open] .menu__icon--close,
.menu.is-closing .menu__icon--open {
  display: block;
}

.menu__panel {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100dvh;
  padding: 24px;
  background: var(--color-background);
  border-top: 1px solid var(--color-border);
}

.menu__link {
  align-self: flex-start;
  padding: 10px 0;
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: none;
}

.menu__link:hover {
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  /* The links slide in one after another */
  .menu__link:nth-child(2) {
    animation-delay: 0.05s;
  }

  .menu__link:nth-child(3) {
    animation-delay: 0.1s;
  }

  .menu__link:nth-child(4) {
    animation-delay: 0.15s;
  }

  .menu[open] .menu__panel {
    animation: menu-in 0.28s var(--ease-out);
  }

  .menu[open] .menu__link {
    animation: menu-link-in 0.36s var(--ease-out) backwards;
  }

  /* site.js adds .is-closing and removes the open attribute when menu-out ends */
  .menu.is-closing .menu__panel {
    animation: menu-out 0.2s ease-in forwards;
  }

  .menu.is-closing .menu__link {
    animation: none;
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes menu-link-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
}

@keyframes menu-out {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* Buttons
   ========================================================================== */

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
}

.button {
  padding: 14px 24px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.button--primary {
  color: var(--color-black);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.button--primary:hover {
  color: var(--color-accent);
  background: transparent;
}

.button--outline {
  color: var(--color-text-inverse);
  border-color: var(--color-border-inverse);
}

.button--outline:hover {
  color: var(--color-black);
  background: var(--color-white);
  border-color: var(--color-white);
}

/* Pulse line: the decorative yellow line under the main heading
   ========================================================================== */

.pulse-line {
  width: min(420px, 100%);
  height: 28px;
}

.pulse-line__stroke {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pulse-line__dot {
  fill: var(--color-text-inverse);
}

/* Site footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--color-border);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 15px;
  color: var(--color-muted);
}

/* ==========================================================================
   6. Sections
   ========================================================================== */

/* Section: a full-width band. The default background is the page surface.
   ========================================================================== */

.section--dark {
  color: var(--color-text-inverse);
  background: var(--color-black);
}

.section--light {
  background: var(--color-background);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.section--accent {
  color: var(--color-black);
  background: var(--color-accent);
}

.section__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: 80px;
  padding-bottom: 80px;
}

.section__header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section__title {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
}

.section__intro {
  color: var(--color-muted);
}

.section--dark .section__intro {
  color: var(--color-muted-inverse);
}

/* Hero: greeting, name, lead text and portrait
   ========================================================================== */

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 56px;
  align-items: center;
  padding-top: 88px;
  padding-bottom: 72px;
}

.hero__content {
  display: flex;
  flex: 1 1 420px;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.hero__eyebrow {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.04em;
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(40px, 6vw, 68px);
  font-weight: 700;
  line-height: 1.05;
}

.hero__lead {
  max-width: 520px;
  font-size: 20px;
  color: var(--color-muted-inverse);
}

.hero__portrait {
  flex: 0 1 360px;
  width: 360px;
  min-width: 0;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 20%;
  background: var(--color-surface-dark);
  border-radius: 28px;
}

/* Error page (404): the same look as the hero, centered vertically
   ========================================================================== */

.error-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  min-height: 70vh;
  padding-top: 88px;
  padding-bottom: 88px;
}

/* About: text on the left, dark fact card on the right
   ========================================================================== */

.about {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: stretch;
  padding-top: 80px;
  padding-bottom: 80px;
}

.about__text {
  display: flex;
  flex: 3 1 420px;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  min-width: 0;
}

.about__lead {
  font-size: 24px;
  line-height: 1.4;
}

.about__paragraph {
  font-size: 18px;
}

/* The card stretches to the height of the text, and its rows share the space */
.fact-card {
  display: flex;
  flex: 2 1 300px;
  flex-direction: column;
  min-width: 0;
  padding: 8px 28px;
  color: var(--color-text-inverse);
  background: var(--color-black);
  border-radius: var(--radius-card);
}

.fact-card__row {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-dark);
}

.fact-card__row:last-child {
  border-bottom: 0;
}

.fact-card__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fact-card__value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

/* Experience: two timelines side by side
   ========================================================================== */

.timelines {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
}

.timelines__group {
  display: flex;
  flex: 1 1 320px;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.timelines__title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.timeline {
  margin-left: 7px;
  border-left: 2px solid var(--color-black);
}

.timeline__item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 28px 28px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

/* The dot on the line */
.timeline__item::before {
  position: absolute;
  top: 6px;
  left: -8px;
  width: 14px;
  height: 14px;
  content: "";
  background: var(--color-black);
  border-radius: 50%;
}

.timeline__item--current::before {
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-black);
}

.timeline__period {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-muted);
}

.timeline__title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

/* Now: three columns on the accent band
   ========================================================================== */

.now-list {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

.now-list__item {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-top: 16px;
  border-top: 3px solid var(--color-black);
}

.now-list__label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.now-list__text {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
}

/* Contact: cards on the dark band
   ========================================================================== */

.contact-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.contact-card {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  min-width: 0;
  padding: 24px 28px;
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-card);
}

.contact-card__label {
  flex: 0 0 100%;
  font-size: 15px;
  color: var(--color-muted-inverse);
}

.contact-card__email,
.contact-card__link {
  max-width: 100%;
  font-size: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.contact-card__link {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color var(--transition-fast);
}

.contact-card__link:hover {
  color: var(--color-white);
}

/* Added next to the email address by site.js */
.copy-button {
  padding: 8px 16px;
  margin-left: auto;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-inverse);
  cursor: pointer;
  background: transparent;
  border: 2px solid var(--color-border-inverse);
  border-radius: var(--radius-pill);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.copy-button:hover {
  color: var(--color-black);
  background: var(--color-white);
  border-color: var(--color-white);
}

/* ==========================================================================
   7. Small screens
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Same breakpoint as Tailwind's "md" (768px), so the apps switch layout at the same width */
@media (width < 768px) {
  :root {
    --header-offset: 80px;
  }

  .site-nav {
    display: none;
  }

  .menu {
    display: block;
  }

  .hero {
    gap: 40px;
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .about,
  .section__inner {
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .about {
    gap: 32px;
  }

  .about__lead {
    font-size: 21px;
  }

  .fact-card__row {
    padding: 14px 0;
  }
}

/* ==========================================================================
   8. Print
   ========================================================================== */

/* Printed, the page is a one-page CV: black text on white, no navigation */
@media print {
  @page {
    margin: 14mm 16mm;
  }

  :root {
    --color-surface: var(--color-white);
    --color-text-inverse: var(--color-black);
    --color-muted: var(--color-black);
    --color-muted-inverse: var(--color-black);
    --color-border-dark: var(--color-border);
    --color-surface-dark: var(--color-white);
    --container-gutter: 0;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.4;
  }

  .skip-link,
  .site-header,
  .site-footer,
  .button-group,
  .pulse-line,
  .copy-button {
    display: none;
  }

  .section--dark,
  .section--accent,
  .fact-card {
    color: var(--color-black);
    background: none;
  }

  .section--light {
    border: 0;
  }

  .hero,
  .about,
  .section__inner {
    gap: 12pt;
    padding-top: 0;
    padding-bottom: 14pt;
  }

  .hero {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .hero__content {
    gap: 4pt;
  }

  .hero__eyebrow {
    display: none;
  }

  .hero__title {
    font-size: 24pt;
  }

  .hero__lead,
  .about__lead,
  .about__paragraph {
    max-width: none;
    font-size: inherit;
  }

  .hero__portrait {
    flex: none;
    width: 28mm;
    border-radius: 3mm;
  }

  .section__title {
    padding-bottom: 3pt;
    font-size: 13pt;
    border-bottom: 1pt solid var(--color-black);
  }

  .about {
    flex-wrap: nowrap;
  }

  .about__text {
    gap: 6pt;
  }

  .fact-card {
    padding: 0;
    border-radius: 0;
  }

  .fact-card__row {
    padding: 3pt 0;
  }

  .fact-card__label,
  .now-list__label {
    font-size: 8pt;
    color: var(--color-black);
  }

  .fact-card__value,
  .timeline__title,
  .timelines__title,
  .now-list__text,
  .contact-card__email,
  .contact-card__link {
    font-size: inherit;
  }

  .timelines {
    flex-wrap: nowrap;
    gap: 16pt;
  }

  .timelines__group {
    gap: 6pt;
  }

  .timeline__item {
    padding-bottom: 6pt;
    break-inside: avoid;
  }

  .timeline__period {
    font-size: 8pt;
  }

  .now-list,
  .contact-cards {
    flex-wrap: nowrap;
    gap: 16pt;
  }

  .now-list__item {
    gap: 2pt;
    padding-top: 4pt;
    border-top-width: 1pt;
  }

  .contact-card {
    padding: 0;
    border: 0;
  }

  .contact-card__label {
    font-size: 8pt;
  }

  .contact-card__link {
    color: var(--color-black);
    text-decoration: none;
  }

  .section {
    break-inside: avoid;
  }
}
