/*
 * Pages other than the timeline: the photo archive and the article pages
 * (Building History, Timeline Event Details, About). Loaded after
 * timeline.css, which supplies the colors, fonts, header and settings bar.
 */

.page body { background: var(--washi); }
.page-main {
  max-width: 76rem;
  margin: 0 auto;
  padding: calc(var(--header-h) + 2.5rem) clamp(1rem, 4vw, 3rem) 5rem;
}
@media (max-width: 720px) {
  .page-main { padding-top: calc(var(--header-h) + 1.5rem); }
}

/* ---------- Page heading ---------- */

.page-head { max-width: 46rem; margin-bottom: 2.5rem; }
.page-eyebrow {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: var(--beni);
}
.page-title {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.25;
  text-wrap: balance;
}
.page-lede {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.8;
  text-wrap: pretty;
}
html[lang="en"] .page-lede { line-height: 1.65; }

/* ---------- Archive: filters ---------- */

.archive-tools {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  margin: 0 calc(-1 * clamp(1rem, 4vw, 3rem)) 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 3rem) 0.6rem;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border-bottom: 1px solid var(--material-edge);
}
@media (max-width: 720px) { .archive-tools { position: static; } }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  min-height: 44px;
  padding: 0 1rem;
  border: 2px solid var(--sumi);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.4);
  color: var(--sumi);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.chip:hover { background: var(--material-hover); }
.chip[aria-pressed="true"] { background: var(--pink); }
.jump {
  margin: 0.6rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}
.jump a { margin-left: 0.6rem; color: inherit; text-underline-offset: 0.2em; }
.jump a:hover { color: var(--beni); }
.filter-status { margin: 0.3rem 0 0; font-size: 0.95rem; min-height: 1.2em; }
.chip:focus-visible,
.jump a:focus-visible,
.card-link:focus-visible,
.viewer-btn:focus-visible,
.version:focus-visible,
.viewer a:focus-visible,
.fig a:focus-visible,
.prose a:focus-visible {
  outline: 4px solid var(--beni);
  outline-offset: 3px;
}

/* ---------- Archive: decades and cards ---------- */

.decade { margin-top: 2.5rem; scroll-margin-top: calc(var(--header-h) + 8rem); }
.decade-title {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.3rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
html[data-size="xl"] .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card { scroll-margin-top: calc(var(--header-h) + 8rem); }
.card-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 0.6rem 0.6rem 0.9rem;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}
.card-link:hover { background: var(--material-hover); }
.card-img {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  margin-bottom: 0.4rem;
  border-radius: 10px;
  background: var(--hover);
  overflow: hidden;
}
.card-img img {
  max-width: 92%;
  max-height: 92%;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 4px solid #fff;
  box-shadow: 0 3px 12px rgb(62 39 40 / 0.18);
}
.card-count {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: var(--sumi);
  color: var(--washi);
  font-size: 0.85rem;
  font-weight: 700;
}
.card-date { font-size: 0.95rem; font-weight: 700; color: var(--beni); }
.card-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.4;
}

/* ---------- Archive: viewer ---------- */

.viewer {
  width: min(100vw - 1rem, 72rem);
  max-height: calc(100dvh - 1rem);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--washi);
  color: var(--sumi);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}
.viewer::backdrop { background: rgb(40 25 28 / 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.viewer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  grid-template-areas: "bar bar" "fig text" "versions text";
  gap: 1rem 1.5rem;
  padding: 1rem clamp(1rem, 2.5vw, 1.75rem) 1.5rem;
}
.viewer-bar { grid-area: bar; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.viewer-close { margin-left: auto; }
.viewer-btn {
  min-height: 48px;
  padding: 0 1rem;
  border: 2px solid var(--sumi);
  border-radius: 12px;
  background: var(--pink);
  color: var(--sumi);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.viewer-btn:hover:not(:disabled) { background: var(--pink-deep); }
.viewer-btn:disabled { background: transparent; color: #806c69; border-color: #ddcdc7; cursor: default; }
.viewer-figure { grid-area: fig; margin: 0; display: grid; place-items: center; min-height: 0; }
.viewer-full { display: block; }
.viewer-figure img {
  display: block;
  max-width: 100%;
  max-height: min(70dvh, 52rem);
  width: auto;
  height: auto;
  border: 6px solid #fff;
  box-shadow: 0 6px 24px rgb(62 39 40 / 0.2);
  background: #fff;
}
.viewer-versions { grid-area: versions; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.version {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 7.5rem;
  padding: 0.4rem;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.3;
  cursor: pointer;
}
.version img { width: 100%; height: 4.5rem; object-fit: contain; background: var(--hover); }
.version:hover { background: var(--material-hover); }
.version[aria-pressed="true"] { border-color: var(--sumi); background: var(--pink); }
.viewer-text { grid-area: text; overflow-wrap: anywhere; }
.viewer-date { margin: 0.2rem 0 0.2rem; font-weight: 700; color: var(--beni); }
.est-note { font-weight: 400; }
.viewer-title {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.35;
}
.viewer-caption { margin: 0 0 1rem; font-size: 1.1rem; line-height: 1.8; }
html[lang="en"] .viewer-caption { line-height: 1.6; }
.viewer-credit { margin: 0 0 0.8rem; font-size: 0.95rem; font-weight: 700; }
.viewer-links { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; }
.viewer-links a { color: inherit; font-weight: 700; text-underline-offset: 0.2em; }
.viewer-links a:hover { color: var(--beni); }
@media (max-width: 800px) {
  .viewer-inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "fig" "versions" "text"; }
  .viewer-figure img { max-height: 55dvh; }
}

/* ---------- Article pages ---------- */

.article { max-width: 72rem; }
.chapter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 1.5rem 3rem;
  align-items: start;
  padding: 2.5rem 0;
  border-top: 2px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.chapter.no-figs { grid-template-columns: minmax(0, 46rem); }
@media (max-width: 860px) { .chapter { grid-template-columns: minmax(0, 1fr); } }
.chapter-when {
  margin: 0 0 0.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--beni);
}
.chapter h2 {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  line-height: 1.3;
}
.prose p { margin: 0 0 1rem; font-size: 1.15rem; line-height: 1.9; text-wrap: pretty; }
html[lang="en"] .prose p { line-height: 1.65; }
.prose h3 { margin: 1.6rem 0 0.5rem; font-family: var(--display); font-size: 1.35rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.3rem; font-size: 1.1rem; line-height: 1.7; }
.prose a { color: inherit; font-weight: 700; text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
.prose a:hover { color: var(--beni); }
.quote {
  margin: 1.2rem 0 1.4rem;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 4px solid var(--pink-deep);
  font-family: var(--display);
  font-size: 1.25rem;
  line-height: 1.7;
}
.quote cite { display: block; margin-top: 0.4rem; font-family: var(--text); font-style: normal; font-size: 0.95rem; font-weight: 700; }
.figs { display: grid; gap: 1.5rem; }
.fig { margin: 0; }
.fig a { display: block; }
.fig img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 26rem;
  height: auto;
  border: 6px solid #fff;
  box-shadow: 0 6px 20px rgb(62 39 40 / 0.18);
  background: #fff;
}
.fig figcaption { margin-top: 0.6rem; font-size: 0.95rem; line-height: 1.5; }
.fig-date { display: block; font-weight: 700; color: var(--beni); }
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 2px solid var(--sumi);
  border-radius: 999px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.toc a:hover { background: var(--material-hover); }
.toc a:focus-visible { outline: 4px solid var(--beni); outline-offset: 3px; }
.credits { columns: 2 16rem; column-gap: 3rem; }
.credits li { break-inside: avoid; margin-bottom: 0.4rem; }
.page-foot {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--line);
  font-size: 1rem;
}
.page-foot a { color: inherit; font-weight: 700; margin-right: 1.2rem; }
