/* ============================================================================
 * Jesper Landberg — 1:1 Faithful Stylesheet
 * Fluid root rem system (--size: 390 mobile / --size: 1500 desktop @ 650px)
 * Font: ABCDiatypePlusVariable
 * ============================================================================ */

@font-face {
  font-family: "ABCDiatype";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../assets/fonts/ABCDiatypePlusVariable.woff2") format("woff2-variations"),
       url("../assets/fonts/ABCDiatypePlusVariable.woff2") format("woff2");
}

:root {
  --size: 390;
  --ease-out-expo: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out-expo: cubic-bezier(0.76, 0, 0.24, 1);
  --color-bg: #000000;
  --color-fg: #ffffff;
  --color-sheet-bg: #ffffff;
  --color-sheet-fg: #000000;
  --color-pill-bg: #eeeeee;
  --color-gold: #d9a441;
}

@media (min-width: 650px) {
  :root {
    --size: 1500;
  }
}

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

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: fixed;
  touch-action: none;
}

html {
  font-size: clamp(5px, calc(10 * 100vw / var(--size)), 20px);
  -webkit-text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-bg);
  color: var(--color-fg);
  font-family: "ABCDiatype", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

::selection {
  background: rgba(255, 255, 255, 0.2);
}

html.grabbable {
  cursor: grab;
}

html.grabbing,
html.grabbing * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Micro uppercase label style matching original .label */
.label {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* ============================================================================
 * 1. Preloader Anchor Bars (5rem x 0.5rem — exact original proportions)
 *    WebGL spawns 3 white pill planes directly on these rects and morphs them
 *    into the 3 visible homepage cards.
 * ============================================================================ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader.is-done {
  visibility: hidden;
}

.preloader-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
}

.preloader-bar {
  width: 5rem;
  height: 0.5rem;
  border-radius: 2rem;
  background: transparent;
}

/* ============================================================================
 * 2. WebGL Stage
 * ============================================================================ */
.gl {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.gl canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================================================
 * 3. Fixed 4-Corner HUD Navigation
 * ============================================================================ */
.hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 4rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.65s var(--ease-out-expo);
}

body.is-ready .hud {
  opacity: 1;
}

@media (min-width: 650px) {
  .hud {
    padding: 4rem 8rem;
  }
}

body.is-sheet-open .hud,
body.is-flying-sheet .hud {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 649px) {
  .hud::before,
  .hud::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    height: 11rem;
    pointer-events: none;
    z-index: -1;
  }
  .hud::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0) 100%);
  }
  .hud::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0) 100%);
  }
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-btn {
  pointer-events: auto;
  position: relative;
  transition: opacity 0.3s var(--ease-out-expo);
}

.hud-btn::before {
  content: "";
  position: absolute;
  inset: -1.5rem;
}

@media (hover: hover) and (pointer: fine) {
  .hud-btn:hover {
    opacity: 0.6;
  }
  .hud-brand:hover {
    opacity: 0.75;
  }
}

.hud-views {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.hud-view-link {
  position: relative;
  opacity: 0.5;
  transition: opacity 0.45s var(--ease-out-expo);
}

.hud-view-link::before {
  content: "";
  position: absolute;
  inset: -1.5rem -0.4rem;
}

.hud-view-link.is-active {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .hud-view-link:hover {
    opacity: 1;
  }
}

.hud-slash {
  opacity: 0.5;
}

/* ============================================================================
 * 4. Featured Carousel Interactive Hit Layer
 * ============================================================================ */
.featured-view {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow: hidden;
  transition: opacity 0.45s var(--ease-out-expo);
}

.featured-view.is-hidden {
  pointer-events: none;
  opacity: 0;
}

.carousel-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.carousel-hit-card {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 1.5rem;
  background: transparent;
  outline: none;
}

@media (min-width: 650px) {
  .carousel-hit-card {
    border-radius: 2rem;
  }
}

.carousel-hit-card:focus,
.carousel-hit-card:focus-visible {
  outline: none;
  box-shadow: none;
}

/* ============================================================================
 * 5. Full Index View
 * ============================================================================ */
.full-view {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out-expo), visibility 0.5s var(--ease-out-expo);
}

.full-view.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.full-cloud {
  position: relative;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: center;
  max-width: 36rem;
  padding: 8rem 2.2rem;
  column-gap: 1.2rem;
  row-gap: 0.6rem;
  text-align: center;
}

@media (min-width: 650px) {
  .full-cloud {
    max-width: 92rem;
    padding: 0 2rem;
    column-gap: 1.8rem;
    row-gap: 0.7rem;
  }
}

.full-item-wrap {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
}

@media (min-width: 650px) {
  .full-item-wrap {
    gap: 1.8rem;
  }
}

.full-item {
  position: relative;
  z-index: 1;
  display: inline-block;
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.32;
  color: #fff;
  cursor: pointer;
  transition: text-shadow 0.3s var(--ease-out-expo);
}

.full-item-title,
.full-dot > span {
  display: inline-block;
  pointer-events: none;
}

@media (min-width: 650px) {
  .full-item {
    font-size: 3rem;
    line-height: 1.38;
  }
}

.full-dot {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.72);
  user-select: none;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out-expo);
}

@media (min-width: 650px) {
  .full-dot {
    font-size: 2.2rem;
  }
}

.full-item.is-hovered {
  z-index: 5;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

/* The preview follows the cursor underneath the index links. */
.full-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: min(18rem, calc(100vw - 2.4rem));
  aspect-ratio: 1.6;
  border-radius: 1rem;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0) scale(0.86);
  transition: opacity 0.35s var(--ease-out-expo);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  background: #111;
  will-change: transform, opacity;
}

@media (min-width: 650px) {
  .full-preview {
    width: clamp(22rem, 21vw, 31rem);
    border-radius: 1.3rem;
  }
}

.full-preview.is-visible {
  opacity: 0.77;
}

@media (prefers-reduced-motion: reduce) {
  .full-preview {
    transition: none;
  }
}

.full-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================================
 * 6. Profile & Newsletter Portal Overlays (Centered inside WebGL Glass Ring)
 * ============================================================================ */
.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out-expo), visibility 0.5s var(--ease-out-expo);
}

.portal-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.portal-content {
  width: min(34rem, calc(100vw - 6rem));
  text-align: center;
  transform: translateY(1.2rem) scale(0.97);
  transition: transform 0.65s var(--ease-out-expo);
}

.portal-overlay.is-active .portal-content {
  transform: translateY(0) scale(1);
}

@media (min-width: 650px) {
  .portal-content--profile {
    width: 46rem;
  }
  .portal-content--newsletter {
    width: 38rem;
  }
}

.portal-bio {
  font-size: 1.35rem;
  line-height: 1.48;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 400;
}

@media (min-width: 650px) {
  .portal-bio {
    font-size: 1.55rem;
    line-height: 1.46;
  }
}

.portal-title {
  margin-bottom: 1rem;
  font-size: 1.7rem;
  font-weight: 500;
}

.portal-bio--translation {
  margin-top: 0.85rem;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.2rem;
}

.portal-focus {
  margin-top: 2.8rem;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.portal-socials {
  margin-top: 2.6rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem 2.2rem;
}

.portal-socials:empty {
  display: none;
}

@media (min-width: 650px) {
  .portal-socials {
    margin-top: 3rem;
  }
}

.portal-social-link {
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  color: #fff;
  transition: opacity 0.3s var(--ease-out-expo);
  position: relative;
}

.portal-social-link::before {
  content: "";
  position: absolute;
  inset: -0.8rem;
}

@media (hover: hover) and (pointer: fine) {
  .portal-social-link:hover {
    opacity: 0.55;
  }
}

/* Newsletter Iridescent Rainbow Border Pill Form */
.newsletter-form {
  margin: 2.6rem auto 0;
  max-width: 28rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
}

@media (min-width: 650px) {
  .newsletter-form {
    max-width: 32rem;
    margin-top: 3rem;
  }
}

.newsletter-input-ring {
  flex: 1;
  position: relative;
  border-radius: 999px;
  padding: 1.5px;
  background: linear-gradient(
    90deg,
    #38bdf8,
    #34d399,
    #facc15,
    #fb7185,
    #a855f7,
    #38bdf8
  );
  background-size: 240% 100%;
  animation: rainbowShift 6s linear infinite;
}

@keyframes rainbowShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 240% 50%;
  }
}

.newsletter-input {
  width: 100%;
  height: 4.2rem;
  border: 0;
  outline: none;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-family: inherit;
  font-size: max(1.35rem, 13px);
  letter-spacing: -0.02em;
  text-align: center;
  padding: 0 2rem;
  caret-color: #fff;
}

.newsletter-input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.newsletter-submit {
  width: 4.2rem;
  height: 4.2rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease-out-expo), opacity 0.3s var(--ease-out-expo);
}

.newsletter-submit svg {
  width: 1.6rem;
  height: 1.6rem;
}

@media (hover: hover) and (pointer: fine) {
  .newsletter-submit:hover {
    transform: scale(1.06);
  }
}

.newsletter-submit:active {
  transform: scale(0.95);
}

.newsletter-status {
  margin-top: 1.4rem;
  min-height: 1.8rem;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.72);
}

.newsletter-status.is-error {
  color: #fda4af;
}

/* ============================================================================
 * 7. Project Detail Sheet (Casa Di Solare Template — Reusable)
 *    The WebGL card itself morphs & expands from its 3D carousel slot into the
 *    white sheet rect; once landed, this crisp DOM sheet reveals seamlessly.
 * ============================================================================ */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background: transparent;
  transition: opacity 0.32s var(--ease-out-expo), visibility 0.32s var(--ease-out-expo);
}

.sheet-wrap.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Peeking adjacent dark sheets on left & right edges (exact match to step_24) */
.sheet-peek {
  display: none;
}

@media (min-width: 650px) {
  .sheet-peek {
    display: block;
    position: fixed;
    top: 8.5rem;
    bottom: 8.5rem;
    width: 3rem;
    background: #333333;
    border-radius: 1.6rem;
    z-index: 51;
    opacity: 0;
    transform: translateX(0);
    transition: transform 0.55s var(--ease-out-expo), background-color 0.3s ease, opacity 0.45s var(--ease-out-expo);
  }

  .sheet-wrap.is-open .sheet-peek {
    opacity: 0.85;
  }

  .sheet-peek--prev {
    left: -0.6rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    transform: translateX(-2rem);
  }

  .sheet-peek--next {
    right: -0.6rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    transform: translateX(2rem);
  }

  .sheet-wrap.is-open .sheet-peek--prev,
  .sheet-wrap.is-open .sheet-peek--next {
    transform: translateX(0);
  }

  .sheet-wrap.is-open .sheet-peek--prev:hover {
    transform: translateX(0.6rem);
    background: #555555;
    opacity: 1;
  }

  .sheet-wrap.is-open .sheet-peek--next:hover {
    transform: translateX(-0.6rem);
    background: #555555;
    opacity: 1;
  }
}

.sheet {
  position: fixed;
  top: 1.5rem;
  bottom: 1.5rem;
  left: 2rem;
  right: 2rem;
  z-index: 52;
  background: var(--color-sheet-bg);
  color: var(--color-sheet-fg);
  border-radius: 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sheet-info,
.sheet-media-viewport,
.sheet-close {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 0.45s var(--ease-out-expo), transform 0.55s var(--ease-out-expo);
}

.sheet-wrap.is-open .sheet-info,
.sheet-wrap.is-open .sheet-media-viewport,
.sheet-wrap.is-open .sheet-close {
  opacity: 1;
  transform: translateY(0);
}

.sheet-wrap.is-open .sheet-media-viewport {
  transition-delay: 0.06s;
}

.sheet.is-switching-next {
  transform: translate3d(-4rem, 0, 0) scale(0.98);
  opacity: 0.4;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.sheet.is-switching-prev {
  transform: translate3d(4rem, 0, 0) scale(0.98);
  opacity: 0.4;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

@media (min-width: 650px) {
  .sheet {
    top: 2rem;
    bottom: 2rem;
    left: 5rem;
    right: 5rem;
    border-radius: 2rem;
    flex-direction: row;
    align-items: stretch;
    gap: 10rem;
    padding-left: 4rem;
    padding-right: 12rem;
  }
}

/* Top-right Black Circular Close Button */
.sheet-close {
  position: absolute;
  top: 1.8rem;
  right: 1.8rem;
  z-index: 10;
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  background: #000;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s var(--ease-out-expo), opacity 0.3s ease;
}

.sheet-close svg {
  width: 1.6rem;
  height: 1.6rem;
}

@media (min-width: 650px) {
  .sheet-close {
    top: 3rem;
    right: 3rem;
    width: 4.5rem;
    height: 4.5rem;
  }
  .sheet-close svg {
    width: 1.8rem;
    height: 1.8rem;
  }
}

@media (hover: hover) and (pointer: fine) {
  .sheet-close:hover {
    transform: scale(1.08) rotate(90deg);
  }
}

/* Left Info Column */
.sheet-info {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4rem 2.2rem 2.4rem;
  flex-shrink: 0;
}

@media (min-width: 650px) {
  .sheet-info {
    flex: 1;
    padding: 4rem 0 3rem;
    height: 100%;
  }
}

.sheet-title {
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.05em;
  color: #000;
  padding-right: 5rem;
}

@media (min-width: 650px) {
  .sheet-title {
    font-size: 4.5rem;
    padding-right: 0;
  }
}

.sheet-description {
  margin-top: 1.5rem;
  max-width: 40rem;
  font-size: 1.4rem;
  line-height: 1.4;
  letter-spacing: -0.035em;
  color: #111;
}

.sheet-description:empty {
  display: none;
}

@media (min-width: 650px) {
  .sheet-description {
    margin-top: 2rem;
    font-size: 1.6rem;
  }
}

.sheet-meta-row {
  margin-top: 2.8rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
}

@media (min-width: 650px) {
  .sheet-meta-row {
    margin-top: 4.5rem;
  }
}

.sheet-ext-btn {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  background: #000;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s var(--ease-out-expo);
}

.sheet-ext-btn svg {
  width: 1.35rem;
  height: 1.35rem;
}

@media (hover: hover) and (pointer: fine) {
  .sheet-ext-btn:hover {
    transform: scale(1.1);
  }
}

.sheet-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.sheet-tag {
  display: inline-flex;
  align-items: center;
  height: 2.8rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  background: var(--color-pill-bg);
  color: #111;
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  transition: background-color 0.25s ease;
}

a.sheet-tag:hover {
  background: #e0e0e0;
}

/* 3D Rotating Gold Award Trophy */
.sheet-award-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  margin-left: 0.2rem;
  cursor: default;
}

.sheet-award-wrap[hidden] {
  display: none;
}

.award-canvas {
  width: 3.6rem;
  height: 3.6rem;
  display: block;
}

.sheet-award-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.6rem);
  transform: translateX(-50%) translateY(0.4rem);
  background: #000;
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out-expo);
}

.sheet-award-wrap:hover .sheet-award-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Bottom-left Circular Scroll Progress Ring */
.sheet-progress {
  display: none;
}

@media (min-width: 650px) {
  .sheet-progress {
    display: block;
    position: absolute;
    left: -1rem;
    bottom: 3rem;
    width: 2.6rem;
    height: 2.6rem;
  }
}

.sheet-progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.sheet-progress-track {
  fill: none;
  stroke: #e4e4e4;
  stroke-width: 1.5;
}

.sheet-progress-arc {
  fill: none;
  stroke: #111111;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 72.26;
  stroke-dashoffset: 72.26;
}

/* Right Infinite-Looping Vertical Media Column */
.sheet-media-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  padding: 0 2.2rem 3rem;
}

@media (min-width: 650px) {
  .sheet-media-viewport {
    flex: none;
    width: 70rem;
    height: 100%;
    padding: 0;
  }
}

.sheet-media-track {
  position: relative;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.sheet-media-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: #f3f3f3;
  overflow: hidden;
  will-change: transform;
}

.sheet-media-item img,
.sheet-media-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile fallback scrolling inside sheet */
@media (max-width: 649px) {
  .sheet {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  .sheet-media-viewport {
    overflow: visible;
    flex: none;
    height: auto;
  }
  .sheet-media-track {
    position: static;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
    padding-bottom: 4rem;
  }
  .sheet-media-item {
    position: static;
    transform: none !important;
  }
}
