/* joshymedia site styles (used by index.html and every page made from it) */
/* joshymedia: the whole site is this one page (gallery, projects, contact). Content comes from projects.js. */
:root {
  --bg: #141414;
  --panel: #1d1d1d;
  --panel-2: #242424;
  --line: #2e2e2e;
  --stage: #000;
  --text: #d8d8d8;
  --muted: #7a7a7a;
  --accent: #e8622c;
  --strong: #fff;
  --well: #111;
  --edge: #3a3a3a;
  --edge-2: #6a6a6a;
  --menu-h: 30px;
  --tool-h: 34px;
  --strip-h: clamp(96px, 13vh, 150px); /* grows a little on taller screens */
  --side-w: 260px;
}

:root[data-theme="light"] {
  --bg: #f4f4f4;
  --panel: #fbfbfb;
  --panel-2: #ececec;
  --line: #dcdcdc;
  --stage: #fff;
  --text: #222;
  --muted: #8a8a8a;
  --strong: #000;
  --well: #f0f0f0;
  --edge: #d6d6d6;
  --edge-2: #a0a0a0;
}
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
.theme-btn { color: var(--text); padding: 0 4px; font-size: 13px; }
.theme-btn:hover { color: var(--strong); }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; text-transform: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }

/* ---------- menu bar ---------- */
.menubar {
  height: var(--menu-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--accent); font-weight: 700; }
.menubar nav { display: flex; gap: 16px; }
.menubar nav a { color: var(--text); }
.menubar nav a:hover, .menubar nav a.on { color: var(--strong); }
.menubar nav a.on { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }
.menubar .spacer { flex: 1; }
.menu-folders { display: none; }

.modes { display: flex; gap: 2px; }
.modes button {
  width: 26px; height: 22px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.modes button.on { background: var(--accent); border-color: var(--accent); }
.modes svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- layout ---------- */
.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
}

/* ---------- sidebar ---------- */
.side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 0;
}
.tree a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  padding-left: calc(10px + var(--depth, 0) * 18px);
  white-space: nowrap;
}
.tree a:hover { background: var(--panel-2); }
.tree a.on { background: var(--accent); color: #fff; }
.tree .twisty { width: 10px; color: var(--muted); font-size: 9px; }
.tree a.on .twisty { color: #fff; }
.folder {
  width: 15px; height: 11px; flex: none;
  background: #e9b949;
  border-radius: 1px;
  position: relative;
}
.folder::before {
  content: ""; position: absolute; left: 0; top: -3px;
  width: 6px; height: 3px; background: #e9b949; border-radius: 1px 1px 0 0;
}
.tree .count { color: var(--muted); margin-left: auto; padding-left: 10px; }
.tree a.on .count { color: #fff; }

.collection {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 0 12px;
}
.collection h3 {
  font-size: 13px;
  font-weight: 700;
  padding: 0 12px 8px;
  display: flex;
  justify-content: space-between;
}
.collection h3 span { color: var(--muted); font-weight: 400; }
.collection a {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px;
}
.collection a::before {
  content: ""; width: 10px; height: 7px; border: 1px solid var(--muted); border-radius: 1px; flex: none;
}
.collection a:hover { background: var(--panel-2); }
.collection a.on { color: var(--accent); }
.collection a.on::before { border-color: var(--accent); }

/* ---------- main column ---------- */
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.toolbar {
  height: var(--tool-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.toolbar .path { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.toolbar .spacer { flex: 1; }
.toolbar button { color: var(--text); padding: 2px 6px; border: 1px solid var(--line); background: var(--panel-2); }
.toolbar button:hover { border-color: var(--edge-2); }
.zoom { min-width: 48px; padding: 2px 6px; border: 1px solid var(--line); background: var(--well); color: var(--text); text-align: right; }

/* single-photo viewer */
.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* photo runs edge to edge; arrows sit on top of it */
}
.stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 200ms ease;
}
.stage img.loading { opacity: 0.6; }

/* zoom (ctrl + scroll / pinch): the photo zooms inside its own frame */
.photo-box { position: relative; flex: none; overflow: hidden; line-height: 0; }
.photo-box img { transform-origin: 0 0; }
.photo-box.zoomed { cursor: grab; }
.photo-box.zoomed.dragging { cursor: grabbing; }
.nav-btn, .pager { z-index: 2; }
.navi {
  position: absolute; left: 12px; bottom: 32px; z-index: 3;
  width: 170px; line-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .75);
  background: #000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  cursor: crosshair;
}
.navi-rect {
  position: absolute;
  border: 2px solid #e5322d;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); /* dims the part that's off screen */
  pointer-events: none;
}
.nav-btn {
  /* spans the photo's height (inside the frame's border), arrow in the middle */
  position: absolute; top: 20px; bottom: 20px; width: 56px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 22px;
}

.nav-btn.prev { left: 0; }
.nav-btn.next { right: 0; }
/* dots under the photo show where you are, on every screen size */
.stage { padding: 20px 0; } /* slight even border above and below the photo */
.pager {
  position: absolute; left: 0; right: 0; bottom: 6px;
  display: flex; justify-content: center; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
}
.pager i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .45; transition: opacity 200ms, transform 200ms; }
.pager i.on { opacity: 1; background: var(--strong); transform: scale(1.15); }
.stage:fullscreen { width: 100vw; height: 100vh; padding: 0; background: #000; overflow: hidden; }
.stage:fullscreen img { max-width: 100vw; max-height: 100vh; width: auto; height: auto; }
/* arrows: faint round buttons over the photo's edges */
.nav-btn { width: 56px; color: #fff; font-size: 0; opacity: .75; transition: opacity 150ms; }
.nav-btn:hover { opacity: 1; }
.nav-btn::before { transition: background-color 150ms; }
.nav-btn::before {
  content: ""; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, .35) center / 12px no-repeat;
  opacity: .7;
}
.nav-btn.prev::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M8 1 3 6l5 5' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E"); }
.nav-btn.next::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m4 1 5 5-5 5' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E"); }


.infobar {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 8px 16px 10px;
  background: var(--stage);
  white-space: nowrap;
  overflow: hidden;
}
.infobar .file { font-weight: 700; color: var(--strong); }
.stars { color: var(--text); letter-spacing: 2px; font-size: 11px; }
.dots { display: inline-flex; gap: 6px; margin-left: 10px; }
.dots i { width: 6px; height: 6px; display: inline-block; opacity: 0.7; }
.infobar .desc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.infobar .desc a, .sheet-head a, .about a { text-decoration: underline; text-underline-offset: 2px; color: var(--text); }

.statusbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 6px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.statusbar .pill { padding: 1px 8px; border: 1px solid var(--line); background: var(--well); color: var(--text); }

.strip {
  height: var(--strip-h);
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px 12px 0;
  overflow-x: auto;
  overflow-y: hidden; /* scrolls left and right only */
  background: var(--panel);
  scrollbar-color: var(--edge-2) transparent;
}
.thumb {
  flex: none;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.thumb .frame {
  width: 140px; height: 84px;
  border: 1px solid var(--edge);
  background: var(--well);
  display: grid; place-items: center;
  padding: 4px;
}
.thumb img { max-width: 100%; max-height: 74px; object-fit: contain; }
.thumb .stars { font-size: 9px; letter-spacing: 1px; }
.thumb .name { font-size: 11px; font-weight: 700; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb:hover .frame { border-color: var(--edge-2); }
.thumb.on .frame { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* filmstrip: each preview is the photo's own shape, filled edge to edge */
.strip .thumb { width: auto; }
.strip .thumb .frame { width: auto; height: calc(var(--strip-h) - 26px); padding: 0; display: block; } /* room left for the scrollbar */
.strip .thumb img { height: 100%; width: auto; max-width: none; max-height: none; }
.strip .thumb .name { width: 0; min-width: 100%; text-align: center; }

/* contact sheet (the gallery) */
.sheet {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  background: var(--bg);
}
.sheet-head { margin-bottom: 18px; max-width: 640px; }
.sheet-head h1 { font-size: 13px; font-weight: 700; color: var(--strong); }
.sheet-head p { color: var(--muted); margin-top: 4px; }

/* large photo + details panel beside it */
.viewer-row { flex: 1; min-height: 0; display: flex; }
.viewer-row .stage { flex: 1; min-width: 0; }
.details > * { max-width: 440px; }
.details {
  flex: 1 1 320px; min-width: 320px; /* takes whatever width the photo leaves */
  overflow: auto;
  padding: 32px 28px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.details .details-title { font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--strong); }
.details .project-desc { font-size: 15px; line-height: 1.5; color: var(--text); margin-top: 12px; }
.details .project-desc a { text-decoration: underline; text-underline-offset: 2px; }
.details-link { display: inline-block; margin-top: 28px; color: var(--accent); }
.details-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* project grid: title, description and credits up top */
#sheetHead { max-width: 720px; margin: 8px 0 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
#sheetHead h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
#sheetHead .project-desc { font-size: 16px; line-height: 1.5; color: var(--text); margin-top: 12px; }
.credits { display: grid; grid-template-columns: 72px 1fr; gap: 6px 16px; margin-top: 22px; font-size: 14px; }
.credits dt { color: var(--muted); }
.credits dd { color: var(--strong); }
/* justified rows: photos in a row share one height and fill the width exactly */
.sheet-grid { display: flex; flex-direction: column; gap: 22px; }
.sheet-row { display: flex; gap: 14px; align-items: flex-start; }
.sheet-grid .thumb { width: auto; min-width: 0; align-items: stretch; text-align: left; }
.sheet-grid .thumb .frame { width: 100%; height: auto; padding: 0; border: 0; background: var(--well); display: block; }
.sheet-grid .thumb img { width: 100%; height: auto; max-height: none; outline: 1px solid var(--edge); outline-offset: -1px; transition: opacity 200ms ease; }
.sheet-grid .thumb:hover img { opacity: 0.85; }
.sheet-grid .thumb:hover .frame { border: 0; }
.sheet-grid .thumb .stars { display: none; }
.sheet-grid .thumb .name { margin-top: 6px; }
.sheet-grid .thumb .frame { background: none; }
.sheet-grid .thumb img { cursor: zoom-in; }
.sheet-grid .thumb .proj { font-size: 11px; color: var(--muted); }

/* contact: simple text, top-left, like the previous site */
.contact {
  flex: 1; min-height: 0; overflow: auto;
  padding: 40px 40px 64px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
.contact section { max-width: 480px; }
.contact section + section { margin-top: 72px; }
.contact .label { color: var(--muted); margin-bottom: 12px; }
.contact ul { list-style: none; }
.contact p + p { margin-top: 1em; }
.contact a { text-decoration: underline; text-underline-offset: 2px; }
.contact a:hover { opacity: .6; }

/* tree: folders are always open */
.tree .twisty { text-align: center; }

/* projects: desktop-style folders with the cover photo inside */
.folders-view { flex: 1; min-height: 0; overflow: auto; padding: 24px; background: var(--bg); }
.folders-view .sheet-head { margin-bottom: 28px; }
.folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 40px 32px;
}
.fcard { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ficon { position: relative; width: 100%; aspect-ratio: 5 / 4; }
.ficon .back {
  position: absolute; inset: 7% 0 0 0;
  background: #c8922c;
  border-radius: 0 8px 8px 8px;
}
.ficon .back::before {
  content: ""; position: absolute; left: 0; bottom: 100%;
  width: 40%; height: 9%;
  background: #c8922c;
  border-radius: 8px 8px 0 0;
}
/* the photo area sits above the front flap, so the whole photo always shows */
.ficon .paper {
  position: absolute; left: 6%; right: 6%; top: 12%; bottom: 21%;
  display: flex; align-items: flex-end; justify-content: center;
  transition: transform 250ms ease;
}
.ficon img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  border: 3px solid #fafafa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.ficon .front {
  position: absolute; left: 0; right: 0; bottom: 0; height: 20%;
  background: linear-gradient(#f3c862, #e2ad40);
  border-radius: 4px 4px 8px 8px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, .18);
  transform-origin: 50% 100%;
  transform: perspective(700px) rotateX(-6deg);
  transition: transform 250ms ease;
}
.fcard:hover .ficon .paper { transform: translateY(-5%); }
.fcard:hover .ficon .front { transform: perspective(700px) rotateX(-20deg); }
.fcard .fname { color: var(--strong); font-weight: 700; }
.fcard .fmeta { color: var(--muted); font-size: 12px; margin-top: -8px; }
.fcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

.hidden { display: none !important; }

/* ---------- phones ---------- */
@media (max-width: 1199px) {
  .viewer-row { flex-direction: column; overflow: auto; }
  .viewer-row .stage { flex: none; }
  .stage img { max-width: 100%; max-height: 72vh; width: auto; height: auto; }
  .details { width: auto; flex: 1 0 auto; min-width: 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  :root { --strip-h: 84px; }
  .nav-btn { top: 12px; bottom: 22px; }
  .app { grid-template-columns: 1fr; }
  .menu-folders { display: block; color: var(--text); }
  .menubar nav { display: none; }
  .side {
    position: fixed; z-index: 20;
    top: var(--menu-h); bottom: 0; left: 0;
    width: min(80vw, 300px);
    transform: translateX(-100%);
    transition: transform 200ms ease;
    box-shadow: 0 0 40px rgba(0,0,0,.6);
  }
  body.drawer .side { transform: none; }

  /* phones: swipe the photo; faint arrows + dots show there's more */
  .stage { touch-action: pan-y; overflow: hidden; padding: 12px 0 22px; }
  .stage img { max-height: 62vh; }
  .infobar { flex-wrap: wrap; gap: 4px 16px; white-space: normal; }
  .infobar .desc { flex-basis: 100%; white-space: normal; }
  .statusbar .hide-sm, .toolbar .hide-sm { display: none; }
  .thumb { width: 100px; }
  .thumb .frame { width: 100px; height: 64px; }
  .thumb img { max-height: 54px; }
  .strip .thumb { width: auto; }
  .strip .thumb .frame { width: auto; height: calc(var(--strip-h) - 20px); }
  .strip .thumb img { max-height: none; }
  .strip .thumb .stars, .strip .thumb .name { display: none; }
  .sheet { padding: 12px; }
  .contact { padding: 24px 16px 48px; }
  .contact section + section { margin-top: 56px; }
  #sheetHead { margin-bottom: 24px; padding-bottom: 20px; }
  #sheetHead h1 { font-size: 21px; }
  .viewer-row { flex-direction: column; }
  .details { padding: 16px; }
  .details .details-title { font-size: 19px; }
  .details .credits { margin-top: 14px; }
  .details-link { margin-top: 14px; }
  #sheetHead .project-desc { font-size: 15px; }
  .folders-view { padding: 16px; }
  .folders { grid-template-columns: repeat(2, 1fr); gap: 28px 16px; }
  .fcard .fname { font-size: 12px; }
  .sheet-grid { gap: 16px; }
  .sheet-row { gap: 8px; }
  .sheet-grid .thumb .name, .sheet-grid .thumb .proj { font-size: 10px; }
}

/* navigator thumbnail (after the other .stage img rules so it wins) */
.stage .navi img, .stage:fullscreen .navi img {
  width: 100%; height: auto; max-width: none; max-height: none;
  display: block; opacity: .9; transition: none;
}
@media (max-width: 760px) {
  .navi { width: 110px; left: 8px; bottom: 30px; }
}

/* previews fade in once loaded */
img.fade-in { opacity: 0; transition: opacity 220ms ease; }
img.fade-in.loaded { opacity: 1; }

/* phones: backdrop behind the open folder menu */
.scrim { display: none; }
@media (max-width: 760px) {
  body.drawer .scrim {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; top: var(--menu-h);
    z-index: 19;
    background: rgba(0, 0, 0, .45);
    animation: scrim-in 200ms ease;
  }
}
@keyframes scrim-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  img.fade-in, body.drawer .scrim { transition: none; animation: none; }
}
