:root {
  --fg: #eef3ff;
  --dim: rgba(238, 243, 255, 0.55);
  --accent: #ff5a1f;
  --bg: #050505;
  --pad: clamp(16px, 2.2vw, 32px);
  --ease: cubic-bezier(0.77, 0, 0.175, 1);
  --display: "Anton", "Impact", sans-serif;
  --ui: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--fg); font-family: var(--ui); }
/* iPhone safe areas (notch / home bar), 0 elsewhere */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
/* iOS Low Power Mode blocks autoplay and draws a big play button over videos: hide it, the poster stays */
video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
video::-webkit-media-controls { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------------- Loader ---------------- */
#loader {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: flex; align-items: flex-end; transition: opacity .8s ease, visibility .8s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; }
.loader-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, transparent, var(--accent));
  transition: width .3s ease;
}
.loader-pct { position: absolute; right: var(--pad); bottom: 28px; font-size: 13px; }

/* ---------------- Header ---------------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(var(--pad) + var(--sat)) calc(var(--pad) + var(--sar)) var(--pad) calc(var(--pad) + var(--sal)); font-size: 13px; font-weight: 500;
  color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.35);  /* solid white, shadow keeps it readable on bright footage */
}
.nav-left, .nav-right { display: flex; gap: clamp(16px, 8vw, 140px); }
.nav-right { justify-content: flex-end; }
.navlink { white-space: nowrap; text-decoration: underline 1px transparent; text-underline-offset: 5px; transition: text-decoration-color .3s; }
.navlink:hover, .navlink.is-active { text-decoration-color: currentColor; }
.navlink sup { font-size: 9px; margin-left: 2px; }
.logo { font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: .02em; line-height: 1.2; }  /* <h1> with the name */

/* ---------------- Stage / sections ---------------- */
#stage { position: fixed; inset: 0; }
.slide {
  position: absolute; inset: 0; overflow: hidden;
  clip-path: inset(100% 0 0 0);
  z-index: 1;
}
.slide.is-active { clip-path: inset(0 0 0 0); z-index: 3; transition: clip-path 1.1s var(--ease); }
.slide.is-active.from-top { }
.slide.is-leaving { clip-path: inset(0 0 0 0); z-index: 2; }
.slide.no-anim { transition: none !important; }

.slide .media {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.15); transition: transform 1.6s var(--ease);
}
.slide.is-active .media { transform: scale(1); }
.slide.is-leaving .media { transform: scale(1.05) translateY(-6%); transition: transform 1.1s var(--ease); }
.slide::after {  /* legibility shade */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.15), rgba(0,0,0,.55));
}

/* animated fallback when media is missing */
.fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--c) 100%, white 25%), transparent 55%),
    radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--c) 100%, black 40%), transparent 60%),
    var(--c);
  background-size: 200% 200%;
  animation: drift 14s ease-in-out infinite alternate;
}
.fallback::before {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 1px, transparent 1px 3px);
}
@keyframes drift { to { background-position: 100% 100%; } }

/* ---------------- Meta (title etc.) ---------------- */
.meta {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--pad);
}
.meta-left, .meta-right { font-size: 15px; font-weight: 500; overflow: hidden; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.4); }
.meta-right { text-align: right; }
.meta-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
#meta-title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(56px, 15vw, 260px); line-height: 1; letter-spacing: -.01em;
  max-width: 78vw; overflow: hidden; padding: .04em 0 .08em; margin-bottom: -.12em;
}
#meta-client { font-size: 13px; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.5); letter-spacing: .12em; text-transform: uppercase; overflow: hidden; }

/* text reveal */
.line { display: inline-block; transform: translateY(110%); }
.meta.show .line { transform: none; transition: transform .9s var(--ease); }
.meta.show #meta-title .line { transition-delay: .25s; }
.meta.show #meta-client .line { transition-delay: .4s; }
.meta.show .meta-left .line, .meta.show .meta-right .line { transition-delay: .35s; }
.meta.hide .line { transform: translateY(-110%); transition: transform .5s var(--ease); }

.cta {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 20px 11px 14px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  backdrop-filter: blur(8px); background: rgba(0,0,0,.18);
  opacity: 0; transform: translateY(12px); transition: opacity .5s, transform .5s var(--ease), background .3s, color .3s;
}
.meta.show .cta { opacity: 1; transform: none; transition-delay: .55s; }
.cta:hover { background: var(--fg); color: #000; }
.cta-icon { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); position: relative; }
.cta[data-kind="video"] .cta-icon::after {
  content: ""; position: absolute; left: 8px; top: 6px;
  border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.cta[data-kind="gallery"] .cta-icon::after {
  content: ""; position: absolute; inset: 6px; border: 1.5px solid #fff; border-radius: 2px;
}

/* ---------------- Bottom ---------------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0 calc(var(--pad) + var(--sar)) calc(14px + var(--sab)) calc(var(--pad) + var(--sal)); }
.progress { display: flex; gap: 6px; margin-bottom: 12px; }
.progress button { flex: 1; height: 14px; position: relative; }
.progress button::before, .progress button i {
  content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: rgba(255,255,255,.25);
}
.progress button i { right: auto; width: 0; background: var(--accent); }
.progress button.done i { width: 100%; }
.progress button:hover::before { background: rgba(255,255,255,.6); }
.foot { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.4); }
.foot-links { display: flex; gap: 24px; }
.foot-links a:hover { color: var(--accent); }

/* ---------------- Panels (Portfolio / About / Contact) ---------------- */
.panel {
  position: fixed; inset: 0; z-index: 35; overflow-y: auto;
  background: rgba(5,5,5,.94); backdrop-filter: blur(14px);
  clip-path: inset(0 0 100% 0); transition: clip-path .9s var(--ease); visibility: hidden;
}
.panel.open { clip-path: inset(0 0 0 0); visibility: visible; }
.panel:not(.open) { transition: clip-path .9s var(--ease), visibility 0s .9s; }
.panel-inner { padding: 120px var(--pad) 140px; }
.panel-inner.narrow { max-width: 1100px; margin: 0 auto; }
.panel-title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(56px, 11vw, 180px); line-height: .9; margin-bottom: 48px;
}
.big-text { font-size: clamp(20px, 2.6vw, 36px); line-height: 1.3; max-width: 30ch; }
#about-text { white-space: pre-line; font-size: clamp(16px, 1.4vw, 22px); line-height: 1.5; max-width: 60ch; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.card { display: block; text-align: left; }
.card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #111; }
.card-media > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease), opacity .4s ease; }
.card:hover .card-media > * { transform: scale(1.06); }
.card-row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; }
.card-row h3 { font: inherit; font-weight: 600; }
.card-row span { color: var(--dim); }
.card-desc { margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--dim); max-width: 48ch; }

.contact { display: flex; flex-direction: column; gap: 22px; }
.contact a.big { font-family: var(--display); font-size: clamp(32px, 6vw, 88px); text-transform: uppercase; line-height: 1; }
.contact a.big:hover { color: var(--accent); }
.contact .socials { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 20px; font-size: 15px; }
.contact .socials a { border-bottom: 1px solid var(--dim); }

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .50); backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s;
}
.lightbox.open { opacity: 1; visibility: visible; transition: opacity .5s; }
/* --ar is set from the film's real size in main.js, so the player hugs the frame (no black bars) */
.lb-body { --ar: 1.7778; width: min(92vw, calc(82vh * var(--ar))); aspect-ratio: var(--ar); display: flex; align-items: center; justify-content: center; }
.lb-body video, .lb-body iframe { width: 100%; height: 100%; border: 0; background: #000; }
.lb-body.gallery { aspect-ratio: auto; width: 92vw; height: 82vh; }
.lb-body video { object-fit: contain; }
.lb-body.gallery img { max-width: 100%; max-height: 100%; object-fit: contain; animation: fadeIn .5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: scale(.98); } }
.lb-close { position: absolute; top: var(--pad); right: var(--pad); font-size: 13px; font-weight: 500; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 28px; padding: 20px; opacity: .7; }
.lb-nav:hover { opacity: 1; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lightbox:not(.is-gallery) .lb-nav, .lightbox:not(.is-gallery) .lb-count { display: none; }
.lb-count { position: absolute; bottom: var(--pad); font-size: 12px; color: var(--dim); }

/* ---------------- Cinema (full-screen film player) ---------------- */
.cinema {
  position: fixed; inset: 0; z-index: 70; background: #000; overflow: hidden;
  opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s .6s;
}
.cinema.open { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.cin-stage, .cin-stage video, .cin-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cin-stage video { object-fit: cover; cursor: pointer; }
.cinema.is-embed .cin-controls { display: none; }         /* YouTube / Vimeo use their own controls */
.cinema.is-embed .cin-top { pointer-events: none; }
.cinema.is-embed .cin-top button { pointer-events: auto; }

.cin-top, .cin-controls { position: absolute; left: 0; right: 0; padding: var(--pad) calc(var(--pad) * 1.6 + var(--sar)) var(--pad) calc(var(--pad) * 1.6 + var(--sal)); transition: opacity .5s ease, transform .5s var(--ease); }
.cin-top { padding-top: calc(var(--pad) + var(--sat)); }
.cin-controls { padding-bottom: calc(var(--pad) + var(--sab)); }
.cin-top {
  top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  background: linear-gradient(rgba(0,0,0,.45), transparent);
}
.cin-controls { bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); padding-top: 60px; }
.cinema.idle .cin-top { opacity: 0; transform: translateY(-10px); }
.cinema.idle .cin-controls { opacity: 0; transform: translateY(10px); }
.cinema.idle { cursor: none; }

.cin-back { justify-self: start; font-size: 13px; font-weight: 500; opacity: .8; }
.cin-back:hover { opacity: 1; }
.cin-title { text-align: center; }
.cin-title h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(28px, 3.2vw, 48px); line-height: 1; padding-bottom: .05em; }
.cin-title p { font-size: 14px; color: rgba(255,255,255,.8); margin-top: 6px; }
.cin-next { justify-self: start; margin-left: clamp(16px, 4vw, 60px); text-align: left; font-size: 13px; line-height: 1.3; }
.cin-next small { display: block; font-size: 10px; color: var(--dim); }
.cin-next span::after { content: " ›"; }
.cin-next:hover span { color: var(--accent); }

.cin-scrub { position: relative; height: 16px; cursor: pointer; }
.cin-scrub > div { position: absolute; left: 0; top: 7px; height: 2px; }
.cin-scrub::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: rgba(255,255,255,.2); }
.cin-buf { background: rgba(255,255,255,.45); width: 0; }
.cin-played { background: var(--accent); width: 0; }
.cin-played i { position: absolute; right: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .2s; }
.cin-scrub:hover .cin-played i, .cin-scrub.dragging .cin-played i { transform: scale(1); }
.cin-scrub:hover::before, .cin-scrub:hover > div { height: 4px; top: 6px; }

.cin-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 10px; }
.cin-time { font-size: 13px; font-variant-numeric: tabular-nums; }
.cin-right { display: flex; justify-content: flex-end; gap: 8px; }
.cin-btn {
  width: 34px; height: 34px; border-radius: 4px; background: rgba(255,255,255,.08);
  background-repeat: no-repeat; background-position: center; background-size: 18px;
  transition: background-color .2s;
}
.cin-btn:hover { background-color: rgba(255,255,255,.2); }
.cin-play { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 4l13 8-13 8z'/%3E%3C/svg%3E"); }
.cinema.playing .cin-play { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 4h4v16H6zM14 4h4v16h-4z'/%3E%3C/svg%3E"); }
.cin-mute { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='white'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M19 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E"); }
.cinema.muted .cin-mute { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='white'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6'/%3E%3C/svg%3E"); }
.cin-fs { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E"); }

/* film carousel (projects with several films) */
.cin-carousel {
  position: absolute; right: calc(var(--pad) * 1.6); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  max-height: 64vh; overflow-y: auto; scrollbar-width: none;
  transition: opacity .5s ease, transform .5s var(--ease);
}
.cin-carousel::-webkit-scrollbar { display: none; }
.cinema.idle .cin-carousel { opacity: 0; transform: translate(10px, -50%); pointer-events: none; }
.cin-carousel button {
  position: relative; flex: none; width: 88px; aspect-ratio: 16/9; overflow: hidden; background: #111;
  opacity: .45; transition: opacity .3s, box-shadow .3s;
}
.cin-carousel button:hover { opacity: .85; }
.cin-carousel button.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.cin-carousel img, .cin-carousel video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cin-carousel span { display: grid; place-items: center; height: 100%; font-size: 14px; }
.cin-carousel em {
  position: absolute; left: 5px; bottom: 3px; font-style: normal; font-size: 10px; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* ---------------- Legal pages (Impressum) ---------------- */
html.legal, html.legal body { height: auto; overflow: auto; }
.legal-page { max-width: 760px; margin: 0 auto; padding: 140px var(--pad) 80px; }
.legal-page .panel-title { margin-bottom: 40px; }
.legal-page section { margin-bottom: 32px; }
.legal-page h2 { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.legal-page p { font-size: 16px; line-height: 1.6; }
.legal-page a { border-bottom: 1px solid var(--dim); }
.legal-page a:hover { color: var(--accent); }
.legal-foot { display: flex; justify-content: space-between; gap: 16px; padding: 0 var(--pad) 20px; font-size: 11px; }
.legal-foot .foot-links a:hover { color: var(--accent); }

/* ---------------- Mobile ---------------- */
@media (max-width: 720px) {
  .top { grid-template-columns: 1fr auto; row-gap: 10px; }
  .logo { grid-column: 1; grid-row: 1; justify-self: start; font-size: 19px; white-space: nowrap; }
  .nav-left { grid-column: 1 / -1; grid-row: 2; gap: 20px; }
  .nav-right { grid-column: 2; grid-row: 1; gap: 20px; }
  .meta { grid-template-columns: 1fr 1fr; align-content: center; row-gap: 24px; }
  .meta-center { grid-column: 1 / -1; grid-row: 1; }
  .meta-left, .meta-right { grid-row: 2; font-size: 13px; }
  #meta-title { max-width: 92vw; }
  .foot-links, .foot-hint { display: none; }
  .cin-top { grid-template-columns: auto 1fr; gap: 16px; }
  .cin-title { text-align: right; }
  .cin-next { display: none; }
  .cin-carousel { top: auto; bottom: 110px; transform: none; right: var(--pad); left: var(--pad); flex-direction: row; justify-content: flex-end; align-items: flex-end; overflow-x: auto; max-height: none; }
  .cinema.idle .cin-carousel { transform: translateY(10px); }
  .cin-carousel button { width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
