/* ---------- dorm page ---------- */

.atlas-page {
  padding-top: var(--head-h);
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: clamp(30px, 6vw, 100px);
  align-items: end;
  padding-block: clamp(52px, 7vw, 92px) clamp(34px, 5vw, 58px);
  border-bottom: 1px solid var(--line);
}

.page-intro .lede {
  max-width: 36em;
  margin-top: 24px;
}

.intro-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}

.intro-meta div {
  padding: 14px 0 12px;
}

.intro-meta div:nth-child(odd) {
  padding-right: 16px;
}

.intro-meta div:nth-child(even) {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.intro-meta div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.intro-meta b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 500;
  line-height: 1;
}

.intro-meta span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.atlas-wrap {
  padding-block: 0 clamp(40px, 5vw, 64px);
}

.atlas-toolbar {
  position: sticky;
  top: var(--head-h);
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 239, 230, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
}

.plate-current {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plate-current b {
  color: var(--red-dark);
  font-weight: 400;
}

.plate-current .divider {
  width: 26px;
  height: 1px;
  flex: none;
  background: var(--line-strong);
}

.plate-current .plate-name {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-hint {
  margin-right: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.tool-btn:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink);
}

.tool-btn svg {
  width: 13px;
  height: 13px;
}

.atlas-grid {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr) 360px;
  gap: clamp(20px, 2.5vw, 38px);
  align-items: start;
  padding-top: clamp(20px, 2.5vw, 32px);
}

/* ---------- plate index ---------- */

.plate-index {
  position: sticky;
  top: calc(var(--head-h) + 78px);
  max-height: calc(100dvh - var(--head-h) - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.filter-row .chip {
  min-height: 32px;
  padding: 0 10px;
  font-size: 10px;
}

.plate-list {
  border-top: 1px solid var(--ink);
}

.plate-item {
  display: grid;
  grid-template-columns: 26px 56px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  opacity: 0.58;
  transition:
    opacity 0.22s ease,
    color 0.22s ease,
    padding 0.3s var(--ease-out);
}

.plate-item:hover {
  padding-left: 4px;
  opacity: 1;
}

.plate-item[aria-current="true"] {
  padding-left: 4px;
  color: var(--red);
  opacity: 1;
}

.plate-item .thumb {
  width: 56px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

.plate-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.6);
  transition: filter 0.25s ease;
}

.plate-item[aria-current="true"] .thumb img,
.plate-item:hover .thumb img {
  filter: saturate(1);
}

.plate-item .id {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.plate-item .name {
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- stage ---------- */

.plate-viewer {
  min-width: 0;
}

.stage {
  position: relative;
  display: grid;
  height: clamp(450px, 64vh, 720px);
  place-items: center;
  padding: clamp(14px, 2.2vw, 30px);
  border: 1px solid var(--line-strong);
  background-color: var(--paper-deep);
  background-image:
    linear-gradient(rgba(25, 25, 22, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 25, 22, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 43%, rgba(255, 255, 255, 0.55), transparent 65%);
  background-size:
    24px 24px,
    24px 24px,
    100% 100%;
  overflow: hidden;
}

.stage::before {
  content: "MEASURED / HFIT / 2026";
  position: absolute;
  top: 13px;
  left: 15px;
  color: rgba(25, 25, 22, 0.32);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 24px;
  height: 24px;
  border-right: 1px solid rgba(213, 71, 42, 0.58);
  border-bottom: 1px solid rgba(213, 71, 42, 0.58);
  pointer-events: none;
}

.plate-canvas {
  position: relative;
  background: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 20px 45px rgba(25, 25, 22, 0.13);
  view-transition-name: hero-plate;
}

.plate-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    opacity 0.42s ease,
    filter 0.42s ease;
}

.plate-layer.is-front {
  z-index: 1;
  opacity: 1;
}

.plate-layer.is-back {
  z-index: 2;
  opacity: 0;
  filter: blur(4px);
}

.plate-layer.is-back.is-visible {
  opacity: 1;
  filter: none;
}

.hotspot {
  position: absolute;
  z-index: 4;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--red);
  border-radius: 50%;
  background: rgba(251, 248, 240, 0.9);
  color: var(--red);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1;
  transform: translate(-50%, -50%);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.35s var(--ease-spring);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.hotspot::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(213, 71, 42, 0.4);
  border-radius: 50%;
  animation: hotspot-pulse 2.8s ease-out infinite;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}

@keyframes hotspot-pulse {
  0% {
    opacity: 0.65;
    transform: scale(0.86);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

.hotspot:hover,
.hotspot:focus-visible {
  background: var(--red);
  color: var(--paper-high);
  transform: translate(-50%, -50%) scale(1.12);
}

.hotspot[aria-pressed="true"] {
  background: var(--red);
  color: var(--paper-high);
}

.hotspot .tip {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  max-width: 200px;
  padding: 5px 8px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--ease-out);
}

.hotspot:hover .tip,
.hotspot:focus-visible .tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.plate-caption {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  line-height: 1.7;
  text-transform: uppercase;
}

.plate-caption b {
  color: var(--ink-soft);
  font-weight: 400;
}

.plate-caption .caption-right {
  text-align: right;
}

/* ---------- inspector ---------- */

.inspector {
  position: sticky;
  top: calc(var(--head-h) + 78px);
  max-height: calc(100dvh - var(--head-h) - 100px);
  overflow-y: auto;
  padding-left: clamp(20px, 2.2vw, 32px);
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.inspector-empty {
  display: grid;
  min-height: 360px;
  align-content: center;
  gap: 16px;
  padding: 32px 0;
}

.inspector-empty .crosshair {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.inspector-empty .crosshair::before,
.inspector-empty .crosshair::after {
  content: "";
  position: absolute;
  background: var(--red);
}

.inspector-empty .crosshair::before {
  top: 50%;
  left: -7px;
  width: 46px;
  height: 1px;
}

.inspector-empty .crosshair::after {
  top: -7px;
  left: 50%;
  width: 1px;
  height: 46px;
}

.inspector-empty h2 {
  max-width: 9em;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  font-weight: 520;
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.inspector-empty p {
  max-width: 24em;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.inspector-empty .ledger-link {
  justify-self: start;
  margin-top: 6px;
}

.note-content {
  padding: 2px 0 20px;
}

.note-content .kicker {
  margin-bottom: 12px;
}

.note-content h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2.8vw, 2.55rem);
  font-weight: 530;
  line-height: 1.16;
  letter-spacing: -0.045em;
}

.note-body {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.note-body p {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.note-body p + p {
  margin-top: 12px;
}

.note-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.note-images a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

.note-images img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.note-images a:hover img {
  transform: scale(1.04);
}

.note-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  line-height: 1.7;
  text-transform: uppercase;
}

.note-source::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
}

.note-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}

.note-switch .chip {
  min-height: 26px;
  padding: 0 9px;
  font-size: 8px;
}

.note-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.note-next .mono {
  color: var(--muted);
}

.note-content.is-updating {
  animation: note-in 0.45s var(--ease-out) both;
}

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

/* ---------- notes ledger ---------- */

.notes-ledger {
  padding-block: clamp(56px, 8vw, 110px);
  border-top: 1px solid var(--line);
}

.ledger-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: clamp(24px, 3vw, 38px);
}

.ledger-head h2 {
  max-width: 10em;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4.4vw, 4.4rem);
  font-weight: 520;
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.ledger-head .mono {
  color: var(--muted);
  white-space: nowrap;
}

.ledger-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(20px, 4vw, 56px);
  border-top: 1px solid var(--ink);
}

.ledger-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  width: 100%;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease;
}

.ledger-item:hover {
  color: var(--red);
}

.ledger-item .n {
  color: var(--red);
  font-family: var(--mono);
  font-size: 9px;
}

.ledger-item .q {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.ledger-item .p {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .atlas-grid {
    grid-template-columns: 185px minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }
}

@media (max-width: 900px) {
  .page-intro {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
  }

  .intro-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
  }

  .intro-meta div:nth-child(n + 3) {
    border-top: 0;
  }

  .intro-meta div + div {
    border-left: 1px solid var(--line);
  }

  .intro-meta div:nth-child(odd) {
    padding-right: 0;
  }

  .intro-meta div:nth-child(even) {
    padding-left: 0;
  }

  .intro-meta div {
    padding-inline: 12px !important;
  }

  .intro-meta div:first-child {
    padding-left: 0 !important;
  }

  .atlas-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .plate-viewer {
    order: 1;
  }

  .plate-index {
    position: static;
    order: 2;
    min-width: 0;
    max-width: 100%;
    max-height: none;
    overflow: visible;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(var(--pad) * -1);
    padding-inline: var(--pad);
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .plate-list {
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    border-top: 0;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-inline: calc(var(--pad) * -1);
    padding-inline: var(--pad);
  }

  .plate-list::-webkit-scrollbar {
    display: none;
  }

  .plate-item {
    grid-template-columns: 22px 58px minmax(0, 1fr);
    width: 188px;
    flex: none;
    padding: 9px 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.18);
    scroll-snap-align: start;
  }

  .plate-item:hover,
  .plate-item[aria-current="true"] {
    padding-left: 8px;
  }

  .plate-item[aria-current="true"] {
    border-color: var(--red);
    background: var(--paper-high);
  }

  .stage {
    height: min(62vh, 580px);
  }

  .ledger-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .key-hint {
    display: none;
  }
}

@media (max-width: 620px) {
  .page-intro .lede {
    font-size: 15.5px;
    line-height: 1.8;
  }

  .intro-meta b {
    font-size: 1.55rem;
  }

  .intro-meta span {
    font-size: 9.5px;
  }

  .atlas-toolbar {
    min-height: 52px;
  }

  .plate-current .divider {
    width: 14px;
  }

  .tool-btn span {
    display: none;
  }

  .tool-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  .stage {
    height: min(56vh, 480px);
    padding: 10px;
  }

  .hotspot {
    width: 32px;
    height: 32px;
    font-size: 9.5px;
  }

  .plate-caption {
    flex-direction: column;
    gap: 3px;
  }

  .plate-caption .caption-right {
    text-align: left;
  }

  .ledger-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .ledger-item {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .ledger-item .p {
    display: none;
  }
}

/* ---------- phone: readable stats, tighter intro ---------- */

@media (max-width: 620px) {
  .page-intro {
    gap: 22px;
    padding-block: 36px 26px;
  }

  .intro-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-meta div {
    padding: 10px 14px 10px 0 !important;
  }

  .intro-meta div:nth-child(even) {
    padding-left: 16px !important;
    border-left: 1px solid var(--line);
  }

  .intro-meta div:nth-child(3) {
    padding-left: 0 !important;
    border-left: 0;
  }

  .intro-meta div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .intro-meta b {
    font-size: 1.5rem;
  }

  .intro-meta span {
    margin-top: 4px;
  }

  .atlas-grid {
    gap: 14px;
    padding-top: 16px;
  }
}
