/* Demo Hub — BrowserStack-inspired formal UI */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8ff;
  --navy: #181c26;
  --ink: #2b2f3a;
  --muted: #5a6072;
  /* BrowserStack blue accent (repurposed from the old orange vars) */
  --orange: #2c74f6;
  --orange-2: #1b5fe0;
  --brand: #6f7bff;
  --brand-2: #2340a8;
  --border: #e3e8f2;
  --card: #ffffff;
  --radius: 18px;
  --shadow-sm: 0 2px 8px rgba(34, 19, 49, 0.06);
  --shadow-md: 0 10px 30px rgba(34, 19, 49, 0.10);
  --shadow-lg: 0 20px 50px rgba(34, 19, 49, 0.16);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark mode overrides */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-alt: #161b27;
  --navy: #f0f2f8;
  --ink: #d8dce8;
  --muted: #8892a8;
  --border: #252d3d;
  --card: #161b27;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.5);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .navbar {
  background: rgba(15,17,23,0.88);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .hero-glass {
  background: rgba(22,27,39,0.82);
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .card {
  background: var(--card);
  border-color: var(--border);
}
[data-theme="dark"] .panel {
  background: var(--card);
  border-color: var(--border);
}
[data-theme="dark"] .player-wrap { background: #0a0c12; }
[data-theme="dark"] .linklist a { background: #1e2535; border-color: var(--border); color: var(--ink); }
[data-theme="dark"] .pl-item:hover { background: #1e2535; }
[data-theme="dark"] .pl-item.active { background: rgba(44,116,246,0.18); }
[data-theme="dark"] .chip { background: rgba(44,116,246,0.15); border-color: rgba(44,116,246,0.3); color: var(--ink); }
[data-theme="dark"] .site-footer { border-top-color: var(--border); }

/* Smooth Global Theme Transitions */
body, 
.navbar, 
.hero-glass, 
.card, 
.panel, 
.player-wrap, 
.linklist a, 
.site-footer {
  transition: background-color 0.4s var(--ease),
              color 0.4s var(--ease),
              border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}

/* ============================================================
   Premium 3D Dark Toggle Animation
   ============================================================ */
.nav-right { display: flex; align-items: center; gap: 12px; }

.dark-toggle {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-alt); cursor: pointer; display: grid; place-items: center;
  font-size: 16px; flex-shrink: 0;
  
  /* 3D setup */
  transform-style: preserve-3d;
  transform: perspective(500px) rotateY(0deg) scale(1);
  
  /* The bouncy release transition */
  transition: background-color 0.4s var(--ease), 
              border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease),
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); /* Custom strong spring */
}

/* Hover state: Gentle lift and glow */
.dark-toggle:hover { 
  border-color: var(--orange); 
  box-shadow: 0 4px 12px rgba(44, 116, 246, 0.15);
  transform: perspective(500px) rotateY(0deg) scale(1.08); 
}

/* Active state: Tactile inward squish on click down */
.dark-toggle:active {
  transform: perspective(500px) rotateY(0deg) scale(0.8) !important;
  transition: transform 0.1s ease-out; /* Fast snap inward */
}

/* Dark mode triggered state: full 360 degree 3D barrel roll */
[data-theme="dark"] .dark-toggle { 
  transform: perspective(500px) rotateY(360deg) scale(1); 
}

/* Dark mode hover state */
[data-theme="dark"] .dark-toggle:hover { 
  transform: perspective(500px) rotateY(360deg) scale(1.08); 
}

/* Dark mode active state */
[data-theme="dark"] .dark-toggle:active {
  transform: perspective(500px) rotateY(360deg) scale(0.8) !important;
  transition: transform 0.1s ease-out;
}
/* ============================================================ */

.navbar.is-home .nav-cta { display: none; }
.nav-cta { cursor: pointer; }

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Top navigation bar */
.navbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 66px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.navbar .brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.navbar .brand .logo {
  width: 30px; height: 30px;
  display: grid; place-items: center;
}
.navbar .brand .logo svg,
.navbar .brand .logo img { display: block; width: 28px; height: 28px; }
.navbar .brand b { font-size: 1.15rem; color: var(--navy); letter-spacing: -0.02em; }
.navbar .nav-cta {
  font-size: 0.9rem; font-weight: 600; color: #fff; padding: 9px 18px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: var(--shadow-sm); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.navbar .nav-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 56px 24px 100px; }

/* Hero */
header.hero { text-align: center; margin-bottom: 56px; }
header.hero .eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--orange); margin-bottom: 16px;
  padding: 6px 14px; border-radius: 100px; background: rgba(252, 109, 38, 0.10);
}
header.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; color: var(--navy);
  line-height: 1.08;
}
header.hero h1 .grad {
  background: linear-gradient(120deg, var(--orange), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
header.hero p { color: var(--muted); margin-top: 16px; font-size: 1.15rem; max-width: 620px; margin-inline: auto; }

/* Home hero — liquid glass */
.home-hero-wrap {
  position: relative; margin-bottom: 52px; border-radius: 28px; overflow: hidden;
  padding: 2px; /* border gradient trick */
  background: linear-gradient(135deg, rgba(44,116,246,0.25), rgba(111,123,255,0.15), rgba(44,116,246,0.1));
}
.hero-orb {
  position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; z-index: 0;
  animation: orbdrift 12s ease-in-out infinite alternate;
}
.orb-1 { width: 420px; height: 420px; top: -120px; left: -80px; background: radial-gradient(circle, rgba(44,116,246,0.22), transparent 70%); animation-delay: 0s; }
.orb-2 { width: 320px; height: 320px; top: -60px; right: -60px; background: radial-gradient(circle, rgba(111,123,255,0.18), transparent 70%); animation-delay: -4s; }
.orb-3 { width: 260px; height: 260px; bottom: -80px; left: 40%; background: radial-gradient(circle, rgba(44,116,246,0.14), transparent 70%); animation-delay: -8s; }
@keyframes orbdrift { from { transform: translate(0,0) scale(1); } to { transform: translate(20px, -20px) scale(1.08); } }
.hero-glass {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 8px 40px rgba(44,116,246,0.10), inset 0 1px 0 rgba(255,255,255,0.9);
  padding: 52px 56px 48px;
  text-align: center;
}
.hero-logo-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.hero-logo { width: 36px; height: 36px; }
.hero-brand { font-size: 1.05rem; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.hero-title {
  font-size: clamp(2.6rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.04em;
  color: var(--navy); line-height: 1.05; margin-bottom: 10px;
}
.hero-grad {
  background: linear-gradient(120deg, var(--orange), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 1.25rem; font-weight: 600; color: var(--orange); letter-spacing: 0.01em; margin-bottom: 18px;
}
.hero-desc {
  color: var(--muted); font-size: 1.05rem; line-height: 1.7; max-width: 640px; margin: 0 auto 28px;
}
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  font-size: 0.82rem; font-weight: 600; padding: 7px 16px; border-radius: 100px;
  background: rgba(44,116,246,0.08); border: 1px solid rgba(44,116,246,0.18);
  color: var(--ink); letter-spacing: 0.01em;
}
.section-label {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 20px;
}
@media (max-width: 640px) {
  .hero-glass { padding: 36px 24px 32px; }
  .hero-title { font-size: 2.2rem; }
}

/* Breadcrumb */
.crumbs { display: flex; gap: 8px; align-items: center; margin-bottom: 28px; font-size: 0.92rem; }
.crumbs a { color: var(--muted); cursor: pointer; text-decoration: none; transition: color 0.2s; }
.crumbs a:hover { color: var(--orange); }
.crumbs span { color: #b9bccb; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 30px; cursor: pointer; position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease);
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card:hover::before { transform: scaleX(1); }
.card .icon {
  font-size: 1.8rem; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(252,109,38,0.12), rgba(120,87,230,0.12)); margin-bottom: 18px;
}
.card h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; color: var(--navy); }
.card p { color: var(--muted); margin-top: 8px; line-height: 1.5; }
.card .count {
  margin-top: 20px; font-size: 0.82rem; font-weight: 600; color: var(--orange);
  display: inline-flex; align-items: center; gap: 6px;
}

/* Video thumb card */
.vthumb { padding: 0; }
.vthumb .thumbwrap { position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.vthumb .thumbimg { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.vthumb:hover .thumbimg { transform: scale(1.06); }
.vthumb .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(34,19,49,0) 40%, rgba(34,19,49,0.35));
  opacity: 0; transition: opacity 0.35s var(--ease);
}
.vthumb:hover .play { opacity: 1; }
.vthumb .play span {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,0.92);
  display: grid; place-items: center; color: var(--orange); font-size: 20px; box-shadow: var(--shadow-md);
  transform: scale(0.8); transition: transform 0.35s var(--ease);
}
.vthumb:hover .play span { transform: scale(1); }
.vthumb .meta { padding: 20px 24px 26px; }
.vthumb h3 { font-size: 1.15rem; color: var(--navy); font-weight: 700; }
.vthumb p { color: var(--muted); margin-top: 6px; font-size: 0.94rem; line-height: 1.5; }
.vthumb .dur {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  background: rgba(34, 19, 49, 0.85); color: #fff; font-size: 0.75rem; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; letter-spacing: 0.02em;
}
.vthumb .thumbimg.noimg {
  background: linear-gradient(135deg, #2b3ff2, #1e2a99);
  min-height: 100%;
}
.vthumb .thumbimg.noimg { content: ""; }

/* Video detail */
.detail { display: grid; grid-template-columns: 1fr; gap: 26px; }
.player-wrap {
  background: var(--navy); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-md); overflow: hidden;
}
.player-wrap iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; display: block; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 28px;
}
.panel h2 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); margin-bottom: 12px; }
.panel h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 16px; font-weight: 700; }
.panel p { color: var(--ink); line-height: 1.7; }
.linklist { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.linklist a {
  color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--border);
  font-weight: 500; font-size: 0.94rem; transition: all 0.25s var(--ease);
}
.linklist a:hover { background: #fff; border-color: var(--orange); color: var(--orange); transform: translateX(3px); box-shadow: var(--shadow-sm); }

/* Playlist panel */
.pl-panel .playlist { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; margin: -4px -6px; padding: 4px 6px; }
.pl-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
  cursor: pointer; position: relative; transition: background 0.2s var(--ease);
}
.pl-item:hover { background: var(--bg-alt); }
.pl-item.active { background: rgba(44, 116, 246, 0.10); }
.pl-index { flex: 0 0 20px; text-align: center; font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.pl-item.active .pl-index { color: var(--orange); }
.pl-thumb { flex: 0 0 72px; width: 72px; height: 42px; object-fit: cover; border-radius: 8px; background: #1e2a99; }
.pl-thumb.noimg { background: linear-gradient(135deg, #2b3ff2, #1e2a99); }
.pl-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pl-title { font-size: 0.86rem; font-weight: 600; color: var(--navy); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pl-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-dur { font-size: 0.72rem; color: var(--muted); }
.pl-now { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--orange); background: rgba(44,116,246,0.12); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }

@media (min-width: 900px) {
  .detail { grid-template-columns: 1fr 340px; align-items: start; }
  .detail .player-wrap { grid-column: 1 / 2; }
  .detail .desc-panel { grid-column: 1 / 2; }
  .detail .side { grid-column: 2 / 3; grid-row: 1 / 3; display: flex; flex-direction: column; gap: 24px; }
}

/* Entrance animations */
.fade { animation: fadeup 0.6s var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.grid .card { animation: fadeup 0.6s var(--ease) both; }
.grid .card:nth-child(1) { animation-delay: 0.04s; }
.grid .card:nth-child(2) { animation-delay: 0.10s; }
.grid .card:nth-child(3) { animation-delay: 0.16s; }
.grid .card:nth-child(4) { animation-delay: 0.22s; }
.grid .card:nth-child(5) { animation-delay: 0.28s; }
.grid .card:nth-child(6) { animation-delay: 0.34s; }

/* Footer */
.site-footer {
  margin-top: 72px; border-top: 1px solid var(--border); padding: 48px 0 32px;
}
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;
}
.footer-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700; color: var(--navy);
}
.footer-desc { color: var(--muted); font-size: 0.95rem; max-width: 520px; line-height: 1.6; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; }
.footer-links a {
  color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--orange); }
.footer-copy { color: var(--muted); font-size: 0.82rem; }