/* =============================================================
   Baldur.design — homepage styles
   Sections: reset · base · layout · header · hero · work
             · about · footer · buttons · animation
   ============================================================= */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

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

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

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Base ---------- */
body {
  font-family: var(--font-family);
  font-weight: var(--weight-regular);
  font-size: var(--fs-paragraph);
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Visually hidden but available to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 16px;
  top: -120px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius-standard);
  font-weight: var(--weight-semibold);
  transition: top 0.2s ease;
}

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

/* ---------- Header ---------- */
/* Full-bleed sticky bar; its contents are constrained to the shared container
   so the logo / nav line up with the main content edges. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-block: var(--margin-topbottom);
  background-color: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.4s ease;
  will-change: transform, opacity;
}

/* Kicked out once the hero heading scrolls past the header's bottom edge
   (and the user is scrolling down) — driven by JS, gated to motion-allowed. */
.site-header[data-hidden="true"] {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--margin-side);
}

.site-header__logo {
  display: inline-flex;
  align-items: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.site-header__logo:hover {
  transform: translateY(-2px);
}

.site-header__logo img {
  width: 44px;
  height: auto;
}

/* Nav pill */
.nav__list {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background-color: var(--surface);
  border-radius: var(--radius-standard);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

/* Sliding highlight behind the active link (positioned in JS). */
.nav__indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  background-color: var(--nav-active-bg);
  border-radius: var(--radius-standard);
  z-index: 0;
  pointer-events: none;
}

/* Transition only enabled after the first position is set, so it never
   slides in from the corner on load. */
.nav__list--animate .nav__indicator {
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    height 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.nav__link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: var(--fs-nav);
  font-weight: var(--weight-medium);
  color: var(--text);
  border-radius: var(--radius-standard);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Subtle hover on inactive links — lighter than the solid moving indicator. */
.nav__link:not([aria-current="true"]):hover {
  background-color: color-mix(in srgb, var(--nav-active-bg) 50%, transparent);
}

/* ---------- Main layout ---------- */
.main {
  display: flex;
  flex-direction: column;
  gap: var(--gap-l);
  padding: clamp(48px, 6vw, 80px) var(--margin-side) clamp(64px, 8vw, 120px);
  max-width: var(--content-max);
  margin-inline: auto;
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--heading);
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1048px;
}

.hero__heading {
  font-size: var(--fs-h1);
  font-weight: var(--weight-semibold);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--heading);
  text-wrap: balance;
}

.hero__statement {
  font-size: var(--fs-paragraph-large);
  line-height: 1.4;
  color: var(--text);
  text-wrap: pretty;
}

/* ---------- Work / case studies ---------- */
/* 2 × 2 grid of case cards: 20px column gutter, 80px between rows. */
.work__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 20px;
  row-gap: var(--gap-s); /* 80px */
}

/* Each card is a single link: thumbnail above, title + description below. */
.case {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xxs); /* 24px thumbnail → text */
}

.case__media {
  position: relative;
  aspect-ratio: 650 / 556;
  overflow: hidden;
  background-color: var(--thumbnail-bg);
  border-radius: var(--radius-media);
}

/* Subtle scrim that darkens the thumbnail on hover/focus. */
.case__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #000;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.case:hover .case__media::after,
.case:focus-visible .case__media::after {
  opacity: 0.08;
}

/* Thumbnails are pre-composed to the 650×556 card frame, so they
   simply fill the container; the card colour shows through any
   transparent areas around the device. */
.case__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.case:hover .case__media img,
.case:focus-visible .case__media img {
  transform: scale(1.035);
}

.case__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.case__title {
  font-size: var(--fs-h3);
  font-weight: var(--weight-semibold);
  line-height: 1.1;
  color: var(--heading);
}

.case__desc {
  font-size: var(--fs-paragraph);
  line-height: 1.5;
  color: var(--text);
  text-wrap: pretty;
}

/* ---------- About ---------- */
.about {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

/* Heading sits full-width on top (see .about gap); below it the photo and
   body text share a row, top-aligned. The photo stretches to the full
   height of the body text. */
.about__content {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--grid-gutter);
  align-items: stretch;
}

.about__photo {
  grid-column: 1 / 4; /* columns 1–3 (≈314px); col 4 + gutters form the gap */
  align-self: stretch; /* matches the body-text height */
  overflow: hidden;
  background-color: var(--thumbnail-bg);
  border-radius: var(--radius-media);
}

.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.about__text {
  grid-column: 5 / -1; /* columns 5–12, leaving col 4 + gutters as the gap */
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  align-items: flex-start;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  font-size: var(--fs-paragraph);
  line-height: 1.5;
}

.prose strong {
  font-weight: var(--weight-semibold);
}

/* ---------- Footer ---------- */
/* Basic sign-off: monogram on the left, contact links on the right.
   Contents align to the shared content container. */
.site-footer {
  padding-block: clamp(40px, 5vw, 64px);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--margin-side);
}

.site-footer__logo {
  display: inline-flex;
  align-items: center;
  transition: transform 0.25s ease;
}

.site-footer__logo:hover {
  transform: translateY(-2px);
}

.site-footer__logo img {
  width: 42px;
  height: auto;
}

.site-footer__links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.site-footer__link {
  font-size: var(--fs-footer);
  font-weight: var(--weight-medium);
  color: var(--text);
  transition: color 0.2s ease;
}

.site-footer__link:hover {
  color: var(--color-accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  font-size: 1.25rem; /* 20px — matches the Button Primary text style */
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  border-radius: var(--radius-standard);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-accent-strong);
}

.btn__icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  color: currentColor;
  transition: transform 0.2s ease;
}

.btn__icon svg {
  width: 100%;
  height: 100%;
}

.btn:hover .btn__icon--arrow {
  transform: translateX(4px);
}

/* ---------- Scroll-reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
/* Stacked mobile layout — mirrors the Home - Mobile Figma frame (390px). */
@media (max-width: 760px) {
  :root {
    --margin-side: clamp(16px, 4vw, 32px); /* 16px at 390px */
    --margin-topbottom: 16px;              /* header padding */
  }

  /* Section rhythm: 56px between the major blocks, 32px page padding */
  .main {
    gap: 56px;
    padding-block: 32px;
  }

  .hero {
    gap: 16px;
  }

  /* Cards collapse to a single column; thumbnail → text gap is 24px */
  .work__grid {
    grid-template-columns: 1fr;
    row-gap: 56px;
  }

  .case {
    gap: var(--gap-xxs); /* 24px thumbnail → text */
  }

  .case__text {
    gap: 8px; /* title → description */
  }

  /* Primary buttons fill the width once the layout is single-column */
  .btn {
    width: 100%;
  }

  /* About: heading, photo, prose and button stack;
     the portrait spans the full content width with a fixed aspect ratio. */
  .about {
    gap: 24px; /* heading → photo */
  }

  .about__content {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .about__photo {
    grid-column: auto;
    align-self: stretch;
    aspect-ratio: 361 / 427;
  }

  .about__text {
    grid-column: auto;
    gap: 48px;
    align-items: stretch;
  }

  /* Footer: monogram stacks above the contact links */
  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  /* Contact links stack too — email below LinkedIn */
  .site-footer__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 460px) {
  .nav__list {
    gap: 4px;
    padding: 6px;
  }

  .nav__link {
    padding: 6px 10px;
  }
}

/* Honour reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
