/* Kiln Globe — a pottery studio's spring firing, arranged on a turning globe */

:root {
  --clay: #ece4d8;
  --clay-hi: #f5efe6;
  --clay-deep: #e0d3c1;
  --ink: #2b221c;
  --muted: rgba(43, 34, 28, 0.6);
  --line: rgba(43, 34, 28, 0.14);
  --ember: #b4532b;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(18px, 3vw, 40px);
  --card-w: clamp(6.5rem, 11vw, 11rem);
  --radius: 18px;
}

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: radial-gradient(120% 90% at 50% 46%, var(--clay-hi) 0%, var(--clay) 55%, var(--clay-deep) 100%);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ── Chrome ─────────────────────────────────────────── */

.bar,
.foot {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: -0.005em;
  pointer-events: none;
}

.bar { top: var(--gutter); }
.foot { bottom: var(--gutter); color: var(--muted); }

.bar i,
.foot i { font-style: normal; color: var(--ember); padding: 0 0.3em; }

.logo {
  pointer-events: auto;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.logo span { font-style: italic; font-weight: 300; color: var(--ember); margin-left: 0.12em; }

.bar__meta { color: var(--muted); }

/* ── Stage ──────────────────────────────────────────── */

.stage {
  position: fixed;
  inset: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.stage[data-dragging],
.stage[data-dragging] .piece { cursor: grabbing; }

.center {
  position: absolute;
  inset: 0;
  z-index: 500; /* pieces on the far side pass behind the words, near ones in front */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.4rem, 9.6vw, 9.25rem);
  font-variation-settings: "opsz" 144;
  line-height: 0.84;
  letter-spacing: -0.045em;
}

.title span { display: block; }
.title em { font-style: italic; color: var(--ember); letter-spacing: -0.03em; }

.dek {
  width: min(88%, 26rem);
  margin: clamp(18px, 2.4vw, 28px) 0 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.05vw, 1.02rem);
  line-height: 1.45;
  text-wrap: balance;
}

/* ── Globe ──────────────────────────────────────────── */

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

.piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-w);
  aspect-ratio: var(--ratio, 1);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  translate: -50% -50%;
  perspective: 700px;
  cursor: pointer;
  pointer-events: none;
  outline: none;
  opacity: 0;
  will-change: transform, opacity, filter;
  -webkit-tap-highlight-color: transparent;
}

.piece[data-front] { pointer-events: auto; }

.piece__card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #d8c9b5;
  box-shadow:
    0 1px 2px rgba(70, 45, 25, 0.08),
    0 14px 34px -16px rgba(70, 45, 25, 0.42);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.piece__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* A soft light that follows the cursor across the hovered piece */
.piece__card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--lx, 50%) var(--ly, 50%),
    rgba(255, 244, 228, 0.6) 0%,
    rgba(255, 244, 228, 0.16) 22%,
    transparent 56%
  );
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.piece[data-hover] .piece__card::after { opacity: 1; }
.stage[data-dragging] .piece__card::after { opacity: 0; }

.piece:focus-visible .piece__card {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* Name label under the hovered piece */
.tag {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1200;
  padding: 6px 11px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--clay-hi);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: -0.005em;
  pointer-events: none;
  opacity: 0;
  translate: -50% 0;
  transition: opacity 0.22s var(--ease);
}

.tag[data-show] { opacity: 1; }

/* ── Detail ─────────────────────────────────────────── */

.detail {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.detail[hidden] { display: none; }

.detail__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(236, 228, 216, 0.55);
  -webkit-backdrop-filter: blur(26px) saturate(0.8);
  backdrop-filter: blur(26px) saturate(0.8);
  opacity: 0;
}

.detail__frame {
  position: absolute;
  margin: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.detail__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 22px;
  background: #d8c9b5;
  box-shadow: 0 40px 90px -40px rgba(70, 45, 25, 0.55);
}

.detail__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail__hi { opacity: 0; transition: opacity 0.35s var(--ease); }
.detail__hi[data-ready] { opacity: 1; }

.detail__caption {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: calc(100% + 16px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.detail[data-phase="open"] .detail__caption { opacity: 1; transform: none; }
.detail[data-phase="closing"] .detail__caption { opacity: 0; transition-duration: 80ms; }

.detail__caption h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.detail__note,
.detail__count { font-size: 13px; color: var(--muted); }
.detail__count { font-variant-numeric: tabular-nums; }

.detail__close {
  position: absolute;
  left: 50%;
  bottom: var(--gutter);
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 239, 230, 0.6);
  color: var(--ink);
  cursor: pointer;
  translate: -50% 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease), border-color 0.2s;
}

.detail[data-phase="open"] .detail__close { opacity: 1; }
.detail__close:hover { border-color: rgba(43, 34, 28, 0.32); }
.detail__close:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.detail__close span { position: relative; width: 14px; height: 14px; }
.detail__close span::before,
.detail__close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}
.detail__close span::after { transform: rotate(-45deg); }

/* ── Small screens ──────────────────────────────────── */

@media (max-width: 760px) {
  :root {
    --card-w: clamp(5.25rem, 24vw, 7rem);
    --radius: 12px;
  }

  /* A soft veil keeps the headline readable as pieces pass in front */
  .center::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -1;
    width: min(92vw, 23rem);
    height: 15rem;
    background: radial-gradient(closest-side, rgba(245, 239, 230, 0.96), rgba(245, 239, 230, 0.78) 50%, transparent);
    filter: blur(6px);
    transform: translate(-50%, -50%);
  }

  .title { font-size: clamp(3rem, 14vw, 4.2rem); }
  .dek { width: min(80vw, 19rem); font-size: 0.84rem; }
  .bar__meta, .foot__credit { display: none; }
  .foot { justify-content: center; }
  .detail__media { border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .piece__card::after,
  .detail__caption,
  .detail__close,
  .detail__hi { transition: none; }
}
