/*
 * Corporate typeface "TT Norms Pro" (license required).
 * Place the webfont files in a "fonts" folder next to this stylesheet if needed.
 * A locally installed copy of the font is preferred over the web font.
 */
@font-face {
  font-family: "TT Norms Pro";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: local("TT Norms Pro Regular"), local("TTNormsPro-Regular"),
    url("fonts/TTNormsPro-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "TT Norms Pro";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: local("TT Norms Pro Medium"), local("TTNormsPro-Medium"),
    url("fonts/TTNormsPro-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "TT Norms Pro";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local("TT Norms Pro Bold"), local("TTNormsPro-Bold"),
    url("fonts/TTNormsPro-Bold.woff2") format("woff2");
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  /* Colors taken exclusively from the BAUINDUSTRIE corporate design */
  --color-background: #ffffff; /* light page background, blue only in the header */
  --color-brand: #10059f; /* BAUINDUSTRIE brand color */
  --color-accent: #009cde; /* BAUINDUSTRIE accent color */
  --color-secondary-1: #071d49; /* secondary color I, used as text color */
  --color-secondary-2: #2d68c4; /* secondary color II, used for muted text */
  --color-secondary-4: #92c1e9; /* secondary color IV */
  --color-line: #dbe6f3; /* derived from secondary color IV */
  --color-text: var(--color-secondary-1);
  --color-text-muted: var(--color-secondary-2);
  --color-surface-soft: #eef4fb;
  --color-surface-soft-dark: #e3edf8;
  --color-funding-link: #0a3d91;
  --color-text-logo: #333333;
  --color-lightbox-backdrop: rgba(7, 29, 73, 0.96);

  /* The signet angle of the BAUINDUSTRIE logo, repeated in the header facets */
  --signet-angle: 55.3deg;

  --radius: 14px;
  --gap: clamp(14px, 1.6vw, 28px);
  --page-max-width: 1840px;
  --page-padding: clamp(16px, 2.4vw, 40px);
  --logo-row-height: 46px;
  --hover-duration: 0.35s;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-text);
  font-family: "TT Norms Pro", "Helvetica Neue", Helvetica, Arial, system-ui,
    -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

/* Wins over component display rules so the hidden attribute always works */
[hidden] {
  display: none !important;
}

.container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--page-padding);
}

/* Hides content visually while keeping it available to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
/* Header in the brand color with facets at the signet angle, following the key visual */
.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  flex-wrap: wrap;
  padding: clamp(22px, 2.6vw, 44px)
    max(var(--page-padding), calc((100% - var(--page-max-width)) / 2 + 40px));
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(
      var(--signet-angle),
      transparent 56%,
      rgba(45, 104, 196, 0.45) 56%,
      rgba(45, 104, 196, 0.45) 71%,
      transparent 71%
    ),
    linear-gradient(
      calc(-1 * var(--signet-angle)),
      transparent 64%,
      rgba(0, 156, 222, 0.35) 64%,
      rgba(0, 156, 222, 0.35) 78%,
      rgba(45, 104, 196, 0.3) 78%
    ),
    var(--color-brand);
}

/* Accent line along the bottom edge of the header */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  background: var(--color-accent);
}

.site-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
  font-size: clamp(24px, 2.3vw, 40px);
}

.site-subtitle {
  margin: 0;
  padding-bottom: 0.2em; /* sits on the baseline of the title's second line */
  color: #fff;
  opacity: 0.9;
  font-size: clamp(20px, 1.9vw, 32px);
  text-align: right;
}

/* ---------- Cameras ---------- */
.camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: clamp(18px, 2.2vw, 34px);
}

.camera {
  margin: 0;
  min-width: 0;
}

.camera-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 2px 10px;
}

.camera-title {
  font-size: clamp(15px, 1.1vw, 19px);
  font-weight: 600;
}

.camera-timestamp {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Frames are real buttons; reset the UA button styling */
.camera-frame,
.panorama-frame {
  display: block;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-line);
  /* Kept short so the shadow ends before the funding logo below */
  box-shadow: 0 6px 16px -12px rgba(7, 29, 73, 0.4);
  cursor: zoom-in;
  transition: box-shadow var(--hover-duration) ease;
}

.camera-frame:hover,
.camera-frame:focus-visible,
.panorama-frame:hover,
.panorama-frame:focus-visible {
  box-shadow: 0 8px 20px -12px rgba(7, 29, 73, 0.5);
}

.camera-frame:focus-visible,
.panorama-frame:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Slight zoom of the image signals that the frame can be enlarged */
.camera-frame:hover .camera-image,
.camera-frame:focus-visible .camera-image,
.panorama-frame:hover .panorama-canvas,
.panorama-frame:focus-visible .panorama-canvas {
  transform: scale(1.03);
}

/* Fullscreen hint, revealed on hover and keyboard focus */
.camera-fullscreen-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7, 29, 73, 0.78);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity var(--hover-duration) ease,
    transform var(--hover-duration) ease;
}

.camera-fullscreen-hint svg {
  width: 16px;
  height: 16px;
}

.camera-frame:hover .camera-fullscreen-hint,
.camera-frame:focus-visible .camera-fullscreen-hint,
.panorama-frame:hover .camera-fullscreen-hint,
.panorama-frame:focus-visible .camera-fullscreen-hint {
  opacity: 1;
  transform: translateY(0);
}

/* Pictures are stacked: a new one loads progressively on top of the previous */
.camera-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--hover-duration) ease;
}

/* Shown until the first image has loaded, or when no image could be loaded */
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  color: var(--color-secondary-2);
  background: linear-gradient(
    var(--signet-angle),
    var(--color-surface-soft) 0 55%,
    var(--color-surface-soft-dark) 55% 70%,
    var(--color-surface-soft) 70%
  );
}

.camera-placeholder strong {
  font-size: clamp(15px, 1.2vw, 20px);
  color: var(--color-secondary-1);
}

.camera-placeholder span {
  font-size: 13px;
  max-width: 36ch;
}

.camera-placeholder svg {
  width: 44px;
  height: 44px;
}

.camera-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  background: var(--color-surface-soft);
}

/* ---------- Panorama ---------- */
.panorama {
  margin-top: var(--gap);
}

.panorama-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 0 2px 10px;
}

/* Segmented control: Panorama | Lageplan */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 2px;
  background: var(--color-surface-soft);
}

.view-toggle button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.view-toggle button[aria-pressed="true"] {
  background: var(--color-brand);
  color: #fff;
}

.view-toggle button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.panorama-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Same look and zoom affordance as a camera frame, in the panorama's aspect ratio */
.panorama-frame {
  position: relative;
  aspect-ratio: var(--panorama-aspect, 7220 / 2232);
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-line);
  box-shadow: 0 6px 16px -12px rgba(7, 29, 73, 0.4);
  cursor: zoom-in;
  transition: box-shadow var(--hover-duration) ease;
}

.panorama-scroll {
  display: block;
  position: absolute;
  inset: 0;
}

.panorama-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  transition: transform var(--hover-duration) ease;
}

/* Shown only while the panorama strip can be scrolled sideways */
.panorama-scroll-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  padding: 8px;
  border-radius: 999px;
  background: rgba(7, 29, 73, 0.78);
  color: #fff;
  pointer-events: none;
  animation: scroll-hint-nudge 1.6s ease-in-out infinite;
}

.panorama-scroll-hint svg {
  width: 20px;
  height: 20px;
}

@keyframes scroll-hint-nudge {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(calc(-50% + 6px), -50%); }
}

.panorama-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 20px;
  color: var(--color-secondary-2);
  background: linear-gradient(
    var(--signet-angle),
    var(--color-surface-soft) 0 55%,
    var(--color-surface-soft-dark) 55% 70%,
    var(--color-surface-soft) 70%
  );
}

.panorama-placeholder strong {
  font-size: clamp(15px, 1.2vw, 20px);
  color: var(--color-secondary-1);
}

.panorama-placeholder span {
  font-size: 13px;
  max-width: 40ch;
}

.panorama-placeholder svg {
  width: 44px;
  height: 44px;
}

.panorama-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 12px;
}

.button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-brand);
  background: var(--color-brand);
  color: #fff;
  cursor: pointer;
  transition: background var(--hover-duration) ease, color var(--hover-duration) ease;
}

.button:hover:not(:disabled) {
  background: var(--color-secondary-2);
  border-color: var(--color-secondary-2);
}

.button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button--secondary {
  background: transparent;
  color: var(--color-brand);
}

.button--secondary:hover:not(:disabled) {
  background: var(--color-surface-soft);
  color: var(--color-brand);
}

.panorama-status {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  flex: 1 1 40ch;
}

.panorama-status[data-kind="warning"] {
  color: #8a5a00;
}

.panorama-status[data-kind="error"] {
  color: #b3261e;
}

/* ---------- EFRE funding notice ---------- */
.funding {
  margin: var(--gap) auto 0;
  width: min(100%, 820px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.4vw, 36px);
  flex-wrap: wrap;
}

/* The logo combination must not be altered, only scaled */
.funding-logos {
  display: block;
  width: min(100%, 640px);
  height: auto;
  flex: 0 1 640px;
}

.funding-link {
  color: var(--color-funding-link);
  font-weight: 700;
  font-size: clamp(13px, 1vw, 16px);
  text-decoration: none;
  white-space: nowrap;
}

.funding-link:hover {
  text-decoration: underline;
}

/* ---------- Project partners ---------- */
.partners {
  margin-top: var(--gap);
}

.partners-title {
  margin: 0 2px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.logo-panel {
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
  padding: clamp(18px, 1.8vw, 28px) 2px;
}

/* Logos in a responsive grid; each cell centers its logo vertically */
.logo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px clamp(20px, 2.6vw, 48px);
  align-items: center;
  justify-items: center;
}

.logo-grid li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--logo-row-height);
  min-width: 0;
}

.logo-grid a {
  display: flex;
}

/* Role of a project partner, shown over the dimmed logo on hover (no transition on purpose) */
.partner {
  position: relative;
}

.partner::after {
  content: attr(data-role);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--color-secondary-1);
  opacity: 0;
  pointer-events: none;
}

.partner:hover::after {
  opacity: 1;
}

.partner:hover > * {
  opacity: 0.12;
}

.logo-grid--secondary {
  margin-top: clamp(14px, 1.4vw, 22px);
  padding-top: clamp(14px, 1.4vw, 22px);
  border-top: 1px solid var(--color-line);
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

/* Each logo carries its own display height via a size modifier class below */
.logo {
  display: block;
  width: auto;
  height: var(--logo-height, 44px);
  max-width: 100%;
  object-fit: contain;
}

.logo--h32 { --logo-height: 32px; }
.logo--h34 { --logo-height: 34px; }
.logo--h36 { --logo-height: 36px; }
.logo--h38 { --logo-height: 38px; }
.logo--h40 { --logo-height: 40px; }
.logo--h42 { --logo-height: 42px; }
.logo--h46 { --logo-height: 46px; }
.logo--h50 { --logo-height: 50px; }

.client-name {
  color: var(--color-brand);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
}

.text-logo {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.08em;
  color: var(--color-text-logo);
}

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 0; /* the main container already provides the vertical spacing */
  color: var(--color-text-muted);
  font-size: 12px;
}

.site-footer a {
  color: inherit;
}

.about-title {
  margin: 0 2px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.about-text {
  margin: 0 2px;
  max-width: 120ch;
  font-size: 13px;
  line-height: 1.55;
}

/* Two columns: description on the left, legal links bottom-right */
.about {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.about-content {
  flex: 1 1 60ch;
}

.legal-links {
  display: flex;
  gap: 16px;
  margin: 0 2px;
  font-size: 13px;
}

/* ---------- Fullscreen lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--color-lightbox-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vw;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

/* Zoomable pictures: fit first, 1:1 with two-axis scrolling after a click */
.lightbox[data-mode="zoomable"] img {
  cursor: zoom-in;
}

.lightbox--zoomed {
  justify-content: flex-start;
  align-items: flex-start;
  overflow: auto;
  cursor: default;
}

.lightbox--zoomed img {
  flex: none;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  border-radius: 0;
  cursor: zoom-out;
}

.lightbox-hint {
  position: fixed;
  left: 50%;
  bottom: max(2vw, env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

.lightbox-caption {
  position: fixed;
  left: 3vw;
  top: 1.4vw;
  z-index: 1;
  font-size: 15px;
  color: #fff;
}

.lightbox-close {
  position: fixed;
  right: 2vw;
  top: 1.2vw;
  z-index: 1;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
}

.lightbox-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Prevents the page from scrolling behind the open lightbox */
body.lightbox-open {
  overflow: hidden;
}

@media (hover: none) {
  .camera-fullscreen-hint {
    opacity: 0.85;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .camera-frame,
  .camera-image,
  .camera-fullscreen-hint {
    transition: none;
  }

  .panorama-scroll-hint {
    animation: none;
  }

  .camera-frame:hover .camera-image,
  .camera-frame:focus-visible .camera-image,
  .panorama-frame:hover .panorama-canvas,
  .panorama-frame:focus-visible .panorama-canvas {
    transform: none;
  }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  /* Header: title and subtitle stacked */
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 18px var(--page-padding) 22px;
  }

  .site-title {
    font-size: 22px;
  }

  .site-subtitle {
    padding-bottom: 0;
    font-size: 18px;
    text-align: left;
  }

  .camera-grid {
    grid-template-columns: 1fr;
  }

  /* 3) Logos: two to three per row, scaled down a little */
  .logo-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 20px 16px;
  }

  .logo-grid--secondary {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .logo {
    height: calc(var(--logo-height, 44px) * 0.8);
  }

  .client-name {
    font-size: 14px;
  }

  .text-logo {
    font-size: 20px;
  }

  /* Instead of shrinking to a thin strip, the panorama keeps a readable
     height and can be scrolled sideways with a finger */
  .panorama-frame:not(.panorama-frame--map) {
    aspect-ratio: auto;
    height: 220px;
  }

  .panorama-frame--map .panorama-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
  }

  .panorama-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* the arrow icon below indicates scrollability */
  }

  .panorama-scroll::-webkit-scrollbar {
    display: none;
  }

  .panorama-canvas {
    position: static;
    width: auto;
    height: 100%;
    aspect-ratio: var(--panorama-aspect, 7220 / 2232);
  }

  .panorama-frame:hover .panorama-canvas,
  .panorama-frame:focus-visible .panorama-canvas {
    transform: none;
  }
}
