:root {
  --bg-0: #070708;
  --bg-1: #121210;
  --ink: #e7e1d1;
  --muted: #aaa28f;
  --frame: #3c372f;
  --focus: #d7c8aa;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", serif;
  color: var(--ink);
  background:
    radial-gradient(120vw 90vh at 50% 10%, #171714 0%, #0c0c0d 48%, #080809 100%);
  letter-spacing: 0.015em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background:
    radial-gradient(circle at 20% 80%, #ffffff 0 0.7px, transparent 0.8px),
    radial-gradient(circle at 80% 30%, #ffffff 0 0.7px, transparent 0.8px);
  background-size: 6px 6px, 7px 7px;
}

#app {
  min-height: 100svh;
}

a,
button {
  color: inherit;
  font: inherit;
}

.home {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.home-panel {
  width: min(44rem, 100%);
  text-align: center;
  animation: drift-in 700ms ease-out both;
}

.site-title {
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 9vw, 5.2rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-line {
  margin: 0 auto 2.35rem;
  max-width: 28rem;
  font-size: clamp(1.1rem, 2.7vw, 1.45rem);
  color: var(--muted);
}

.start-button {
  border: 1px solid rgba(215, 200, 170, 0.38);
  background: rgba(18, 18, 16, 0.78);
  color: var(--ink);
  padding: 1rem 2.4rem;
  min-width: min(90vw, 19rem);
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
  letter-spacing: 0.085em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  border-color: rgba(215, 200, 170, 0.62);
  background: rgba(27, 27, 23, 0.86);
}

.start-button:focus-visible,
.ghost-link:focus-visible,
.back-corner:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.painting-view {
  min-height: 100svh;
  padding: clamp(0.8rem, 2.2vw, 2rem);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: clamp(0.7rem, 2vw, 1.4rem);
}

.stage-wrap {
  display: grid;
  place-items: center;
}

.painting-stage {
  position: relative;
  width: min(88vw, 820px);
  aspect-ratio: var(--painting-ratio-number, 3 / 4);
  border: 1px solid var(--frame);
  overflow: hidden;
  background:
    linear-gradient(160deg, #10100f 0%, #0d0d0c 70%, #0a0a09 100%);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.65),
    inset 0 0 0 4px rgba(255, 255, 255, 0.03);
}

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

.painting-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
  color: #cbc3b0;
  background:
    linear-gradient(145deg, #2d2922 0%, #11110f 56%, #090908 100%);
}

.painting-placeholder p {
  margin: 0;
  max-width: 24rem;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
}

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

.apple {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate3d(0, 0, 0);
  transform-origin: center;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.apple-back {
  z-index: 3;
  pointer-events: none;
  opacity: 0.97;
}

.apple-front {
  z-index: 5;
  cursor: grab;
  pointer-events: auto;
}

.apple-front.dragging {
  cursor: grabbing;
}

.clock-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.clock-anchor {
  position: absolute;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}

.clock-draggable {
  position: absolute;
  inset: auto;
  object-fit: cover;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate3d(0, 0, 0) rotate(0deg) skewX(0deg) scale(1, 1);
  transform-origin: top center;
  will-change: transform;
  cursor: grab;
}

.clock-draggable.dragging {
  cursor: grabbing;
}

.painting-meta {
  width: min(88vw, 820px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.painting-caption {
  line-height: 1.1;
}

.painting-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 500;
}

.painting-artist {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.3rem);
}

.ghost-links {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-link {
  display: inline-block;
  border: 1px solid rgba(215, 200, 170, 0.33);
  color: var(--muted);
  text-decoration: none;
  padding: 0.42rem 0.82rem;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.ghost-link:hover {
  border-color: rgba(215, 200, 170, 0.68);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.not-found {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.not-found p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
}

.painting-view--minimal {
  padding: 0;
  display: block;
  background: #050505;
}

.painting-view--minimal .stage-wrap {
  min-height: 100svh;
  padding: 0;
}

.painting-view--minimal .painting-stage {
  width: min(100vw, calc(100svh * var(--painting-ratio-number, 1.778)));
  border: none;
  box-shadow: none;
  background: #000;
}

.painting-view--minimal .painting-image {
  object-fit: cover;
}

.back-corner {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 30;
  border: 1px solid rgba(215, 200, 170, 0.42);
  color: #d5c7aa;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  padding: 0.46rem 0.72rem;
  background: rgba(9, 9, 9, 0.6);
  backdrop-filter: blur(2px);
}

.back-corner:hover {
  border-color: rgba(215, 200, 170, 0.72);
  color: #f0e6d1;
}

@keyframes drift-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .painting-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .ghost-links {
    width: 100%;
    justify-content: flex-start;
  }
}
