/* ---------- Fonts (Junicode) ---------- */
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-SemiCondLight.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-SemiCondLightItalic.ttf") format("truetype");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Junicode";
  src: url("../assets/font/Junicode-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: rgb(250, 255, 255);
  --ink: #1a1a1a;
  --ink-soft: rgba(26, 26, 26, 0.62);
  --gutter: clamp(1.1rem, 4vw, 2.75rem);
  --lightbox-gutter: clamp(0.6rem, 1.6vw, 1.4rem);
  --chrome-gutter: clamp(0.7rem, 2.2vw, 1.4rem);
  --text-size: 0.95rem;
  --img-pad-v: clamp(3vh, 5vh, 7vh);
  /* each row is shorter than the viewport on purpose: a sliver of the next
     (or previous) image is always visible, never a scroll position showing
     exactly one image and nothing else */
  --row-h: 93vh;
  /* normal = the site's own "↓" glyph (from "about (↓)"), same size and shape;
     move/link are the pack's cross/X cropped + rescaled to that same 16px
     scale, so all three read as one consistent, small cursor language */
  --cursor-normal: url("../assets/classicblueb/normal-arrow.png") 3 15, auto;
  --cursor-move: url("../assets/classicblueb/move-small.png") 5 5, move;
  --cursor-link: url("../assets/classicblueb/link-x-small.png") 8 8, pointer;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

/* scroll lock that preserves the exact scroll position (js/main.js sets
   body's top offset and restores scrollTo on unlock) — a plain
   overflow:hidden here would reset scrollTop to 0 on some browsers */
html.lock-scroll {
  overflow: hidden;
}
html.lock-scroll body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

body {
  font-family: "Junicode", serif;
  font-weight: 300;
  font-size: var(--text-size);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  cursor: var(--cursor-normal);
}

a {
  color: inherit;
  cursor: var(--cursor-link);
}

/* ---------- Fixed chrome (identical in gallery + lightbox) ---------- */
.chrome-left {
  position: fixed;
  top: var(--chrome-gutter);
  left: var(--chrome-gutter);
  z-index: 950;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 3em;
}

.corner-btn,
.hero-mark,
.lightbox-close {
  font-family: "Junicode", serif;
  font-weight: 400;
  font-size: var(--text-size);
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
}

.corner-btn,
.hero-mark,
.lightbox-close {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--ink);
  cursor: var(--cursor-link);
}

.lightbox-close:hover { opacity: 0.6; }

.hero-mark {
  line-height: 1.3;
}

/* the about (↓) button has no purpose while the lightbox is open — its own
   close button (top-right) takes over */
body.lightbox-active .corner-btn { display: none; }

.lightbox-close {
  position: fixed;
  top: var(--chrome-gutter);
  right: var(--chrome-gutter);
  z-index: 960;
}

/* ---------- Gallery ---------- */
#gallery {
  position: relative;
}

.artwork {
  position: relative;
  width: 100%;
  height: var(--row-h);
  padding: 0 var(--gutter);
}

.artwork .frame {
  position: absolute;
  top: var(--img-pad-v);
  display: block;
  height: calc(var(--row-h) - 2 * var(--img-pad-v));
  width: fit-content;
  cursor: var(--cursor-move);
  touch-action: none; /* dragging owns touch gestures on the image itself */
}

.artwork .frame:active { cursor: var(--cursor-link); }

.artwork .frame img {
  display: block;
  height: 100%;
  width: auto;
}

.artwork .caption {
  position: absolute;
  top: 0;
  width: 15rem;
  max-width: 46vw;
  font-size: var(--text-size);
  line-height: 1.55;
  color: var(--ink-soft);
  opacity: 0;
  pointer-events: none;
}

.artwork.caption-right .caption {
  left: 100%;
  margin-left: clamp(1rem, 3vw, 2.5rem);
}

.artwork.caption-left .caption {
  right: 100%;
  margin-right: clamp(1rem, 3vw, 2.5rem);
  text-align: right;
}

/* the image fills (or nearly fills) the row — no room beside it, so the
   caption sits over its top-left corner instead, on a translucent scrim
   so it stays legible over any artwork */
.artwork.caption-overlay .caption {
  top: 1rem;
  left: 1rem;
  right: auto;
  margin: 0;
  width: auto;
  max-width: min(70%, 20rem);
  text-align: left;
  background: rgba(250, 255, 255, 0.85);
  padding: 0.6em 0.85em;
}

.artwork .frame:hover .caption,
.artwork .frame:focus-visible .caption {
  opacity: 1;
}

.cap-title { color: var(--ink); font-weight: 600; font-style: normal; }
.cap-line { display: block; }

@media (max-width: 720px) {
  .artwork {
    height: auto;
    display: block;
    padding: 2rem var(--gutter);
  }
  .artwork .frame {
    position: static;
    height: auto;
    width: 100%;
    touch-action: auto;
  }
  .artwork .frame img { height: auto; width: 100%; }
  .artwork .caption {
    position: static;
    opacity: 1;
    width: auto;
    max-width: none;
    margin-top: 0.6rem;
    pointer-events: auto;
  }
  .artwork.caption-right .caption,
  .artwork.caption-left .caption { margin-left: 0; margin-right: 0; }
  .artwork.caption-overlay .caption {
    background: none;
    padding: 0;
    max-width: none;
  }
}

@media (hover: none) and (min-width: 721px) {
  .artwork .caption { opacity: 1; pointer-events: auto; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 900;
  visibility: hidden;
  pointer-events: none;
}

.lightbox.open {
  visibility: visible;
  pointer-events: auto;
}

#lightbox-img {
  position: absolute;
  left: var(--lightbox-gutter);
  top: var(--lightbox-gutter);
  height: calc(100vh - 2 * var(--lightbox-gutter));
  width: auto;
  max-width: calc(100vw - 2 * var(--lightbox-gutter));
  object-fit: contain;
  object-position: left center;
}

#lightbox-caption {
  position: absolute;
  right: var(--lightbox-gutter);
  bottom: var(--lightbox-gutter);
  max-width: min(22rem, 40vw);
  text-align: right;
  font-size: var(--text-size);
  line-height: 1.6;
  color: var(--ink-soft);
}


@media (max-width: 720px) {
  .lightbox {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #lightbox-img {
    position: static;
    height: auto;
    width: auto;
    max-width: calc(100vw - 2 * var(--lightbox-gutter));
    max-height: 72vh;
    object-position: center center;
  }
  #lightbox-caption {
    left: var(--lightbox-gutter);
    right: var(--lightbox-gutter);
    max-width: none;
    text-align: left;
    bottom: var(--lightbox-gutter);
  }
}

/* ---------- About ---------- */
#about {
  /* top padding matches --img-pad-v so the gap above the bio image equals
     the gap between any two gallery images (each row already ends with
     its own --img-pad-v of bottom space) — keeps the section seamless */
  padding: var(--img-pad-v) var(--gutter) clamp(2rem, 6vh, 4rem);
}

.about-inner {
  max-width: 78rem;
  margin: 0 auto;
}

.about-portrait-wrap {
  position: relative;
  width: clamp(360px, 48vw, 720px);
  /* the image is absolutely positioned (draggable) below, so this reserves
     the matching height in normal flow via its own aspect ratio */
  aspect-ratio: 2048 / 1536;
  /* the text beside it is absolutely positioned and can run on past the
     image's own bottom edge; js/main.js measures and sets the exact
     buffer needed so the footer never overlaps it */
  margin-bottom: 3rem;
}

.about-portrait {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: clamp(360px, 48vw, 720px);
  height: auto;
  touch-action: none;
  cursor: var(--cursor-move);
}

.about-portrait:active { cursor: var(--cursor-link); }

.about-text {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: clamp(1.5rem, 4vw, 3.5rem);
  width: clamp(14rem, 32vw, 26rem);
  font-size: var(--text-size);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.7;
  touch-action: none;
}

.about-text p { margin: 0 0 1.1em; }

.about-links a,
.about-downloads a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.about-links span { margin: 0 0.6em; color: var(--ink-soft); }

.about-downloads a { margin-right: 2em; }

@media (max-width: 720px) {
  .about-portrait-wrap { width: min(80vw, 420px); aspect-ratio: auto; margin-bottom: 0; }
  .about-portrait { position: static; width: 100%; touch-action: auto; }
  .about-text {
    position: static;
    width: auto;
    margin-left: 0;
    margin-top: 1.25rem;
    touch-action: auto;
  }
}

/* ---------- Footer ---------- */
#site-footer {
  padding: clamp(1.5rem, 4vh, 2.5rem) var(--gutter);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-align: right;
}

#site-footer a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  color: var(--ink-soft);
}
