:root {
  --bg: #0f0f10;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.13);
  --surface-border: rgba(255, 255, 255, 0.17);
  --surface-hover: rgba(255, 255, 255, 0.14);
  --text: #f7f7f7;
  --text-soft: rgba(247, 247, 247, 0.72);
  --text-muted: rgba(247, 247, 247, 0.46);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
  --dock-bottom: 52px;
  --stage-top: 54px;
  --stage-width: min(1180px, calc(100vw - 72px));
  --stage-height: min(700px, calc(100vh - 198px));
  --pointer-x: 50vw;
  --pointer-y: 50vh;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body.is-preloading {
  overflow: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }

.site-shell {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.background-layer,
.background-overlay,
.fluid-layer,
.popup-scrim,
.loading-screen {
  position: fixed;
  inset: 0;
}

.background-layer {
  z-index: 0;
  overflow: hidden;
}

.background-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: scale(1.08);
  filter: grayscale(1) contrast(1.02);
  animation: bgSettle 2.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.background-overlay {
  z-index: 1;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 255, 255, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(14, 14, 15, 0) 0%, rgba(14, 14, 15, 0.02) 36%, rgba(14, 14, 15, 0.22) 100%);
}

.background-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.16) 0.6px, transparent 0.6px),
    radial-gradient(rgba(0, 0, 0, 0.12) 0.6px, transparent 0.6px);
  background-position: 0 0, 9px 9px;
  background-size: 18px 18px;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.background-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000 100%);
  pointer-events: none;
}

.background-frost {
  position: absolute;
  inset: auto 0 0;
  height: min(48vh, 460px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 1), transparent 78%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1), transparent 78%);
}

.fluid-layer {
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: difference;
  isolation: isolate;
}

.cursor-invert {
  position: absolute;
  width: 36px;
  height: 36px;
  left: calc(var(--pointer-x) - 18px);
  top: calc(var(--pointer-y) - 18px);
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0.96;
  transition: transform 0.18s ease;
  z-index: 10000;
}

.views {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.view {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(28px) scale(0.985);
  transition:
    opacity 0.54s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.54s cubic-bezier(0.16, 1, 0.3, 1);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.view-stage {
  position: absolute;
  top: var(--stage-top);
  left: 50%;
  width: var(--stage-width);
  height: var(--stage-height);
  transform: translateX(-50%);
}

.stage-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.project-card {
  position: absolute;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: cardEnter 1.1s calc(var(--delay, 0) * 1ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.is-preloading .project-card {
  opacity: 0;
  animation: none;
}

body.is-ready .project-card {
  animation: cardEnter 1.1s calc((var(--delay, 0) + 180) * 1ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.project-card-button {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --lift: 0px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 12px;
  transition:
    transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.26s ease,
    border-color 0.26s ease,
    box-shadow 0.26s ease;
  transform: perspective(700px) translateY(var(--lift)) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  will-change: transform;
}

.project-card:hover .project-card-button,
.project-card:focus-within .project-card-button {
  --lift: -3px;
}

.project-img-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0);
  background: rgba(255, 255, 255, 0);
  transition:
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.project-card:hover .project-img-wrap,
.project-card:focus-within .project-img-wrap {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) -55.51%, rgba(0, 0, 0, 0.35) 224.26%);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.project-thumb {
  position: relative;
  overflow: hidden;
  width: 80px;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform-origin: center;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), filter 0.26s ease;
}

.project-card:hover .project-thumb,
.project-card:focus-within .project-thumb {
  transform: scale(1.018);
  filter: brightness(1.02);
}

.project-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-thumb.square { aspect-ratio: 1 / 1; }
.project-thumb.portrait { aspect-ratio: 80 / 83.33; }
.project-thumb.landscape { aspect-ratio: 80 / 53.33; }

.project-title {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 0;
  padding: 3px 10px;
  color: rgba(247, 247, 247, 0.88);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-align: center;
  text-shadow: none;
  white-space: nowrap;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0);
  transition: background 0.22s ease, color 0.22s ease, font-weight 0.22s ease;
}

.project-card:hover .project-title,
.project-card:focus-within .project-title {
  background: #1877f2;
  color: #ffffff;
  font-weight: 500;
}

.list-view-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 60px 48px 140px;
  overflow-y: auto;
}

.panel-list {
  position: relative;
  width: min(600px, calc(100vw - 96px));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 0 0 auto;
  align-self: center;
}

.panel-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) -55.51%, rgba(0, 0, 0, 0.35) 224.26%);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: inherit;
  cursor: pointer;
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.28s ease,
    border-color 0.28s ease;
  opacity: 0;
  animation: panelEnter 0.48s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.panel-card:hover,
.panel-card:focus-visible {
  transform: translateY(-4px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) -55.51%, rgba(0, 0, 0, 0.42) 224.26%);
  border-color: rgba(255, 255, 255, 0.18);
}

.panel-card img {
  width: 136px;
  min-width: 136px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
}

.panel-card-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
}

.panel-card-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-card-title {
  font-size: 20px;
  line-height: 1.22;
  letter-spacing: -0.04em;
}

.panel-card-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-soft);
}

.panel-card-year {
  font-size: 12px;
  color: rgba(247, 247, 247, 0.58);
  letter-spacing: -0.02em;
  justify-self: end;
  text-align: right;
}

.unified-dock {
  position: fixed;
  left: 50%;
  bottom: var(--dock-bottom);
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(24px) saturate(1.45);
  -webkit-backdrop-filter: blur(24px) saturate(1.45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  animation: dockReveal 1s 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.is-preloading .unified-dock {
  opacity: 0;
  animation: none;
}

body.is-ready .unified-dock {
  animation: dockReveal 1s 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dock-nav-item,
.dock-icon-item {
  position: relative;
  border: 0;
  background: transparent;
}

.dock-nav-item {
  padding: 8px 13px;
  border-radius: 12px;
  color: rgba(247, 247, 247, 0.58);
  font: 400 12.5px/1 "Inter", sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-nav-item:hover {
  color: rgba(247, 247, 247, 0.92);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.dock-nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 500;
}

.dock-nav-item.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
}

.dock-icon-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: visible;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-icon-item:hover {
  transform: translateY(-7px) scale(1.11);
}

.dock-icon-item img {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}

.dock-divider {
  width: 1px;
  height: 28px;
  margin: 0 10px 0 6px;
  border-radius: 64px;
  background: rgba(255, 255, 255, 0.16);
}

.dock-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  border-radius: 64px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  font: 500 12px/1.3 "Inter", sans-serif;
  letter-spacing: -0.04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.dock-label::after {
  content: "";
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.96);
}

.dock-nav-item:hover .dock-label,
.dock-icon-item:hover .dock-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.popup-scrim {
  z-index: 400;
  background: rgba(4, 4, 5, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.popup-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.popup-window {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 401;
  width: min(860px, calc(100vw - 40px));
  max-height: min(86vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -47%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-window.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.popup-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(250, 250, 250, 0.92);
}

.tl-btn {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.tl-red { background: #ff5f57; }
.tl-yellow { background: #febc2e; }
.tl-green { background: #28c840; }

.popup-title-text {
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.55);
  letter-spacing: -0.01em;
}

.popup-body {
  overflow: auto;
  display: grid;
  gap: 28px;
  padding: 32px;
}

.popup-hero {
  width: 100%;
  border-radius: 18px;
  object-fit: cover;
  max-height: 360px;
}

.popup-tag {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.42);
}

.popup-title {
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.05em;
  color: #101012;
}

.popup-desc {
  max-width: 700px;
  font-size: 14px;
  line-height: 1.8;
  color: rgba(0, 0, 0, 0.62);
}

.popup-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.popup-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-meta-key {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.36);
}

.popup-meta-value {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.76);
}

.loading-screen {
  z-index: 500;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.08), transparent 32%),
    rgba(9, 9, 10, 0.94);
  transition: opacity 0.54s ease, visibility 0.54s ease;
}

.loading-screen.exiting {
  animation: loadingScreenExit 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loading-screen.exiting .loading-card {
  animation: loadingCardExit 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  display: grid;
  gap: 14px;
  width: min(320px, calc(100vw - 48px));
  text-align: center;
}

.loading-kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(247, 247, 247, 0.42);
}

.loading-title {
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.loading-bar {
  overflow: hidden;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.loading-bar::before {
  content: "";
  display: block;
  width: var(--loading-progress, 0%);
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.98));
  transition: width 0.1s linear;
}

.loading-progress {
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(247, 247, 247, 0.72);
}

@keyframes bgSettle {
  from { transform: scale(1.12); }
  to { transform: scale(1.03); }
}

@keyframes dockReveal {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px)) scale(0.94);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loadingScreenExit {
  0% {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-100%);
    visibility: hidden;
  }
}

@keyframes loadingCardExit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-36px) scale(0.96);
    filter: blur(14px);
  }
}

@media (max-width: 920px) {
  :root {
    --dock-bottom: 24px;
    --stage-top: 42px;
    --stage-width: calc(100vw - 40px);
    --stage-height: calc(100vh - 188px);
  }

  body {
    overflow: auto;
  }

  .views {
    position: relative;
    min-height: 100vh;
    padding-bottom: 124px;
  }

  .view {
    position: relative;
    min-height: calc(100vh - 124px);
    transform: none;
    transition: opacity 0.34s ease;
  }

  .view:not(.active) {
    display: none;
  }

  .view-stage,
  .list-view-shell {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: calc(100vw - 40px);
    max-width: 100%;
    margin: 42px auto 0;
    height: auto;
    min-height: 520px;
  }

  .stage-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 8px;
    align-items: start;
    justify-items: center;
  }

  .project-card {
    position: relative;
    left: auto !important;
    top: auto !important;
    transform: none;
    animation-name: mobileCardEnter;
  }

  body.is-ready .project-card {
    animation-name: mobileCardEnter;
  }

  .project-card-button {
    width: 100%;
  }

  .project-title {
    white-space: normal;
  }

  .panel-list {
    width: min(600px, calc(100vw - 40px));
    gap: 12px;
  }

  .panel-card {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .panel-card img {
    width: 100%;
    min-width: 0;
  }

  .panel-card-year {
    justify-self: auto;
    text-align: left;
  }

  .popup-window {
    width: calc(100vw - 24px);
    max-height: 90vh;
  }

  .popup-body {
    padding: 22px;
    gap: 22px;
  }

  .popup-meta {
    grid-template-columns: 1fr;
  }

  @keyframes mobileCardEnter {
    from {
      opacity: 0;
      transform: translateY(24px) scale(0.94);
      filter: blur(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
      filter: blur(0);
    }
  }
}

@media (max-width: 640px) {
  .unified-dock {
    gap: 0;
    padding: 10px 12px;
    max-width: calc(100vw - 20px);
  }

  .dock-nav-item {
    padding: 8px 10px;
    font-size: 12px;
  }

  .dock-icon-item,
  .dock-icon-item img {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
}

@media (pointer: coarse) {
  .fluid-layer {
    display: none;
  }
}
