/* ==========================================================================
   Layout: header, hero, sections, footer
   ========================================================================== */

/* Header ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(233 238 236 / 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

/* Without JavaScript the mobile menu can't collapse, so the header (with the
   menu open) scrolls away with the page instead of covering it */
html:not(.js) .site-header {
  position: static;
}

.site-header[data-scrolled] {
  border-bottom-color: var(--spray-dim);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  max-width: var(--max);
  margin-inline: auto;
  padding: 0.55rem var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--tar);
  text-decoration: none;
  transition: 0.3s ease;
}

.brand:hover {
  opacity: 30%;
  cursor: pointer;
}

/* Logo (Terminal Jarl). Height drives the size; width follows. */
.brand__logo {
  display: block;
  width: auto;
  height: 44px;
}

@media (min-width: 56rem) {
  .brand__logo {
    height: 52px;
  }
}

/* Navigation: mobile first (collapsible panel) */

/* Menu button: filled ocean blue like the other buttons, 48px touch target */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0 1rem;
  background: var(--ocean);
  color: var(--white);
  border: 0;
  border-radius: var(--radius-s);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
  background: var(--fjord);
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 1.15rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition:
    transform 0.25s var(--ease-out),
    opacity 0.2s ease;
}

.nav-toggle__bars {
  position: relative;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle__bars::before {
  top: -6px;
}
.nav-toggle__bars::after {
  top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* Very narrow phones: icon-only menu button so the logo keeps its size */
@media (max-width: 22.5rem) {
  .nav-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .nav-toggle {
    padding: 0;
  }
}

.site-nav__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Mobile dropdown: a filled ocean-blue panel with large rows */
@media (max-width: 55.99rem) {
  /* The open menu sits IN the page flow under the header bar, so it pushes
     the page down instead of covering it: the hero buttons can never end up
     under the blue panel, whatever the screen width. */
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0;
  }

  .site-nav {
    flex: 1 0 100%;
    margin: 0.55rem calc(var(--gutter) * -1) 0;
    /* never taller than the screen below the header bar */
    max-height: calc(100vh - 5rem); /* browsers without dvh */
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
    padding: 0.25rem var(--gutter) var(--space-m);
    background: var(--ocean);
    --focus: var(--ochre);
  }

  /* Stop the browser's scroll anchoring from sliding the page back under
     the menu while it is open */
  html:has(.site-nav[data-open]) {
    overflow-anchor: none;
  }

  .site-nav[data-open] {
    animation: menu-in 0.22s var(--ease-out);
  }

  /* JS adds .js to <html>; without JS the menu simply stays open */
  .js .site-nav:not([data-open]) {
    display: none;
  }

  .site-nav__list {
    display: flex;
    flex-direction: column;
  }

  .site-nav__list li:not(:last-child) {
    border-bottom: 1px solid rgb(233 238 236 / 0.14);
  }

  .site-nav__list a:not(.button) {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 0 0 1rem;
    color: var(--spray);
    font-size: var(--step-1);
    font-weight: 700;
    text-decoration: none;
  }

  /* Ochre marker for the section in view (and on press) */
  .site-nav__list a:not(.button)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 1.4em;
    border-radius: 2px;
    background: var(--ochre);
    transform: translateY(-50%) scaleY(0);
    transition: transform 0.2s var(--ease-out);
  }

  .site-nav__list a:not(.button):hover::before,
  .site-nav__list a:not(.button):active::before,
  .site-nav__list a[aria-current="true"]::before {
    transform: translateY(-50%) scaleY(1);
  }

  .site-nav__list a:not(.button):focus-visible {
    outline-offset: -3px;
  }

  /* "Ta kontakt": full width, light on the blue panel */
  .site-nav__list .button {
    width: 100%;
    min-height: 52px;
    margin-top: var(--space-s);
    background: var(--spray);
    border-color: var(--spray);
    color: var(--ocean);
    font-size: var(--step-0);
  }

  .site-nav__list .button:hover {
    background: var(--white);
    border-color: var(--white);
    color: var(--ocean);
  }
}

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

@media (min-width: 56rem) {
  .nav-toggle {
    display: none;
  }

  .site-nav,
  .js .site-nav:not([data-open]) {
    position: static;
    display: block;
    padding: 0;
    background: none;
    border: 0;
  }

  .site-nav__list {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-m);
  }

  .site-nav__list a:not(.button) {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px; /* touch tablets in landscape use this layout too */
    color: var(--tar);
    font-size: var(--step--1);
    font-weight: 700;
    text-decoration: none;
  }

  .site-nav__list a:not(.button):hover,
  .site-nav__list a[aria-current="true"] {
    color: var(--fjord);
  }

  /* An ochre "plank" slides under the active/hovered link */
  .site-nav__list a:not(.button)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 6px;
    height: 3px;
    background: var(--ochre);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease-out);
  }

  .site-nav__list a:not(.button):hover::after,
  .site-nav__list a[aria-current="true"]::after {
    transform: scaleX(1);
  }

  .site-nav__list .button {
    margin: 0 0 0 var(--space-xs);
  }
}

/* Hero -------------------------------------------------------------------
   Kept short so the next section peeks above the fold on common screens,
   which tells visitors there is more to read. */

.hero {
  padding-top: clamp(2rem, 1rem + 4vw, 4.5rem);
  overflow: hidden;
}

.hero__text {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hero__title {
  font-size: var(--step-hero);
  line-height: 0.95;
  letter-spacing: -0.045em;
  max-width: 11ch;
}

.hero__bottom {
  display: grid;
  gap: var(--space-l);
  margin-top: var(--space-m);
}

.hero__copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-m);
  align-content: start;
}

.hero__lead {
  font-size: var(--step-0);
  line-height: 1.55;
  max-width: 40ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Mobile: the ship sits under the text */
.hero__art {
  padding-top: var(--space-xs);
}

@media (min-width: 48rem) {
  .hero__title {
    max-width: 17ch; /* two lines on larger screens */
  }

  .hero__lead {
    font-size: var(--step-1);
    max-width: 34ch;
  }
}

@media (min-width: 64rem) {
  /* Desktop: copy on the left, the ship beside it */
  .hero__bottom {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: end;
    gap: var(--space-m);
  }

  .hero__art {
    padding-top: 0;
  }
}

/* Sections --------------------------------------------------------------- */

.section {
  max-width: var(--max);
  margin-inline: auto;
  padding: var(--space-xl) var(--gutter) 0;
}

.hero + .section {
  padding-top: clamp(2.5rem, 2rem + 2vw, 4rem);
}

.section__head {
  display: grid;
  gap: var(--space-s);
  margin-bottom: var(--space-l);
}

.section__head p {
  color: var(--muted);
  max-width: 48ch;
}

@media (min-width: 56rem) {
  .section__head {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: end;
    gap: var(--space-l);
  }
}

/* About ------------------------------------------------------------------ */

.about {
  display: grid;
  /* minmax(0, …) stops wide children (the terminal) from widening the page */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-l);
}

.about__text {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-s);
  align-content: start;
}

.about__text h2 {
  margin-bottom: var(--space-xs);
}

@media (min-width: 48rem) {
  .about {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: start;
    gap: var(--space-xl);
  }

  /* The text column is long with the terminal, so the photo stays in view */
  .about__portrait {
    position: sticky;
    top: 6rem;
  }
}

.profile-pic {
  border-radius: 25px;
}

/* Contact ---------------------------------------------------------------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-l);
  padding-bottom: var(--space-xl);
}

.contact__intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-s);
  align-content: start;
}

@media (min-width: 56rem) {
  .contact {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--space-xl);
  }
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
  --focus: var(--ochre);
  background: var(--ocean);
  color: var(--spray);
  font-size: var(--step--1);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-l);
  max-width: var(--max);
  margin-inline: auto;
  padding: var(--space-l) var(--gutter);
}

.site-footer a,
.site-footer .link-button {
  color: var(--spray);
}

.site-footer__logo {
  display: block;
  width: 15rem;
  height: auto;
  margin-bottom: var(--space-m);
}

.site-footer__links {
  display: grid;
  gap: 0; /* the links carry their own 44px tap height */
  align-content: start;
}

@media (min-width: 40rem) {
  .site-footer__links {
    text-align: right;
  }
}

.site-footer__copy {
  color: #b9c2bf;
}
