/*
 * tinlanh.vn portal styles (TINL-1014) — used only by ./index.html.
 * Layout: full-screen photo + dark scrim (the "overlay"), a centered header
 * and three glass cards (Ethan.Bible / Công Nghệ Tin Lành / TruBible —
 * TINL-1048). Three columns from 1080px; from 720px two columns with the
 * TruBible card spanning the row as a horizontal card; stacked below 720px
 * with a short photo band. Motion is transform/opacity only and fully
 * disabled under prefers-reduced-motion.
 */

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #0b1020;
  color: #f8fafc;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background photo + scrim ---------- */
.portal-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.portal-bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 35% 60%;
  /* Slow Ken Burns drift so the backdrop feels alive without distracting. */
  animation: portal-kenburns 30s ease-in-out infinite alternate;
  will-change: transform;
}

.portal-scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 85% 70% at 50% 45%, rgba(11, 16, 32, 0.4), rgba(11, 16, 32, 0.9)),
    linear-gradient(180deg, rgba(11, 16, 32, 0.6), rgba(11, 16, 32, 0.3) 40%, rgba(11, 16, 32, 0.88));
}

/* ---------- Page frame (centered stack) ---------- */
.portal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vh, 40px);
  width: 100%;
  max-width: 1240px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(28px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

/* ---------- Header ---------- */
.portal-head {
  max-width: 48rem;
  text-align: center;
  animation: portal-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.portal-domain {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 14px;
  border: 1px solid rgba(245, 181, 68, 0.35);
  border-radius: 999px;
  background: rgba(245, 181, 68, 0.12);
  color: #fde7b0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-domain::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f5b544;
  box-shadow: 0 0 10px #f5b544;
}

.portal-title {
  margin: 0;
  font-size: clamp(1.45rem, 4.6vw, 3.1rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.portal-lead {
  margin: 12px 0 0;
  color: rgba(226, 232, 240, 0.9);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
}

/* ---------- The three choices ---------- */
.choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: 100%;
}

@media (min-width: 720px) {
  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (min-width: 1080px) {
  .choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.choice {
  /* Per-card accent: amber for Ethan.Bible, sky for Công Nghệ Tin Lành. */
  --accent: #f5b544;
  --accent-ink: #1c1405;
  --accent-soft: rgba(245, 181, 68, 0.16);
  position: relative; /* containing block for the CTA's stretched ::after */
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 28, 52, 0.74), rgba(9, 14, 30, 0.88));
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  /* `backwards` (not `both`): once the entrance ends, :hover can move the card. */
  animation: portal-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s backwards;
}

.choice--congnghe {
  --accent: #7dd3fc;
  --accent-ink: #04131d;
  --accent-soft: rgba(125, 211, 252, 0.16);
  animation-delay: 0.3s;
}

/* TruBible: violet, echoing its indigo→violet brand. */
.choice--trubible {
  --accent: #c4b5fd;
  --accent-ink: #1b1033;
  --accent-soft: rgba(196, 181, 253, 0.16);
  animation-delay: 0.45s;
}

.choice:hover,
.choice:has(.choice-cta:focus-visible) {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow:
    0 28px 60px -22px rgba(0, 0, 0, 0.8),
    0 0 44px -12px var(--accent);
}

/* Photo band: 2:1 keeps the side-by-side pair inside a 900px-tall screen
   (phones and short screens override it below). */
.choice-media {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: #111827;
}

.choice-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(9, 14, 30, 0.85));
}

.choice-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.choice:hover .choice-media img {
  transform: scale(1.06);
}

/* Keep the reader's face in the thin phone band (the photo's subject sits high). */
.choice--ethan .choice-media img {
  object-position: 50% 30%;
}

/* Text column */
.choice-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0 24px 22px;
}

/* Logo tile overlapping the photo band. Not positioned against the card, so
   the CTA's stretched ::after still covers the whole card. */
.choice-badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: -30px 0 14px;
  border: 3px solid rgba(9, 14, 30, 0.95);
  border-radius: 18px;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.choice-badge--logo {
  background: #fff;
}

.choice-badge--logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.choice-badge--icon {
  background: linear-gradient(135deg, #7dd3fc, #2563eb);
  color: #fff;
}

.choice--trubible .choice-badge--icon {
  background: linear-gradient(135deg, #8b5cf6, #0891b2);
}

/* "Trực tiếp" pill on the TruBible photo, with a pulsing red dot. Decorative
   and pointer-events: none, so the card-wide click area is untouched. */
.choice-live {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(9, 14, 30, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.choice-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: portal-live 1.6s ease-out infinite;
}

.choice-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.choice-title {
  margin: 6px 0 0;
  color: #fff;
  font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.choice-desc {
  margin: 10px 0 0;
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.98rem;
  line-height: 1.6;
}

.choice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
  padding: 0;
  list-style: none;
}

.choice-tags li {
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Primary action. Its ::after stretches over the whole card, so the card is
   one big click target while screen readers hear a single, short link. */
.choice-cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  min-height: 48px;
  margin-top: auto;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 10px 24px -10px var(--accent);
  color: var(--accent-ink);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.25s ease;
}

.choice-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* Brighten via background, NOT `filter`: a filter would make the CTA the
   containing block of its ::after and shrink the card-wide click area to the
   button while hovering. */
.choice:hover .choice-cta {
  background: color-mix(in srgb, var(--accent) 88%, #fff);
}

.choice-cta:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.choice-arrow {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.choice:hover .choice-arrow,
.choice-cta:focus-visible .choice-arrow {
  transform: translateX(4px);
}

.choice-url {
  margin: 10px 0 0;
  color: rgba(203, 213, 225, 0.72);
  font-size: 0.82rem;
}

/* ---------- Footer ---------- */
.portal-foot {
  animation: portal-fade 1s ease 0.5s backwards;
}

.portal-foot p {
  margin: 0;
  color: rgba(203, 213, 225, 0.65);
  font-size: 0.8rem;
}

/* ---------- Tablets (720–1079px): TruBible spans the row, photo on the left ---------- */
@media (min-width: 720px) and (max-width: 1079px) {
  .choice--trubible {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .choice--trubible .choice-media {
    flex: 0 0 42%;
    aspect-ratio: auto;
  }

  .choice--trubible .choice-media::after {
    background: linear-gradient(90deg, transparent 55%, rgba(9, 14, 30, 0.85));
  }

  .choice--trubible .choice-body {
    padding: 22px 24px;
  }

  /* No photo band above it here, so the badge sits in the flow. */
  .choice--trubible .choice-badge {
    margin: 0 0 12px;
  }
}

/* ---------- Short desktop screens: slimmer photo band so all fits ---------- */
@media (min-width: 720px) and (max-height: 820px) {
  .choice-media {
    aspect-ratio: 5 / 2;
  }
}

/* ---------- Phones: compact cards, both visible on one screen ---------- */
@media (max-width: 719px) {
  .portal {
    gap: 18px;
  }

  .portal-domain {
    margin-bottom: 10px;
  }

  .choices {
    gap: 14px;
  }

  .choice-media {
    aspect-ratio: 4 / 1;
  }

  .choice-body {
    padding: 0 18px 18px;
  }

  .choice-badge {
    width: 52px;
    height: 52px;
    margin: -26px 0 10px;
    border-radius: 15px;
  }

  .choice-badge--logo img {
    width: 34px;
    height: 34px;
  }

  .choice-desc {
    margin-top: 6px;
    font-size: 0.93rem;
    line-height: 1.5;
  }

  /* The description already says it; tags and the bare domain would push
     the second card below the fold. */
  .choice-tags,
  .choice-url {
    display: none;
  }

  /* Full-width, thumb-sized button. */
  .choice-cta {
    align-self: stretch;
    justify-content: center;
    margin-top: 16px;
  }
}

/* ---------- Motion ---------- */
@keyframes portal-rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes portal-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Live dot: an expanding ring (box-shadow on a fixed-size dot, no layout shift). */
@keyframes portal-live {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }

  100% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

@keyframes portal-kenburns {
  from {
    transform: scale(1.12);
  }

  to {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
