* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  background: #faf6ed;
  color: #2c2a26;
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  border-bottom: 1px solid #e8dfc9;
}

header h1 {
  margin: 0;
  font-weight: 400;
}

header h1 a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
}

.mark {
  width: 54px;
  height: 45px;
  color: #2c2a26;
}

.name {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.tagline {
  margin: 0.5rem 0 0;
  color: #6b6558;
  font-style: italic;
  font-size: 1.1rem;
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem;
}

body.detail-view main {
  max-width: 1000px;
}

.gallery {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.card a {
  display: block;
  color: inherit;
  text-decoration: none;
  background: #fff;
  border: 1px solid #e8dfc9;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card a:hover,
.card a:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(44, 42, 38, 0.12);
  outline: none;
}

.card a:focus-visible {
  outline: 3px solid #a5322a;
  outline-offset: 2px;
}

.card img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #f3ead4;
  padding: 1.5rem;
  filter: drop-shadow(0 8px 18px rgba(44, 42, 38, 0.22));
}

.card-body {
  padding: 1rem 1.25rem 1.25rem;
}

.card h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 400;
}

.meta {
  margin: 0.25rem 0 0;
  color: #6b6558;
  font-size: 1rem;
}

.detail-header .meta {
  margin-top: 0.5rem;
}

.back {
  display: inline-block;
  padding: 0.75rem 0;
  color: #a5322a;
  text-decoration: none;
  font-size: 1.1rem;
  min-height: 44px;
}

.back:hover,
.back:focus-visible { text-decoration: underline; }

.detail-header {
  text-align: center;
  margin-bottom: 2rem;
}

.detail-header img {
  width: 100%;
  max-width: 420px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(44, 42, 38, 0.25));
}

.detail-header h2 {
  margin: 1rem 0 0;
  font-size: 2rem;
  font-weight: 400;
}

.scatter-hint {
  margin: 2rem 0 0;
  text-align: center;
  color: #6b6558;
  font-style: italic;
  font-size: 0.95rem;
}

.scatter {
  position: relative;
  width: 100vw;
  margin: 1.5rem calc(50% - 50vw) 4rem;
  padding: 0 2rem;
  min-height: 400px;
  touch-action: pan-y;
  box-sizing: border-box;
}

.item {
  --rot: 0deg;
  position: absolute;
  margin: 0;
  padding: 0;
  text-align: center;
  transform: rotate(var(--rot));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.item:hover,
.item:focus-within {
  transform: rotate(calc(var(--rot) * 0.3)) scale(1.04);
  z-index: 50;
}

.item.dragging {
  cursor: grabbing;
  transform: rotate(calc(var(--rot) * 0.5)) scale(1.05);
  transition: none;
}

.item img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0.5rem;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(44, 42, 38, 0.22));
}

.caption {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) rotate(calc(var(--rot) * -1));
  margin: 0;
  padding: 0.6rem 0.85rem;
  min-width: 160px;
  max-width: 240px;
  background: #fffaef;
  border: 1px solid #e8dfc9;
  border-radius: 2px;
  box-shadow: 0 10px 22px rgba(44, 42, 38, 0.28);
  font-size: 0.85rem;
  font-style: italic;
  color: #4a4640;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
  z-index: 1000;
}

.item.selected {
  z-index: 500;
}

.item.selected .caption {
  display: block;
}

@media (max-width: 600px) {
  .scatter { margin: 1rem 0 3rem; }
  .item { width: auto !important; max-width: 60vw; }
  .caption { font-size: 0.8rem; }
}

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

.empty,
.loading {
  text-align: center;
  color: #6b6558;
  font-style: italic;
  padding: 3rem 1rem;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem 4rem;
}

.hero-illustration {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
}

.empty-state p {
  margin: 0;
  color: #6b6558;
  font-style: italic;
  font-size: 1.15rem;
}

footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid #e8dfc9;
  color: #6b6558;
  font-size: 1rem;
}

footer a {
  color: #a5322a;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  display: inline-block;
  min-height: 44px;
}

footer a:hover,
footer a:focus-visible {
  text-decoration: underline;
}

.about {
  font-size: 1.2rem;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

.about p {
  margin: 0 0 1.5rem;
}

.about .soon {
  color: #6b6558;
  font-style: italic;
}

@media (min-width: 768px) {
  html { font-size: 19px; }
  header { padding: 4rem 2rem 2rem; }
  .name { font-size: 3rem; }
  .mark { width: 64px; height: 53px; }
  main { padding: 2.5rem 2rem; }
  .gallery { gap: 3rem; }
}
