/* ETHAS component patterns. Load AFTER bootstrap.min.css, modified.css, and ethas-team.css
   so these rules win the cascade. Designed to work with the existing template markup. */

/* ============================================================
   1. PROSE WRAPPER (legal pages)
   Overrides the legacy `p { margin-bottom: 3rem !important; }` rule in ethas-team.css.
   ============================================================ */
.prose p          { margin: 0 0 var(--space-4) !important; line-height: 1.65; color: var(--color-text); }
.prose ul         { margin: 0 0 var(--space-4) var(--space-5); list-style-type: disc; }
.prose ul li      { margin-bottom: var(--space-2); }
.prose h2         { font: 500 1.375rem/1.25 var(--ff-display); color: var(--color-primary); margin: var(--space-7) 0 var(--space-3); }
.prose h2:first-of-type { margin-top: var(--space-4); }
.prose a          { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   2. SURFACE-INFO CARD (legal/contact blocks)
   ============================================================ */
.surface-info {
  background: rgba(69, 189, 246, .08);
  border: 1px solid rgba(69, 189, 246, .25);
  border-left: 4px solid var(--color-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
}
.surface-info__label {
  display: inline-block;
  font: 500 11px/1 var(--ff-body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(3, 33, 89, .6);
  margin-bottom: var(--space-3);
}
.surface-info p           { margin: 0 0 var(--space-3) !important; line-height: 1.55; color: var(--color-text); }
.surface-info p:last-child{ margin-bottom: 0 !important; }
.surface-info strong      { color: var(--color-primary); }
.surface-info a           { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   3. SECTION DIVIDER (replaces .bg-success on h1 spans in showcase pages)
   ============================================================ */
.section-divider {
  display: flex; align-items: baseline; gap: var(--space-3);
  flex-wrap: wrap;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin: var(--space-7) 0 var(--space-4);
}
.section-divider__pill {
  font: 500 .75rem/1 var(--ff-body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: rgba(69, 189, 246, .18);
  padding: .35rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.section-divider__title {
  font: 500 clamp(1.25rem, 2.6vw, 1.75rem)/1.2 var(--ff-display);
  color: var(--color-primary);
  margin: 0;
}

/* ============================================================
   4. PHOTO CARD
   - Soft radius + shadow, slight lift on hover
   - Gradient is HIDDEN by default and FADES IN with the description (520ms)
   - Badge (.pill) and title (h1) are ALWAYS visible — title gets a text-shadow
     so it reads on any photo even with no gradient
   - Description (p / .fade-in-text) reveals on hover, 520ms
   - Button group (when nested inside .content) reveals on hover at the TOP of
     the stack, above the description and badge — no more lower-right collision
   - Visual stack from top to bottom (when revealed):
       [button-group]  ← hover-only, top
       [description]   ← hover-only
       [title]         ← always visible
       [badge / pill]  ← always visible, anchored to bottom
   ============================================================ */
.image-container {
  position: relative;
  width: 100%;
  padding-top: 56%;
  background: center/cover no-repeat;
  overflow: hidden;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}
.image-container:hover,
.image-container:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg) !important;
}

/* Hidden-by-default navy gradient. Fades in WITH the descriptive text. */
.image-container::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 78%;
  background: linear-gradient(to top,
              rgba(3, 33, 89, .94) 0%,
              rgba(3, 33, 89, .60) 55%,
              rgba(3, 33, 89, 0) 100%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 520ms var(--ease-out);
}
.image-container:hover::after,
.image-container:focus-within::after {
  opacity: 1;
}

/* Hide the legacy .overlay div — replaced by ::after gradient */
.image-container .overlay { display: none !important; }

/* Content stack: flex column anchored to bottom-left, growing upward */
.image-container .content {
  position: absolute !important;
  left: var(--space-5) !important;
  right: var(--space-5) !important;
  bottom: var(--space-5) !important;
  z-index: 3;
  color: #fff;
  text-align: left;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  opacity: 1 !important;
  transform: none !important;
  max-width: calc(100% - var(--space-7));
}

/* Visual order: buttons (top), p, h1, pill (bottom) — set independent of HTML order */
.image-container .content > .button-group { order: 1; }
.image-container .content > p,
.image-container .content > .fade-in-text { order: 2; }
.image-container .content > h1,
.image-container .content > h2,
.image-container .content > h3,
.image-container .content > .title         { order: 3; }
.image-container .content > .pill          { order: 4; }

/* Title — always visible. Strong text-shadow keeps it readable when the gradient is off. */
.image-container .content > h1,
.image-container .content > h2,
.image-container .content > h3,
.image-container .content > .title {
  font: 500 clamp(1.5rem, 3vw, 2.25rem)/1.1 var(--ff-display) !important;
  color: #fff !important;
  margin: 0 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .55), 0 0 6px rgba(3, 33, 89, .55);
}

/* Badge / pill — always visible, sits at the bottom of the stack */
.image-container .content > .pill {
  display: inline-block;
  font: 500 11px/1 var(--ff-body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-primary) !important;
  background: var(--color-accent);
  padding: 5px 11px;
  border-radius: 999px;
  margin: var(--space-2) 0 0 0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* Description — hidden by default, reveals on hover with the gradient (520ms) */
.image-container .content > p,
.image-container .content > .fade-in-text {
  font-size: .9375rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .96) !important;
  margin: 0 !important;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transition: opacity 520ms var(--ease-out),
              max-height 520ms var(--ease-out),
              margin 520ms var(--ease-out);
}
.image-container:hover .content > p,
.image-container:hover .content > .fade-in-text,
.image-container:focus-within .content > p,
.image-container:focus-within .content > .fade-in-text {
  opacity: 1;
  max-height: 360px;
  margin-bottom: var(--space-3) !important;
}

/* Button group — when nested INSIDE .content, becomes part of the reveal stack at the top.
   Animates in with the description (520ms) and the gradient.
   - Left-aligned with the description (align-self: flex-start)
   - No overflow: hidden / max-height clipping, so the hover scale and the
     button box-shadow have room to breathe. The button-group always reserves
     its natural height, so the descriptive text below isn't pushed around
     when the buttons fade in. */
.image-container .content > .button-group {
  position: static !important;
  display: flex;
  gap: var(--space-2);
  align-self: flex-start;          /* LEFT aligned with the descriptive text */
  margin: 0 0 var(--space-3) 0 !important;
  padding: var(--space-2) 0;       /* breathing room for hover-scale + shadow */
  opacity: 0;
  pointer-events: none;
  overflow: visible;               /* don't clip scaled buttons or their shadow */
  transform: none !important;
  z-index: 4;
  transition: opacity 520ms var(--ease-out);
}
.image-container:hover .content > .button-group,
.image-container:focus-within .content > .button-group {
  opacity: 1;
  pointer-events: auto;
}

/* Caption-only photo cards (showcase galleries — only a <p> inside .content, no title/badge):
   the caption now follows the same reveal behavior as the description above, so the user gets
   a clean photo by default and the caption + gradient appear on hover. */

/* Upper-right logo plate (e.g. BioRescue / IZW). Hidden by default, fades in
   on hover together with the gradient and the descriptive text (520ms). */
.image-container .flying-svg {
  position: absolute !important;
  top: var(--space-4) !important;
  right: var(--space-4) !important;
  width: 96px !important;
  height: auto !important;
  z-index: 3;
  opacity: 0 !important;
  transform: none !important;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.35));
  background: rgba(255, 255, 255, .92);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  transition: opacity 520ms var(--ease-out) !important;
}
.image-container:hover .flying-svg,
.image-container:focus-within .flying-svg {
  opacity: 1 !important;
  pointer-events: auto;
}

/* Mobile sizing */
@media (max-width: 575.98px) {
  .image-container { padding-top: 70%; }
  .image-container .flying-svg { width: 64px !important; padding: 6px 8px; }
}

/* Touch devices (no hover): show description, gradient, buttons, and logo plate by default */
@media (hover: none) {
  .image-container::after { opacity: 1; }
  .image-container .content > p,
  .image-container .content > .fade-in-text {
    opacity: 1; max-height: 360px; margin-bottom: var(--space-3) !important;
  }
  .image-container .content > .button-group {
    opacity: 1;
    pointer-events: auto;
  }
  .image-container .flying-svg {
    opacity: 1 !important;
    pointer-events: auto;
  }
}

/* ============================================================
   5. INVERTED CIRCULAR ICON BUTTONS (lower-right of hero cards)
   - Default: navy background with white icon
   - Hover:   sky-blue background with navy icon
   ============================================================ */
.image-container .button-group .btn-icon,
.image-container .button-group a.btn {
  width: 46px !important; height: 46px !important;
  min-width: 46px; min-height: 46px;
  border-radius: 50% !important;
  background: var(--color-primary) !important;
  color: #fff !important;
  border: none;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  text-decoration: none;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.image-container .button-group .btn-icon:hover,
.image-container .button-group .btn-icon:focus-visible,
.image-container .button-group a.btn:hover,
.image-container .button-group a.btn:focus-visible {
  background: var(--color-secondary) !important;
  color: var(--color-primary) !important;
  transform: scale(1.06);
}
.image-container .button-group .btn-icon svg,
.image-container .button-group a.btn svg {
  width: 20px; height: 20px;
  fill: currentColor;
  transition: fill var(--t-fast) var(--ease-out);
}
.image-container .button-group .btn-icon i,
.image-container .button-group a.btn i {
  background: none !important;
  color: inherit !important;
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: 0;
}

/* ============================================================
   6. RESPONSIVE INTRO COLUMN (replaces hard-coded width:660px)
   ============================================================ */
.intro-col {
  max-width: 720px;
  margin: 0 auto var(--space-7);
  padding: 0 var(--space-3);
}

/* ============================================================
   7. PROSE LINK underlines (reverse modified.css `p a {text-decoration: none !important}`)
   ============================================================ */
.prose p a, .prose li a,
.surface-info p a, .surface-info li a {
  text-decoration: underline !important;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
