/* Civil Affairs — Coming Soon Page
   Design tokens aligned with the project design system */

:root {
  --brand-primary: #002622;
  --brand-secondary: #29443d;
  --brand-accent: #b7a678;
  --bg-page: #f3f6f5;
  --bg-card: #ffffff;
  --text-primary: #161616;
  --text-secondary: #1c1e1d;
  --text-muted: #4a4e4c;
  --text-inverse: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 24px 64px rgba(41, 68, 61, 0.12);
  --radius-card: clamp(16px, 4vw, 24px);
  --font-family: 'Tajawal', sans-serif;
  --motion-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --motion-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --space-page: clamp(1rem, 4vw, 2rem);
  --space-card: clamp(1.5rem, 5vw, 3rem);
  --header-logo-h: clamp(36px, 8vw, 52px);
  --header-emblem-h: clamp(28px, 6vw, 40px);
  --gate-offset-x: 52vw;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: clamp(14px, 2.5vw, 16px);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

/* ── Entrance curtain ── */

.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

.page-curtain__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(183, 166, 120, 0.08), transparent 65%),
    linear-gradient(135deg, var(--brand-primary) 0%, #054239 50%, var(--brand-secondary) 100%);
  transform-origin: top center;
}

.page-curtain__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image:
    repeating-linear-gradient(45deg, #fff 0, #fff 1px, transparent 1px, transparent 32px),
    repeating-linear-gradient(-45deg, #fff 0, #fff 1px, transparent 1px, transparent 32px);
}

body.is-ready .page-curtain__bg {
  animation: curtain-lift 1.15s var(--motion-ease) 0.85s forwards;
}

@keyframes curtain-lift {
  0% {
    opacity: 1;
    transform: scaleY(1);
  }
  40% {
    opacity: 1;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform: scaleY(0);
    visibility: hidden;
  }
}

/* Logos centered on curtain */
.page-curtain__logos {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 3vw, 1.25rem);
  padding-inline: 1rem;
}

.page-curtain__logo {
  display: block;
  width: auto;
  flex-shrink: 0;
  opacity: 0;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.25));
}

.page-curtain__logo--ministry {
  height: clamp(40px, 10vw, 64px);
  max-width: min(200px, 55vw);
}

.page-curtain__logo--emblem {
  height: clamp(32px, 8vw, 52px);
  max-width: min(80px, 22vw);
}

.page-curtain__divider {
  width: 1px;
  height: clamp(28px, 6vw, 44px);
  background: linear-gradient(to bottom, transparent, var(--brand-accent), transparent);
  opacity: 0;
  flex-shrink: 0;
}

/* Logos appear on curtain — both together, from depth */
body.is-loading .page-curtain__logo {
  animation: curtain-logo-in 1.1s var(--motion-ease) 0.2s both;
}

body.is-loading .page-curtain__divider {
  animation: curtain-divider-in 0.6s var(--motion-ease) 0.85s both;
}

@keyframes curtain-logo-in {
  0% {
    opacity: 0;
    transform: scale(0.55);
    filter: blur(18px) drop-shadow(0 0 0 transparent);
  }
  60% {
    opacity: 1;
    filter: blur(2px) drop-shadow(0 6px 28px rgba(0, 0, 0, 0.3));
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) drop-shadow(0 4px 24px rgba(0, 0, 0, 0.25));
  }
}

@keyframes curtain-divider-in {
  to {
    opacity: 0.7;
  }
}

/* Gate opening — logos split to sides while curtain lifts */
body.is-ready .page-curtain__logo--ministry {
  animation: logo-gate-right 1.05s var(--motion-ease) 0.6s both;
}

body.is-ready .page-curtain__logo--emblem {
  animation: logo-gate-left 1.05s var(--motion-ease) 0.6s both;
}

body.is-ready .page-curtain__divider {
  animation: curtain-divider-out 0.35s var(--motion-ease) 0.55s both;
}

@keyframes logo-gate-right {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--gate-offset-x), 0) scale(0.8);
  }
}

@keyframes logo-gate-left {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--gate-offset-x) * -1), 0) scale(0.8);
  }
}

@keyframes curtain-divider-out {
  to {
    opacity: 0;
    transform: scaleY(0);
  }
}

/* Hide entire curtain after sequence */
body.is-ready .page-curtain {
  animation: curtain-remove 0.01s linear 2.1s forwards;
}

@keyframes curtain-remove {
  to {
    visibility: hidden;
    pointer-events: none;
  }
}

/* ── Background layers ── */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}

body.is-ready .page-bg {
  animation: bg-reveal 1.4s var(--motion-ease) 0.15s forwards;
}

@keyframes bg-reveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page-bg__gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(41, 68, 61, 0.08), transparent 60%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(183, 166, 120, 0.1), transparent 55%),
    linear-gradient(165deg, #f3f6f5 0%, #eef3f1 50%, #f5f0e6 100%);
}

.page-bg__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image:
    repeating-linear-gradient(45deg, var(--brand-primary) 0, var(--brand-primary) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(-45deg, var(--brand-accent) 0, var(--brand-accent) 1px, transparent 1px, transparent 28px);
}

.page-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  transform: scale(0.6);
}

body.is-ready .page-bg__orb {
  animation:
    orb-enter 1.6s var(--motion-ease) forwards,
    float 12s var(--motion-ease) 1.6s infinite alternate;
}

body.is-ready .page-bg__orb--2 {
  animation-delay: 0.2s, 1.8s;
}

@keyframes orb-enter {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.page-bg__orb--1 {
  width: clamp(200px, 50vw, 420px);
  height: clamp(200px, 50vw, 420px);
  top: clamp(-80px, -15vw, -120px);
  inset-inline-end: clamp(-40px, -10vw, -80px);
  background: rgba(41, 68, 61, 0.12);
}

.page-bg__orb--2 {
  width: clamp(180px, 45vw, 360px);
  height: clamp(180px, 45vw, 360px);
  bottom: clamp(-60px, -12vw, -100px);
  inset-inline-start: clamp(-30px, -8vw, -60px);
  background: rgba(183, 166, 120, 0.15);
}

@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-20px, 16px) scale(1.05); }
}

/* ── Reveal system ── */

.reveal {
  opacity: 0;
}

body.is-ready .reveal {
  animation: reveal-up 0.9s var(--motion-ease) both;
  animation-delay: var(--delay, 0s);
}

body.is-ready .reveal--scale {
  animation-name: reveal-scale;
}

body.is-ready .reveal--fade {
  animation-name: reveal-fade;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes reveal-scale {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(24px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes reveal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Layout ── */

.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-page);
  gap: clamp(1.25rem, 4vw, 2rem);
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
}

/* ── Header ── */

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 2vw, 1rem);
  width: 100%;
}

.header__logo {
  height: var(--header-logo-h);
  width: auto;
  max-width: min(166px, 70vw);
  display: block;
}

.header__divider {
  width: 1px;
  height: clamp(24px, 5vw, 36px);
  background: linear-gradient(to bottom, transparent, var(--brand-accent), transparent);
  opacity: 0;
  transform: scaleY(0);
}

body.is-ready .header__divider {
  animation: divider-grow 0.6s var(--motion-ease) 1.05s forwards;
}

@keyframes divider-grow {
  to {
    opacity: 0.6;
    transform: scaleY(1);
  }
}

.header__emblem {
  height: var(--header-emblem-h);
  width: auto;
  max-width: min(66px, 22vw);
  display: block;
  opacity: 0.9;
}

/* ── Main card ── */

.card {
  width: 100%;
  max-width: 560px;
  text-align: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  padding: var(--space-card) clamp(1.25rem, 4vw, 2.5rem) clamp(1.5rem, 4vw, 2.75rem);
  position: relative;
  overflow: hidden;
}

/* Gold shimmer line on card top */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--brand-accent) 30%,
    #d4c49a 50%,
    var(--brand-accent) 70%,
    transparent
  );
  transform: scaleX(0);
  transform-origin: center;
}

body.is-ready .card::before {
  animation: shimmer-line 1s var(--motion-ease) 1.2s forwards;
}

@keyframes shimmer-line {
  to { transform: scaleX(1); }
}

.card__badge-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 2vw, 0.75rem);
  margin-bottom: clamp(1.25rem, 4vw, 1.75rem);
  max-width: 100%;
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(36px, 9vw, 44px);
  height: clamp(36px, 9vw, 44px);
  border-radius: 50%;
  background: rgba(183, 166, 120, 0.1);
  color: var(--brand-accent);
}

body.is-ready .card__icon {
  animation:
    icon-pop 0.7s var(--motion-spring) 1.35s both,
    pulse-ring 3s var(--motion-ease) 2.1s infinite;
}

@keyframes icon-pop {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-30deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.card__icon svg {
  width: clamp(18px, 4.5vw, 24px);
  height: clamp(18px, 4.5vw, 24px);
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(183, 166, 120, 0.25); }
  50%      { box-shadow: 0 0 0 12px rgba(183, 166, 120, 0); }
}

.card__badge {
  display: inline-flex;
  align-items: center;
  padding: clamp(0.35rem, 1.5vw, 0.5rem) clamp(0.75rem, 3vw, 1rem);
  font-size: clamp(0.7rem, 2.2vw, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--brand-secondary);
  background: rgba(41, 68, 61, 0.06);
  border: 1px solid rgba(41, 68, 61, 0.1);
  border-radius: 999px;
  text-align: center;
  max-width: 100%;
}

.card__title {
  font-size: clamp(1.75rem, 7vw, 2.75rem);
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: clamp(0.5rem, 2vw, 0.75rem);
  line-height: 1.15;
  position: relative;
  display: inline-block;
}

/* Title character stagger via clip */
.card__title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  inset-inline: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
  transform: scaleX(0);
}

body.is-ready .card__title::after {
  animation: title-underline 0.8s var(--motion-ease) 1.5s forwards;
}

@keyframes title-underline {
  to { transform: scaleX(1); }
}

.card__subtitle {
  font-size: clamp(0.9rem, 2.8vw, 1.125rem);
  font-weight: 500;
  color: var(--brand-secondary);
  margin-bottom: clamp(0.875rem, 3vw, 1.25rem);
  line-height: 1.55;
  padding-inline: clamp(0, 2vw, 0.5rem);
}

.card__description {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  color: var(--text-muted);
  max-width: 42ch;
  margin-inline: auto;
  margin-bottom: clamp(1.25rem, 4vw, 2rem);
  line-height: 1.75;
  padding-inline: clamp(0, 2vw, 0.5rem);
}

/* ── Progress indicator ── */

.progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(1.25rem, 4vw, 2rem);
}

.progress__dot {
  width: clamp(6px, 1.5vw, 8px);
  height: clamp(6px, 1.5vw, 8px);
  border-radius: 50%;
  background: rgba(41, 68, 61, 0.15);
  opacity: 0;
}

body.is-ready .progress__dot {
  animation:
    dot-enter 0.5s var(--motion-spring) both,
    dot-bounce 1.4s var(--motion-ease) 1.2s infinite;
}

body.is-ready .progress__dot:nth-child(1) { animation-delay: 1.65s, 1.85s; }
body.is-ready .progress__dot:nth-child(2) { animation-delay: 1.77s, 1.97s; }
body.is-ready .progress__dot:nth-child(3) { animation-delay: 1.89s, 2.09s; }

@keyframes dot-enter {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40%           { transform: scale(1.2); opacity: 1; background: var(--brand-accent); }
}

/* ── Features strip ── */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.5rem, 2vw, 0.75rem);
  padding-top: clamp(1.25rem, 4vw, 1.75rem);
  border-top: 1px solid var(--border-subtle);
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.25rem, 1.5vw, 0.5rem);
  opacity: 0;
}

body.is-ready .feature {
  animation: reveal-up 0.7s var(--motion-ease) both;
}

body.is-ready .feature:nth-child(1) { animation-delay: 1.75s; }
body.is-ready .feature:nth-child(2) { animation-delay: 1.87s; }
body.is-ready .feature:nth-child(3) { animation-delay: 1.99s; }

.feature__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(34px, 8vw, 40px);
  height: clamp(34px, 8vw, 40px);
  border-radius: 10px;
  background: rgba(41, 68, 61, 0.06);
  color: var(--brand-secondary);
  transition: transform 0.3s var(--motion-ease), background 0.3s ease;
}

.feature:hover .feature__icon {
  transform: translateY(-3px);
  background: rgba(183, 166, 120, 0.12);
}

.feature__icon svg {
  width: clamp(16px, 4vw, 20px);
  height: clamp(16px, 4vw, 20px);
}

.feature__label {
  font-size: clamp(0.65rem, 2vw, 0.75rem);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.3;
  text-align: center;
}

/* ── Footer ── */

.footer {
  text-align: center;
  width: 100%;
  padding-inline: clamp(0.5rem, 3vw, 1rem);
}

.footer__org {
  font-size: clamp(0.75rem, 2.2vw, 0.875rem);
  font-weight: 600;
  color: var(--brand-secondary);
  margin-bottom: 0.35rem;
}

.footer__copy {
  font-size: clamp(0.7rem, 2vw, 0.8125rem);
  color: var(--text-muted);
  opacity: 0.85;
  line-height: 1.5;
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════ */

/* Tablet portrait & small laptops */
@media (max-width: 768px) {
  .page {
    max-width: 100%;
    justify-content: safe center;
  }

  .card {
    max-width: 100%;
  }
}

/* Mobile landscape — compact vertical spacing */
@media (max-height: 500px) and (orientation: landscape) {
  .page {
    justify-content: flex-start;
    padding-block: 1rem;
    gap: 0.75rem;
    min-height: auto;
  }

  body {
    min-height: auto;
  }

  .card {
    padding-block: 1.25rem;
  }

  .card__badge-row {
    margin-bottom: 0.75rem;
  }

  .card__description {
    margin-bottom: 1rem;
  }

  .progress {
    margin-bottom: 1rem;
  }

  .features {
    padding-top: 1rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  :root {
    --gate-offset-x: 40vw;
  }

  .page-curtain__logos {
    gap: 0.625rem;
  }

  .header {
    flex-direction: column;
    gap: 0.625rem;
  }

  .header__divider {
    width: clamp(40px, 20vw, 80px);
    height: 1px;
    background: linear-gradient(to right, transparent, var(--brand-accent), transparent);
    transform: scaleX(0);
  }

  body.is-ready .header__divider {
    animation-name: divider-grow-h;
  }

  @keyframes divider-grow-h {
    to {
      opacity: 0.6;
      transform: scaleX(1);
    }
  }

  .features {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }

  .feature {
    flex-direction: row;
    justify-content: center;
    gap: 0.75rem;
    padding-block: 0.375rem;
  }

  .feature__label {
    text-align: start;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  :root {
    --gate-offset-x: 32vw;
  }

  html {
    font-size: 13px;
  }

  .card__badge {
    font-size: 0.65rem;
    padding-inline: 0.625rem;
  }

  .card__title {
    font-size: 1.625rem;
  }
}

/* Large screens */
@media (min-width: 1200px) {
  .page {
    max-width: 800px;
  }

  .card {
    max-width: 600px;
  }

  .page-bg__orb--1 {
    width: 480px;
    height: 480px;
  }

  .page-bg__orb--2 {
    width: 400px;
    height: 400px;
  }
}

/* Ultra-wide — prevent excessive stretch */
@media (min-width: 1600px) {
  .page-bg__gradient {
    background:
      radial-gradient(ellipse 50% 50% at 85% 10%, rgba(41, 68, 61, 0.07), transparent),
      radial-gradient(ellipse 45% 45% at 15% 90%, rgba(183, 166, 120, 0.09), transparent),
      linear-gradient(165deg, #f3f6f5 0%, #eef3f1 50%, #f5f0e6 100%);
  }
}

/* Touch devices — larger tap targets */
@media (hover: none) and (pointer: coarse) {
  .feature {
    min-height: 44px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .page-curtain {
    display: none;
  }

  .page-bg,
  .reveal,
  .card__icon,
  .progress__dot,
  .feature {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  body.is-ready .page-bg__orb {
    animation: float 12s var(--motion-ease) infinite alternate;
    opacity: 1;
  }
}
