/* ── Are.na portfolio: the info panel, the slideshow and the switcher ──────────
   Tokens, type and the chrome come from /css/base.css; the grid theme's
   own styles from /css/gallery.css.
   ───────────────────────────────────────────────────────────────── */

html, body { background: var(--paper); color: var(--ink); }
.ap-main:empty { min-height: 100svh; }

/* The chrome's text sits on the page in the info panel and slideshow, so the
   blend only matters over photographs; it stays as base.css sets it. */
.ap-info-toggle { cursor: pointer; }
@media (hover: hover) {
  .ap-info-toggle { transition: opacity var(--t-state) var(--ease); }
  .ap-info-toggle:hover { opacity: .5; }
}

/* Nothing to show (no board, a board that can't be read, no photographs): one quiet line
   where the work would start, and on the open web the way to the start page. */
.ap-empty {
  padding: calc(var(--pad-top) + var(--ident-h) + var(--clearance)) var(--pad-right) 0 var(--pad-left);
  line-height: 1.3;
}
.ap-empty span { opacity: .5; }
.ap-empty a { display: inline-block; margin-top: 1.3em; }
@media (hover: hover) {
  .ap-empty a { transition: opacity var(--t-state) var(--ease); }
  .ap-empty a:hover { opacity: .5; }
}

/* ── Info ──────────────────────────────────────────────────────────
   The photographer's own words, on the page colour, where the work starts. */
html.ap-info-open { overflow: hidden; }
.ap-info {
  position: fixed;
  inset: 0;
  z-index: 20;  /* under the chrome (30), over the work */
  overflow-y: auto;
  background: var(--paper);
  padding: calc(var(--pad-top) + var(--ident-h) + var(--clearance)) var(--pad-right) var(--pad-bottom) var(--pad-left);
}
.ap-info:focus { outline: none; }
.ap-info-body { max-width: 34em; line-height: 1.3; }
.ap-info-body p + p { margin-top: 1.3em; }
.ap-info-body a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
@media (hover: hover) {
  .ap-info-body a { transition: opacity var(--t-state) var(--ease); }
  .ap-info-body a:hover { opacity: .5; }
}

/* ── Theme 2: slideshow ────────────────────────────────────────────
   The photograph fills the space between the name and the caption line. */
.ss {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
}
.ss-stage {
  position: absolute;
  top: calc(var(--pad-top) + var(--ident-h) + var(--clearance));
  bottom: calc(var(--pad-bottom) + 15.4px + var(--clearance));
  left: var(--pad-left);
  right: var(--pad-right);
}
.ss-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ss-zone { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1; }
.ss-zone--prev { left: 0; cursor: w-resize; }
.ss-zone--next { right: 0; cursor: e-resize; }
.ss-count, .ss-caption { line-height: 1.1; }
.ss-caption {
  opacity: .5;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The slideshow's count and caption belong to the photograph, not the info. */
html.ap-info-open .ss-count,
html.ap-info-open .ss-caption { visibility: hidden; }

/* Theme switcher (testing only) */
.ap-switch { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; max-width: 58vw; line-height: 1.1; }
@media (max-width: 700px) {
  /* one line that scrolls sideways, so it doesn't stack over the work */
  .ap-switch { flex-wrap: nowrap; justify-content: flex-start; max-width: 62vw; overflow-x: auto; scrollbar-width: none; pointer-events: auto; }
  .ap-switch::-webkit-scrollbar { display: none; }
}
.ap-switch a { opacity: .5; }
.ap-switch a[aria-current] { opacity: 1; }
@media (hover: hover) {
  .ap-switch a { transition: opacity var(--t-state) var(--ease); }
  .ap-switch a:hover { opacity: 1; }
}

/* ── Shared conventions (themes/kit.js lists them) ─────────────────
   Here, not in kit.css, because the slideshow keeps them too and kit.css only loads with
   the themes in themes/. */
/* The count, top centre: figures of one width; it belongs to the photographs, not the info. */
.ap-count { line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; transition: opacity var(--t-state) var(--ease); }
.ap-count.is-gone { opacity: 0; }
html.ap-info-open .ap-count { visibility: hidden; }

/* A caption under (or beside) a photograph; --cap-lines lowers the clamp where needed. */
.ap-cap {
  margin-top: 8px;
  line-height: 1.3;
  opacity: .5;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--cap-lines, 3);
  line-clamp: var(--cap-lines, 3);
  overflow: hidden;
}

/* A half-screen zone (click to step): keyboard focus is a hairline bracket set in from the
   zone's outer edge, open towards the middle, never a box across a photograph. A theme sets
   --zone-inset (how far in from the screen's edge) and --zone-t / --zone-b if it needs to. */
.ap-zone:focus-visible { outline: none; }
.ap-zone::after {
  content: '';
  position: absolute;
  top: var(--zone-t, 8px);
  bottom: var(--zone-b, 8px);
  width: 6px;
  border: 1px solid currentColor;
  opacity: 0;
  pointer-events: none;
}
.ap-zone--prev::after { left: var(--zone-inset, 8px); border-right: 0; }
.ap-zone--next::after { right: var(--zone-inset, 8px); border-left: 0; }
.ap-zone:focus-visible::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ap-count { transition: none; } }

/* ── Black or white, whatever the device ───────────────────────────
   "background: black" (or white) in the Info block sets data-scheme; without it the page
   follows the device's light or dark mode, as base.css does. */
:root[data-scheme="dark"] {
  color-scheme: dark;
  --paper: #000; --ink: #fff; --line: #262626; --line-hover: #3a3a3a; --wash: #0d0d0d; --hold: #111;
}
:root[data-scheme="light"] {
  color-scheme: light;
  --paper: #fff; --ink: #000; --line: #e0e0e0; --line-hover: #d3d3d3; --wash: #f7f7f7; --hold: #f2f2f2;
}
.ap-switch .ap-switch-gap { margin-left: 12px; }
