/* =========================================================================
   merani.cc — site styles
   One set of tokens; desktop = bento boxes with inner scroll,
   mobile (< 820px) = one continuous page scroll, no nested scrolling.
   ========================================================================= */

@font-face { font-family: "SuisseIntl"; src: url("fonts/SuisseIntl-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "SuisseIntl"; src: url("fonts/SuisseIntl-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "SuisseIntl"; src: url("fonts/SuisseIntl-Medium.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Ostberga"; src: url("fonts/Ostberga-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Icons"; src: url("fonts/icons.woff2") format("woff2"); font-display: block; }

:root {
  --ink: #000;
  --paper: #fff;
  --muted: #7a7a7a;
  --line: 2px;
  --gap: 10px;
  --pad: clamp(18px, 1.7vw, 28px);
  --r-box: clamp(28px, 3vw, 48px);
  --r-media: clamp(22px, 2.2vw, 36px);
  --sans: "SuisseIntl", "Helvetica Neue", Arial, sans-serif;
  --display: "Ostberga", "Arial Black", sans-serif;
  --fs-body: clamp(16px, 0.55vw + 10px, 20px);
  --fs-title: clamp(30px, 2.8vw, 54px);
  --fs-project: clamp(40px, 5.6vw, 108px);
  --fs-ex: clamp(22px, 1.9vw, 36px);
  --fs-small: 0.8em;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.box-dark :focus-visible { outline-color: var(--paper); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { font-family: "Icons"; font-style: normal; font-weight: normal; line-height: 1; speak: never; }
.accent { font-family: var(--display); }

/* ---------- boxes ---------- */

.bento { padding: var(--gap); gap: var(--gap); }

.box {
  position: relative;
  min-height: 0;
  background: var(--paper);
  border: var(--line) solid var(--ink);
  border-radius: var(--r-box);
  overflow: hidden;
}
.box-dark { background: var(--ink); color: var(--paper); }

.box-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 var(--pad) calc(var(--pad) * 2);
}
.box-scroll::-webkit-scrollbar { display: none; }

/* soft fade at the bottom edge of scrolling boxes */
.box::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 48px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--paper));
  pointer-events: none;
}
.box-dark::after { background: linear-gradient(to bottom, rgb(0 0 0 / 0), var(--ink)); }

.box-title {
  font-family: var(--display);
  font-size: var(--fs-title);
  line-height: 1;
  text-align: center;
  padding: 0.55em 0 0.75em;
  text-wrap: balance;
}
.page-home .box-title, .box-text .box-title { text-transform: uppercase; }

/* ---------- pills ---------- */

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block;
  font-size: var(--fs-small);
  line-height: 1.4;
  padding: 0.12em 1.1em;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--paper);
  white-space: nowrap;
}
.pills-light .pill, .box-dark .pill { background: transparent; }

.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 44px; min-width: 44px;
  padding: 0 14px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 500;
  font-size: 16px;
  line-height: 1;
}
.pill-btn .icon { font-size: 18px; }
.pill-btn:hover { background: var(--ink); color: var(--paper); }

/* ---------- prose ---------- */

.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.prose strong { font-weight: 500; }
.bio a { font-family: var(--display); text-decoration: none; }
.bio a:hover { text-decoration: underline; }

/* ---------- top bar (mobile, and legal page) ---------- */

.topbar {
  display: none;
  position: sticky; top: 0; z-index: 10;
  align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--gap) 8px;
  background: rgb(255 255 255 / 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.seg {
  display: flex; flex: 1; min-width: 0;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: 3px;
  background: var(--paper);
}
.seg-item {
  flex: 1; text-align: center;
  padding: 8px 6px;
  border-radius: 999px;
  font-size: 15px; font-weight: 500; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color .2s, color .2s;
}
.seg-item.is-active { background: var(--ink); color: var(--paper); }
.pill-back .icon { font-size: 13px; }

/* =========================================================================
   HOME
   ========================================================================= */

.bento-home {
  display: grid;
  height: 100vh; height: 100dvh;
  grid-template-columns: 104px minmax(0, 1fr) minmax(0, 39%);
  grid-template-rows: minmax(0, 2.15fr) minmax(0, 1fr);
  grid-template-areas:
    "projects projects ex"
    "links    about    ex";
}
.box-projects { grid-area: projects; background-position: center; background-size: cover; }
.box-exhibitions { grid-area: ex; }
.box-about { grid-area: about; }
.box-links { grid-area: links; }

/* project list */
.project a {
  display: block;
  padding-bottom: clamp(20px, 2.2vw, 36px);
}
.project-name {
  display: block;
  font-size: var(--fs-project);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin-bottom: 0.18em;
  overflow-wrap: anywhere;
}
.project-thumb { display: none; }
.project a:hover .project-name { text-decoration: underline; text-decoration-thickness: 0.05em; text-underline-offset: 0.1em; }
.box-projects.has-cover::after { display: none; }

/* exhibitions */
.ex { padding-bottom: clamp(24px, 2.4vw, 40px); }
.ex .pills { margin-bottom: 10px; }
.ex h3 { font-size: var(--fs-ex); line-height: 1.12; margin-bottom: 6px; text-wrap: pretty; }
.ex-venue { margin: 0 0 18px; font-size: var(--fs-small); }
.ex-venue a { text-decoration: underline; text-underline-offset: 0.18em; }
.ex-media { display: grid; gap: 14px; }
.ex-media img { width: 100%; border-radius: var(--r-media); }
.ex-media figcaption { font-size: 12px; color: #b5b5b5; margin-top: 6px; padding-left: 0.6em; }
.show-all { display: none; }

/* links column: 2 × 3 tall pills, as in the original */
.box-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
}
.box-links .pill-btn { min-height: 0; padding: 0; height: 100%; }
.box-links .pill-wide { grid-column: span 2; font-size: 13px; padding: 0 6px; }
.about-links { display: none; }

/* about */
.box-about .box-scroll { padding-top: var(--pad); }
.friends { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2em 0 0; }
.friends a {
  display: inline-block; font-weight: 500; font-size: 15px;
  padding: 6px 14px; border: var(--line) solid var(--ink); border-radius: 999px;
}
.friends a:hover { background: var(--ink); color: var(--paper); }
.copyright { margin: 1.6em 0 0; text-align: center; font-size: 12px; font-weight: 300; color: var(--muted); }

/* =========================================================================
   PROJECT + ARCHIVE PAGES
   ========================================================================= */

.bento-project {
  display: grid;
  height: 100vh; height: 100dvh;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 39%);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "head  head  text"
    "media media text"
    "links pager text";
}
.box-head { grid-area: head; border-bottom: 0; border-radius: var(--r-box) var(--r-box) 0 0; }
.box-head::after { display: none; }
.box-head .box-title { padding-bottom: 0.4em; }
.head-pills { display: none; }
.box-media {
  grid-area: media;
  margin-top: calc(var(--gap) * -1);
  border-top: 0;
  border-radius: 0 0 var(--r-box) var(--r-box);
}
.box-text { grid-area: text; }
.bento-project .box-links { grid-area: links; grid-template-columns: 1fr; }
.pager { grid-area: pager; }

.media { margin-bottom: 18px; }
.media img, .media video { width: 100%; border-radius: var(--r-media); }
.media figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; padding-left: 0.8em; }
.media.embed { aspect-ratio: 16 / 9; border-radius: var(--r-media); overflow: hidden; background: #111; }
.media.embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.box-text .prose { padding-bottom: 1em; }
.read-toggle { display: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.pager-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: clamp(14px, 1.6vw, 26px) 16px;
  border: var(--line) solid var(--ink);
  border-radius: var(--r-box);
  text-align: center;
}
.pager-title {
  font-family: var(--display);
  font-size: clamp(22px, 2.5vw, 46px);
  line-height: 1;
  text-transform: uppercase;
  color: var(--paper);
  -webkit-text-stroke: 1px var(--ink);
  paint-order: stroke fill;
  overflow-wrap: anywhere;
}
.pager-label { font-size: 14px; font-weight: 500; }
.pager-link:hover { background: var(--ink); }
.pager-link:hover .pager-title { color: var(--ink); -webkit-text-stroke-color: var(--paper); }
.pager-link:hover .pager-label { color: var(--paper); }

/* archive page */
.page-archive .bento-project {
  grid-template-rows: auto minmax(0, 1fr) 64px;
  grid-template-areas:
    "head  head  text"
    "media media text"
    "links links text";
}
.page-archive .bento-project .box-links { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.archive-text { margin-top: 8px; }
.archive-list li { padding-bottom: 28px; }
.archive-name {
  display: block;
  font-size: clamp(30px, 3.6vw, 68px);
  line-height: 1;
  font-weight: 400;
  margin-bottom: 10px;
}
.archive-list .is-current .archive-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }
.archive-list a:hover .archive-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }

/* legal page */
.page-legal .topbar { display: flex; max-width: 900px; margin: 0 auto; }
.legal-wrap { max-width: 900px; margin: 0 auto; padding: 0 var(--gap) var(--gap); }
.box-legal { height: calc(100dvh - 72px); }
.box-legal .prose { max-width: 68ch; margin: 0 auto; font-size: 0.9em; }

/* =========================================================================
   MOBILE — one continuous page, no scroll-inside-a-box
   ========================================================================= */

@media (max-width: 819px) {
  :root {
    --gap: 8px;
    --pad: 18px;
    --r-box: 28px;
    --r-media: 22px;
    --fs-body: 17px;
    --fs-title: 30px;
    --fs-project: 27px;
    --fs-ex: 23px;
  }
  .topbar { display: flex; }

  .bento-home, .bento-project {
    display: flex; flex-direction: column;
    height: auto;
    padding-top: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--gap));
  }
  .box { overflow: visible; }
  .box::after { display: none; }
  .box-scroll { height: auto; overflow: visible; padding-bottom: var(--pad); }
  .box-title { padding: 0.6em 0 0.6em; }
  section[id] { scroll-margin-top: 72px; }

  /* home */
  .box-links { display: none; }
  .about-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.4em; }
  .box-projects { background-image: none !important; }

  .project a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    grid-template-areas: "name thumb" "pills thumb";
    align-items: center;
    column-gap: 14px;
    row-gap: 8px;
    padding: 10px 0;
  }
  .project + .project a { border-top: 1px solid rgb(0 0 0 / 0.12); }
  .project-name { grid-area: name; margin: 0; align-self: end; line-height: 1.05; }
  .project .pills { grid-area: pills; align-self: start; gap: 6px; }
  .project .pill { font-size: 13px; padding: 0.1em 0.9em; }
  .project-thumb {
    grid-area: thumb; display: block;
    width: 84px; height: 84px;
    border-radius: 20px; overflow: hidden; background: #eee;
  }
  .project-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .project a:hover .project-name { text-decoration: none; }
  .project a:active { opacity: 0.6; }

  .ex .pill { font-size: 13px; }
  .ex-venue { font-size: 15px; }
  .ex-media.is-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    gap: 8px;
    margin: 0 calc(var(--pad) * -1);
    padding: 0 var(--pad);
    scroll-padding: 0 var(--pad);
  }
  .ex-media.is-strip::-webkit-scrollbar { display: none; }
  .ex-media.is-strip figure { flex: 0 0 84%; scroll-snap-align: start; }
  .ex-media img { aspect-ratio: 4 / 3; object-fit: cover; }
  .ex-list.is-collapsed .ex:nth-child(n+9) { display: none; }
  .show-all {
    display: flex; width: 100%; margin-top: 4px;
    background: transparent; color: var(--paper); border-color: var(--paper);
    font-family: inherit; cursor: pointer;
  }
  .show-all[hidden] { display: none; }

  .bio { font-size: 16px; line-height: 1.55; }

  /* project page */
  .page-project .box-links.side { display: none; }
  .box-head { border-bottom: var(--line) solid var(--ink); border-radius: var(--r-box); padding: 0 var(--pad) var(--pad); order: 1; }
  .box-head .box-title { padding-bottom: 0.45em; }
  .box-head .year { display: none; }
  .head-pills { display: flex; justify-content: center; }
  .box-text { order: 2; }
  .box-text .box-title { display: none; }
  .box-text .box-scroll { padding-top: var(--pad); }
  .box-media { order: 3; margin-top: 0; border: 0; border-radius: 0; background: none; }
  .box-media .box-scroll { padding: 0; }
  .media { margin-bottom: var(--gap); }
  .media figcaption { padding: 0 var(--pad); }
  .pager { order: 4; }
  .pager-link { padding: 18px 10px; }
  .pager-title { font-size: 21px; }
  .pager-label { font-size: 13px; }

  .prose.clamp.is-collapsed {
    max-height: 9.5em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
    padding-bottom: 0;
  }
  .read-toggle {
    display: inline-flex; margin-top: 12px;
    background: transparent; color: var(--paper); border-color: var(--paper);
    font-family: inherit; cursor: pointer;
  }

  /* archive page */
  .page-archive .box-media { order: 2; }
  .page-archive .archive-text { padding: var(--pad); border: var(--line) solid var(--ink); border-radius: var(--r-box); }
  .page-archive .box-text { order: 3; }
  .page-archive .box-text .box-title { display: block; }
  .page-archive .box-text .box-scroll { padding-top: 0; }
  .archive-name { font-size: 30px; }

  /* legal */
  .box-legal { height: auto; }
}

@media (hover: hover) and (min-width: 820px) {
  .box-projects.has-cover .pill { background: var(--paper); }
}

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