/* =========================================================
   RHDC e-Service — homepage
   Same layout as eservice.pmeat.gov.bd: pink page, centred logo,
   green title, "ই-সেবা নির্বাচন করুন", flip cards (front: round
   artwork + green "+" button, back: description + orange button).
   --brand / --brand-dark / --accent come from Site settings.
   ========================================================= */

:root {
  --brand: #007b5e;
  --brand-dark: #005c46;
  --accent: #f0a500;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "SolaimanLipi", "Noto Sans Bengali", sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #212529;
  background: #ffebeb;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; }

section { padding: 60px 0 40px; }
#team { flex: 1; }
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- logo + title ---------- */
.brand { text-align: center; margin-bottom: 30px; }
.brand-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}
.brand-logo {
  display: block;
  width: 128px;
  height: 128px;
  padding: 7px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .55), 0 16px 32px -16px rgba(0, 70, 50, .5);
  transition: transform .3s ease, box-shadow .3s ease;
}
.brand-logo:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .8), 0 22px 36px -16px rgba(0, 70, 50, .55);
}
.brand-divider {
  width: 2px;
  height: 84px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(0, 123, 94, .45), transparent);
}
.section-title {
  margin: 22px 0 4px;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--brand);
}
.brand-ministry {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 700;
  color: #3b4a45;
}
.brand-ministry::before,
.brand-ministry::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, .18);
}
.brand-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0 0;
  font-weight: 700;
  color: var(--brand-dark);
}
.brand-sub::before,
.brand-sub::after {
  content: "";
  width: 60px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 123, 94, .5));
}
.brand-sub::after { background: linear-gradient(90deg, rgba(0, 123, 94, .5), transparent); }

/* ---------- cards ---------- */
/* Column gutters via padding + negative margin (works in old in-app WebViews without flex gap). */
.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 -15px;
}
.flip-card {
  flex: 0 0 33.3333%;
  max-width: 33.3333%;
  display: flex;
  padding: 0 15px 30px;
  cursor: pointer;                         /* iOS only sends click events to "clickable" elements */
  touch-action: manipulation;              /* no double-tap-zoom delay: taps react instantly */
  -webkit-tap-highlight-color: transparent;
  -webkit-perspective: 1000px;
  perspective: 1000px;
  animation: card-in .7s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 120ms + 80ms);
}
/* Both faces share one grid cell, so the card is as tall as its longest face (no inner scrollbar). */
.flip-inner {
  position: relative;
  flex: 1;
  display: grid;
  min-height: 312px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4, .2, .2, 1);
}
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
/* Without JavaScript the card still flips on hover. */
@media (hover: hover) {
  html:not(.flip-ready) .flip-card:hover .flip-inner { transform: rotateY(180deg); }
}

.face {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem;
  border-radius: .5rem;
  background: #fff;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 5px 7px 12px -6px rgba(158, 158, 158, .75);
}
.front { transform: rotateY(0deg); }       /* WebKit honours backface-visibility only on transformed faces */
.back {
  transform: rotateY(180deg);
  justify-content: center;
}
/* The face turned away can never catch a tap or click. */
.flip-card:not(.is-flipped) .back,
.flip-card.is-flipped .front { pointer-events: none; }
@media (hover: hover) {
  html:not(.flip-ready) .flip-card:hover .back { pointer-events: auto; }
  html:not(.flip-ready) .flip-card:hover .front { pointer-events: none; }
}
/* Touch screens: one gentle peek on the first card shows that cards turn. */
.flip-card.hint:not(.is-flipped) .flip-inner { animation: card-peek 1.1s ease-in-out 1; }

.avatar {
  width: 120px;
  height: 120px;
  margin: 0 0 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #fff 0, #e9f7f1 60%, #d6efe6 100%);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 68px; height: 68px; }
.avatar .emoji { font-size: 56px; line-height: 1; }

.ic-a { fill: var(--brand); }
.ic-b { fill: var(--brand-dark); }
.ic-c { fill: var(--accent); }
.ic-s { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }

.card-title {
  margin: 0 0 .75rem;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--brand);
}
.card-text { flex: 1; margin: 0 0 1rem; }
.btn-plus {
  padding: .3rem .55rem;
  border: 1px solid var(--brand);
  border-radius: .2rem;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-plus svg { width: 14px; height: 14px; }
.btn-plus:hover { background: #108d6f; border-color: #108d6f; }

.back .card-title { margin-top: 1.5rem; padding: 0 30px; }
.card-desc {
  margin: 0 0 1rem;
  text-align: justify;
}
.btn-go {
  display: block;
  width: 100%;
  padding: .375rem .75rem;
  border: 1px solid var(--accent);
  border-radius: .25rem;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  background: var(--accent);
  transition: filter .15s;
}
.btn-go:hover { filter: brightness(.93); }

.btn-back {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(0, 123, 94, .25);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: #fff;
  cursor: pointer;
}
.btn-back svg { width: 16px; height: 16px; }
/* Shown when the card was opened by tap or keyboard (hover users just move the mouse away). */
.flip-card.is-flipped:not([data-open-by="mouse"]) .btn-back { display: flex; }

.btn-plus:focus-visible,
.btn-go:focus-visible,
.btn-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid rgba(0, 123, 94, .16);
  background: rgba(255, 255, 255, .6);
  font-size: .92rem;
  color: #4b5a55;
}
.site-foot__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 18px;
}
.site-foot p { margin: 0; }
.site-foot__dev { display: inline-flex; align-items: baseline; gap: 8px; }
.site-foot__dev a {
  position: relative;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--brand);
  text-decoration: none;
  transition: color .2s;
}
.site-foot__dev a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.site-foot__dev a:hover { color: var(--brand-dark); }
.site-foot__dev a:hover::after,
.site-foot__dev a:focus-visible::after { transform: scaleX(1); }
.site-foot__dev a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes card-peek {
  0%, 100% { transform: rotateY(0deg); }
  35% { transform: rotateY(-32deg); }
  70% { transform: rotateY(9deg); }
}

@media (max-width: 991px) {
  .flip-card { flex-basis: 50%; max-width: 50%; }
}
/* Finger-sized targets on touch screens. */
@media (pointer: coarse) {
  .btn-plus { min-width: 44px; min-height: 36px; }
  .btn-go { padding: .6rem .75rem; }
  .btn-back { width: 44px; height: 44px; top: 6px; right: 6px; }
}
@media (max-width: 575px) {
  .flip-card { flex-basis: 100%; max-width: 100%; }
  .brand-logos { gap: 18px; }
  .brand-logo { width: 100px; height: 100px; padding: 5px; box-shadow: 0 0 0 5px rgba(255, 255, 255, .55), 0 12px 26px -14px rgba(0, 70, 50, .5); }
  .brand-divider { height: 64px; }
  .brand-sub::before, .brand-sub::after { width: 32px; }
  .site-foot__inner { justify-content: center; text-align: center; }
}
/* "Remove animations" on the phone: no entrance or peek, and a short flip instead of none. */
@media (prefers-reduced-motion: reduce) {
  .flip-card { animation: none; }
  .flip-inner { transition-duration: .25s; }
  .flip-card.hint .flip-inner { animation: none; }
}
