@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600&display=swap');

:root {
  --bg: #551122;
  --bg-2: #6b1c2d;
  --ink: #cca476;
  --ink-soft: #cca476;
  --line: rgba(204,164,118,.3);
  --accent: #cca476;
}

:root[data-theme="light"] {
  --bg: #f7f1e6;
  --bg-2: #efe6d4;
  --ink: #8a6f4b;
  --ink-soft: #8a6f4b;
  --line: rgba(138,111,75,.3);
  --accent: #8a6f4b;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  letter-spacing: 0.025em;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}

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

/* Fixed corner icon buttons (back / theme) */
.icon-btn {
  position: fixed;
  top: max(20px, calc(env(safe-area-inset-top) + 14px));
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: transform .2s, opacity .2s;
}
.icon-btn:hover { transform: translateY(-1px); opacity: .75; }
.icon-btn svg { width: 20px; height: 20px; display: block; transition: opacity .2s ease; }
.icon-btn.spin { animation: spin-once .45s ease; }
@keyframes spin-once {
  from { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(160deg) translateY(-2px); }
  to { transform: rotate(360deg) translateY(0); }
}

.icon-btn--back { left: max(20px, calc(env(safe-area-inset-left) + 14px)); }
.icon-btn--theme { right: max(20px, calc(env(safe-area-inset-right) + 14px)); }

.top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 6vw 24px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-size: 30px;
  letter-spacing: 0.04em;
  font-style: normal;
  font-weight: 500;
}

.wordmark small {
  display: block;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 4px;
}

.count {
  font-size: 16px;
  color: var(--ink-soft);
  font-style: normal;
}

/* Index grid */
.grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 18px 18px 80px;
}

.card {
  display: block;
  width: min(calc(100vw - 36px), calc(177.778dvh - 195.556px));
  transition: transform .35s ease;
}
.card:hover {
  transform: translateY(-4px);
}

.card .cover {
  aspect-ratio: 400 / 770;
  border-radius: 50px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.6);
  transition: border-color .35s ease, box-shadow .35s ease;
}
.card:hover .cover {
  border-color: var(--ink);
}
.card .cover img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform .5s ease;
}
.card:hover .cover img {
  transform: scale(1.06);
}

.card .meta { padding-top: 14px; text-align: center; }
.card .name {
  font-size: 24px;
  font-style: normal;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.card .sub {
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: .02em;
  margin-top: 2px;
}

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.reveal-in {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  padding: 80px 6vw;
  text-align: center;
  color: var(--ink-soft);
  font-style: normal;
  font-size: 22px;
}

/* Detail page */
.hero {
  padding: 160px 6vw 40px;
  text-align: center;
}
.hero .specimen {
  display: inline-block;
  max-width: 100%;
  font-size: clamp(60px, 11vw, 168px);
  line-height: 0.95;
  color: var(--ink);
  word-break: break-word;
  white-space: nowrap;
}
.hero .tagline {
  margin-top: 34px;
  padding: 0 12%;
  font-style: normal;
  font-size: 22px;
  color: var(--ink-soft);
}

.info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  justify-content: center;
  gap: 24px;
  padding: 32px 6vw;
  text-align: center;
}
.info .label {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.info .value { font-size: 19px; letter-spacing: 0.05em; color: var(--ink); }

.desc {
  padding: 32px 6vw 48px;
  max-width: 760px;
  margin: 0 auto;
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: 0.015em;
  color: var(--ink);
  text-align: justify;
}

.credit {
  text-align: center;
  padding: 0 6vw 60px;
  font-size: 15px;
  color: var(--ink-soft);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 40px 6vw 90px;
}
.gallery a {
  display: block;
  border-radius: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.6);
}
.gallery img {
  width: 100%; display: block;
  transition: transform .4s ease;
}
.gallery a:hover img { transform: scale(1.03); }

@media (max-width: 640px) {
  .top { padding: 84px 5vw 20px; }
  .hero { padding: 130px 6vw 32px; }
  .gallery { grid-template-columns: 1fr; }
}
