:root {
  color-scheme: dark;
  --line-dark: #0c0b10;
  --line-pink: #ff1278;
  --line-gradient: linear-gradient(112deg, #ed0061, #850080);
  --line-title: "DIN Condensed", "Arial Narrow", Impact, sans-serif;
  --line-ease: cubic-bezier(.22, 1, .32, 1);
  --line-top: max(19px, env(safe-area-inset-top));
  --line-edge: clamp(18px, 3.2vw, 56px);
}

html, body { margin: 0; background: var(--line-dark); }
body { overflow: hidden; }

.case-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100svh;
  height: 100dvh;
}

.case-page > .chrome::before {
  position: absolute;
  z-index: -1;
  inset: calc(-1 * var(--top)) calc(-1 * var(--edge)) auto;
  height: calc(var(--top) + 88px);
  background: linear-gradient(180deg, rgb(0 0 0 / 68%) 0 50%, transparent);
  pointer-events: none;
  content: "";
}

.case-page > .home-footer {
  margin-top: 0;
  padding-block: 10px max(10px, env(safe-area-inset-bottom));
}

.line-case, .line-case * { box-sizing: border-box; }
.line-case {
  position: relative;
  height: 100svh;
  overflow: hidden;
  color: #fff;
  background: var(--line-dark);
  font: 400 16px/1.5 Arial, sans-serif;
}

.case-page > .line-case { height: auto; }
.case-page > .line-case > .line-chrome { display: none; }

.line-case a { color: inherit; text-decoration: none; }
.line-case button { font: inherit; }
.line-case :focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.line-chrome {
  position: absolute;
  z-index: 4;
  inset: var(--line-top) var(--line-edge) auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.line-chrome a { pointer-events: auto; }
.line-back, .line-step, .line-expand {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--line-pink);
  background: rgb(12 11 16 / 85%);
  cursor: pointer;
}

.line-case a.line-back { color: var(--line-pink); }
.line-case svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.line-back:hover, .line-step:hover, .line-expand:hover { color: #fff; background: #991053; }

.line-pill, .line-case button.line-pill {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--line-gradient);
  font: 700 1rem/1 var(--line-title);
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 180ms ease;
}

.line-pill:hover { filter: brightness(1.16); }

.line-pill > span { transform: translateY(.1em); }

@supports (text-box: trim-both cap alphabetic) {
  .line-pill > span {
    text-box: trim-both cap alphabetic;
    transform: none;
  }
}

.line-watch::before {
  width: 8px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  content: "";
}

.line-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: auto hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  animation: line-enter 540ms var(--line-ease) both;
}

.line-track::-webkit-scrollbar { display: none; }
.line-track:focus-visible { outline-offset: -4px; }

@keyframes line-enter {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

.line-track > * { flex-shrink: 0; height: 100%; margin: 0; }
.line-opening { position: relative; width: min(57vw, 110svh); }
.line-opening img, .line-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.line-track figure img { cursor: zoom-in; }
.line-opening img { object-position: 54% center; }

.line-copy {
  display: grid;
  width: clamp(330px, 36vw, 680px);
  place-items: center;
  padding: 72px clamp(28px, 4vw, 76px) 76px;
  overflow-y: auto;
  background: linear-gradient(163deg, #0b1c46 4%, #291936 47%, #701215 100%);
  text-align: center;
}
.line-copy > div { width: min(100%, 440px); }
.line-logo {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 28px;
  background: currentColor;
  clip-path: polygon(4% 2%, 52% 35%, 98% 2%, 98% 98%, 86% 98%, 86% 26%, 52% 53%, 17% 26%, 17% 86%, 66% 86%, 66% 73%, 29% 73%, 29% 62%, 78% 62%, 78% 98%, 4% 98%);
}
.line-copy h1, .line-copy h2 {
  margin: 0;
  color: inherit;
  font: 700 clamp(2rem, 3.4vw, 3.9rem)/1.02 var(--line-title);
  text-transform: uppercase;
}
.line-copy p { margin: 0 0 .75em; font-size: clamp(.85rem, 1.1vw, 1rem); line-height: 1.62; }
.line-copy p.line-chapter { margin: 1.5em 0; font: 700 1.1rem/1.15 var(--line-title); text-transform: uppercase; }
.line-copy .line-watch { margin-top: 21px; }
.line-light { color: #202024; background: #fcfcfc; }
.line-light :focus-visible { outline-color: #202024; }

:where(.bus-case) .line-copy { width: clamp(360px, 71svh, 780px); }
:is(.bus-case, .sogep-case) .line-copy:not(.line-light) { background: #262626; }
:where(.polskibus-case, .sogep-case) .line-copy { width: clamp(360px, calc(100svh * var(--copy-ratio, .75)), 880px); }
.polskibus-case .line-copy:not(.line-light) { background: #d52119; }
:is(.bus-case, .polskibus-case, .sogep-case) .line-copy :is(h1, h2) {
  margin-bottom: clamp(22px, 3.4vh, 38px);
  font-size: clamp(1.6rem, 2.2vw, 2.5rem);
}

.line-image { position: relative; width: calc(100svh * var(--image-ratio)); }
.line-board { background: #fff; }
.line-dark { background: var(--line-dark); }
.line-board img { object-fit: contain; }
.line-track figure .line-expand { position: absolute; right: 20px; bottom: 76px; }

.line-controls, .line-project-return {
  position: absolute;
  z-index: 2;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  min-height: 50px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 999px;
  background: rgb(12 11 16 / 86%);
}

.line-controls {
  right: var(--line-edge);
  gap: 10px;
  padding: 2px 6px;
}

.line-project-return {
  left: var(--line-edge);
  gap: 8px;
  padding: 2px 14px;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}

.line-project-return:hover { background: #991053; }

@media (max-width: 380px) {
  .line-controls { right: 12px; gap: 4px; }
  .line-controls .line-progress { width: 24px; }
  .line-project-return { left: 12px; gap: 6px; padding-inline: 10px; }
}
.line-step { border: 0; color: #fff; background: transparent; }
.line-step:disabled { opacity: .35; cursor: default; background: transparent; }
.line-scroll-hint { display: none; }
.line-progress { width: clamp(55px, 9vw, 150px); height: 2px; overflow: hidden; background: #ffffff52; }
.line-progress span { display: block; width: 100%; height: 100%; background: var(--line-pink); transform: scaleX(var(--line-progress, 0)); transform-origin: left center; }

.line-viewer, .line-viewer::backdrop {
  --viewer-duration: 420;
  --viewer-time: calc(var(--viewer-duration) * 1ms);
  --viewer-ease: cubic-bezier(.42, .04, .24, 1);
}

.line-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  overflow: hidden;
}

.line-viewer[open] { display: grid; place-items: center; }
.line-viewer::backdrop {
  background: rgb(9 7 15 / 72%);
  backdrop-filter: blur(15px);
  opacity: 0;
  transition: opacity var(--viewer-time) var(--viewer-ease);
}
.line-viewer[data-kind="video"]::backdrop { background: #000; backdrop-filter: none; }
.line-viewer.is-visible::backdrop { opacity: 1; }

.line-viewer :is(.line-chrome, .line-close), .line-viewer[data-kind="video"] .line-viewer-content {
  opacity: 0;
  transition: opacity var(--viewer-time) var(--viewer-ease);
}
.line-viewer.is-visible :is(.line-chrome, .line-close), .line-viewer[data-kind="video"].is-visible .line-viewer-content {
  opacity: 1;
}
.line-viewer[data-kind="video"] .line-viewer-content {
  transform: translateY(10px) scale(.985);
  transition: opacity var(--viewer-time) var(--viewer-ease), transform var(--viewer-time) var(--viewer-ease);
}
.line-viewer[data-kind="video"].is-visible .line-viewer-content { transform: none; }

.line-viewer-frame {
  position: relative;
  display: grid;
  width: min(90vw, 1500px);
  max-height: calc(100svh - 124px);
  place-items: center;
}

.line-viewer-content { width: 100%; text-align: center; }
.line-viewer-content img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100svh - 124px);
  margin: auto;
  transform-origin: center;
  object-fit: contain;
}
.line-viewer-content video, .line-viewer-content iframe {
  display: block;
  width: 100%;
  max-height: calc(100svh - 124px);
  margin: auto;
  border: 0;
  background: #000;
}
.line-viewer-content video { aspect-ratio: 2.013; }
.line-viewer-content iframe {
  width: min(100%, calc((100svh - 124px) * 16 / 9));
  aspect-ratio: 16 / 9;
}
.line-viewer-content:has(.line-video-source) iframe {
  width: min(100%, calc((100svh - 160px) * 16 / 9));
}
.line-case .line-video-source {
  display: inline-block;
  margin-top: 12px;
  font-size: .85rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.line-close { position: absolute; z-index: 2; right: 8px; bottom: 8px; }
.line-viewer[data-kind="video"] .line-contact { display: none; }
.line-viewer[data-kind="video"] .line-close {
  position: fixed;
  top: var(--line-top);
  right: var(--line-edge);
  bottom: auto;
}
.line-viewer-note { margin: 0; padding: 2rem; background: #0d0b14; }

@media (max-width: 680px) {
  .line-case { height: 100dvh; }
  .line-opening, .line-image { display: grid; grid-template-rows: 100%; width: auto; }
  .line-track figure img { grid-area: 1 / 1; width: auto; }
  .line-copy { width: min(90vw, 440px); padding-inline: 25px; }
  .line-track figure .line-expand {
    position: sticky;
    grid-area: 1 / 1;
    right: 13px;
    bottom: auto;
    align-self: end;
    justify-self: end;
    margin: 0 13px 76px 0;
  }
  .line-copy h1, .line-copy h2 { font-size: clamp(1.8rem, 8vw, 2.65rem); }

  .line-case button.line-scroll-hint:not([hidden]) {
    position: absolute;
    z-index: 3;
    top: 50%;
    right: var(--line-edge);
    display: grid;
    border: 1px solid var(--line-pink);
    color: #fff;
    background: rgb(12 11 16 / 85%);
    transform: translateY(-50%);
  }
  .line-scroll-hint svg { animation: line-hint-right 1.8s ease-in-out infinite; }
}

@keyframes line-hint-right {
  0%, 70%, 100% { transform: translateX(0); }
  35% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .line-case *, .line-viewer::backdrop { animation: none !important; transition: none !important; }
}
