/* =========================================================
   A Book, an Axis — shared stylesheet

   Desktop: fluid layout that fills the viewport. Type stays at a
   fixed readable size; horizontal gaps compress; copy wraps taller;
   decorative images shrink so pages do not scroll.

   Landing is a special case: full-bleed cover image, title locked
   to the visual center, social links locked to the bottom edge.
   ========================================================= */

@font-face {
  font-family: 'UN-11 ST';
  src: url('../assets/fonts/UN_11ST_Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

:root {
  --color-bg-dark: #151311;
  --color-text-light: #CBCAC6;
  --color-text-muted: #383634;
  --color-white: #FFFFFF;

  --font-display: 'UN-11 ST', Georgia, serif;

  --page-bg: #000000;
  --page-pad-x: 52px;
  --nav-top: 21px;
  --social-bottom: 127px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--page-bg);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.page-dark {
  --page-bg: #151311;
}

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

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

p, h1, h2, h3, h4, h5, h6, blockquote {
  margin: 0;
  font-weight: 400;
  font-size: inherit;
  line-height: inherit;
}

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

/* ---------------------------------------------------------
   Stage: fills the viewport; pages lay out inside it
   --------------------------------------------------------- */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

.stage--dark {
  background: var(--color-bg-dark);
}

.stage--landing {
  background: #000000;
}

.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--page-pad-x);
}

/* ---------------------------------------------------------
   Navigation
   --------------------------------------------------------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 24px;
  padding: var(--nav-top) var(--page-pad-x) 0;
  position: relative;
  z-index: 2;
  /* 16px at 1440 — same baseline as body, so nav stays ≥ body as type scales */
  font-size: max(16px, calc(16 / 1440 * 100vw));
}

.nav--landing {
  justify-content: flex-end;
}

.nav--landing .nav__wordmark {
  display: none;
  color: var(--color-white);
}

.nav__wordmark {
  font-size: 1em;
  line-height: 1.5;
  color: var(--color-text-light);
  flex-shrink: 0;
  white-space: nowrap;
}

.nav__items {
  display: flex;
  align-items: center;
  gap: 36px;
  flex-shrink: 0;
}

.nav__link {
  font-size: 1em;
  line-height: 1.5;
  white-space: nowrap;
}

.nav__link--landing {
  color: var(--color-white);
}

.nav__link--active {
  color: var(--color-text-light);
}

.nav__link--inactive {
  color: var(--color-text-muted);
}

/* ---------------------------------------------------------
   Landing page
   --------------------------------------------------------- */
.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  z-index: 0;
  pointer-events: none;
  display: block;
  margin: 0;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.hero-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% - 25px));
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 400;
  /* 20% larger than the previous 92.43px / 6.42vw cap */
  font-size: min(110.92px, 7.7vw);
  line-height: 1.5;
  color: var(--color-white);
  white-space: nowrap;
  text-align: center;
  margin: 0;
}

.social-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--social-bottom);
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.social-row a {
  font-size: 20px;
  line-height: 30px;
  color: var(--color-white);
}

/* ---------------------------------------------------------
   About page
   Type/image/gaps: 14px / 218px at 1440, then scale with the window
   so the composition stays in Figma proportion.
   --------------------------------------------------------- */
.page--about {
  justify-content: center;
  align-items: center;
  gap: max(46px, calc(46 / 1440 * 100vw));
  font-size: max(14px, calc(14 / 1440 * 100vw));
}

.about-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  gap: max(28px, calc(28 / 1440 * 100vw));
}

.about-image {
  width: max(218px, calc(218 / 1440 * 100vw));
  height: auto;
  aspect-ratio: 218 / 170;
  object-fit: contain;
  flex-shrink: 0;
}

.quote {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1em;
  line-height: 1.5;
  text-align: center;
  color: var(--color-text-light);
  max-width: max(311px, calc(311 / 1440 * 100vw));
  flex-shrink: 0;
}

.quote p + p {
  margin-top: 0.57em;
}

.quote__attribution {
  color: var(--color-text-muted);
  line-height: 2.17;
}

.about-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: max(45px, calc(45 / 1440 * 100vw));
  width: max(1003px, calc(1003 / 1440 * 100vw));
  max-width: 100%;
  flex: 0 0 auto;
}

.about-col {
  font-size: 1em;
  line-height: 1.58;
  color: var(--color-text-light);
}

.about-col p + p {
  margin-top: 1.58em;
}

/* ---------------------------------------------------------
   Books page
   Image and type: Figma size at 1440, then scale with the window.
   --------------------------------------------------------- */
.page--books {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max(463px, calc(463 / 1440 * 100vw)) minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: max(49px, calc(49 / 1440 * 100vw));
  font-size: max(16px, calc(16 / 1440 * 100vw));
  transform: translateY(-15px);
}

.books-image {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
}

.books-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 463 / 557;
  object-fit: contain;
  display: block;
}

.books-social {
  font-size: 1em;
  line-height: 1.58;
  white-space: nowrap;
}

.books-social--left {
  justify-self: end;
}

.books-social--right {
  justify-self: start;
}

.books-social__label {
  color: var(--color-text-muted);
}

.books-social__handle {
  color: var(--color-text-light);
}

/* ---------------------------------------------------------
   Library Services + Contact (split image / copy)
   --------------------------------------------------------- */
.page--split {
  display: grid;
  grid-template-columns: 50vw minmax(0, 1fr);
  gap: 0;
  padding-left: 0;
  align-items: center;
  align-content: center;
  min-height: 0;
  transform: translateY(-15px);
}

.split-image {
  display: block;
  width: calc(50vw - var(--page-pad-x));
  height: auto;
  margin-left: var(--page-pad-x);
  justify-self: start;
}

.split-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 689 / 533;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.lib-copy-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  /* Figma: image ends at 741, copy starts at 850 → 109px gutter */
  margin-left: 109px;
  justify-self: start;
  width: max(315px, calc(315 / 1440 * 100vw));
  max-width: calc(100% - 109px);
  /* 14px at 1440; grows with the window so type stays in proportion to the image */
  font-size: max(14px, calc(14 / 1440 * 100vw));
}

.lib-copy-col > .lib-copy:first-child {
  margin-bottom: 7px;
}

.lib-copy {
  font-size: 1em;
  line-height: 1.5;
  color: var(--color-text-light);
}

.lib-items {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.lib-item {
  display: grid;
  grid-template-columns: 5em minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.lib-item-label {
  font-size: 1em;
  line-height: 1.58;
  color: var(--color-text-light);
}

.lib-item-desc {
  font-size: 1em;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.lib-copy-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contact-copy {
  display: flex;
  flex-direction: column;
  gap: 0.38em;
  /* Figma: image ends at 741, copy starts at 864 → 123px gutter */
  margin-left: 123px;
  justify-self: start;
  width: max(352px, calc(352 / 1440 * 100vw));
  max-width: calc(100% - 123px);
  /* 16px at 1440; grows with the window so type stays in proportion to the image */
  font-size: max(16px, calc(16 / 1440 * 100vw));
}

.contact-email {
  font-size: 1em;
  line-height: 1.58;
  color: var(--color-text-light);
}

.contact-message {
  font-size: 1em;
  line-height: 1.45;
  color: var(--color-text-muted);
}

/* Narrower than the 1440 Figma frame: keep type, let images shrink. */
@media (max-width: 1280px) {
  .page--books {
    grid-template-columns: minmax(0, 1fr) minmax(0, 463px) minmax(0, 1fr);
    gap: clamp(16px, 3vw, 49px);
  }

  .books-image {
    width: 100%;
    height: auto;
    max-width: 463px;
    max-height: 557px;
  }

  .books-image img {
    max-height: 557px;
  }
}

/* ===========================================================
   Mobile fallback
   Below this breakpoint, inner pages stack and may scroll.
   Landing stays a full-viewport cover composition.
   =========================================================== */
@media (max-width: 700px) {
  body:not(.page-landing) {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  body:not(.page-landing) .stage {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: 24px;
  }

  .nav {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 0;
    font-size: 16px;
  }

  .nav--landing .nav__wordmark {
    display: block;
    visibility: hidden;
  }

  .nav__items {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 24px;
  }

  .nav__items {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 24px;
  }

  .page {
    padding: 20px 24px 24px;
    flex: none;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .hero-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    width: max-content;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: left;
    font-size: 63px;
    line-height: 1.2;
  }

  .page-landing .social-row {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    gap: 32px;
  }

  .page-landing .social-row a {
    font-size: 16px;
    line-height: 1.5;
  }

  .page--about {
    gap: 49px;
    font-size: 14px;
    padding-top: 45px; /* 20px page padding + 25px under the nav */
  }

  .about-image {
    width: 218px;
    height: auto;
    max-width: 218px;
    max-height: none;
  }

  .quote {
    max-width: none;
  }

  .about-cols {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
    flex: none;
    gap: 24px;
  }

  .page--books {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    font-size: 16px;
    transform: none;
  }

  .books-image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    order: 1;
  }

  .books-social {
    justify-self: center;
  }

  .books-social--left {
    order: 2;
  }

  .books-social--right {
    order: 3;
  }

  .page--split {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
    padding-left: 24px;
    transform: none;
  }

  .page--library,
  .page--contact {
    align-items: center;
    padding: 48px 8.5vw 48px;
    gap: 24px;
  }

  .split-image {
    width: 100%;
    height: auto;
    max-height: none;
    margin-left: 0;
  }

  .lib-copy-col,
  .contact-copy {
    width: 100%;
    max-width: none;
    margin-left: 0;
    padding: 0 5vw;
  }

  .lib-copy-col {
    font-size: 14px;
    gap: 1.5em;
  }

  .lib-copy-col > .lib-copy:first-child {
    margin-bottom: 0;
  }

  .lib-items {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 2.5ch;
    row-gap: 1.5em;
  }

  .page--library .lib-item {
    display: contents;
  }

  .contact-copy {
    font-size: 16px;
  }
}
