/* ===== Readymag-style pixel-perfect replica ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; width: 100%; }
html, body { height: 100%; }

body.rm-body {
  font-family: "Times New Roman", Times, serif;
  color: #e8e3da;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  margin: 0;
  position: relative;
  min-height: 100vh;
}

/* Full-viewport background mirror — matches .rm-bg but extends edge-to-edge */
.rm-body-bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.8; }

/* The page is a fixed 1024-wide design canvas.
   scale.js applies transform: scale() at runtime to fit mobile viewports. */
.rm-page {
  position: relative;
  width: 1024px;
  /* transform + marginLeft set via JS; default to no scale (full width) */
}

/* Background - fills full page behind all content */
.rm-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}

/* Stage: relative so absolutely-positioned widgets anchor to it */
.rm-stage {
  position: relative;
  width: 1024px;
  z-index: 1;
}

.rm-w { box-sizing: border-box; }

.rm-picture { overflow: hidden; display: block; }
.rm-picture img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.rm-picture-link { cursor: pointer; }
.rm-picture-link:hover img { transform: scale(1.02); }

.rm-text { line-height: 1; }
.rm-text h2 { font-weight: 400; margin: 0; }
/* Readymag authors often use multiple spaces to create visual gaps in credits etc.
   Preserve that whitespace (but still wrap when the line fills). */
.rm-text h2, .rm-text span { white-space: pre-wrap; }

/* Readymag link styles */
.link-style-3e131d54-29fc-40dd-9549-e23f070e419a,
.link-style-3e131d54-29fc-40dd-9549-e23f070e419a span {
  text-decoration: none;
  padding-bottom: 1px;
  color: rgba(255, 255, 255, 1);
  background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 100%) 0 100% / 100% 1px no-repeat;
}
.link-style-3e131d54-29fc-40dd-9549-e23f070e419a:hover,
.link-style-3e131d54-29fc-40dd-9549-e23f070e419a:hover span {
  color: rgba(0, 0, 0, 0.8);
  background: linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 100%) 0 100% / 100% 1px no-repeat;
}

.link-style-0617f86b-734f-47af-8e53-de4bdcc06031,
.link-style-0617f86b-734f-47af-8e53-de4bdcc06031 span {
  text-decoration: none;
  color: rgba(255, 255, 255, 1);
}
.link-style-0617f86b-734f-47af-8e53-de4bdcc06031:hover,
.link-style-0617f86b-734f-47af-8e53-de4bdcc06031:hover span {
  color: rgba(255, 255, 255, 0.8);
}

/* Readymag's inline text-style class reset */
.unstyled {
  font-size: 18px;
  line-height: 26px;
  font-family: Inter, "Times New Roman", serif;
  font-weight: 400;
  font-style: normal;
}
.align-center { text-align: center !important; }
.align-left { text-align: left !important; }
.align-right { text-align: right !important; }

/* =====================================================================
   MOBILE (<= 768px): abandon the absolute-positioned 1024 canvas and
   stack widgets vertically in their original top-to-bottom order.
   Images go full-width at their intended aspect ratio; text scales up.
   ===================================================================== */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }

  .rm-page {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 70px 20px 40px;
    min-height: 100vh;
  }

  .rm-stage {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
  }

  /* Reset every widget to flow layout, ordered by its design-space top value. */
  .rm-w {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    order: var(--o, 0);
    filter: none !important;  /* drop-shadows look bad on scaled images */
  }

  /* Images fill the width at their intended aspect ratio. */
  .rm-picture {
    aspect-ratio: var(--ar, 3/4);
    height: auto !important;
    overflow: hidden;
  }
  .rm-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Text: readable size, center-aligned by default. */
  .rm-text {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    padding: 4px 0;
  }
  .rm-text h2 {
    font-size: 14px !important;
    line-height: 1.45 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .rm-text span { font-size: 14px !important; }

  /* Nav (Home / Work / About) pinned to top in a row. */
  .rm-text[data-kind="nav"] {
    position: fixed !important;
    top: 16px !important;
    width: auto !important;
    z-index: 100;
    padding: 0;
    order: unset;
    pointer-events: auto;
    background: transparent;
  }
  /* Home link → left edge */
  .rm-text[data-kind="nav"]:has(a[href$="index.html"]),
  .rm-text[data-kind="nav"]:has(a[href="../index.html"]) {
    left: 24px !important;
  }
  /* Work link → center */
  .rm-text[data-kind="nav"]:has(a[href$="work.html"]) {
    left: 50% !important;
    transform: translateX(-50%);
  }
  /* About link → right edge */
  .rm-text[data-kind="nav"]:has(a[href$="about.html"]) {
    right: 24px !important;
    left: auto !important;
  }

  /* Hide desktop prev/next arrows on mobile — rely on bottom links instead */
  .rm-text[data-kind="arrow"] { display: none !important; }

  /* Home page tweaks: center Maria Judas text block */
  .rm-page[data-page="1-home"] {
    padding: 70px 24px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .rm-page[data-page="1-home"] .rm-text {
    font-size: 16px;
    line-height: 1.6;
  }

  /* About page: collage and text stack */
  .rm-page[data-page="2-about"] {
    padding: 80px 24px 40px;
  }
}
