/* Shared viewing and inquiry surfaces. The homepage owns its own composition. */
body:has(dialog[open]) { overflow: hidden; }

.small-label {
  font-family: Manrope, Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.underlined {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-align: start;
  text-decoration: none;
}
.underlined:hover { opacity: .72; }
.underlined .icon { width: 18px; height: 18px; }
.underlined.small { font-size: 12px; }

.solid-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 56px;
  padding: 17px 24px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font-family: Manrope, Arial, sans-serif;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
  text-align: start;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.solid-button .icon { width: 18px; height: 18px; filter: invert(1); }
.solid-button:hover { background: #373732; color: var(--paper); }
.solid-button:hover .icon { filter: invert(1); }
.solid-button:disabled { opacity: .55; cursor: wait; }

/* Native dialogs retain focus and history behavior from app.js. */
dialog {
  box-sizing: border-box;
  width: min(1360px, calc(100% - 40px));
  max-width: calc(100% - 40px);
  max-height: 90svh;
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  font-family: Manrope, Arial, sans-serif;
  box-shadow: 0 24px 100px #19191738;
}
dialog::backdrop {
  background: #19191775;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
dialog[open] { animation: shared-modal-enter .32s var(--ease); }
@keyframes shared-modal-enter {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.modal-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 80px;
  padding: 16px 28px;
  border-bottom: 1px solid #19191725;
  background: var(--paper);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .12em;
}
.icon-button,
.icon-button.glass {
  position: relative;
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 11px;
  border: 1px solid #19191745;
  border-radius: 50%;
  background: #ffffff60;
  color: var(--ink);
  box-shadow: inset 0 1px #ffffffb3;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.icon-button .icon { width: 20px; height: 20px; filter: none; }
.icon-button:hover { background: #e6e2d8; border-color: var(--ink); }
dialog :is(button, a, input, textarea):focus-visible,
.detail-page :is(button, a):focus-visible,
.error-page a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* Full-film index: one list, with a subordinate preview beside it. */
.index-dialog { width: min(1280px, calc(100% - 40px)); }
.index-heading { padding: 42px 44px 30px; }
.index-heading h2 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(40px, 5.3vw, 76px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -.065em;
}
.index-heading > p { margin-top: 16px; color: #5a5850; font-size: 14px; line-height: 1.7; }
.index-body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  padding: 4px 44px 44px;
}
.film-list { min-width: 0; }
.film-row {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 104px;
  padding: 22px 0;
  border: 0;
  border-top: 1px solid #19191730;
  background: transparent;
  color: var(--ink);
  text-align: start;
  transition: background .2s ease;
}
.film-row:hover { background: #19191707; }
.row-number { flex-shrink: 0; color: #66635b; font-size: 11px; }
.row-film { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 8px; }
.row-category { color: #5a5850; font-size: 10px; line-height: 1.4; letter-spacing: .11em; text-transform: uppercase; }
.row-title { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -.045em; overflow-wrap: anywhere; }
.row-duration { flex-shrink: 0; color: #5a5850; font-size: 11px; }
.film-row > .icon { flex-shrink: 0; width: 18px; height: 18px; filter: none; }
.index-preview { position: sticky; top: 110px; align-self: start; min-width: 0; padding-top: 16px; }
.index-preview img { display: block; width: 100%; height: auto; aspect-ratio: 1.2; object-fit: cover; border-radius: 2px; }
.index-preview span { display: block; margin-top: 16px; font-size: 14px; line-height: 1.5; }
.index-preview span + span { margin-top: 8px; color: #5a5850; font-size: 10px; line-height: 1.6; letter-spacing: .06em; }
.archive-links { display: flex; flex-wrap: wrap; gap: 18px 24px; padding-top: 26px; border-top: 1px solid #19191730; }
.archive-links > .small-label { width: 100%; color: #5a5850; font-size: 10px; }
.archive-links a { display: inline-flex; align-items: center; gap: 9px; min-height: 32px; font-size: 12px; }
.archive-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.archive-links .icon { width: 15px; height: 15px; filter: none; }

/* Standalone project pages and the same content inside the native viewer. */
.project-page { background: var(--paper); color: var(--ink); color-scheme: light; }
.detail-page { width: 100%; max-width: 1600px; margin: auto; padding: 36px var(--gutter) 80px; }
.back-home { font-size: 13px; }
.back-home .icon { filter: none; }
.detail-content { min-width: 0; padding: 42px 44px 54px; }
.detail-page > .detail-content { padding: 44px 0 0; }
.detail-head { min-width: 0; padding-bottom: 30px; }
.detail-head h1,
.detail-head h2 {
  max-width: 17ch;
  margin: 17px 0 0;
  font-size: clamp(40px, 5.6vw, 82px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.06em;
  overflow-wrap: anywhere;
}
.detail-head :is(h1, h2) em,
.detail-inquiry h3 em,
.inquiry-body h2 em {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-style: italic;
}
.detail-head .small-label { color: #5a5850; }
.detail-duration { display: block; margin-top: 18px; color: #5a5850; font-size: 12px; line-height: 1.5; }
.detail-player { min-width: 0; }
.detail-player video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72svh;
  object-fit: contain;
  background: #090a08;
  border: 0;
}
.detail-player.is-portrait video { max-height: 76svh; }
.player-caption { margin-top: 12px; color: #5a5850; font-size: 10px; line-height: 1.5; letter-spacing: .09em; }
.detail-copy { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 90px); padding: 46px 0; }
.detail-description { max-width: 35ch; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.6; letter-spacing: -.025em; }
.detail-copy > div { min-width: 0; color: #5a5850; font-size: 14px; line-height: 1.8; }
.detail-copy .small-label { margin-bottom: 14px; }
.detail-credit { margin-top: 20px; font-size: 12px; }
.detail-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.detail-gallery button { position: relative; display: block; width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 0; background: transparent; }
.detail-gallery button > img { display: block; width: 100%; height: auto; object-fit: contain; }
.gallery-enlarge,
.gallery-enlarge.glass { position: absolute; right: 15px; bottom: 15px; display: grid; place-items: center; width: 44px; height: 44px; padding: 12px; border: 1px solid #ffffff90; border-radius: 50%; background: #19191745; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 1px #ffffff70; }
.gallery-enlarge .icon { width: 18px; height: 18px; filter: invert(1); }
.detail-inquiry { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 48px; padding: 36px 0; border-block: 1px solid #19191730; }
.detail-inquiry h3 { margin-top: 12px; font-size: clamp(30px, 3vw, 42px); font-weight: 500; line-height: 1.1; letter-spacing: -.05em; }
.detail-next { display: flex; align-items: center; gap: 28px; min-height: 90px; padding-top: 30px; color: var(--ink); }
.detail-next .small-label { flex-shrink: 0; color: #5a5850; }
.detail-next > span:nth-child(2) { flex: 1; min-width: 0; font-size: clamp(22px, 2.5vw, 32px); line-height: 1.2; letter-spacing: -.04em; overflow-wrap: anywhere; }
.detail-next > .icon { width: 22px; height: 22px; filter: none; }
.media-error { margin-top: 14px; padding: 16px; border-left: 3px solid var(--ink); background: #e7e2d3; color: var(--ink); font-size: 14px; line-height: 1.7; }
.media-error a { text-decoration: underline; text-underline-offset: 3px; }

/* Image viewer stays dark so the supplied image, rather than its frame, leads. */
.image-dialog { width: min(1600px, calc(100% - 32px)); height: 90svh; max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); color-scheme: dark; }
.image-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.image-dialog .modal-top { min-height: 76px; background: var(--ink); color: var(--paper); border-color: #f4f2e930; }
.image-dialog .icon-button { border-color: #f4f2e960; background: #ffffff0a; color: var(--paper); box-shadow: inset 0 1px #ffffff35; }
.image-dialog .icon-button:hover { background: #ffffff20; }
.image-dialog .icon { filter: invert(1); }
.image-dialog :is(button, a):focus-visible { outline-color: var(--paper); }
.image-stage { display: grid; min-height: 0; place-items: center; padding: 18px clamp(16px, 3vw, 40px); overflow: hidden; }
.image-stage img { display: block; width: 100%; height: 100%; min-height: 0; max-height: 100%; object-fit: contain; }
.image-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 28px; border-top: 1px solid #f4f2e925; }
.image-bottom p { min-width: 0; max-width: 75ch; color: #dedcd3; font-size: 12px; line-height: 1.6; text-align: center; overflow-wrap: anywhere; }

/* Project inquiry: a compact paper sheet with explicit, local-only actions. */
.inquiry-dialog { width: 620px; max-width: calc(100% - 32px); max-height: 90svh; margin: 5svh 24px 5svh auto; background: var(--paper); color: var(--ink); color-scheme: light; }
.inquiry-body { padding: 30px 36px 34px; }
.inquiry-body h2 { margin: 18px 0 24px; font-size: clamp(48px, 5.2vw, 68px); font-weight: 500; line-height: 1.03; letter-spacing: -.065em; }
.inquiry-intro { color: #5a5850; font-size: 14px; line-height: 1.75; }
.inquiry-intro strong { color: var(--ink); font-weight: 650; }
#brief-form fieldset { margin: 28px 0 24px; padding: 0; border: 0; }
#brief-form legend,
.field-label { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.5; }
.kind-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kind-options label { position: relative; cursor: pointer; }
.kind-options input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
.kind-options span { display: flex; align-items: center; min-height: 44px; padding: 11px 14px; border: 1px solid #19191755; border-radius: 24px; background: transparent; color: var(--ink); font-size: 12px; line-height: 1.5; transition: background .18s ease, border-color .18s ease; }
.kind-options label:hover span { border-color: var(--ink); }
.kind-options input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 650; }
.kind-options input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.field-label { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 0 10px; }
.field-label span { color: #5a5850; font-size: 12px; font-weight: 400; }
#brief-form textarea,
#brief-form input:not([type=radio]) {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  padding: 14px;
  border: 1px solid #19191765;
  border-radius: 3px;
  background: #fffdf7;
  color: var(--ink);
  font-family: Manrope, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  resize: vertical;
}
#brief-form textarea::placeholder,
#brief-form input::placeholder { color: #66635b; opacity: 1; font-size: 16px; }
#brief-form textarea:focus,
#brief-form input:not([type=radio]):focus { border-color: var(--ink); }
.brief-copy { width: 100%; margin-top: 22px; }
.brief-status { min-height: 20px; margin-top: 14px; color: #4b4a43; font-size: 12px; line-height: 1.7; }
#brief-form .brief-output { min-height: 190px; margin-top: 14px; font-size: 16px; }
.discord-next { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding-top: 22px; border-top: 1px solid #19191735; }
.discord-next .small-label { color: #5a5850; font-size: 10px; }
.discord-next p { margin-top: 8px; color: #5a5850; font-size: 12px; line-height: 1.7; }
.discord-next strong { color: var(--ink); font-weight: 650; }
.discord-next a { flex-shrink: 0; gap: 12px; color: var(--ink); font-size: 12px; white-space: nowrap; }
.discord-next .icon { filter: none; }
.privacy-note { margin-top: 20px; color: #5a5850; font-size: 11px; line-height: 1.7; }
.inquiry-reference { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: start; gap: 18px; margin: 28px 0; padding: 18px 0; border-block: 1px solid #19191730; color: #5a5850; font-size: 12px; line-height: 1.6; }
.inquiry-reference > img { display: block; width: 116px; height: auto; aspect-ratio: 2.39; object-fit: cover; }
.inquiry-reference strong { display: block; margin: 4px 0; color: var(--ink); font-size: 14px; font-weight: 650; line-height: 1.5; }
.inquiry-reference button { display: block; min-height: 32px; margin-top: 4px; padding: 6px 0; border: 0; background: transparent; color: var(--ink); font-size: 11px; line-height: 1.5; text-decoration: underline; text-underline-offset: 3px; }

.error-page { max-width: 1400px; margin: auto; padding: 14svh var(--gutter) 10svh; color: var(--ink); }
.error-page > p { font-size: 12px; line-height: 1.5; letter-spacing: .1em; }
.error-page h1 { margin: 38px 0; font-size: clamp(48px, 8vw, 112px); font-weight: 500; line-height: 1.04; letter-spacing: -.065em; }
.noscript-note { padding: 28px var(--gutter); color: var(--ink); font-size: 14px; line-height: 1.9; }
.noscript-note a { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1000px) {
  .index-heading { padding: 34px 30px 26px; }
  .index-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; padding: 4px 30px 34px; }
  .index-preview img { aspect-ratio: .9; }
  .row-title { font-size: 23px; }
  .detail-content { padding: 34px 30px 44px; }
  .detail-copy { gap: 36px; }
}

@media (max-width: 700px) {
  dialog,
  .index-dialog,
  .project-dialog { width: calc(100% - 20px); max-width: calc(100% - 20px); max-height: 90svh; border-radius: 7px; }
  .modal-top { min-height: 70px; gap: 16px; padding: 12px 18px; font-size: 9px; }
  .icon-button { min-width: 44px; min-height: 44px; }
  .index-heading { padding: 30px 20px 24px; }
  .index-heading h2 { font-size: 43px; }
  .index-heading > p { max-width: 28ch; font-size: 13px; }
  .index-body { display: block; padding: 0 20px 30px; }
  .index-preview { display: none; }
  .film-row { gap: 12px; min-height: 92px; padding: 20px 0; }
  .row-title { font-size: 22px; }
  .row-number,
  .row-duration { font-size: 10px; }
  .row-category { font-size: 10px; }
  .film-row > .icon { width: 16px; height: 16px; }
  .archive-links { gap: 14px 20px; }
  .detail-page { padding: 24px var(--gutter) 50px; }
  .detail-content { padding: 30px 20px 36px; }
  .detail-page > .detail-content { padding-top: 32px; }
  .detail-head h1,
  .detail-head h2 { font-size: clamp(37px, 8vw, 52px); line-height: 1.07; }
  .detail-head { padding-bottom: 26px; }
  .detail-duration { font-size: 12px; }
  .detail-player video { max-height: 60svh; }
  .player-caption { font-size: 9px; line-height: 1.6; }
  .detail-copy { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 32px 0; }
  .detail-description { max-width: none; font-size: 22px; line-height: 1.55; }
  .detail-copy > div { font-size: 14px; }
  .detail-gallery { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .gallery-enlarge { right: 12px; bottom: 12px; }
  .detail-inquiry { display: block; margin-top: 34px; padding: 28px 0; }
  .detail-inquiry h3 { margin-bottom: 24px; font-size: 32px; }
  .detail-inquiry .solid-button { width: 100%; }
  .detail-next { flex-wrap: wrap; gap: 14px; padding-top: 28px; }
  .detail-next > .small-label { width: 100%; }
  .detail-next > span:nth-child(2) { font-size: 24px; }
  .image-dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); height: 90svh; }
  .image-dialog .modal-top { min-height: 68px; }
  .image-stage { padding: 12px; }
  .image-bottom { gap: 10px; padding: 12px; }
  .image-bottom p { font-size: 11px; line-height: 1.5; }
  .inquiry-dialog { width: calc(100% - 20px); max-width: calc(100% - 20px); max-height: 90svh; margin: 5svh auto; }
  .inquiry-body { padding: 26px 22px 30px; }
  .inquiry-body h2 { margin: 16px 0 22px; font-size: 54px; }
  .inquiry-intro { font-size: 14px; }
  #brief-form fieldset { margin-top: 26px; }
  .kind-options { gap: 7px; }
  .kind-options span { padding: 10px 12px; font-size: 11px; }
  .field-label { font-size: 13px; }
  .field-label span { font-size: 11px; }
  .brief-copy { padding: 16px 19px; font-size: 13px; }
  .brief-status { font-size: 12px; }
  .discord-next { align-items: start; flex-direction: column; gap: 12px; }
  .discord-next a { font-size: 13px; }
  .privacy-note { font-size: 11px; }
  .inquiry-reference { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; font-size: 11px; }
  .inquiry-reference > img { width: 88px; }
  .inquiry-reference strong { font-size: 13px; }
}

@media (max-width: 360px) {
  .modal-top { padding-inline: 15px; font-size: 8px; }
  .index-heading { padding-inline: 17px; }
  .index-heading h2 { font-size: 40px; }
  .index-body { padding-inline: 17px; }
  .film-row { gap: 10px; }
  .row-title { font-size: 20px; }
  .row-duration { display: none; }
  .detail-content { padding-inline: 17px; }
  .detail-head h1,
  .detail-head h2 { font-size: 37px; }
  .inquiry-body { padding-inline: 18px; }
  .inquiry-body h2 { font-size: 49px; }
  .kind-options span { padding-inline: 10px; }
  .inquiry-reference { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .inquiry-reference > img { width: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: none; }
  .solid-button,
  .underlined,
  .film-row,
  .kind-options span { transition: none; }
}

@media (forced-colors: active) {
  dialog,
  .modal-top,
  .icon-button,
  .kind-options span,
  .solid-button { border: 1px solid CanvasText; }
  .kind-options input:checked + span { border-width: 3px; }
  .image-dialog .icon { filter: none; }
}
