/* Shared styles for index, past-work, photos, videos (and the nav on article pages).
   Look: white page, black Cardo, red on hover, light grey placeholders.
   Layout: navigation list in a left column (25%), page content in the right column. */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --accent: #ff0000;
  --placeholder: #f5f5f5;

  --nav-w: 25%;           /* left column */
  --edge: 32px;           /* space around the edges */
  --gap: 16px;            /* between photos */
  --font: "Cardo", "Times New Roman", Times, serif;
  --size: 16px;
  --small: 14px;
  --line: 1.35;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--size);
  line-height: var(--line);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible,
button:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.content h1, .content p, .content ol, .item { margin: 0; }
.content h1 { font-size: inherit; font-weight: 400; }

/* ---------- two columns: nav on the left, page on the right ---------- */

@media (min-width: 701px) {
  body {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    align-items: start;
  }
  body > * { grid-column: 2; }
  body > .site-header {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
  }
}

/* ---------- navigation (left column, top to bottom) ---------- */

.site-header {
  padding: var(--edge);
  background: var(--bg);
  white-space: normal;      /* article pages set pre-wrap on body */
  line-height: var(--line);
}

.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav li { margin: 0; padding: 0; list-style: none; }
.site-nav li::marker { content: none; }
.site-nav li + li { margin-top: 6px; }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav .site-email { margin: 1.6em 0 0; }

/* ---------- home ---------- */

.content { padding: var(--edge) var(--edge) 96px; }

.content .hello { font-style: italic; margin-bottom: 1.35em; }

.bio { max-width: 34em; }
.bio + .bio { margin-top: 1.35em; }
.bio a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- past work ---------- */

.works { list-style: none; padding: 0; max-width: 48em; }

.works a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 40px;
  padding: 3px 0;
}
.works li + li { margin-top: 6px; }

.works__title { font-style: italic; }
.works__date { white-space: nowrap; }

/* ---------- photos / videos stream ---------- */

.stream { position: relative; }

.stream__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.stream__track {
  display: flex;
  gap: var(--gap);
  padding: 0 var(--edge) 24px;
  will-change: transform;
}

.stream-page[data-kind="photos"] { --ratio: 1.5; }        /* 3:2 */
.stream-page[data-kind="videos"] { --ratio: 1.7778; }     /* 16:9 */

.item {
  /* ~3 across the right column on a 14" MacBook; never so big that small originals
     get blurry, never taller than the window */
  --w: min(
    560px,
    calc((75vw - 2 * var(--edge) - 3 * var(--gap)) / 3.2),
    calc((100svh - 140px) * var(--ratio))
  );
  flex: 0 0 var(--w);
  width: var(--w);
}

.item__frame {
  position: relative;
  aspect-ratio: var(--ratio);
  background: var(--placeholder);
  overflow: hidden;
}

.item__frame img,
.item__frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item__frame img { opacity: 0; transition: opacity 0.5s ease-in-out; }
.item__frame img.is-loaded { opacity: 1; }
.item__frame video { cursor: pointer; }

.item figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: var(--small);
  font-style: italic;
  line-height: 1.3;
}

.sound {
  font: inherit;
  font-style: normal;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
.sound:hover,
.sound[aria-pressed="true"] { color: var(--accent); }

.stream-empty { padding: var(--edge); }

/* ---------- phones: nav list on top, page below ---------- */

@media (max-width: 700px) {
  :root { --edge: 16px; }

  .site-header { padding: 20px var(--edge) 0; }
  .content { padding-top: 32px; padding-bottom: 64px; }

  .works a { grid-template-columns: 1fr; padding: 6px 0; }

  /* photos/videos become one vertical column you scroll normally */
  .stream { height: auto !important; }
  .stream__pin {
    position: static;
    height: auto;
    overflow: visible;
    display: block;
  }
  .stream__track {
    flex-direction: column;
    gap: 28px;
    padding: 32px var(--edge) 64px;
    transform: none !important;
  }
  .item { --w: 100%; flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .item__frame img { transition: none; }
}
