/* ---------- Base ---------- */
:root {
  --bg: #fffbf5;
  --ink: #292a2d;
  --accent: #ff4d25;
  --gap: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font: 16px -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  background: var(--bg);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; color: inherit; font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.desktop {
  max-width: 1800px;
  min-height: 100svh;
  margin: auto;
  padding: clamp(28px, 4vw, 64px) clamp(16px, 3vw, 48px) 84px;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(32px, 4.5vw, 64px);
}
.identity { display: flex; align-items: flex-start; gap: 10px; color: var(--accent); white-space: nowrap; }
.identity h1 { margin: 0; font-size: clamp(25px, 2vw, 34px); font-weight: 600; letter-spacing: -.055em; line-height: .96; }
.identity p { margin: 6px 0 0; font-size: 13px; font-style: italic; letter-spacing: -.01em; }
.identity a { display: grid; width: 26px; height: 26px; place-items: center; transition: transform .25s ease, color .25s ease; }
.identity a:hover { transform: translateY(-2px); color: #17191d; }
.identity svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.55; }
.identity svg .dot { fill: currentColor; stroke: none; }
.site-nav { display: flex; gap: clamp(14px, 2vw, 24px); padding-top: 2px; }
.site-nav a { padding-bottom: 4px; border-bottom: 1.5px solid transparent; color: var(--accent); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; opacity: .6; transition: opacity .2s ease, border-color .2s ease; }
.site-nav a:hover { opacity: 1; }
.site-nav a[aria-current="page"] { border-color: currentColor; opacity: 1; }
.empty-gallery { color: #71818a; font-size: 14px; }

/* ---------- Film grid (justified rows; row breaks set in app.js) ---------- */
.film-grid { display: flex; flex-direction: column; gap: var(--gap); }
.film-row { display: flex; gap: var(--gap); }
.film-row-spacer { flex-basis: 0; }
.film-tile {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #e9e4dc;
  animation: arrive .65s both;
  animation-delay: calc(var(--i) * 40ms);
}
.is-settled .film-tile { animation: none; }
.film-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.16, 1, .3, 1), filter .35s ease;
}
.film-tile:hover img { transform: scale(1.035); filter: brightness(1.06); }
.film-tile:focus-visible { outline-offset: 3px; }

/* Shots: tighter grid; the clip fades in over its still frame once it's actually playing. */
.shot-grid { --gap: 6px; }
.shot-tile { border-radius: 6px; }
.shot-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.shot-tile.is-playing video { opacity: 1; }
.shot-tile:hover img { transform: none; filter: none; }

@media (max-width: 780px) {
  :root { --gap: 8px; }
  .shot-grid { --gap: 4px; }
  .desktop { padding: 26px 12px 54px; }
  .site-header { gap: 12px; margin-bottom: 32px; }
  .site-nav a { font-size: 12px; }
  .film-tile { border-radius: 8px; }
  .shot-tile { border-radius: 4px; }
}
@media (max-width: 520px) {
  .site-header { flex-direction: column; gap: 18px; }
}
@media (max-width: 430px) {
  .identity h1 { font-size: 22px; }
  .identity a { width: 22px; height: 22px; }
}

/* ---------- Player ---------- */
.player-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 28px;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  background: #fffbf548;
  backdrop-filter: blur(0);
  transition: opacity .38s ease, visibility .38s step-end, backdrop-filter .55s ease;
}
.player-modal.is-open { opacity: 1; visibility: visible; backdrop-filter: blur(10px); transition: opacity .38s ease, visibility 0s, backdrop-filter .55s ease; }
.player-modal[hidden] { display: none; }
.player-window {
  width: min(760px, 100%);
  overflow: hidden;
  transform: translateY(24px) scale(.972);
  opacity: 0;
  border: 1px solid #ffffffb8;
  border-radius: 22px;
  background: #f7f5f0c2;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 26px 70px #2f271f42;
  backdrop-filter: blur(26px) saturate(135%);
  transition: transform .62s cubic-bezier(.16, 1, .3, 1), opacity .32s ease-out;
}
.player-modal.is-open .player-window { transform: translateY(0) scale(1); opacity: 1; }
.player-window.is-portrait { width: min(540px, calc((100svh - 150px) * var(--ratio, .75))); }
.player-window.is-square { width: min(620px, calc(100svh - 170px)); }
.player-window:not(.has-info) .film-info { display: none; }
.window-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid #d4d6da;
  background: linear-gradient(#f9f9fa, #e9eaed);
}
#filename { flex: 1; overflow: hidden; color: #6b6e74; font-size: 12px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.window-bar button { width: 28px; height: 28px; padding: 0 3px; border-radius: 50%; background: none; color: #4b4841; font-size: 23px; line-height: 1; }
.screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #131517; }
.screen iframe, .screen video { display: block; width: 100%; height: 100%; border: 0; }
.film-info { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 22px 15px; }
.film-info h2 { margin: 6px 0 0; font-size: 22px; font-weight: 550; letter-spacing: -.6px; }
.player-subtitle { display: block; margin-top: 5px; color: #6e6960; font-size: 13px; }
.copy-link {
  flex: none;
  padding: 9px 15px;
  border-radius: 999px;
  background: #fffbf5;
  box-shadow: 3px 3px 8px #ddd5c8, -3px -3px 8px #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: box-shadow .2s ease;
}
.copy-link:active { box-shadow: inset 2px 2px 5px #ddd5c8, inset -2px -2px 5px #fff; }
.copy-link[hidden] { display: none; }

@media (max-width: 900px) {
  .player-modal { padding: 14px; }
  .player-window { transform: none; }
  .player-window.is-portrait { width: min(420px, calc((100svh - 125px) * var(--ratio, .75))); }
  .window-bar { height: 35px; }
  .film-info { padding: 13px 17px 16px; }
  .film-info h2 { font-size: 19px; }
}

/* ---------- Motion ---------- */
@keyframes arrive { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* ---------- Edit mode (?edit, signed in) ---------- */
.edit-bar {
  position: fixed;
  z-index: 40;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 18px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 10px 10px 18px;
  transform: translateX(-50%);
  border: 1px solid #ffffffb8;
  border-radius: 16px;
  background: #f7f5f0d9;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 18px 50px #2f271f33;
  backdrop-filter: blur(22px) saturate(135%);
  font-size: 13px;
}
.edit-bar-text { display: grid; gap: 2px; min-width: 0; }
.edit-bar-text strong { color: var(--accent); font-weight: 650; }
.edit-status { color: #6e6960; }
.edit-status a { color: var(--accent); text-decoration: underline; }
.edit-bar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.edit-bar-actions button, .edit-bar-actions a { padding: 8px 12px; border-radius: 10px; background: #ffffffa6; color: #3d3833; font-size: 13px; font-weight: 600; line-height: 1.2; }
.edit-bar-actions .edit-save { background: var(--accent); color: #fff; }
.edit-bar-actions button:disabled { opacity: .4; cursor: default; }
.is-editing .desktop { padding-bottom: 120px; }
.is-editing .film-tile { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.is-editing .film-tile:hover img { transform: none; filter: none; }
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.edit-label {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 6px;
  background: #000000a0;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
  width: fit-content;
  max-width: calc(100% - 12px);
}
.film-tile.is-placeholder { opacity: .25; outline: 2px dashed var(--accent); outline-offset: -2px; }
.edit-ghost {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  flex: none;
  animation: none;
  pointer-events: none;
  box-shadow: 0 24px 50px #2f271f55;
  transition: none;
}
@media (max-width: 600px) {
  .edit-bar { flex-direction: column; align-items: stretch; gap: 10px; bottom: 10px; padding: 12px; }
}

/* ---------- Homepage filter: soft-UI look, Apple-style spring slide ---------- */
.film-filter {
  position: relative;
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: calc(clamp(32px, 4.5vw, 64px) * -.45) auto clamp(22px, 2.6vw, 34px);
  padding: 6px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 3px 3px 7px #e7e0d4, inset -3px -3px 7px #ffffff;
  user-select: none;
  -webkit-user-select: none;
}
.film-filter[hidden] { display: none; }
.film-filter button {
  position: relative;
  z-index: 1;
  padding: 11px 18px 11px 24px;
  border-radius: 999px;
  background: none;
  color: #b1aaa0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  transition: color .3s ease;
}
.film-filter button:hover { color: #857e74; }
.film-filter button[aria-pressed="true"] { color: #4a443d; }
.film-filter button:focus-visible { outline-offset: 1px; }
/* The dot lives in the left padding, so tab widths never change mid-slide. */
.film-filter button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 11px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0);
  transition: opacity .3s ease, transform .4s cubic-bezier(.3, 1.4, .5, 1);
}
.film-filter button[aria-pressed="true"]::before { opacity: 1; transform: scale(1); }
.film-filter-thumb {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 4px 4px 10px #e3dbce, -4px -4px 10px #ffffff, inset 0 0 0 1px #ffffff80;
  transition: scale .25s ease;
}
.film-filter-thumb.is-animated { transition: transform .5s cubic-bezier(.3, 1.25, .5, 1), width .5s cubic-bezier(.3, 1.25, .5, 1), scale .25s ease; }
.film-filter:active .film-filter-thumb { scale: 1.08 1.12; }
@media (max-width: 520px) {
  .film-filter { margin: -6px auto 20px; padding: 5px; }
  .film-filter-thumb { top: 5px; bottom: 5px; }
  .film-filter button { padding: 10px 11px 10px 19px; font-size: 12px; letter-spacing: .04em; }
  .film-filter button::before { left: 8px; }
}

/* ---------- Contact ---------- */
.contact { display: grid; justify-items: start; gap: 18px; padding: clamp(24px, 9vh, 120px) 0 40px; animation: arrive .65s both; }
.contact-kicker { margin: 0; color: #a49d94; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.contact-email {
  max-width: 100%;
  color: var(--accent);
  font-size: clamp(30px, 6.4vw, 92px);
  font-weight: 600;
  letter-spacing: -.055em;
  line-height: 1;
  overflow-wrap: anywhere;
  transition: opacity .2s ease;
}
.contact-email:hover { opacity: .75; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.soft-button {
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--bg);
  color: #4a443d;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 4px 4px 10px #e3dbce, -4px -4px 10px #ffffff, inset 0 0 0 1px #ffffff80;
  transition: box-shadow .25s ease, color .25s ease, scale .25s ease;
}
.soft-button:hover { color: var(--accent); }
.soft-button:active { scale: .97; box-shadow: inset 3px 3px 7px #e7e0d4, inset -3px -3px 7px #ffffff; }
.contact-status { min-height: 1em; margin: 0; color: #a49d94; font-size: 13px; }
@media (max-width: 520px) {
  .contact-actions { gap: 10px; }
  .soft-button { padding: 12px 16px; font-size: 12px; }
}
