/* Catalog page. Colors, typography, and identity come from brand/tokens.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 0;
  margin: 0;
  background: var(--brand-paper);
  color: var(--brand-ink);
  font: 16px/1.5 var(--brand-font-ui);
}

button,
input {
  font: inherit;
}

.catalog {
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 40px) clamp(48px, 9vw, 96px);
}

.catalog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 48px);
  padding-bottom: clamp(24px, 4vw, 40px);
  border-bottom: 1px solid var(--brand-line);
}

.catalog-logo {
  width: auto;
  height: var(--brand-logo-height-large);
  flex: 0 0 auto;
}

.catalog-heading {
  max-width: 34rem;
  text-align: right;
}

.catalog-heading h1,
.catalog-heading p,
.brochure-card h2,
.brochure-page-count,
.catalog-results,
.catalog-empty h2,
.catalog-empty p {
  margin: 0;
}

.catalog-heading h1 {
  font-family: var(--brand-font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.catalog-heading p {
  margin-top: 8px;
  color: var(--brand-muted);
}

.catalog-search {
  width: min(100%, 34rem);
  margin-top: clamp(28px, 5vw, 48px);
}

.catalog-search > label,
.manual-copy label {
  display: block;
  margin-bottom: 7px;
  color: var(--brand-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.catalog-search-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.catalog-search input,
.manual-copy input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--brand-line);
  border-radius: 0;
  background: var(--brand-paper);
  color: var(--brand-ink);
}

.catalog-search input {
  width: 100%;
  padding: 10px 12px;
}

.catalog-search button,
.catalog-empty button,
.brochure-actions a,
.brochure-actions button {
  min-height: 44px;
  border: 1px solid var(--brand-line);
  border-radius: 0;
  background: var(--brand-paper);
  color: var(--brand-ink);
  cursor: pointer;
  text-decoration: none;
}

.catalog-search button,
.catalog-empty button {
  padding: 9px 16px;
}

.catalog-results {
  margin-top: 18px;
  color: var(--brand-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: clamp(28px, 4vw, 48px) clamp(18px, 3vw, 32px);
  min-width: 0;
  margin: clamp(22px, 4vw, 36px) 0 0;
  padding: 0;
  list-style: none;
}

.catalog-item,
.brochure-card,
.brochure-card-body {
  min-width: 0;
}

.brochure-card {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.catalog-cover-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* DECISION: one uniform cover box for the whole grid, not each book's own
   aspect ratio. Sizing the box per book (the rejected alternative) staggers
   every row — covers, titles, and actions all land at different heights and
   the grid reads as broken. 16/9 because 6 of the 12 brochures are exactly
   that, so the common case fills the box and the outliers (1.294–1.884)
   letterbox inside a consistent frame. Contain, never cover: these are
   publication covers and cropping one is a content error. */
.catalog-cover {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: var(--catalog-cover-ratio, 16 / 9);
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--brand-line);
  background: var(--brand-surface);
}

.catalog-cover-fallback {
  max-width: 12rem;
  padding: 16px;
  color: var(--brand-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.catalog-cover img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--brand-paper);
}

.brochure-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding-top: 15px;
}

.brochure-card h2 {
  overflow-wrap: anywhere;
  font-family: var(--brand-font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
}

.brochure-page-count {
  margin-top: 5px;
  color: var(--brand-muted);
  font-size: 0.8125rem;
}

/* margin-top:auto pins actions to the bottom of a stretched card, so they
   stay aligned across a row even when a title wraps to two lines (e.g.
   "Westin Residences Playa Bonita"). Depends on the grid stretching items
   and .brochure-card being height:100% — both above. */
.brochure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.brochure-actions a,
.brochure-actions button {
  display: inline-flex;
  flex: 1 1 9rem;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  text-align: center;
}

.manual-copy {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--brand-line);
  background: var(--brand-surface);
}

.manual-copy input {
  width: 100%;
  padding: 9px 10px;
}

.catalog-empty {
  margin-top: 30px;
  padding: clamp(28px, 6vw, 56px) 20px;
  border-block: 1px solid var(--brand-line);
  text-align: center;
}

.catalog-empty h2 {
  font-family: var(--brand-font-display);
  font-size: 1.5rem;
  font-weight: 500;
}

.catalog-empty p {
  margin-top: 7px;
  color: var(--brand-muted);
}

.catalog-empty button {
  margin-top: 18px;
}

.catalog-cover-link:hover .catalog-cover,
.catalog-search button:hover,
.catalog-empty button:hover,
.brochure-actions a:hover,
.brochure-actions button:hover {
  background: var(--brand-hover);
}

:where(a, button, input):focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 3px;
}

.catalog-cover-link:focus-visible {
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 560px) {
  .catalog-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalog-heading {
    text-align: left;
  }

  .catalog-search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
