/* ---------------------------------------------------------------------------
   Tobias S. Groetzinger — Portfolio landing
   Three blocks anchored to the viewport — name (top), intro (below it) and
   nav + About (bottom) — adapting from 1440px down to mobile.
--------------------------------------------------------------------------- */

@font-face {
  font-family: 'Neue Montreal';
  src: url('fonts/NeueMontreal-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

:root {
  --ink:   #1f1f1f;   /* primary text   */
  --muted: #6a6a6a;   /* secondary text */

  /* Left/right inset for name, content and footer (Landing + About) */
  --rail: 156px;

  --font: 'Neue Montreal', 'Inter', sans-serif;
}

body {
  margin: 0;
  background: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  font-style: normal;
  line-height: 20px;
  letter-spacing: 0.0144em;   /* 1.44% of font-size */
  color: var(--ink);
  -webkit-font-smoothing: antialiased;

  /* Fade the page in on load */
  opacity: 0;
  animation: page-fade-in 0.8s ease forwards;
}

@keyframes page-fade-in {
  to { opacity: 1; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  body { opacity: 1; animation: none; }
}

/* Full-height canvas; children are anchored to its edges / centre. */
.frame {
  position: relative;
  min-height: 100vh;    /* fallback for older browsers */
  min-height: 100dvh;   /* matches the *visible* viewport → no empty overscroll on mobile */
}

/* --- Name / masthead (top) --------------------------------------------- */
.masthead {
  position: absolute;
  top: 20px;
  left: var(--rail);
  margin: 0;
  font-size: inherit;      /* keep body 14px, not the default h1 size */
  font-weight: 400;
  line-height: 20px;
  white-space: nowrap;
}
.name {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.name:hover { color: var(--ink); }

/* Hidden visually, still read by screen readers & search engines */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Intro (anchored below the masthead) ------------------------------- */
.intro {
  position: absolute;
  top: 80px;
  left: var(--rail);
  right: var(--rail);
  color: var(--muted);
}
.intro__text { width: 454px; max-width: 100%; }
.intro__text p { margin: 0; line-height: 20px; }
.intro__text p + p { margin-top: 8px; }
.intro__text .lead { color: var(--ink); }

/* --- About: accordion (Figma node 34:153), shares the .intro top offset - */
.acc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 454px;
  max-width: 100%;
  line-height: 20px;
}
.acc__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}
.acc__h { margin: 0; font: inherit; align-self: flex-start; }
.acc__head {
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  line-height: 20px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.acc__body {
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  color: var(--muted);
  opacity: 0;
  transition: grid-template-rows 0.4s ease, opacity 0.4s ease;
}
.acc__body.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.acc__inner {
  min-height: 0;
  overflow: hidden;
}
/* 8px above the first line (heading → text) and between paragraphs.
   Uses margin, not padding: a closed grid row can't compress border-box
   padding, so padding would leave a residual gap when collapsed. */
.acc__inner p { margin: 8px 0 0; line-height: 20px; }
.acc__inner .focus-list { margin: 8px 0 0; padding: 0; list-style: none; }
.acc__inner .focus-list li { line-height: 20px; }

/* --- Portrait (About view only) ---------------------------------------- */
.portrait {
  position: absolute;
  top: 20px;                 /* align with masthead top (20px inset) */
  left: 480px;
  width: 130px;
  height: 182px;
  object-fit: cover;
  display: block;
}
.intro--about { top: 222px; }   /* 20px below the portrait (20 + 182 height + 20 gap) */

@media (prefers-reduced-motion: reduce) {
  .acc__body { transition: none; }
}

/* --- Crossfade between Home and About content -------------------------- */
.view { transition: opacity 0.8s ease, visibility 0.8s ease; }
body[data-view="home"] .view--about,
body[data-view="about"] .view--home {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .view { transition: none; }
}

/* --- Footer: nav + About (bottom) -------------------------------------- */
.footer {
  position: absolute;
  bottom: 20px;          /* match Name top: 20px for symmetric top/bottom space */
  left: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;             /* gap nav → About (Figma gap-24) */
}

.nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 115px;
  line-height: 20px;
  color: var(--muted);
  white-space: nowrap;
}
.nav a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
.nav a:hover { color: var(--ink); }

/* --- Outbound ↗ arrow, revealed on link hover -------------------------- */
.arrow {
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav a:hover .arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}

/* --- Swap links: replace the label with a hover phrase ----------------- */
.swap { position: relative; display: inline-block; }
.swap__label,
.swap__reveal { transition: opacity 0.2s ease; }
.swap__reveal {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  opacity: 0;
}
.swap:hover .swap__label { opacity: 0; }
.swap:hover .swap__reveal { opacity: 1; }

/* Non-interactive swap (e.g. "Thoughts") — hover effect only, not clickable */
.swap--static { cursor: default; }
.swap[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .swap__label,
  .swap__reveal,
  .arrow { transition: none; }
}

.about {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

/* --- Device-specific text: edit Desktop and Mobile copy independently --- */
/* Desktop is the default; mobile-only blocks are hidden until the breakpoint. */
[data-device="mobile"] { display: none; }

/* --- Mobile layout (≤ 600px) — Figma nodes 58:2 / 59:11 ----------------- */
@media (max-width: 600px) {
  :root { --rail: 20px; }

  /* swap the text variants */
  [data-device="desktop"] { display: none; }
  [data-device="mobile"]  { display: block; }
  .nav[data-device="mobile"],
  .acc[data-device="mobile"] { display: flex; }   /* nav & accordion need flex column */

  /* mobile: text 200px from the top (desktop uses 120px), full column width */
  .intro { top: 200px; }
  .intro__text { width: 100%; }
  .acc { width: 100%; }

  /* mobile About: portrait upper-left, accordion below it */
  .portrait { top: 124px; left: 20px; }
  .intro--about { top: 343px; }

  /* footer → top-right: About/Back on top, nav below, right-aligned */
  .footer {
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
    flex-direction: column-reverse;
    align-items: flex-end;
  }
  .nav { width: auto; align-items: flex-end; }
}
