/* ============================================================
   Paul Hamilton — Portfolio
   Infinite draggable image grid, dark theme
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.grafwerk-logo {
  position: fixed;
  top: 8px;
  left: clamp(20px, 3.125vw, 32px);
  z-index: 200;
  display: block;
  line-height: 0;
}

.grafwerk-logo img {
  display: block;
  width: auto;
  height: 28px;
}

@media (min-width: 768px) {
  .grafwerk-logo img {
    height: 32px;
  }
}

/* ---------- Hero / grid ---------- */

.hero {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;       /* free 2D dragging on touch */
  user-select: none;
  -webkit-user-select: none;
}

.hero.dragging {
  cursor: grabbing;
}

.grid {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.tile {
  position: absolute;
  overflow: hidden;         /* crops the 9:16 image to a 1:1 square */
  border-radius: 6px;
  background: #141414;
}

.tile img {
  display: block;
  width: 100%;              /* natural 9:16 ratio, top-aligned — bottom gets cropped */
  height: auto;
  pointer-events: none;
}

/* ---------- Detail view ---------- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 50;              /* unter der Navbar (z-index 100) */
  display: none;
}

.detail.open {
  display: block;
}

/* Linke Karte: liegt normal unter dem Bild, faehrt bei Prev/Next darueber */
.detail-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #151515;
  z-index: 2;
  transform: translateX(calc(-1 * var(--panel-w, 420px)));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.detail.card-in .detail-card {
  opacity: 1;
}

.detail.wiping .detail-card {
  z-index: 4;               /* ueber dem Bild waehrend des Wipes */
}

/* FLIP-Klon der angeklickten Kachel — left/top/width/height werden animiert */
.detail-img {
  position: fixed;
  overflow: hidden;         /* Container-Aspect waechst 1:1 -> 9:16 und gibt das Bild frei */
  border-radius: 6px;
  background: #141414;
  z-index: 3;
}

.detail-img img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;     /* fixes Seitenverhaeltnis: Crop haengt nur am Container */
  object-fit: cover;
  object-position: top;
  pointer-events: none;
}

/* Eintretende Elemente: unsichtbar bis die Kaskade sie einblendet */
.d-item {
  opacity: 0;
}

.detail-text {
  position: fixed;
  left: clamp(28px, 4vw, 64px);
  top: 9vh;
  z-index: 5;
  color: #f2f0ec;
}

.detail-text h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: clamp(48px, 6vw, 92px);
  letter-spacing: -0.01em;
  line-height: 1.05;
  white-space: nowrap;
  margin-bottom: 44px;
}

.d-section {
  width: min(340px, 26vw);
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.d-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #f5f3ef;
  margin-bottom: 9px;
}

.d-section p {
  font-size: 13px;
  line-height: 1.62;
  color: rgba(255, 255, 255, 0.58);
}

/* CTA unten links + Pfeile unten rechts der Karte: bleiben verankert */
.d-cta {
  position: fixed;
  left: clamp(28px, 4vw, 64px);
  bottom: 34px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  color: #f2f0ec;
  font-size: 13px;
  text-decoration: none;
  pointer-events: none;     /* aktiv erst mit .ui-live */
  transition: background 0.25s ease;
}

.d-cta:hover {
  background: rgba(255, 255, 255, 0.1);
}

.d-nav {
  position: fixed;
  bottom: 34px;
  right: calc(var(--panel-w, 420px) + 32px);
  z-index: 6;
  display: flex;
  gap: 10px;
}

.d-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  color: #f2f0ec;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  pointer-events: none;     /* aktiv erst mit .ui-live */
  transition: background 0.25s ease;
}

.d-nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.detail-close {
  position: fixed;
  top: 40px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(235, 232, 228, 0.85);
  color: #1a1a1a;
  font-size: 13px;
  cursor: pointer;
  z-index: 6;
  pointer-events: none;     /* aktiv erst mit .ui-live */
  transition: background 0.25s ease;
}

.detail-close:hover {
  background: #ffffff;
}

.detail.ui-live .d-cta,
.detail.ui-live .d-nav button,
.detail.ui-live .detail-close {
  pointer-events: auto;
}

/* Schmale Viewports: Bild oben zentriert, Text darunter, Karte wischt vollflaechig */
@media (max-width: 799px) {
  .detail-card {
    transform: translateX(-100vw);
  }

  .detail-text {
    left: 24px;
    right: 24px;
    top: calc(84px + 46vh + 24px);
    bottom: 88px;
    overflow-y: auto;
  }

  .detail-text h1 {
    font-size: 38px;
    white-space: normal;
    margin-bottom: 24px;
  }

  .d-section {
    width: auto;
  }

  .d-cta {
    left: 24px;
    bottom: 24px;
  }

  .d-nav {
    right: 24px;
    bottom: 24px;
  }

  .detail-close {
    top: 24px;
    right: 24px;
  }
}

/* ---------- Navbar pill ---------- */

.nav {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.35s ease;
}
/* In der Detailansicht ausblenden, damit die Pill nie den Projekttitel ueberlappt */
body:has(.detail.open) .nav { opacity: 0; pointer-events: none; }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 9px 10px 9px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.nav-name {
  color: #f2f0ec;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.25s ease;
}

.nav-burger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-burger span {
  display: block;
  width: 17px;
  height: 1.2px;
  background: #f2f0ec;
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav.open .nav-burger span:nth-child(1) {
  transform: translateY(3.1px) rotate(45deg);
}

.nav.open .nav-burger span:nth-child(2) {
  transform: translateY(-3.1px) rotate(-45deg);
}

/* ---------- Dropdown ---------- */

.nav-dropdown {
  margin-top: 10px;
  min-width: 210px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);

  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.nav.open .nav-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nav-dropdown a {
  display: block;
  padding: 11px 16px;
  border-radius: 14px;
  color: #f2f0ec;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.nav-dropdown a:hover {
  background: rgba(255, 255, 255, 0.09);
}

/* Menuepunkt ohne Verlinkung (z.B. Kontakt): nicht klickbar-aussehend */
.nav-dropdown a.nav-nolink { cursor: default; color: rgba(242, 240, 236, 0.6); }
.nav-dropdown a.nav-nolink:hover { background: transparent; }

@media (max-width: 767px) {
  .nav {
    top: 8px;
    right: 20px;
    left: auto;
    align-items: flex-end;
    transform: none;
  }

  .nav-pill {
    gap: 0;
    padding: 3px 7px;
  }

  .nav-name {
    display: none;
  }

  .nav-dropdown {
    transform-origin: top right;
  }
}

/* ---------- Zurueck-zu-Grafwerk-Ribbon ---------- */
.sc-back {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  color: #f2f0ec;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.25s ease, opacity 0.3s ease;
}
.sc-back:hover { background: rgba(255, 255, 255, 0.1); }
.sc-back svg { width: 15px; height: 15px; }
/* In der Detailansicht ausblenden, damit es Bild/CTA nicht ueberlagert */
body:has(.detail.open) .sc-back { opacity: 0; pointer-events: none; }
