/* ============================================
   DIMENSIONAL GATEWAY — PORTAL SYSTEM
   ============================================ */

/* ── Floating Trigger ── */
.portal-wrapper {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9000;
}

.portal-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.portal-trigger:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-dim), 0 0 0 1px var(--accent-dim);
}

.portal-trigger__glyph {
  font-size: 0.95rem;
  color: var(--accent);
  line-height: 1;
  transition: color var(--transition);
}

.portal-trigger:hover .portal-trigger__glyph {
  color: var(--accent-hover);
}

/* ── Portal Expanded overlay ── */
.portal-expanded {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.portal-expanded.active {
  opacity: 1;
  visibility: visible;
}

.portal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 10, 0.94);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

body.light .portal-backdrop {
  background: rgba(238, 238, 246, 0.94);
}

/* ── Close button ── */
.portal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.portal-close:hover {
  border-color: var(--text-secondary);
  color: var(--text);
}

/* ── Gateway container ── */
.gateway {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  opacity: 0;
  transform: translateY(18px);
}

.portal-expanded.active .gateway {
  animation: gatewayIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.06s forwards;
}

@keyframes gatewayIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Gateway header ── */
.gateway__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gateway__tag {
  font-family: var(--font);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}

.gateway__status {
  font-family: var(--font);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: uppercase;
}

.gw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
  flex-shrink: 0;
  animation: gwBlink 2.4s ease-in-out infinite;
}

@keyframes gwBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Gateway grid (two dimension panels + separator) ── */
.gateway__grid {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  height: 340px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* ── Vertical separator ── */
.gateway__sep {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--border);
  padding: 1.5rem 0;
  width: 1px;
  position: relative;
}

/* Make separator a bit wider for the glyph */
.gateway__sep-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1;
  user-select: none;
  transition: background var(--transition);
}

body.light .gateway__sep-glyph {
  background: var(--bg);
}

.gateway__sep-line {
  display: none; /* glyph only */
}

/* ── Dimension Card (each panel) ── */
.dim-card {
  position: relative;
  overflow: hidden;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: background 0.3s ease;
}

/* Subtle overlay on hover */
.dim-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.03);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
  pointer-events: none;
}

.dim-card:hover::before {
  opacity: 1;
}

/* Gradient so text is always readable */
.dim-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 75%;
  background: linear-gradient(to top, rgba(4, 4, 10, 0.9) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

body.light .dim-card::after {
  background: linear-gradient(to top, rgba(230, 230, 242, 0.92) 0%, transparent 100%);
}

/* ── Animated backgrounds ── */
.dim-card__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* FLUIDS: drifting color blobs */
.dim-card__bg--fluids {
  background: #050510;
}

body.light .dim-card__bg--fluids {
  background: #f0f0fc;
}

.dim-card__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0.65;
}

.dim-card__blob--a {
  width: 220px;
  height: 220px;
  background: rgba(16, 185, 129, 0.55);
  top: -60px;
  left: -60px;
  animation: blobA 11s ease-in-out infinite alternate;
}

.dim-card__blob--b {
  width: 170px;
  height: 170px;
  background: rgba(168, 85, 247, 0.45);
  bottom: -30px;
  right: -30px;
  animation: blobB 13s ease-in-out infinite alternate;
}

.dim-card__blob--c {
  width: 130px;
  height: 130px;
  background: rgba(6, 182, 212, 0.4);
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  animation: blobC 9s ease-in-out infinite alternate;
}

@keyframes blobA {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(70%, 90%) scale(1.35); }
}

@keyframes blobB {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-55%, -65%) scale(1.25); }
}

@keyframes blobC {
  0%   { transform: translate(-50%, -50%) scale(1); }
  50%  { transform: translate(-25%, -75%) scale(0.75); }
  100% { transform: translate(-75%, -25%) scale(1.15); }
}

/* TUBES: animated mesh grid */
.dim-card__bg--tubes {
  background: #06050f;
}

body.light .dim-card__bg--tubes {
  background: #ededfc;
}

.dim-card__grid-lines {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 29px,
      rgba(249, 103, 251, 0.07) 29px,
      rgba(249, 103, 251, 0.07) 30px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 29px,
      rgba(105, 88, 213, 0.07) 29px,
      rgba(105, 88, 213, 0.07) 30px
    );
  animation: gridShift 5s linear infinite;
}

.dim-card__bg--tubes::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 55px,
      rgba(249, 103, 251, 0.04) 55px,
      rgba(249, 103, 251, 0.04) 56px
    );
  animation: gridDiag 9s linear infinite;
}

.dim-card__bg--tubes::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(105, 88, 213, 0.35);
  filter: blur(55px);
  top: 20%;
  left: 15%;
  animation: tubeGlow 8s ease-in-out infinite alternate;
}

@keyframes gridShift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 0 30px, 30px 0; }
}

@keyframes gridDiag {
  0%   { background-position: 0 0; }
  100% { background-position: 56px 56px; }
}

@keyframes tubeGlow {
  0%   { transform: translate(0, 0); opacity: 0.5; }
  100% { transform: translate(50%, -40%); opacity: 0.85; }
}

/* ── Card body (text content) ── */
.dim-card__body {
  position: relative;
  z-index: 3;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
}

.dim-card__id {
  font-family: var(--font);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

body.light .dim-card__id {
  color: var(--text-secondary);
}

.dim-card__name {
  font-family: var(--font);
  font-size: 2.4rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  margin: 0;
  transition: letter-spacing 0.3s ease;
}

body.light .dim-card__name {
  color: var(--text);
}

.dim-card:hover .dim-card__name {
  letter-spacing: 0.1em;
}

.dim-card__spec {
  font-family: var(--font);
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 0.04em;
  margin: 0;
}

body.light .dim-card__spec {
  color: var(--text-secondary);
  opacity: 0.7;
}

.dim-card__enter {
  font-family: var(--font);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-top: 0.6rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease 0.05s, transform 0.3s ease 0.05s;
}

.dim-card--tubes .dim-card__enter {
  color: #f967fb;
}

.dim-card:hover .dim-card__enter {
  opacity: 1;
  transform: translateX(0);
}

/* ── Scan line sweep on hover ── */
.dim-card__scan {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-dim);
  z-index: 4;
  opacity: 0;
  pointer-events: none;
}

.dim-card--tubes .dim-card__scan {
  background: #f967fb;
  box-shadow: 0 0 10px rgba(249, 103, 251, 0.8), 0 0 20px rgba(249, 103, 251, 0.3);
}

.dim-card:hover .dim-card__scan {
  animation: scanSweep 0.55s ease-out forwards;
}

@keyframes scanSweep {
  0%   { top: 0; opacity: 1; }
  80%  { opacity: 0.8; }
  100% { top: 100%; opacity: 0; }
}

/* ── Gateway footer ── */
.gateway__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  opacity: 0.5;
  text-transform: uppercase;
}

/* ── Light mode close / portal-open ── */
body.portal-open #cursorGlow {
  display: none !important;
}

body.portal-open {
  cursor: auto !important;
}

.portal-expanded * {
  cursor: auto !important;
}

.portal-expanded a,
.portal-expanded button {
  cursor: pointer !important;
}

/* ============================================
   DIMENSION TRANSITION OVERLAY (scanline)
   ============================================ */
.dim-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.dim-transition.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.dim-transition__scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
  box-shadow: 0 0 24px #fff, 0 0 48px rgba(255, 255, 255, 0.5);
  top: 0;
  opacity: 0;
}

.dim-transition.active .dim-transition__scan {
  animation: transitionScan 0.75s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes transitionScan {
  0%   { top: 0;      opacity: 1; }
  88%  { top: 100vh;  opacity: 1; }
  100% { top: 100vh;  opacity: 0; }
}

.dim-transition__fill {
  position: absolute;
  inset: 0;
  background: #050508;
  opacity: 0;
}

body.light .dim-transition__fill {
  background: #f8f8fc;
}

.dim-transition.active .dim-transition__fill {
  animation: transitionFill 0.45s ease forwards 0.55s;
}

@keyframes transitionFill {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================
   DIMENSION MODE BACKGROUND CANVAS (WebGL Fluid)
   ============================================ */
.dimension-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  display: none;
}

body.dimension-mode .dimension-bg {
  display: block;
  opacity: 1;
}

/* ============================================
   DIMENSION MODE — visual overrides (DARK)
   ============================================ */
body.dimension-mode {
  --bg: rgba(8, 8, 12, 0.35);
  --bg-secondary: rgba(18, 18, 24, 0.3);
  --bg-tertiary: rgba(28, 28, 36, 0.25);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f0f0f8;
  --text-secondary: #b0b0c0;
  --accent: #a855f7;
  --accent-hover: #c084fc;
  --accent-dim: rgba(168, 85, 247, 0.15);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  background: #050508;
}

/* ============================================
   DIMENSION MODE — visual overrides (LIGHT)
   ============================================ */
body.light.dimension-mode {
  --bg: rgba(255, 255, 255, 0.25);
  --bg-secondary: rgba(245, 245, 250, 0.3);
  --bg-tertiary: rgba(235, 235, 242, 0.25);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1a1a2e;
  --text-secondary: #52525b;
  --accent: #7c3aed;
  --accent-hover: #a855f7;
  --accent-dim: rgba(124, 58, 237, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  background: #f8f8fc;
}

/* Hide the normal dot grid and grain in dimension mode */
body.dimension-mode::before,
body.dimension-mode::after {
  display: none;
}

/* Ensure layout content sits above fluid canvas */
body.dimension-mode .layout {
  position: relative;
  z-index: 2;
}

/* Mobile header — glass bar so canvas shows slightly through */
body.dimension-mode .mobile-header {
  background: rgba(6, 6, 10, 0.78) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body.light.dimension-mode .mobile-header {
  background: rgba(248, 248, 252, 0.82) !important;
}

body.dimension-mode .mobile-nav-overlay {
  background: rgba(6, 6, 10, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

body.light.dimension-mode .mobile-nav-overlay {
  background: rgba(245, 245, 250, 0.94);
}

/* Panel backgrounds become glass so fluid shows through */
body.dimension-mode .panel-left {
  background: rgba(8, 8, 12, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body.light.dimension-mode .panel-left {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body.dimension-mode .content-right {
  background: transparent;
}

body.dimension-mode .content-section {
  background: transparent;
}

body.dimension-mode .experience-card,
body.dimension-mode .project-card,
body.dimension-mode .education-card,
body.dimension-mode .contact-form,
body.dimension-mode .skills-group {
  background: rgba(12, 12, 18, 0.35);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-color: rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

body.light.dimension-mode .experience-card,
body.light.dimension-mode .project-card,
body.light.dimension-mode .education-card,
body.light.dimension-mode .contact-form,
body.light.dimension-mode .skills-group {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-color: rgba(0, 0, 0, 0.06);
}

body.dimension-mode .skills-group {
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.light.dimension-mode .skills-group {
  border-color: rgba(0, 0, 0, 0.06);
}

body.dimension-mode .skill-chip {
  background: rgba(20, 20, 30, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.06);
}

body.light.dimension-mode .skill-chip {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(0, 0, 0, 0.06);
}

body.dimension-mode .cert-card {
  background: rgba(12, 12, 18, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.08);
}

body.light.dimension-mode .cert-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(0, 0, 0, 0.06);
}

body.dimension-mode .stat-item {
  background: rgba(12, 12, 18, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.light.dimension-mode .stat-item {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(0, 0, 0, 0.05);
}

body.dimension-mode .about-stats {
  background: rgba(12, 12, 18, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.06);
}

body.light.dimension-mode .about-stats {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(0, 0, 0, 0.05);
}

body.dimension-mode .metric-chip {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

body.light.dimension-mode .metric-chip {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.15);
  color: #7c3aed;
}

body.dimension-mode .contact-link-item:hover {
  background: rgba(20, 20, 30, 0.4);
}

body.light.dimension-mode .contact-link-item:hover {
  background: rgba(255, 255, 255, 0.3);
}

body.dimension-mode .form-group input,
body.dimension-mode .form-group textarea {
  background: rgba(8, 8, 14, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.08);
}

body.light.dimension-mode .form-group input,
body.light.dimension-mode .form-group textarea {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(0, 0, 0, 0.08);
}

body.dimension-mode .section-header {
  color: var(--text);
}

body.dimension-mode .panel-footer {
  background: transparent;
}

/* Accent overrides for purple theme */
body.dimension-mode .experience-card:hover,
body.dimension-mode .project-card:hover,
body.dimension-mode .education-card:hover {
  border-color: rgba(168, 85, 247, 0.3);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.1);
}

body.light.dimension-mode .experience-card:hover,
body.light.dimension-mode .project-card:hover,
body.light.dimension-mode .education-card:hover {
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.08);
}

body.dimension-mode .status-dot {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

body.light.dimension-mode .status-dot {
  background: #7c3aed;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.4);
}

body.dimension-mode .panel-name .accent {
  color: #a855f7;
}

body.light.dimension-mode .panel-name .accent {
  color: #7c3aed;
}

body.dimension-mode .experience-card::before {
  background: linear-gradient(135deg, transparent 40%, #a855f7 50%, transparent 60%);
}

body.light.dimension-mode .experience-card::before {
  background: linear-gradient(135deg, transparent 40%, #7c3aed 50%, transparent 60%);
}

body.dimension-mode .nav-indicator {
  background: #a855f7;
}

body.light.dimension-mode .nav-indicator {
  background: #7c3aed;
}

body.dimension-mode .panel-nav-link.active .nav-text {
  color: var(--text);
}

body.dimension-mode .panel-nav-link.active .nav-indicator {
  width: 60px;
  background: #a855f7;
}

body.light.dimension-mode .panel-nav-link.active .nav-indicator {
  background: #7c3aed;
}

body.dimension-mode .expand-toggle {
  border-color: rgba(255, 255, 255, 0.08);
}

body.dimension-mode .expand-toggle:hover {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}

body.light.dimension-mode .expand-toggle:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

body.dimension-mode .exp-tags span {
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}

body.light.dimension-mode .exp-tags span {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

body.dimension-mode .exp-subtitle {
  color: #c084fc;
}

body.light.dimension-mode .exp-subtitle {
  color: #7c3aed;
}

body.dimension-mode .btn-submit:hover {
  background: var(--accent-dim);
  border-color: var(--accent-hover);
}

/* Hide portal trigger in dimension mode */
body.dimension-mode .portal-wrapper {
  display: none;
}

/* Hide the normal cursor glow in dimension mode */
body.dimension-mode #cursorGlow {
  display: none !important;
}

/* Scroll progress bar in dimension mode */
body.dimension-mode .scroll-progress {
  background: #a855f7;
}

body.light.dimension-mode .scroll-progress {
  background: #7c3aed;
}

/* ============================================
   DIMENSION CONTROLS (exit, zen, theme)
   ============================================ */

/* Exit dimension button */
.dimension-exit {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9000;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  font-family: var(--font);
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dimension-mode .dimension-exit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dimension-exit:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
}

body.light.dimension-mode .dimension-exit {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.25);
  color: #7c3aed;
}

body.light.dimension-mode .dimension-exit:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.5);
}

/* Zen mode toggle button */
.dimension-zen {
  position: fixed;
  bottom: 2rem;
  right: 9rem;
  z-index: 9000;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dimension-mode .dimension-zen {
  display: flex;
}

.dimension-zen:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
}

body.light.dimension-mode .dimension-zen {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.25);
  color: #7c3aed;
}

body.light.dimension-mode .dimension-zen:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.5);
}

/* Theme toggle in dimension mode */
.dimension-theme {
  position: fixed;
  bottom: 2rem;
  right: 11.5rem;
  z-index: 9000;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dimension-mode .dimension-theme {
  display: none;
}

.dimension-theme:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
}

body.light.dimension-mode .dimension-theme {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.25);
  color: #7c3aed;
}

body.light.dimension-mode .dimension-theme:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.5);
}

/* ============================================
   ZEN MODE (hide UI, fluid canvas only)
   ============================================ */
body.zen-mode .layout,
body.zen-mode .scroll-progress,
body.zen-mode .mobile-header,
body.zen-mode .portal-wrapper {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease;
}

body.zen-mode .dimension-bg {
  pointer-events: auto !important;
}

body.zen-mode .dimension-zen i::before {
  content: "\f066";
}

body.zen-mode .dimension-exit,
body.zen-mode .dimension-theme {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body.zen-mode:hover .dimension-exit,
body.zen-mode:hover .dimension-zen,
body.zen-mode:hover .dimension-theme {
  opacity: 1;
  pointer-events: auto;
}

body.zen-mode .dimension-zen,
body.zen-mode .dimension-theme {
  display: flex;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

body.zen-mode:hover .dimension-zen,
body.zen-mode:hover .dimension-theme {
  opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .portal-wrapper {
    bottom: 1.25rem;
    right: 1.25rem;
  }

  .portal-trigger {
    padding: 0.4rem 0.75rem;
    font-size: 0.66rem;
  }

  .portal-close {
    top: 1rem;
    right: 1rem;
  }

  .gateway {
    padding: 1.25rem 1rem;
    gap: 1rem;
  }

  .gateway__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  /* Stack panels vertically on mobile */
  .gateway__grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1px 1fr;
    height: 460px;
  }

  .gateway__sep {
    width: auto;
    height: 1px;
    flex-direction: row;
    padding: 0;
    background: var(--border);
  }

  .gateway__sep-glyph {
    position: static;
    transform: none;
    padding: 0 0.5rem;
  }

  .dim-card__name {
    font-size: 1.8rem;
  }

  .dim-card__body {
    padding: 1.25rem;
  }

  .gateway__footer {
    display: none;
  }

  .dimension-exit {
    cursor: pointer;
  }
}

@media (max-width: 480px) {
  .gateway__tag {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .dim-card__name {
    font-size: 1.5rem;
  }

  .gateway__grid {
    height: 400px;
  }
}
