/* My Work. Shared page styles are in pages.css. */
.ridge { display: block; width: 100%; image-rendering: pixelated; margin-bottom: -10vh; }
.ridge[hidden] { display: none; }

.cat { margin-top: 9vh; }

/* tile */
.tile { position: relative; margin: 0; cursor: zoom-in; }
.tile .media { position: relative; overflow: hidden; background: rgba(0, 0, 0, .2); }
.tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile figcaption { padding-top: 10px; color: var(--dim); font-family: var(--font-text); font-size: var(--fs-small); line-height: var(--lh-small); }
.no-captions .tile figcaption { display: none; }
.tile:active .media { transform: scale(.985); transition: transform 120ms ease-out; }

/* loading veil: a quick dither in the site blues that dissolves once, when the tile first appears */
.veil { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; z-index: 1; }

/* HUD corners that open from the centre, like the landing's content frames */
.hud-anim .tile .media .q { position: absolute; width: 50%; height: 50%; pointer-events: none; z-index: 2; transition: transform 620ms var(--ease-out); }
.hud-anim .tile .media .q.tl { left: 0; top: 0; transform: translate(100%, 100%); }
.hud-anim .tile .media .q.br { right: 0; bottom: 0; transform: translate(-100%, -100%); }
.hud-anim .tile .media .q::before { content: ''; position: absolute; width: 14px; height: 14px; border: 0 solid var(--hud); }
.hud-anim .tile .media .q.tl::before { left: 6px; top: 6px; border-top-width: 1.5px; border-left-width: 1.5px; }
.hud-anim .tile .media .q.br::before { right: 6px; bottom: 6px; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.hud-anim .tile.seen .media .q { transform: none; }
.hud-anim .tile .media > video, .hud-anim .tile .media > .veil { clip-path: inset(50% 50% 50% 50%); transition: clip-path 620ms var(--ease-out) 60ms; }
.hud-anim .tile.seen .media > video, .hud-anim .tile.seen .media > .veil { clip-path: inset(0 0 0 0); }


/* player (js/player.js): full version with sound, grows out of the clicked tile */
#lightbox { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(4, 8, 60, .9); opacity: 0; transition: opacity 150ms ease-out; }
#lightbox.in { opacity: 1; transition: opacity 200ms ease-out; }
#lightbox[hidden] { display: none; }
.pl { position: relative; width: min(92vw, 1400px, calc(78vh * var(--ar, 16 / 9))); outline: none; color: var(--ink);
  transition: transform 280ms var(--ease-out); }
.pl-stage { position: relative; aspect-ratio: var(--ar, 16 / 9); background: #000; cursor: pointer; }
.pl-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.pl .q { position: absolute; width: 18px; height: 18px; border: 0 solid var(--ink); pointer-events: none; }
.pl .q.tl { left: -8px; top: -8px; border-top-width: 1.5px; border-left-width: 1.5px; }
.pl .q.br { right: -8px; bottom: -8px; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.pl-spinner { position: absolute; left: 12px; bottom: 10px; font-family: var(--font-label); font-size: var(--fs-label); letter-spacing: var(--track-label); color: var(--ink); opacity: 0; transition: opacity 150ms ease-out; pointer-events: none; }
.loading .pl-spinner { opacity: .8; transition-delay: 400ms; }
.pl-ui { transition: opacity 200ms ease-out; }
.idle .pl-ui { opacity: 0; }
.idle .pl-stage { cursor: none; }
.pl-row { display: flex; align-items: center; gap: 18px; }
.pl-top { position: absolute; left: 0; right: 0; top: -34px; }
.pl-title { opacity: .8; }
.pl-bottom { margin-top: 12px; }
.pl-spacer { flex: 1; }
.pl-time { font-variant-numeric: tabular-nums; opacity: .8; }
.pl-time .pl-dur { opacity: .6; }
.pl-btn { background: none; border: 0; padding: 4px 0; color: var(--ink); font: 700 var(--fs-label) var(--font-label); letter-spacing: var(--track-label); cursor: pointer; opacity: .75; transition: opacity 150ms ease-out; }
@media (hover: hover) and (pointer: fine) { .pl-btn:hover { opacity: 1; } }
.pl-btn:active { transform: scale(.96); transition: transform 100ms ease-out; }
.pl-btn:focus-visible, .pl-bar:focus-visible { outline: 1px solid var(--orange); outline-offset: 3px; }
.pl-close { margin-left: auto; border: 1px solid rgba(244, 241, 234, .4); padding: 5px 8px; }
/* timeline: hairline that thickens on hover / drag, orange progress, square playhead */
.pl-bar { position: relative; height: 18px; margin-top: 10px; cursor: pointer; touch-action: none; }
.pl-track { position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: rgba(244, 241, 234, .2); transition: height 150ms ease-out, top 150ms ease-out; }
.pl-bar:hover .pl-track, .pl-bar.scrub .pl-track { top: 6px; height: 6px; }
.pl-buf, .pl-prog { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); }
.pl-buf { background: rgba(244, 241, 234, .25); }
.pl-prog { background: var(--orange); }
.pl-head { position: absolute; top: 5px; width: 8px; height: 8px; margin-left: -4px; background: var(--orange); opacity: 0; transition: opacity 150ms ease-out; }
.pl-bar:hover .pl-head, .pl-bar.scrub .pl-head { opacity: 1; }
.pl-tip { position: absolute; bottom: 20px; transform: translateX(-50%); padding: 3px 5px; background: var(--ink); color: var(--blue); font-weight: 700; font-size: var(--fs-label);
  pointer-events: none; opacity: 0; transition: opacity 120ms ease-out; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .pl-bar:hover .pl-tip { opacity: 1; } }
.pl-bar.scrub .pl-tip { opacity: 1; }
.pl:fullscreen { width: 100vw; height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 4vh 4vw; background: #000; }
.pl:fullscreen .pl-stage { max-height: 82vh; }
.pl:fullscreen .pl-top { position: static; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  #lightbox, .pl { transition: opacity 150ms ease-out; transform: none; }
  .hud-anim .tile .media .q, .hud-anim .tile .media > video, .hud-anim .tile .media > .veil { transition: none; }
}

/* ---- player as a sheet (default): slides up from the bottom, video + card ---- */
#lightbox.sheet { place-items: end stretch; background: rgba(4, 8, 60, .55); }
.sh { height: 94vh; display: flex; flex-direction: column; background: var(--blue); border-top: 1px solid rgba(244, 241, 234, .25); color: var(--ink);
  transform: translateY(100%); transition: transform 200ms cubic-bezier(.32, .72, 0, 1); }
#lightbox.sheet.in .sh { transform: none; transition: transform 380ms cubic-bezier(.32, .72, 0, 1); }
.sh-grab { position: relative; display: flex; justify-content: center; align-items: center; height: 44px; flex: none; cursor: grab; touch-action: none; }
.sh-grab:active { cursor: grabbing; }
.sh-handle { width: 44px; height: 3px; background: rgba(244, 241, 234, .45); }
.sh-close { position: absolute; right: var(--gutter); top: 12px; border: 1px solid rgba(244, 241, 234, .4); padding: 5px 8px; }
.sh-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 25vw); gap: 4vw; padding: 2vh var(--gutter) 4vh; align-items: start; }
#lightbox.sheet .pl { width: 100%; max-width: calc(76vh * var(--ar, 16 / 9)); justify-self: center; transition: none; }
#lightbox.sheet .pl-stage { max-height: 76vh; }
.sh-info { padding-top: 6px; }
.sh-meta { opacity: .7; }
.sh-title { font-size: var(--fs-l); line-height: var(--lh-l); margin: 14px 0 18px; }
.sh-desc { font-size: var(--fs-body); line-height: var(--lh-body); }
.sh-nav { display: flex; gap: 10px; margin-top: 28px; }
.sh-nav .btn { color: var(--ink); border-color: rgba(244, 241, 234, .5); padding: 9px 12px; }
.sh-nav .btn:disabled { opacity: .3; pointer-events: none; }
.sh-count { margin-top: 14px; }
@media (max-width: 860px) { .sh-body { grid-template-columns: 1fr; overflow-y: auto; } }
@media (prefers-reduced-motion: reduce) { .sh, #lightbox.sheet.in .sh { transition: opacity 150ms ease-out; transform: none; } }

/* ---- layout: sidebar (default) — real titles on the left (sticky, scroll-spy, clickable), grid on the right ---- */
.sidebar { display: grid; grid-template-columns: 25vw minmax(0, 1fr); gap: 0 3vw; padding: 0 var(--gutter); }
.cats-nav { position: sticky; top: 96px; align-self: start; padding-top: 7vh; }
.cats-nav ol { list-style: none; display: grid; gap: var(--sp-3); }
.cats-nav li { font-family: var(--font-display); font-style: var(--display-style); font-size: var(--fs-section); line-height: .98; font-weight: var(--w-display); letter-spacing: var(--track-display); }
/* category links: on hover a solid block appears AT ONCE behind the title (text turns blue), on leave it slides away
   to the right and the text fades back. Inline + box-decoration-break: the block follows each line of a 2-line title */
.cats-nav a { display: inline; padding: 0 .1em; margin-left: -.1em; color: var(--fg); text-decoration: none; opacity: .38;
  background: linear-gradient(var(--fg), var(--fg)) right center / 0% 100% no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 460ms var(--ease-out), color 300ms ease-out, opacity 300ms ease-out; }
.cats-nav a[aria-current] { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .cats-nav a:hover { background-size: 100% 100%; background-position: left center; color: var(--page); opacity: 1; transition: none; }
}
.cats-nav a:focus-visible { outline-offset: 6px; }
.cat-title { margin: 0 0 22px; color: var(--fg); }
.sidebar .cat { margin-top: 9vh; scroll-margin-top: 100px; }
/* video grid: justified rows. Every video keeps its real format (no stretched verticals): tiles of a row share one
   height, their widths follow their aspect ratio (flex-grow proportional to it), the last row is not stretched */
.vgrid { --row: clamp(170px, 16vw, 290px); display: flex; flex-wrap: wrap; gap: var(--sp-5) var(--sp-4); }
.vgrid .tile { flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row)); min-width: 0; }
.vgrid .tile .media { aspect-ratio: var(--ar); }
.vgrid::after { content: ''; flex: 1000 1 0; }
@media (max-width: 900px) { .sidebar { grid-template-columns: 1fr; } .cats-nav { position: static; padding-top: 4vh; } .vgrid { --row: 160px; } }

/* tile hover: ASCII corner selector made of the live video (js/ascii-hover.js) */
.ascii-sel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.tile .media .q::before { transition: opacity 120ms ease-out; }
.tile.sel .media .q::before { opacity: 0; }   /* the ASCII selector replaces the static HUD corners while hovered */
.tile { cursor: pointer; }
.tile:focus-visible { outline: 1px solid var(--orange); outline-offset: 4px; }
/* sidebar layout: the sticky column already names the category on screen, so the section title is for screen readers (and small screens, where the column is not sticky) */
@media (min-width: 901px) { .sidebar .cat-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }
#cats:empty { min-height: 120vh; }   /* the grid arrives with the data: keep its room so the footer never jumps */
@media (max-width: 720px) {
  .cats-nav { display: none; }                                  /* one column: the section titles carry the names */
  .sidebar .cat-title { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: var(--fs-section); }
  .sidebar .cat { margin-top: 6vh; }
  .vgrid { --row: 130px; gap: var(--sp-4) var(--sp-3); }
  .pl { width: 100vw; }
}
.k-touch { display: none; }
/* ---- phones: the player is a full-screen page: title + CLOSE on top, the video full width, big controls, nothing hides ---- */
@media (max-width: 720px) {
  #lightbox:not(.sheet) { z-index: 50; background: var(--blue); place-items: center; padding: 0; }
  #lightbox:not(.sheet) .pl { width: min(100vw, calc((100svh - 250px) * var(--ar, 16 / 9))); max-width: none; }   /* tall videos: room left for the title and the controls */
  #lightbox:not(.sheet) .pl-top { position: absolute; top: auto; bottom: calc(100% + var(--sp-4)); padding: 0 var(--gutter); }
  #lightbox:not(.sheet) .pl-title { font-size: var(--fs-small); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #lightbox .pl-close { white-space: nowrap; flex: none; }
  #lightbox:not(.sheet) .pl-top { left: 0; right: 0; justify-content: space-between; }
  .k-desk { display: none; } .k-touch { display: inline; }
  .pl .q { display: none; }
  #lightbox .pl-ui { padding: var(--sp-3) var(--gutter) 0; opacity: 1 !important; }
  #lightbox .pl-btn { min-height: 40px; padding: 0 var(--sp-2); font-size: 11px; }
  #lightbox .pl-close { border: 1px solid rgba(244, 241, 234, .5); padding: 0 var(--sp-3); }
  #lightbox .pl-bar { height: 28px; }
  #lightbox .pl-row { gap: var(--sp-3); }
  body:has(#lightbox:not([hidden])) .mnav { display: none; }
}
