/* ==============================================
   FRONTIER TRAILS — journal.css
   The Journal as one stream, like a travel journal spread out on a dark
   desk: taped prints, loose photos, strips of 35 mm film, typed field
   notes, a few marks in the margins. Laid out compactly in columns so a
   lot is in view at once and invites a click. Plus the full-screen viewer
   and the field note page. Loaded after style.css and pages.css.
   ============================================== */

/* ── The desk: three columns of pieces, placed by hand so they come out
   even; film strips run across the whole desk ── */
.j-stream { max-width: 1280px; margin: 0 auto; padding: 1.4rem 0 2rem; }
.j-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.8rem, 3.4vw, 3rem);
  align-items: start;
}
.j-col { display: flex; flex-direction: column; gap: clamp(2.4rem, 4vw, 3.4rem); }
.j-span { margin: clamp(2.6rem, 4.4vw, 3.6rem) 0; }
.j-span-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.8rem, 3.4vw, 3rem); }
/* One strip: its lines sit beside it when there's room. */
.j-span-one .j-strip { display: flex; align-items: center; gap: clamp(1.5rem, 3vw, 3rem); }
.j-span-one .film { flex: 0 1 auto; min-width: 0; }
.j-span-one .j-strip .j-cap { flex: 1 1 260px; margin: 0; }

/* ── A print, taped in ── */
.j-photo {
  position: relative;
  display: block;
  width: 100%;
  padding: 10px 10px 12px;
  background: #efe9dc;
  border: 0;
  cursor: pointer;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.62), 0 2px 4px rgba(0, 0, 0, 0.4);
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
html.has-custom-cursor .j-photo,
html.has-custom-cursor .j-polaroid,
html.has-custom-cursor .j-gate-view { cursor: none; }
.j-photo:hover,
.j-photo:focus-visible { transform: rotate(0deg) scale(1.025); box-shadow: 0 30px 56px rgba(0, 0, 0, 0.7); z-index: 3; }
.j-photo img { display: block; width: 100%; height: auto; }
.j-print .j-photo { width: 88%; margin: 0 auto; }

/* A strip of paper tape, slightly torn at the ends. */
.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 84px;
  height: 24px;
  transform: translateX(-50%) rotate(-4deg);
  background: rgba(240, 230, 200, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  clip-path: polygon(3% 8%, 12% 0, 30% 6%, 52% 0, 75% 5%, 96% 0, 100% 40%, 97% 92%, 80% 100%, 58% 94%, 35% 100%, 14% 95%, 0 100%, 2% 55%);
  z-index: 2;
}

/* The lines under each piece: where, when, the title, one line. */
.j-cap { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1.1rem; }
.j-meta {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.j-title { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(1.35rem, 1.9vw, 1.7rem); line-height: 1.12; }
.j-title a:hover { color: var(--accent); }
.j-excerpt {
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── In the gate: the camera's viewfinder around a frame ── */
.j-gate-view {
  position: relative;
  display: block;
  width: 100%;
  padding: 30px 18px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  background: transparent;
  cursor: pointer;
}
.j-gate-view img { display: block; width: 100%; height: auto; transition: transform 0.6s var(--ease-out); }
.j-gate-view:hover img,
.j-gate-view:focus-visible img { transform: scale(1.02); }
.j-gate-label {
  position: absolute;
  top: 9px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
/* Focus brackets in the middle of the frame. */
.j-gate-corners {
  position: absolute;
  left: 50%;
  top: calc(50% + 6px);
  width: 54px;
  height: 40px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 12px 1.5px,
    linear-gradient(var(--accent), var(--accent)) 0 0 / 1.5px 12px,
    linear-gradient(var(--accent), var(--accent)) 100% 0 / 12px 1.5px,
    linear-gradient(var(--accent), var(--accent)) 100% 0 / 1.5px 12px,
    linear-gradient(var(--accent), var(--accent)) 0 100% / 12px 1.5px,
    linear-gradient(var(--accent), var(--accent)) 0 100% / 1.5px 12px,
    linear-gradient(var(--accent), var(--accent)) 100% 100% / 12px 1.5px,
    linear-gradient(var(--accent), var(--accent)) 100% 100% / 1.5px 12px;
  background-repeat: no-repeat;
  opacity: 0.85;
  pointer-events: none;
}

/* ── Loose photos: two prints taped in separately, overlapping a little ── */
.j-loose .j-photo { width: 60%; }
.j-loose .j-loose-2 { margin: -34% 0 0 auto; }

/* ── A print with its Polaroids tucked on top ── */
.j-collage-set { position: relative; padding: 18px 6% 26px; }
.j-polaroid {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55));
  transition: transform 0.5s var(--ease-out);
  z-index: 2;
}
.j-polaroid img { display: block; width: 100%; height: auto; }
.j-polaroid .tape { width: 54px; height: 18px; top: -9px; }
.j-polaroid-1 { width: 26%; left: 0; top: 0; transform: rotate(-6deg); }
.j-polaroid-2 { width: 21%; right: 0; bottom: 0; transform: rotate(5deg); }
.j-polaroid:hover,
.j-polaroid:focus-visible { transform: rotate(0deg) scale(1.08); z-index: 4; }

/* ── A strip of 35 mm film ──
   Translucent brown base, real sprocket holes (cut out to the desk below),
   amber edge print, a tapered leader at the start, a light leak at the end
   and a little dust. Drag it, scroll it or swipe it. */
.j-strip .j-cap { max-width: 560px; margin-left: clamp(0rem, 5vw, 4rem); }

.film {
  --fh: clamp(190px, 21vw, 290px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  cursor: grab;
  transform: rotate(-0.6deg);
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.65));
}
.j-span-two .j-entry + .j-entry .film { transform: rotate(0.5deg); }
.film::-webkit-scrollbar { display: none; }
.film.is-dragging { cursor: grabbing; }
html.has-custom-cursor .film { cursor: none; }

.film-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 36px 0;
  background: linear-gradient(180deg, #24180d 0%, #1b120a 50%, #24180d 100%);
  clip-path: polygon(0 20%, 54px 0, 100% 0, 100% 100%, 54px 100%, 0 80%);
}
/* Sprocket holes: rows of rounded cut-outs showing the desk through the film. */
.film-track::before,
.film-track::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='14'%3E%3Crect x='6' y='2' width='12' height='10' rx='2.2' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  opacity: 0.92;
}
.film-track::before { top: 7px; }
.film-track::after { bottom: 7px; }

.film-leader { flex: none; width: 64px; align-self: stretch; }
.film-end {
  flex: none;
  width: 70px;
  align-self: stretch;
  background: linear-gradient(90deg, rgba(255, 140, 50, 0) 0%, rgba(255, 130, 40, 0.28) 55%, rgba(255, 196, 120, 0.42) 100%);
  mix-blend-mode: screen;
}
.film-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 30%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 38% 74%, rgba(255, 255, 255, 0.28) 0 1px, transparent 1.5px),
    radial-gradient(circle at 61% 22%, rgba(255, 255, 255, 0.3) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 83% 66%, rgba(255, 255, 255, 0.25) 0 1px, transparent 1.5px),
    radial-gradient(circle at 92% 18%, rgba(255, 255, 255, 0.3) 0 0.8px, transparent 1.3px);
}

.film-frame {
  position: relative;
  flex: none;
  height: var(--fh);
  width: calc(var(--fh) * var(--ar, 0.8));
  margin: 0 5px;
  padding: 0;
  border: 0;
  background: #000;
  cursor: inherit;
}
.film-frame img,
.film-pic { display: block; width: 100%; height: 100%; object-fit: cover; }
.film-pic { background-repeat: no-repeat; }
.film-edge {
  position: absolute;
  top: -21px;
  left: 2px;
  right: 2px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  color: #e3a24e;
  opacity: 0.85;
  pointer-events: none;
}

/* ── Field note: a typed page on the desk ── */
.j-note {
  position: relative;
  display: block;
  padding: 1.4rem 1.5rem 1.7rem;
  background: #ece6d8;
  color: #1c1712;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.6);
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.5s var(--ease-out);
}
.j-note:hover { transform: rotate(0deg) translateY(-4px); }
.j-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5c4d36;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(28, 23, 18, 0.2);
  margin-bottom: 1.1rem;
}
.j-note-head svg { width: 28px; height: 28px; color: #1c1712; }
.j-note-title { display: block; font-family: var(--font-display); font-size: 1.45rem; line-height: 1.18; margin-bottom: 0.6rem; }
.j-note-hook { display: block; font-size: 0.95rem; line-height: 1.6; color: #3a322a; padding-right: 2.8rem; }
.j-note-more { display: inline-block; margin-top: 0.9rem; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: #6b4f1d; }
.j-note:hover .j-note-more { text-decoration: underline; }
.j-note-stamp { position: absolute; right: 1rem; bottom: 1rem; width: 44px; height: 44px; filter: brightness(0.4) sepia(0.4); opacity: 0.75; }

/* ── Marks in the margins ── */
.j-doodle {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-left: 18%;
  color: rgba(240, 235, 224, 0.5);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
}
.j-doodle svg { width: 44px; height: 44px; }
.j-doodle svg text { fill: currentColor; font-family: var(--font-mono); font-size: 7px; }


/* ── The viewer ── */
.j-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
  padding: 4.5rem clamp(1rem, 4vw, 3rem) 4.5rem;
}
.j-viewer[hidden] { display: none; }
.j-viewer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.97); opacity: 0; transition: opacity 0.4s ease; }
.j-viewer.is-open .j-viewer-backdrop { opacity: 1; }

.j-viewer-media {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 6px;
  height: min(76vh, 760px);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  transform-origin: 0 0;
}
.j-viewer-media.fits { justify-content: safe center; }
.j-viewer-media img { height: 100%; width: auto; flex: none; display: block; background: #000; }

.j-viewer-text {
  position: relative;
  z-index: 1;
  max-height: 76vh;
  overflow: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease 0.25s, transform 0.45s var(--ease-out) 0.25s;
}
.j-viewer.is-open .j-viewer-text { opacity: 1; transform: none; }
.j-v-title { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(2.2rem, 3.4vw, 3.2rem); line-height: 1.05; margin: 0.8rem 0 1.2rem; }
.j-v-body p { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.6; margin-bottom: 1rem; color: var(--text); }
.j-v-specs { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-top: 1.4rem; }
.j-v-links { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0 1.4rem; }

.j-viewer-close,
.j-viewer-nav {
  position: absolute;
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.6);
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.j-viewer-close:hover,
.j-viewer-nav:hover { background: var(--accent); color: var(--bg); }
.j-viewer-close { top: 1.2rem; right: clamp(1rem, 4vw, 3rem); font-size: 1.6rem; line-height: 1; }
.j-viewer-prev { bottom: 1.2rem; right: calc(clamp(1rem, 4vw, 3rem) + 60px); }
.j-viewer-next { bottom: 1.2rem; right: clamp(1rem, 4vw, 3rem); }

/* ── Field note page: a typed sheet ── */
.field-note .crumbs { max-width: 820px; margin: 0 auto 1.6rem; }
.fn-sheet {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem);
  background: #ece6d8;
  color: #1c1712;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.fn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(28, 23, 18, 0.2);
}
.fn-label { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: #5c4d36; }
.fn-tulip svg { width: 44px; height: 44px; color: #1c1712; display: block; }
.fn-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 4.6vw, 3.4rem); line-height: 1.08; margin: 1.6rem 0 1rem; }
.fn-lede { font-size: 1.15rem; line-height: 1.7; color: #2a241e; margin-bottom: 1.4rem; }
.fn-sheet h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; line-height: 1.25; margin: 2.2rem 0 0.8rem; color: #1c1712; }
.fn-sheet p { font-size: 1.04rem; line-height: 1.78; color: #2a241e; margin-bottom: 1rem; max-width: 64ch; }
.fn-sheet ul { margin: 0 0 1rem 1.2rem; list-style: disc; }
.fn-sheet li { font-size: 1.02rem; line-height: 1.7; color: #2a241e; margin-bottom: 0.4rem; }
.fn-sheet a { color: #6b4f1d; text-decoration: underline; }
.fn-table { width: 100%; border-collapse: collapse; margin: 1.6rem 0; font-size: 0.95rem; }
.fn-table th, .fn-table td { text-align: left; vertical-align: top; padding: 0.75rem 0.8rem; border-bottom: 1px solid rgba(28, 23, 18, 0.16); line-height: 1.55; color: #2a241e; }
.fn-table thead th { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: #5c4d36; }
.fn-table tbody th { font-family: var(--font-display); font-weight: 600; white-space: nowrap; color: #1c1712; }
.fn-sources { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid rgba(28, 23, 18, 0.2); }
.fn-sources h2 { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: #5c4d36; margin: 0 0 0.8rem; }
.fn-sources ol { margin-left: 1.2rem; }
.fn-sources li, .fn-sources p { font-size: 0.88rem; }
.fn-more { max-width: 820px; margin: clamp(3rem, 6vw, 5rem) auto 0; display: flex; flex-direction: column; gap: 1rem; }
.fn-others { list-style: none; margin-bottom: 1rem; }
.fn-others a { display: inline-block; padding: 0.5rem 0; font-family: var(--font-display); font-size: 1.15rem; color: var(--text); }
.fn-others a:hover { color: var(--accent); }

/* ── Small screens ── */
@media (max-width: 860px) {
  .j-cols, .j-span-two { grid-template-columns: minmax(0, 1fr); gap: clamp(2.4rem, 4vw, 3.4rem); }
  /* One column: the pieces interleave row by row, as they read across the desk. */
  .j-cols { display: flex; flex-direction: column; }
  .j-col { display: contents; }
  .j-span-one .j-strip { display: block; }
  .j-span-one .j-strip .j-cap { margin-top: 1.1rem; }
  .j-strip .j-cap { margin-left: 0; }
  .j-viewer { grid-template-columns: 1fr; align-content: start; overflow-y: auto; padding-top: 4.5rem; }
  .j-viewer-media { height: 52vh; }
  .j-viewer-text { max-height: none; overflow: visible; }
  .fn-table, .fn-table tbody, .fn-table tr, .fn-table th, .fn-table td { display: block; }
  .fn-table thead { display: none; }
  .fn-table tbody th { padding-bottom: 0.2rem; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .j-photo, .j-note, .j-viewer-text, .j-viewer-backdrop { transition: none; }
}
