/* Work page: the page head, the reel wall and the viewer. Tokens come from tokens.css. */

/* ---------- Page head ---------- */
.workhead { padding-block: calc(84px + var(--s-9)) var(--s-7); }
.workhead__inner { display: grid; gap: var(--s-5); }
.workhead__label {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: var(--text-3);
}
.workhead__title { font-size: clamp(2.8rem, 1.6rem + 5vw, 6rem); line-height: 0.98; }
.workhead__lead { max-width: 56ch; color: var(--text-2); font-size: var(--fs-lead); text-wrap: pretty; }

/* ---------- Reel wall ---------- */
.reelsec { padding-block: var(--s-6) var(--section-y); }
.reelsec__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-3) var(--s-6);
  margin-bottom: var(--s-6); padding-bottom: var(--s-4); border-bottom: 1px solid var(--line);
}
.reelsec__title { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-h3); line-height: 1.1; }
.reelsec__note { max-width: 60ch; font-size: var(--fs-small); color: var(--text-2); }

.reels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 280px)); justify-content: start; gap: var(--s-6) var(--s-4); }
.reels__empty { color: var(--text-2); }
/* wide films: 16:9 cards, two to a row */
.reelsec--films { padding-top: 0; }
.reels--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reel--wide .reel__frame { aspect-ratio: 16 / 9; }

.reel {
  display: grid; gap: var(--s-3); padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.reel__frame {
  position: relative; display: block; overflow: hidden; aspect-ratio: 9 / 16;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color var(--t-base) ease, transform var(--t-base) var(--ease-out);
}
.reel__poster, .reel__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel__poster { transition: transform var(--t-slow) var(--ease-out); }
.reel__preview { opacity: 0; transition: opacity var(--t-base) ease; }
.reel.is-previewing .reel__preview { opacity: 1; }
.reel__play {
  position: absolute; left: var(--s-3); bottom: var(--s-3); display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(5, 6, 8, 0.72); color: var(--text);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, opacity var(--t-fast) ease;
}
.reel__play svg { width: 16px; height: 16px; fill: currentColor; }
.reel__caption { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding-inline: var(--s-1); }
.reel__brand { font-family: var(--font-display); font-size: 1.375rem; line-height: 1.1; }
.reel__piece {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: var(--text-3); white-space: nowrap;
}
.reel:hover .reel__frame { border-color: var(--line-strong); transform: translateY(-4px); }
.reel:hover .reel__poster { transform: scale(1.03); }
.reel:hover .reel__play { background: var(--text); color: var(--text-inverse); }
.reel.is-previewing .reel__play { opacity: 0; }
.reel:active .reel__frame { transform: translateY(-1px); }
.reel:focus-visible { outline: none; }
.reel:focus-visible .reel__frame { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Pricing on request ---------- */
.ask { padding-block: var(--s-8); border-top: 1px solid var(--line); background: var(--bg-raised); }
.ask__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-5) var(--s-7); }
.ask__title { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-h3); line-height: 1.1; }
.ask__text { margin-top: var(--s-2); color: var(--text-2); }

/* ---------- Viewer ---------- */
html.viewer-open { overflow: hidden; }
.viewer {
  width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--text);
}
.viewer::backdrop { background: var(--bg); }
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.viewer__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-4) clamp(1rem, 3vw, 2.5rem);
}
.viewer__count { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono); color: var(--text-3); }
.viewer__body {
  display: grid; grid-template-columns: auto auto minmax(0, 440px) auto; justify-content: center; align-items: center;
  gap: clamp(1rem, 3vw, 3rem); min-height: 0; padding: 0 clamp(1rem, 3vw, 2.5rem) var(--s-6);
}
.viewer__film { height: 100%; min-height: 0; display: grid; align-items: center; }
.viewer__frame {
  position: relative; height: 100%; max-height: 100%; aspect-ratio: 9 / 16; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #000;
}
.viewer__video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.viewer__wait {
  position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid var(--line-strong); border-top-color: var(--text); border-radius: 50%;
  opacity: 0; pointer-events: none; animation: viewer-spin 0.8s linear infinite;
}
.viewer.is-waiting .viewer__wait { opacity: 1; }
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.viewer__btn {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: none; color: var(--text); cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.viewer__btn:hover { background: var(--surface-hover); border-color: var(--text-3); }
.viewer__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewer__btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.viewer.is-single .viewer__nav { visibility: hidden; }
/* a wide film: the frame is sized by its width, and the panel beside it is narrower */
.viewer.is-wide .viewer__body { grid-template-columns: auto minmax(0, 1fr) minmax(0, 380px) auto; justify-content: stretch; max-width: 1640px; margin-inline: auto; width: 100%; }
.viewer.is-wide .viewer__film { justify-items: center; }
.viewer.is-wide .viewer__frame { width: 100%; height: auto; max-height: 100%; aspect-ratio: 16 / 9; }

/* the panel beside the film */
.viewer__panel {
  display: grid; align-content: start; gap: var(--s-5);
  max-height: 100%; overflow-y: auto; padding: var(--s-2) var(--s-2) var(--s-2) 0; scrollbar-width: thin;
}
.viewer__spec {
  justify-self: start; padding: var(--s-1) var(--s-3);
  border: 1px solid var(--warn-line, rgba(242, 196, 109, 0.5)); border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: #f2c46d;
}
.viewer__brand {
  margin-bottom: calc(var(--s-4) * -1);
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: var(--text-3);
}
.viewer__title { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); line-height: 1; }
.viewer__desc { color: var(--text-2); font-size: var(--fs-lead); text-wrap: pretty; }
.viewer__block { display: grid; gap: var(--s-3); }
.viewer__label {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: var(--text-3);
}
.viewer__block[hidden] { display: none; }
/* the style sheet: one big picture in the panel, pressed to see it larger */
.sheet {
  display: block; width: 100%; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-raised);
  transition: border-color var(--t-fast) ease;
}
.sheet:hover { border-color: var(--line-strong); }
.sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet__img { display: block; width: 100%; height: auto; }
.zoom {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  padding: var(--s-8) clamp(1rem, 3vw, 2.5rem) var(--s-5); background: var(--bg);
}
.zoom[hidden] { display: none; }
.zoom__close { position: absolute; top: var(--s-4); right: clamp(1rem, 3vw, 2.5rem); }
.zoom__figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: var(--s-4); height: 100%; min-height: 0; }
.zoom__img { align-self: center; width: auto; max-width: 100%; height: auto; max-height: 100%; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-lg); }
.zoom__text { max-width: 60ch; font-size: var(--fs-small); color: var(--text-2); text-align: center; }
/* the facts: four small label-and-value pairs, two to a row */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-5); padding-block: var(--s-4); border-block: 1px solid var(--line); }
.facts__row { display: grid; gap: 2px; }
.facts dt {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-mono);
  text-transform: uppercase; color: var(--text-3);
}
.facts dd { font-size: var(--fs-small); color: var(--text); }
.viewer__notice { font-size: var(--fs-small); color: var(--text-2); }
.viewer__ask { justify-self: start; }

/* ---------- Enquiry box ---------- */
.askbox {
  width: min(560px, calc(100% - 2rem)); max-height: calc(100% - 2rem); margin: auto; padding: var(--s-6);
  overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--bg-raised); color: var(--text);
}
.askbox::backdrop { background: rgba(5, 6, 8, 0.82); }
.askbox[open] { display: grid; gap: var(--s-4); }
.askbox__close { position: absolute; top: var(--s-4); right: var(--s-4); width: 40px; height: 40px; }
.askbox__title { padding-right: var(--s-8); font-family: var(--font-display); font-weight: 400; font-size: var(--fs-h3); line-height: 1.1; }
.askbox__lead { color: var(--text-2); font-size: var(--fs-small); }
.askbox__about {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
}
.askbox__about[hidden] { display: none; }
.askbox__thumb { flex: none; width: 54px; height: 96px; object-fit: cover; border-radius: var(--r-sm); }
.askbox__aboutText { display: grid; gap: var(--s-1); min-width: 0; }
.askbox__film { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.askbox__spec { font-size: var(--fs-small); color: var(--text-2); }
.askbox__form { gap: var(--s-4); margin-top: var(--s-2); }
.askbox__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.askbox__form .form__foot { flex-direction: column; align-items: flex-start; }
.input--area { height: auto; min-height: 7rem; padding-block: var(--s-3); line-height: 1.5; resize: vertical; }

@media (prefers-reduced-motion: reduce) {
  .reel__frame, .reel__poster { transition: none; }
  .viewer__wait { animation: none; }
}

@media (min-width: 640px) {
  .nav__links a[aria-current="page"] { color: var(--text); }
}

/* ---------- Viewer on small screens ---------- */
@media (max-width: 959px) {
  /* on phones and tablets the viewer is one scrolling column: the film, then its panel; the arrows sit on the film's edges */
  .viewer__body { position: relative; display: block; overflow-y: auto; padding: 0 var(--s-4) var(--s-7); }
  .viewer__film { height: auto; justify-items: center; }
  .viewer__frame { height: auto; width: min(100%, 38vh); }
  .viewer__panel { max-height: none; overflow: visible; margin-top: var(--s-6); padding: 0; text-align: center; }
  .viewer__spec, .viewer__ask { justify-self: center; }
  .viewer__nav { position: absolute; top: calc(min(100vw - 2rem, 38vh) * 16 / 18 - 22px); z-index: 1; background: rgba(5, 6, 8, 0.72); }
  .viewer__nav[data-viewer-prev] { left: var(--s-2); }
  .viewer__nav[data-viewer-next] { right: var(--s-2); }
  .viewer.is-wide .viewer__body { display: block; max-width: none; }
  .viewer.is-wide .viewer__frame { width: 100%; }
  .viewer.is-wide .viewer__nav { top: calc((100vw - 2rem) * 9 / 32 - 22px); }
}

/* ---------- Phone ---------- */
@media (max-width: 639px) {
  .askbox { padding: var(--s-5); }
  .askbox__pair { grid-template-columns: minmax(0, 1fr); }
  .askbox__form .form__foot { align-items: stretch; }
  .askbox__form .form__foot .btn { justify-content: center; }
  .workhead { padding-block: calc(64px + var(--s-8)) var(--s-6); text-align: center; }
  .workhead__inner { justify-items: center; }
  .reelsec__head { justify-content: center; text-align: center; }
  .reels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--s-3); }
  /* a wide film takes the full width; a reel on its own sits in the middle at a comfortable size */
  .reels.reels--wide { grid-template-columns: minmax(0, 1fr); }
  .reels:not(.reels--wide) > .reel:only-child { grid-column: 1 / -1; justify-self: center; width: min(100%, 280px); }
  .reel__caption { flex-direction: column; align-items: center; gap: var(--s-1); text-align: center; }
  .reel__brand { font-size: 1.25rem; }
  .reel__play { width: 36px; height: 36px; }
  .ask__inner { flex-direction: column; text-align: center; }
}
