/**
 * Portal stylesheet — single sheet, no preprocessor.
 *
 * Theme palette is applied at runtime by tenants.js via CSS custom
 * properties (var(--brand), var(--canvas), etc.) so this stylesheet is
 * tenant-agnostic.
 *
 * Layout strategy:
 *   - Single column, vertical scroll on mobile
 *   - Hero takes 100svh on first paint
 *   - Device cards reflow:
 *       - <640px : 1 col
 *       - 640-960 : 2 col
 *       - >960px : 4 col
 */

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

:root {
  --brand: #22D3EE;
  --brand-hover: #06B6D4;
  --brand-press: #0891B2;
  --canvas: #050B1A;
  --surface: #0F172A;
  --card: #1E293B;
  --text-primary: #F1F5F9;
  --text-muted: #94A3B8;
  --splash-mid: #0E1A38;
  --splash-end: #020617;
  --brand-a12: #22D3EE1F;
  --brand-a24: #22D3EE3D;
  --brand-a40: #22D3EE66;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-soft: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 60px var(--brand-a40);
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  position: relative;
}

/* Background layers — radial splash + canvas particles + subtle grain */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-radial {
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, var(--splash-mid) 0%, transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, var(--splash-end) 0%, transparent 70%),
    var(--canvas);
}

#bg-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 1;
}

main, header {
  position: relative;
  z-index: 1;
}

/* ─── Top bar (logo on left, language on right) ─── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-mark img {
  height: 32px;
  width: auto;
  border-radius: 6px;
}

.lang-switch {
  display: inline-flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active {
  background: var(--brand-a24);
  color: var(--text-primary);
}

/* ─── Hero ─── */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 24px 60px;
}

.hero-logo {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-glow);
  animation: float 6s ease-in-out infinite;
  object-fit: cover;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.hero-name {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--text-primary) 0%, var(--brand) 200%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--text-muted);
  margin-bottom: 56px;
  max-width: 600px;
}

.hero-cta {
  appearance: none;
  border: 1px solid var(--brand-a40);
  background: var(--brand-a12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}

.hero-cta:hover {
  background: var(--brand-a24);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px var(--brand-a40);
}

.hero-cta::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(45deg);
  animation: bounceArrow 1.6s ease-in-out infinite;
}

@keyframes bounceArrow {
  0%, 100% { transform: rotate(45deg) translate(-2px, -2px); opacity: .5; }
  50%      { transform: rotate(45deg) translate(2px, 2px);   opacity: 1; }
}

/* ─── Device grid ─── */
.devices {
  padding: 40px 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.device-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px)  { .device-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px)  { .device-grid { grid-template-columns: repeat(4, 1fr); } }

.device-card {
  position: relative;
  background: linear-gradient(180deg, var(--card) 0%, var(--surface) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 32px 24px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform .25s, border-color .25s, box-shadow .25s;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
}

.device-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--brand-a40), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .25s;
  z-index: -1;
}

.device-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-a24);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--brand-a12);
}

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

.device-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-a12);
  border-radius: 16px;
  color: var(--brand);
}

.device-icon svg { width: 28px; height: 28px; }

.device-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.device-meta {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 18px;     /* avoid jump while loading */
  margin-bottom: 18px;
}

.device-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  border: 1px solid var(--brand-a40);
  background: transparent;
  border-radius: 999px;
  padding: 8px 18px;
  transition: background .2s;
}

.device-card:hover .device-action {
  background: var(--brand-a24);
}

.device-action[aria-disabled="true"] {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}

/* ─── Web fallback row ─── */
.web-row {
  text-align: center;
  margin-top: 60px;
  font-size: 14px;
  color: var(--text-muted);
}

.web-row a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  margin-left: 8px;
}

.web-row a:hover { text-decoration: underline; }

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 32px 16px 60px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 60px;
}

.footer p + p { margin-top: 6px; }

/* ─── iOS guide ─── */
.ios-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 100px 20px 60px;
}

.ios-header {
  text-align: center;
  margin-bottom: 48px;
}

.ios-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  margin-bottom: 12px;
}

.ios-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.step {
  background: linear-gradient(180deg, var(--card) 0%, var(--surface) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: stepIn .5s ease-out forwards;
  animation-delay: calc(var(--i, 1) * 80ms);
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-num {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-a12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.step h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.step p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.step p a, .step p b {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}

.step img {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 24px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand-a24);
  transition: background .2s;
}

.back-btn:hover { background: var(--brand-a12); }

/* ─── Mobile tuning ─── */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .hero { padding: 80px 16px 40px; }
  .devices { padding: 20px 16px 40px; }
  .device-card { padding: 24px 18px 20px; }
  .ios-page { padding: 80px 16px 40px; }
  .step { padding: 22px 18px; }
}
