/* ==========================================================================
   Cookie Gate & Human Captcha Verification Barrier
   Author: Ghanashyam Budhathoki Portfolio
   ========================================================================== */

/* Lock background body when gate is active */
body.cookie-gate-locked {
  overflow: hidden !important;
}

/* Fullscreen Barrier Overlay */
.cookie-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(3, 7, 18, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #f8fafc;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cookie-gate-overlay.gate-closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Background Ambient Glows */
.cookie-gate-glow-1 {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.cookie-gate-glow-2 {
  position: absolute;
  bottom: 15%;
  right: 20%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0) 70%);
  filter: blur(45px);
  pointer-events: none;
  z-index: 0;
}

/* Main Modal Card */
.cookie-gate-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 580px;
  max-height: calc(100svh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(8, 14, 28, 0.99));
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8),
              0 0 40px -10px rgba(99, 102, 241, 0.2);
  border-radius: 1.5rem;
  /* overflow:hidden keeps the border-radius visual. The BODY child scrolls
     internally (overflow-y:auto + min-height:0 + flex:1 1 auto) so content
     is never clipped — only the rounded corners are applied here. */
  overflow: hidden;
  box-sizing: border-box;
  animation: cookieGatePop 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cookie-gate-exit-screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}

@keyframes cookieGatePop {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header — flex: 0 0 auto keeps it fixed at top; body scrolls below it */
.cookie-gate-header {
  padding: 1.5rem 1.75rem 1.15rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.8);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.3), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cookie-gate-header:active {
  cursor: grabbing;
}

.cookie-gate-drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #94a3b8;
  font-size: 0.68rem;
  white-space: nowrap;
}

.cookie-gate-drag-hint svg {
  flex: 0 0 auto;
}

.cookie-gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-bottom: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cookie-gate-close {
  display: inline-flex;
  flex: 0 0 2.75rem;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  cursor: pointer;
  touch-action: manipulation;
  /* Ensure nothing can sit above this button */
  pointer-events: auto !important;
  position: relative;
  z-index: 9999;
  /* Expand tap target on touch devices without changing visual size */
  -webkit-tap-highlight-color: transparent;
}

.cookie-gate-close:hover {
  background: #334155;
  border-color: #cbd5e1;
}

.cookie-gate-close:focus-visible {
  outline: 3px solid #a5b4fc;
  outline-offset: 2px;
}

.cookie-gate-intro { min-width: 0; }

.cookie-gate-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cookie-gate-subtitle {
  font-size: 0.825rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Content Body — scrolls when content is taller than available space */
.cookie-gate-body {
  flex: 1 1 auto;
  /* min-height: 0 is CRITICAL for flex children to shrink and allow overflow-y scroll */
  min-height: 0;
  padding: 1.35rem 1.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cookie-gate-body::-webkit-scrollbar {
  width: 6px;
}
.cookie-gate-body::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}

/* Step Badges */
.gate-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.gate-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: #4f46e5;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  transition: background-color 0.3s ease;
}

.gate-step-number.checked {
  background: #10b981;
}

/* CAPTCHA Widget Area */
.captcha-box-wrapper {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #334155;
  border-radius: 1rem;
  padding: 1rem;
  transition: all 0.25s ease;
}

.captcha-box-wrapper.verified {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(6, 78, 59, 0.15);
}

/* Classic "I'm not a robot" card */
.robot-checkbox-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.robot-checkbox-card:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #6366f1;
}

.robot-checkbox-card.is-active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.robot-check-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.robot-checkbox {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.35rem;
  border: 2px solid #64748b;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.robot-checkbox:focus-visible {
  outline: 2px solid #6366f1;
}

.robot-checkbox.spinning {
  border-color: #6366f1;
  border-top-color: transparent;
  border-radius: 50%;
  animation: captchaSpin 0.75s linear infinite;
}

@keyframes captchaSpin {
  to { transform: rotate(360deg); }
}

.robot-checkbox.checked {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.robot-check-label {
  font-size: 0.925rem;
  font-weight: 500;
  color: #f1f5f9;
}

.robot-badge-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: #64748b;
}

.robot-badge-right svg {
  width: 1.6rem;
  height: 1.6rem;
}

.robot-badge-right span {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

/* Dynamic Captcha Interactive Challenge Panel */
.captcha-challenge-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(51, 65, 85, 0.7);
  animation: challengeSlide 0.3s ease forwards;
  max-height: 400px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease,
              margin 0.35s ease,
              padding 0.35s ease;
}

.captcha-challenge-panel.is-collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-color: transparent !important;
  pointer-events: none;
}

@keyframes challengeSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.captcha-canvas-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.captcha-canvas-container {
  flex-grow: 1;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.captcha-canvas {
  width: 100%;
  max-width: 200px;
  height: 48px;
  border-radius: 0.4rem;
  display: block;
}

.captcha-actions-group {
  display: flex;
  gap: 0.4rem;
}

.captcha-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #475569;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.captcha-icon-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #6366f1;
}

/* CAPTCHA Input Row and Button */
.captcha-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.captcha-text-input {
  flex: 1 1 0%;
  min-width: 0 !important; /* Prevents intrinsic input size from overflowing flexbox */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #020617;
  border: 1px solid #475569;
  border-radius: 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  color: #ffffff;
  font-family: 'JetBrains Mono', Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.captcha-text-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.captcha-verify-btn {
  flex-shrink: 0;
  padding: 0.55rem 0.95rem;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 0.65rem;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  box-sizing: border-box;
}

.captcha-verify-btn:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.captcha-verify-btn:active {
  transform: scale(0.98);
}

.captcha-status-msg {
  font-size: 0.775rem;
  margin-top: 0.5rem;
  display: none;
}

.captcha-status-msg.error {
  display: block;
  color: #f87171;
}

.captcha-status-msg.success {
  display: block;
  color: #34d399;
}

/* Cookies Section */
.cookie-types-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cookie-type-item {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s;
}

.cookie-type-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cookie-type-label-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.cookie-type-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.cookie-badge-req {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-weight: 600;
}

.cookie-type-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Custom Toggle Switch */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.25s;
  border-radius: 22px;
}

.cookie-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s;
  border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background-color: #10b981;
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: #4f46e5;
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
  transform: translateX(16px);
}

/* Footer / Action Buttons — flex: 0 0 auto keeps it pinned at bottom; body scrolls above it.
   Removed max-height:45% and overflow-y:auto which caused button clipping. */
.cookie-gate-footer {
  padding: 1.15rem 1.75rem;
  border-top: 1px solid rgba(30, 41, 59, 0.8);
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

.cookie-gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-gate-accept {
  flex: 2 1 220px;
  min-width: 0;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: 1px solid rgba(99, 102, 241, 0.5);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-gate-accept:hover:not(:disabled) {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-gate-accept:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #334155;
  border-color: #475569;
  box-shadow: none;
  transform: none;
}

@keyframes pulseReady {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

.btn-gate-accept.pulse-ready {
  animation: pulseReady 1.6s infinite;
  border-color: #818cf8;
}

.btn-gate-exit {
  flex: 1 1 170px;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.8);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-gate-exit:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.gate-legal-notice {
  font-size: 0.725rem;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
}

.gate-legal-notice a {
  color: #818cf8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gate-legal-notice a:hover {
  color: #a5b4fc;
}

/* Exit State Screen */
.cookie-gate-exit-screen {
  padding: 2.5rem 1.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.exit-icon-wrap {
  width: 4rem;
  height: 4rem;
  border-radius: 1.25rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.exit-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.exit-desc {
  font-size: 0.875rem;
  color: #94a3b8;
  max-width: 420px;
  line-height: 1.5;
  margin: 0;
}

.exit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  width: 100%;
  margin-top: 0.5rem;
}

/* Floating Cookie Preferences Trigger Button */
.cookie-preferences-btn {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5),
              0 0 15px rgba(99, 102, 241, 0.15);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.cookie-preferences-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(99, 102, 241, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -5px rgba(99, 102, 241, 0.3);
}

.cookie-preferences-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  color: #a5b4fc;
}

/* Quick Legal Preview Modal embedded in Gate */
.gate-legal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(3, 7, 18, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: legalFadeIn 0.2s ease;
}

@keyframes legalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gate-legal-modal-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 1rem;
  width: 100%;
  max-width: 650px;
  height: 90vh;
  height: 90dvh;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.gate-legal-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.gate-legal-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  font-size: 0.875rem;
  color: #cbd5e1;
  line-height: 1.7;
  flex-grow: 1;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .cookie-gate-overlay {
    /* On mobile, use the full safe area and align-items to flex-start so the card
       doesn't need to be perfectly centered — it can start at the top with safe padding */
    align-items: flex-start;
    padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right))
      max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
  }
  .cookie-gate-card {
    border-radius: 1.15rem;
    margin: auto;
    max-width: 100%;
    width: 100%;
    /* Enough room for the safe area */
    max-height: calc(100svh - 1rem);
    max-height: calc(100dvh - 1rem);
    box-sizing: border-box;
  }
  .cookie-gate-header {
    padding: 0.75rem 0.85rem;
  }
  .cookie-gate-badge {
    max-width: calc(100% - 5rem);
    font-size: 0.65rem;
  }
  .cookie-gate-drag-hint span {
    display: none;
  }
  .cookie-gate-body {
    padding: 0.85rem;
    gap: 1rem;
    box-sizing: border-box;
  }
  .cookie-gate-title { font-size: 1.15rem; }
  .cookie-gate-footer {
    padding: 0.75rem 0.85rem;
    box-sizing: border-box;
  }
  .cookie-gate-actions {
    flex-direction: column;
  }
  .btn-gate-accept, .btn-gate-exit {
    width: 100%;
    flex-basis: auto;
  }
  .captcha-box-wrapper {
    padding: 0.85rem;
    box-sizing: border-box;
  }
  .captcha-input-row {
    gap: 0.45rem;
  }
  .captcha-verify-btn {
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
  }
  .captcha-text-input {
    padding: 0.55rem 0.65rem;
    font-size: 0.825rem;
    letter-spacing: 0.08em;
  }
  .cookie-preferences-btn span {
    display: none;
  }
  .cookie-preferences-btn {
    padding: 0.6rem;
    border-radius: 50%;
  }
}

@media (max-width: 380px) {
  .cookie-gate-header { padding: 0.65rem 0.75rem; }
  .cookie-gate-body { padding: 0.75rem; }
  .cookie-gate-footer { padding: 0.65rem 0.75rem; }
  .captcha-box-wrapper {
    padding: 0.75rem;
  }
  .captcha-verify-btn {
    padding: 0.5rem 0.65rem;
    font-size: 0.775rem;
  }
  .captcha-text-input {
    padding: 0.5rem 0.55rem;
    font-size: 0.775rem;
  }
}

/* ==========================================================================
   Welcome Greeting Toast Banner (10s auto-dismiss)
   ========================================================================== */
.portfolio-welcome-greeting {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 99998;
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.75),
              0 0 30px -5px rgba(99, 102, 241, 0.25);
  border-radius: 1rem;
  overflow: hidden;
  pointer-events: auto;
  /* Start hidden - JS will add greeting-visible to show */
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #f8fafc;
}

/* JS adds this class after 2 rAFs to trigger slide-in */
.portfolio-welcome-greeting.greeting-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* JS adds this class to trigger slide-out */
.portfolio-welcome-greeting.greeting-dismissing {
  opacity: 0 !important;
  transform: translateY(14px) scale(0.97) !important;
  transition: opacity 0.45s ease,
              transform 0.45s ease;
  pointer-events: none;
}

.welcome-greeting-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.15rem 1.25rem 1rem;
}

.welcome-greeting-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 0.1rem;
  animation: greetingWave 1.8s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes greetingWave {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(14deg); }
  40%, 80% { transform: rotate(-8deg); }
}

.welcome-greeting-content {
  flex: 1 1 0%;
  min-width: 0;
}

.welcome-greeting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.welcome-greeting-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.welcome-greeting-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.welcome-greeting-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.welcome-greeting-body {
  font-size: 0.85rem;
  line-height: 1.55;
  color: #cbd5e1;
  margin: 0;
}

.welcome-greeting-countdown {
  height: 3px;
  width: 100%;
  background: rgba(51, 65, 85, 0.4);
  position: relative;
  overflow: hidden;
}

.welcome-greeting-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transform-origin: left;
  animation: greetingCountdown 10s linear forwards;
}

@keyframes greetingCountdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 640px) {
  .portfolio-welcome-greeting {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
    max-width: none;
    width: auto;
  }
  .welcome-greeting-inner {
    padding: 1rem;
    gap: 0.75rem;
  }
  .welcome-greeting-body {
    font-size: 0.82rem;
  }
}
