/* Discovera — NARA aerial photo store. Uses the site tokens from styles.css. */

.store-hero {
  padding: var(--space-7) 0 var(--space-5);
}

.store-hero h1 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-3);
}

.store-hero p {
  color: var(--c-muted);
  max-width: 62ch;
  line-height: var(--leading-body);
  margin: 0 0 var(--space-2);
}

.store-hero .store-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-4);
  color: var(--c-muted-strong);
  font-size: var(--text-sm);
}

.store-hero .store-facts b {
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

/* ---- search bar ------------------------------------------------------- */

.store-searchbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--c-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
  padding: var(--space-3) 0;
}

.store-search-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.store-search-input {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  padding: 10px var(--space-4);
}

.store-search-input:focus-within {
  border-color: var(--c-primary);
}

.store-search-input input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--c-text);
  font: inherit;
  font-size: var(--text-base);
  outline: none;
}

.store-search-input input::placeholder {
  color: var(--c-muted);
}

.store-search-clear {
  background: none;
  border: 0;
  color: var(--c-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.store-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.store-chip {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  color: var(--c-muted-strong);
  font-size: var(--text-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.store-chip:hover {
  border-color: var(--c-primary-dark);
  color: var(--c-text);
}

.store-chip[aria-pressed="true"] {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #1a1206;
  font-weight: 600;
}

.store-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin: var(--space-4) 0 var(--space-3);
  color: var(--c-muted);
  font-size: var(--text-sm);
}

.store-meta-row b {
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

/* ---- grid ------------------------------------------------------------- */

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  padding-bottom: var(--space-7);
}

.store-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.store-card:hover {
  border-color: var(--c-primary-dark);
  transform: translateY(-2px);
}

.store-card-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--c-surface-elevated);
  overflow: hidden;
}

.store-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.store-card-thumb img.is-loaded {
  opacity: 1;
}

.store-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
}

.store-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 6px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--c-text);
  backdrop-filter: blur(4px);
}

.store-badge.is-year {
  margin-left: auto;
}

.store-badge.is-georef {
  background: #2f6f4a;
}

.store-card-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.store-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.store-card-sub {
  font-size: var(--text-xs);
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}

.store-card-hint {
  font-size: var(--text-xs);
  color: #7fb69a;
}

.store-card-actions {
  margin-top: auto;
  padding-top: var(--space-2);
  display: flex;
  gap: 6px;
}

.store-buy {
  flex: 1;
  border: 1px solid var(--c-border);
  background: var(--c-surface-elevated);
  color: var(--c-text);
  border-radius: 10px;
  padding: 9px 8px;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  line-height: 1.25;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.store-buy small {
  display: block;
  font-weight: 400;
  color: var(--c-muted);
  font-size: 0.66rem;
  margin-top: 2px;
}

.store-buy:hover {
  border-color: var(--c-primary);
}

.store-buy.is-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #1a1206;
}

.store-buy.is-primary small {
  color: rgba(26, 18, 6, 0.75);
}

.store-buy.is-primary:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
}

/* ---- empty / loading -------------------------------------------------- */

.store-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--c-muted);
}

.store-empty h2 {
  font-family: var(--font-heading);
  color: var(--c-text);
  margin: 0 0 var(--space-2);
}

.store-empty p {
  margin: 0 auto var(--space-3);
  max-width: 52ch;
  line-height: var(--leading-body);
}

.store-empty .store-suggestions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.store-skeleton {
  background: var(--c-surface);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-card);
  aspect-ratio: 4 / 3.35;
  animation: store-pulse 1.4s ease-in-out infinite;
}

@keyframes store-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.75; }
}

/* ---- detail dialog ---------------------------------------------------- */

.store-dialog {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-panel);
  background: var(--c-surface);
  color: var(--c-text);
  padding: 0;
  max-width: min(920px, 94vw);
  width: 100%;
}

.store-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.store-dialog-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.store-dialog-image {
  background: var(--c-bg);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-dialog-image img {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/*
 * The alignment preview, which replaces the still photograph inside that same cell.
 *
 * The cell centres one element. Everything the preview needs — canvas, slider, credit, note —
 * therefore arrives inside this single wrapper, and the stacking happens here rather than being
 * asked of a flex row that was only ever meant to hold a picture.
 */
.store-georef {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  padding: var(--space-3);
}

.store-georef-canvas {
  display: block;
  width: 100%;
  height: auto;
  /* The backing store is square; without this the intrinsic 640px would win on a narrow column. */
  aspect-ratio: 1 / 1;
  max-height: 60vh;
  border-radius: var(--radius-panel);
  background: var(--c-bg);
}

.store-georef-sliderrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--c-muted);
}

.store-georef-sliderrow span {
  white-space: nowrap;
}

.store-georef-slider {
  /* Takes the rest of the row. Range inputs default to a fixed intrinsic width, which inside a
     flex row is what turned this control into a dot beside its own label. */
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--c-primary);
}

.store-georef-credit,
.store-georef-caption {
  margin: 0;
  text-align: left;
}

/*
 * The one line on the download card that must not be skimmed past. Someone who installs a hundred
 * megabytes and then finds it will not hand over a photograph feels cheated, and is right to; this
 * sentence costs a border and saves that.
 */
.app-download-warning {
  border-left: 3px solid var(--c-primary);
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  color: var(--c-text);
}

.store-dialog-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.store-dialog-body h2 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  margin: 0;
}

.store-spec {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--space-4);
  font-size: var(--text-sm);
}

.store-spec dt {
  color: var(--c-muted);
}

.store-spec dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.store-note {
  font-size: var(--text-xs);
  color: var(--c-muted);
  line-height: var(--leading-body);
  border-left: 2px solid var(--c-border);
  padding-left: var(--space-3);
}

.store-packages {
  display: grid;
  gap: var(--space-2);
  margin-top: auto;
}

.store-package {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  border: 1px solid var(--c-border);
  background: var(--c-surface-elevated);
  color: var(--c-text);
  border-radius: 12px;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.store-package:hover {
  border-color: var(--c-primary);
}

.store-package.is-primary {
  border-color: var(--c-primary);
}

/*
 * "How to get it" — a second dialog rather than a jump to the foot of the page. It has no image
 * beside it, so it does not want the two-column width the photograph dialog needs.
 */
.store-dialog.is-narrow {
  max-width: 44rem;
}

.store-dialog.is-narrow .store-dialog-inner {
  display: block;
}

.store-dialog.is-narrow .store-dialog-body {
  padding: var(--space-6);
}

/*
 * The block that replaced the two purchase buttons. Photographs are not sold one at a time; the
 * card exists to show the frame is there, and this is the way onward.
 */
.store-getapp {
  display: grid;
  gap: var(--space-2);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: var(--space-4);
  background: var(--c-surface-elevated);
}

.store-getapp strong {
  font-size: var(--text-sm);
}

.store-getapp > span {
  color: var(--c-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

/* The call to action is an anchor here, not a button, so it needs centring of its own. */
.store-getapp .store-package {
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}

.store-package-text {
  flex: 1;
}

.store-package-text strong {
  display: block;
  font-size: var(--text-sm);
}

.store-package-text span {
  display: block;
  color: var(--c-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
  margin-top: 2px;
}

.store-package-price {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  white-space: nowrap;
}

.store-dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  color: var(--c-text);
  font-size: 22px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

@media (max-width: 760px) {
  .store-dialog-inner {
    grid-template-columns: 1fr;
  }
  .store-dialog-image {
    min-height: 200px;
  }
  .store-dialog-image img {
    max-height: 38vh;
  }
}

/*
 * The frame lying on the modern map, inside the card. A shop window: the preview is the public
 * 720-pixel thumbnail, enough to see the alignment is real and not enough to work a field with.
 */
.store-georef-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--c-surface-elevated);
}

.store-georef-slider {
  display: block;
  width: 100%;
  margin-top: var(--space-3);
  accent-color: var(--c-primary);
}

.store-georef-caption {
  margin-top: var(--space-2);
}
