/* ============================================================
   EcoCredit NG — shared media + auth CTA components
   Rule: text is NEVER laid over imagery. Captions sit in a bar
   below the frame, or in a column beside it.
   ============================================================ */

:root{
  --ec-frame-radius: 20px;
  --ec-frame-line: rgba(240,235,222,0.14);

  /* SHARPNESS RULE
     Source photographs are 1792px wide. A 2x retina screen needs
     2 device pixels per CSS pixel, so any frame wider than 896 CSS px
     forces the browser to stretch the image — that is what looks blurry.
     Every frame below is capped at 880px. At 2x that is 1760 device
     pixels against a 1792px file: no upscaling anywhere. */
  --ec-frame-max: 880px;
}

/* ---------- FIGURE (single still image) ----------
   ONE layout rule for every figure on the site. No per-instance
   margins in the HTML — that is what caused the scattered look. */
.ec-figure{
  margin: 44px auto 0;          /* consistent rhythm above every figure */
  max-width: var(--ec-frame-max);
  border-radius: var(--ec-frame-radius);
  overflow: hidden;
  border: 1px solid var(--ec-frame-line);
  background: #0B1714;
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
}
.ec-figure picture, .ec-figure img{ display:block; width:100%; }
.ec-figure img{
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  object-position: center;
  background: #0B1714;
}

/* Two figures side by side — replaces stacking them one after another */
.ec-figrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  max-width: 1120px;
  margin: 44px auto 0;
}
.ec-figrid .ec-figure{ margin: 0; max-width: none; }
@media (max-width: 860px){
  .ec-figrid{ grid-template-columns: 1fr; gap: 26px; max-width: var(--ec-frame-max); }
}

/* MOBILE: a 16:9 frame is very short in portrait — photos read as
   "zoomed out". Use 4:3 on phones so the subject fills the frame. */
@media (max-width: 720px){
  .ec-figure{ margin-top: 32px; border-radius: 16px; }
  .ec-figure img{ aspect-ratio: 4 / 3; }
  .ec-figure figcaption{ padding: 13px 16px 15px; font-size: 13px; }
}
/* caption bar sits BELOW the image, never on top of it */
.ec-figure figcaption{
  padding: 15px 20px 17px;
  border-top: 1px solid var(--ec-frame-line);
  background: rgba(18,43,35,0.72);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2, #D4CFBF);
}
.ec-figure figcaption b{ color: var(--green-2, #A8E0C5); font-weight: 600; }

/* ---------- SLIDESHOW ---------- */
.ec-slides{
  margin: 0 auto;
  max-width: var(--ec-frame-max);
  border-radius: var(--ec-frame-radius);
  overflow: hidden;
  border: 1px solid var(--ec-frame-line);
  background: #0B1714;
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
  position: relative;
}
.ec-slides-stage{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0B1714;
  overflow: hidden;
}
/* phones: taller frame so the photo fills instead of letterboxing small */
@media (max-width: 720px){
  .ec-slides{ border-radius: 16px; }
  .ec-slides-stage{ aspect-ratio: 4 / 3; }
  .ec-slides-bar{ padding: 12px 14px; gap: 10px; }
  .ec-slides-cap .ec-cap-t{ font-size: 13px; }
  .ec-nav{ display: none; }         /* swipe + dots are enough on touch */
}
.ec-slide{
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .75s ease;
  pointer-events: none;
}
.ec-slide.is-on{ opacity: 1; pointer-events: auto; }
.ec-slide img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* caption bar BELOW the stage — imagery stays unobstructed */
.ec-slides-bar{
  border-top: 1px solid var(--ec-frame-line);
  background: rgba(18,43,35,0.82);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ec-slides-cap{ flex: 1 1 240px; min-width: 0; }
.ec-slides-cap .ec-cap-k{
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green, #6CC8A3);
  margin-bottom: 4px;
}
.ec-slides-cap .ec-cap-t{
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2, #D4CFBF);
}
.ec-dots{ display:flex; gap:7px; flex:none; }
.ec-dots button{
  width: 9px; height: 9px; padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(240,235,222,0.34);
  background: transparent;
  cursor: pointer;
  transition: background .25s, border-color .25s, transform .25s;
}
.ec-dots button[aria-selected="true"]{
  background: var(--green, #6CC8A3);
  border-color: var(--green, #6CC8A3);
  transform: scale(1.2);
}
.ec-nav{ display:flex; gap:7px; flex:none; }
.ec-nav button{
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(240,235,222,0.22);
  background: rgba(11,23,20,0.6);
  color: var(--ink-2, #D4CFBF);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: border-color .2s, color .2s;
}
.ec-nav button:hover{ border-color: var(--green, #6CC8A3); color: var(--green, #6CC8A3); }

@media (prefers-reduced-motion: reduce){
  .ec-slide{ transition: none; }
}

/* ---------- SPLIT (image beside text) ---------- */
.ec-split{
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 42px;
  align-items: center;
}
.ec-split.reverse .ec-split-media{ order: 2; }
@media (max-width: 900px){
  .ec-split{ grid-template-columns: 1fr; gap: 28px; }
  .ec-split.reverse .ec-split-media{ order: 0; }
}

/* ---------- AUTH BUTTONS IN NAV ---------- */
.nav-auth{ display:flex; align-items:center; gap:9px; }
.btn-auth{
  display:inline-flex; align-items:center; gap:7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.btn-auth.solid{
  background: var(--green, #6CC8A3);
  color: #08170F;
  box-shadow: 0 6px 20px rgba(108,200,163,0.24);
}
.btn-auth.solid:hover{ transform: translateY(-1px); box-shadow: 0 10px 26px rgba(108,200,163,0.34); }
.btn-auth.line{
  border: 1px solid rgba(240,235,222,0.26);
  color: var(--ink, #F0EBDE);
}
.btn-auth.line:hover{ border-color: var(--green, #6CC8A3); color: var(--green, #6CC8A3); }

/* ---------- MOBILE STICKY AUTH BAR ---------- */
.ec-mobilebar{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  display: none;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11,23,20,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(240,235,222,0.12);
}
.ec-mobilebar a{
  flex: 1;
  text-align: center;
  padding: 13px 10px;
  border-radius: 13px;
  font-weight: 700;
  font-size: 14.5px;
}
.ec-mobilebar .solid{ background: var(--green, #6CC8A3); color:#08170F; }
.ec-mobilebar .line{ border:1px solid rgba(240,235,222,0.26); color: var(--ink, #F0EBDE); }
@media (max-width: 820px){
  .ec-mobilebar{ display:flex; }
  body{ padding-bottom: 78px; }
}

/* ---------- AUTH CARDS (join section) ---------- */
.ec-authgrid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 18px;
  margin: 26px 0 8px;
}
.ec-authcard{
  border: 1px solid var(--ec-frame-line);
  border-radius: 18px;
  padding: 26px 24px;
  background: rgba(18,43,35,0.55);
  transition: border-color .2s, transform .2s;
}
.ec-authcard:hover{ border-color: rgba(108,200,163,0.45); transform: translateY(-2px); }
.ec-authcard.primary{
  background: linear-gradient(160deg, rgba(31,122,94,0.34), rgba(18,43,35,0.6));
  border-color: rgba(108,200,163,0.42);
}
.ec-authcard h3{ font-size: 19px; margin-bottom: 8px; }
.ec-authcard p{ font-size: 14px; color: var(--ink-2, #D4CFBF); line-height:1.6; margin-bottom: 16px; }
.ec-authcard .btn{ width: 100%; justify-content:center; }

/* role chooser */
.ec-roles{ display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.ec-roles a{
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(240,235,222,0.2);
  color: var(--ink-2, #D4CFBF);
  transition: border-color .2s, color .2s;
}
.ec-roles a:hover{ border-color: var(--green, #6CC8A3); color: var(--green, #6CC8A3); }
