/* =========================================================================
   Geophysical Event — card (listing / homepage) + detail page styles.
   Card rendered by node--geophysical-event--card; loaded via ngf/geo-event.
   Detail rendered by node--geophysical-event--full; also uses ngf/article.
   ========================================================================= */

/* -------------------------------------------------------------------
   Card
   ------------------------------------------------------------------- */
.ngf-geocard {
  background: var(--ngf-bg-surface);
  border: 1px solid var(--ngf-border);
  border-radius: var(--ngf-r-lg);
  box-shadow: var(--ngf-shadow-1);
  overflow: hidden;
  text-decoration: none;
  /* Flex column + full height so the card fills its stretched grid cell and
     the Read more affordance sits on the baseline, the same way
     .ngf-listingcard behaves on /news. */
  display: flex;
  flex-direction: column;
  height: 100%;
}
.ngf-geocard__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.ngf-geocard__media {
  position: relative;
  height: 140px;
  background: var(--ngf-bg-deep);
  overflow: hidden;
}

.ngf-geocard__media img,
.ngf-geocard__media .ngf-img,
.ngf-geocard__media .field--name-field-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Neutralize the media entity wrapper so the img fills the box */
.ngf-geocard__media .field--name-field-featured-image,
.ngf-geocard__media .field__item,
.ngf-geocard__media .media,
.ngf-geocard__media .media--image { display: contents; }

.ngf-geocard__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--ngf-seismic-900) 0%, var(--ngf-bg-deep) 100%);
}

/* Magnitude badge — bottom-left corner of the image */
.ngf-geocard__mag {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-family: var(--ngf-font-mono);
  font-size: 0.8125rem;
  font-weight: var(--ngf-w-bold);
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: var(--ngf-r-sm);
}
/* Tiered magnitude tints: M6+ amber, M7+ seismic red. */
.ngf-geocard__mag--strong { background: rgba(181, 122, 22, 0.85); }
.ngf-geocard__mag--major { background: rgba(173, 32, 32, 0.85); }

/* The one featured event gets a slim seismic accent along the top. */
.ngf-geocard--featured { border-top: 3px solid var(--ngf-seismic-500); }

.ngf-geocard__body {
  padding: 14px 16px 18px;
}

.ngf-geocard__body .ngf-meta {
  display: block;
  margin-bottom: 6px;
}

.ngf-geocard__title {
  font-family: var(--ngf-font-display);
  font-size: var(--ngf-fs-base);
  font-weight: var(--ngf-w-bold);
  margin: 0;
  line-height: 1.3;
  color: var(--ngf-ink-900);
}

.ngf-geocard__desc {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ngf-fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -------------------------------------------------------------------
   Listing page grid (/geophysical-events)
   ------------------------------------------------------------------- */
/* Fixed three-up grid, matching /news and /events, align-items:start included.
   Cards still fill their row: .ngf-geocard sets height:100%, and a percentage
   height on a grid item resolves against the row, so the tallest card in a row
   sets the height for the rest. That is the same mechanism .ngf-listingcard
   uses; without the height the geo cards sized to their own content and the
   rows looked ragged, since most events have no intro text. */
.ngf-geoevents__listing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 20px;
}
@media (max-width: 900px) {
  .ngf-geoevents__listing { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .ngf-geoevents__listing { grid-template-columns: 1fr; }
}
/* Neutralize block/Views wrappers so each card lands directly in the grid */
.ngf-geoevents__listing .block,
.ngf-geoevents__listing .views-element-container,
.ngf-geoevents__listing .view,
.ngf-geoevents__listing .view-content,
.ngf-geoevents__listing .views-row { display: contents; }
.ngf-geoevents__listing .view-header,
.ngf-geoevents__listing .view-empty { display: none; }

/* -------------------------------------------------------------------
   Homepage section (.ngf-geoevents) — lead event + recent-events list panel
   ------------------------------------------------------------------- */
.ngf-geoevents {
  background: var(--ngf-bg-page);
  border-bottom: 1px solid var(--ngf-border);
}

.ngf-geoevents__inner {
  padding: 88px 48px 96px;
}

.ngf-geoevents__label { margin-bottom: var(--ngf-sp-8); }

.ngf-geoevents__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: start;
}

/* Magnitude badge — overlaid top-left on the event image */
.ngf-geo-magbadge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 4px 8px;
  background: var(--ngf-seismic-500);
  color: #fff;
  border-radius: var(--ngf-r-sm);
  font-family: var(--ngf-font-mono);
  font-weight: var(--ngf-w-bold);
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(11, 22, 26, 0.28);
}
.ngf-geo-magbadge__unit { font-size: 0.625rem; opacity: 0.82; }
.ngf-geo-magbadge__value { font-size: 0.9375rem; }
.ngf-geo-magbadge--lg {
  top: 16px;
  left: 16px;
  padding: 7px 12px;
}
.ngf-geo-magbadge--lg .ngf-geo-magbadge__unit { font-size: 0.75rem; }
.ngf-geo-magbadge--lg .ngf-geo-magbadge__value { font-size: 1.375rem; }

.ngf-geo-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ngf-fg-3);
  flex-shrink: 0;
}

/* Lead event card */
.ngf-geo-lead {
  display: block;
  background: var(--ngf-bg-surface);
  border: 1px solid var(--ngf-border);
  border-radius: var(--ngf-r-md);
  box-shadow: var(--ngf-shadow-1);
  overflow: hidden;
}
.ngf-geo-lead__media {
  position: relative;
  height: 360px;
  background: var(--ngf-ink-50, var(--ngf-bg-deep));
}
.ngf-geo-lead__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ngf-geo-lead__body { padding: 24px 28px 28px; }
.ngf-geo-lead__meta { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.ngf-geo-lead__title {
  font-family: var(--ngf-font-display);
  font-size: var(--ngf-fs-2xl);
  font-weight: var(--ngf-w-bold);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ngf-ink-900);
  text-wrap: balance;
}
.ngf-geo-lead__desc {
  margin-top: 12px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ngf-fg-2);
  text-wrap: pretty;
}
.ngf-geo-lead__cta { display: inline-block; margin-top: 16px; }

/* Recent-events list panel */
.ngf-geoevents__list-panel {
  background: var(--ngf-bg-surface);
  border: 1px solid var(--ngf-border);
  border-radius: var(--ngf-r-md);
  box-shadow: var(--ngf-shadow-1);
  overflow: hidden;
}

.ngf-geo-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  text-decoration: none;
  transition: background-color var(--ngf-dur-base) var(--ngf-ease-out);
}
.ngf-geo-row + .ngf-geo-row { border-top: 1px solid var(--ngf-border); }
.ngf-geo-row:hover { background: var(--ngf-bone); }
.ngf-geo-row:hover .ngf-geo-row__title { color: var(--ngf-seismic-600); }

.ngf-geo-row__media {
  position: relative;
  height: 88px;
  border-radius: var(--ngf-r-sm);
  overflow: hidden;
  background: var(--ngf-ink-50, var(--ngf-bg-deep));
  border: 1px solid var(--ngf-border);
}
.ngf-geo-row__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ngf-geo-row__text { min-width: 0; }
.ngf-geo-row__meta { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.ngf-geo-row__title {
  font-family: var(--ngf-font-display);
  font-size: 1.1875rem;
  font-weight: var(--ngf-w-bold);
  margin: 0;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--ngf-ink-900);
  text-wrap: balance;
  transition: color var(--ngf-dur-base) var(--ngf-ease-out);
}

.ngf-geo-row--viewall {
  grid-template-columns: 1fr;
  justify-content: space-between;
  background: var(--ngf-bone);
  border-top: 1px solid var(--ngf-border);
}

@media (max-width: 900px) {
  .ngf-geoevents__inner { padding: 56px 24px 64px; }
  .ngf-geoevents__grid { grid-template-columns: 1fr; }
  .ngf-geo-lead__media { height: 240px; }
}

/* -------------------------------------------------------------------
   Detail page extensions (layered on top of .ngf-article from article.css)
   ------------------------------------------------------------------- */

/* Hero image — full-width with more height than the inline news media box */
.ngf-geo-article__hero {
  margin: var(--ngf-sp-8) 0;
  border-radius: var(--ngf-r-md);
  overflow: hidden;
  max-height: 480px;
  text-align: center;
}
.ngf-geo-article__hero img { object-fit: cover; max-height: 480px; margin: 0 auto; }

/* Magnitude value — larger than the surrounding stats */
.ngf-geo-article__mag-value {
  font-family: var(--ngf-font-display);
  font-size: var(--ngf-fs-2xl);
  font-weight: var(--ngf-w-bold);
  color: var(--ngf-seismic-500);
  line-height: 1;
}

/* Wide stat (location name can be long) */
.ngf-article__fact--wide { flex: 1 1 100%; }
@media (min-width: 640px) { .ngf-article__fact--wide { flex: 1 1 auto; } }

.ngf-geo-article__intro { margin-bottom: var(--ngf-sp-8); }

/* -------------------------------------------------------------------
   Data Products tile grid
   ------------------------------------------------------------------- */
.ngf-geo-tiles { margin: var(--ngf-sp-10) 0; }

.ngf-geo-tiles__heading {
  font-family: var(--ngf-font-mono);
  font-size: var(--ngf-fs-xs);
  letter-spacing: var(--ngf-tr-caps);
  text-transform: uppercase;
  color: var(--ngf-fg-3);
  margin: 0 0 var(--ngf-sp-5);
}

.ngf-geo-tiles__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.ngf-geo-tile {
  border: 1px solid var(--ngf-border);
  border-radius: var(--ngf-r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ngf-geo-tile__media {
  height: 160px;
  overflow: hidden;
  background: var(--ngf-bg-deep);
}
.ngf-geo-tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ngf-geo-tile__body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ngf-geo-tile__title {
  font-family: var(--ngf-font-display);
  font-size: var(--ngf-fs-base);
  font-weight: var(--ngf-w-bold);
  margin: 0 0 6px;
  color: var(--ngf-ink-900);
  line-height: 1.3;
}

.ngf-geo-tile__desc {
  font-size: var(--ngf-fs-sm);
  color: var(--ngf-fg-2);
  margin: 0 0 12px;
  line-height: 1.5;
  flex: 1;
}

.ngf-geo-tile__link {
  font-size: var(--ngf-fs-sm);
  font-weight: var(--ngf-w-bold);
  color: var(--ngf-link);
  text-decoration: none;
  margin-top: auto;
}
.ngf-geo-tile__link:hover { color: var(--ngf-link-hover); text-decoration: underline; }
.ngf-geo-tile__link::after { content: " →"; }

/* -------------------------------------------------------------------
   Related links (manual tiles)
   ------------------------------------------------------------------- */
.ngf-geo-manual-tiles { margin: var(--ngf-sp-10) 0; }

.ngf-geo-manual-tiles__list {
  list-style: none;
  margin: var(--ngf-sp-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Tile with cover image: side-by-side layout */
.ngf-geo-manual-tile--has-img {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ngf-rule);
}
.ngf-geo-manual-tile--has-img:last-child { border-bottom: none; }

.ngf-geo-manual-tile__thumb {
  flex: 0 0 120px;
  border-radius: var(--ngf-r-sm);
  overflow: hidden;
  background: var(--ngf-bone);
}
.ngf-geo-manual-tile__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* For tiles with an image, the link fills the remaining space */
.ngf-geo-manual-tile--has-img .ngf-geo-manual-tile__link {
  flex: 1;
  padding: 4px 0;
  margin: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ngf-geo-manual-tile__link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-radius: var(--ngf-r-sm);
  text-decoration: none;
  transition: background-color var(--ngf-dur-base) var(--ngf-ease-out);
}
.ngf-geo-manual-tile__link:hover { background: var(--ngf-bone); }
.ngf-geo-manual-tile--has-img .ngf-geo-manual-tile__link:hover { background: none; }

.ngf-geo-manual-tile__title {
  font-size: var(--ngf-fs-base);
  font-weight: var(--ngf-w-bold);
  color: var(--ngf-link);
  flex: 1;
  line-height: 1.3;
}
.ngf-geo-manual-tile__link:hover .ngf-geo-manual-tile__title { text-decoration: underline; }

.ngf-geo-manual-tile__source {
  font-family: var(--ngf-font-mono);
  font-size: var(--ngf-fs-xs);
  color: var(--ngf-fg-3);
  white-space: nowrap;
}

/* Tabbed tile-card grids (geo-tabs / geo-tile-card components) */
.ngf-geo-tabs-section {
  margin: var(--ngf-sp-8) 0;
}
.ngf-geo-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--ngf-sp-5);
}
