@font-face {
  font-family: 'Petrona';
  src: url('/static/font/Petrona-VariableFont_wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
}

@font-face {
  font-family: 'Petrona';
  src: url('/static/font/Petrona-Italic-VariableFont_wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
}

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

:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: rgba(0, 0, 0, 0.3);
  --border: rgba(0, 0, 0, 0.12);
  --search-bg: rgba(0, 0, 0, 0.04);
  --icon-filter: none;
  --icon-shadow: drop-shadow(0 1px 3px rgba(0,0,0,0.18));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --muted: rgba(255, 255, 255, 0.3);
    --border: rgba(255, 255, 255, 0.12);
    --search-bg: rgba(255, 255, 255, 0.06);
    --icon-filter: invert(1);
    --icon-shadow: drop-shadow(0 1px 3px rgba(255,255,255,0.12));
  }
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Petrona', system-ui, serif;
  overflow: hidden;
}

/* ── top bar ── */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 10;
  background: var(--bg);
}

#wordmark {
  font-size: 18px;
  letter-spacing: 0.06em;
  font-weight: 500;
}

#unit-toggle {
  display: flex;
  gap: 4px;
}

.unit-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 16px;
  padding: 4px 12px;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.unit-btn.active {
  border-color: var(--fg);
  color: var(--fg);
}

/* ── landing ── */
#landing {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  z-index: 1;
  transition: opacity 0.4s;
  pointer-events: none;
  padding: 0 48px;
}

#landing.hidden {
  opacity: 0;
  pointer-events: none;
}

#landing-heading {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  text-align: left;
  max-width: 480px;
  line-height: 1.4;
}

#landing-sub {
  font-size: 24px;
  color: var(--muted);
  text-align: left;
  margin-top: 16px;
  letter-spacing: 0.03em;
}

#landing-hand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-bottom: 32px;
}

#landing-hand .dim-height {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

#landing-hand .dim-width {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ── gallery ── */
#gallery {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  bottom: 160px;
  display: flex;
  flex-direction: row;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#gallery::-webkit-scrollbar {
  display: none;
}

/* ── piece ── */
.piece {
  min-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  flex-shrink: 0;
  position: relative;
}

/* ── width callout above painting ── */
.dim-width {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.dim-width-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.dim-width-line {
  position: relative;
  height: 6px;
  display: flex;
  align-items: center;
}

.dim-width-line::before,
.dim-width-line::after {
  content: '';
  position: absolute;
  width: 1px;
  height: 6px;
  background: var(--muted);
  transition: background 0.2s;
}

.dim-width-line::before { left: 0; }
.dim-width-line::after  { right: 0; }

.dim-width-line-inner {
  width: 100%;
  height: 1px;
  background: var(--muted);
  transition: background 0.2s;
}

/* ── height callout left of painting ── */
.dim-height {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
}

.dim-height-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: color 0.2s;
}

.dim-height-line {
  position: relative;
  width: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dim-height-line::before,
.dim-height-line::after {
  content: '';
  position: absolute;
  height: 1px;
  width: 6px;
  background: var(--muted);
  transition: background 0.2s;
}

.dim-height-line::before { top: 0; }
.dim-height-line::after  { bottom: 0; }

.dim-height-line-inner {
  height: 100%;
  width: 1px;
  background: var(--muted);
  transition: background 0.2s;
}

/* ── piece row ── */
.piece-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.painting-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dim-height {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  align-self: flex-end;
}
/* ── painting wrap ── */
.painting-wrap {
  position: relative;
  cursor: none;
  background: transparent;
  overflow: visible;
}

.painting-img {
  display: block;
  object-fit: contain;
  transition: opacity 0.2s;
  background: transparent;
}

/* hover active class — applied via JS, works for both mouse and touch */
.painting-wrap.hovered .painting-img {
  opacity: 0.4;
}

.piece.hovered .dim-width-text,
.piece.hovered .dim-height-text {
  color: var(--fg);
  font-weight: 600;
}

.piece.hovered .dim-width-line-inner,
.piece.hovered .dim-height-line-inner {
  background: var(--fg);
}

.piece.hovered .dim-width-line::before,
.piece.hovered .dim-width-line::after,
.piece.hovered .dim-height-line::before,
.piece.hovered .dim-height-line::after {
  background: var(--fg);
}

/* ── clear button ── */ 

.btn-clear {
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  font-size: 12px;
  font-family: inherit;
  color: rgba(180, 0, 0, 0.6);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.btn-clear:hover {
  color: rgba(180, 0, 0, 1);
}

/* ── piece info ── */
.piece-info {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}

.piece-title {
  font-size: 16px;
  color: var(--fg);
}

.piece-artist {
  font-size: 14px;
  color: var(--muted);
}

/* ── nav arrows ── */
#nav-arrows {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  z-index: 15;
}

.nav-arrow {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.nav-arrow img {
  width: 48px;
  height: 48px;
  filter: var(--icon-filter) var(--icon-shadow);
}

.nav-arrow.muted {
  opacity: 0.2;
  pointer-events: none;
}

/* ── custom cursor ── */
#cursor-hand {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s;
  top: 0;
  left: 0;
  transform: translate(-30%, -20%);
}

#cursor-img {
  display: block;
  filter: var(--icon-filter) var(--icon-shadow);
}

/* ── arrow hint ── */
#arrow-down {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: bob 2.5s ease-in-out infinite;
}

#arrow-down img {
  width: 48px;
  height: 48px;
  filter: var(--icon-filter);
}

#arrow-down.hidden {
  display: none;
}

@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ── search bar ── */
#search-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px 20px;
  background: var(--bg);
  z-index: 20;
}

#search-input {
  width: 100%;
  max-width: 584px;
  height: 44px;
  background: var(--search-bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
  padding: 0 20px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search-input:focus {
  border-color: var(--fg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

#search-input::placeholder {
  color: var(--muted);
}

/* ── suggestions ── */
#suggestions {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 584px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  z-index: 30;
  display: none;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--search-bg);
}

.suggestion-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.suggestion-title {
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-artist {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── mobile ── */
@media (max-width: 768px) {
  #nav-arrows {
    bottom: 112px;
  }

  .nav-arrow img {
    width: 36px;
    height: 36px;
  }

  .btn-clear {
    top: -24px;
    right: -48px;
    width: 48px;
    height: 48px;
  }

  .btn-clear img {
    width: 24px;
    height: 24px;
  }
}
