/* =============================================
   TorchDeploy
   Feel: viewmymodel.com  |  Colors: embedl.com/deploy
   ============================================= */

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

:root {
  --bg:           #050914;
  --surface:      #0B1527;
  --surface-2:    #0f1d35;
  --surface-3:    #162240;
  --cyan:         #58B1C3;
  --cyan-dim:     rgba(88, 177, 195, 0.12);
  --cyan-border:  rgba(88, 177, 195, 0.22);
  --cyan-glow:    rgba(88, 177, 195, 0.18);
  --orange:       #E8613C;
  --orange-dim:   rgba(232, 97, 60, 0.10);
  --text:         #FFFFFF;
  --text-2:       #b0bec5;
  --text-3:       #546e7a;
  --font-head:    'Space Grotesk', 'Montserrat', system-ui, sans-serif;
  --font-body:    'Montserrat', system-ui, sans-serif;
  --r-sm:         8px;
  --r-md:         14px;
  --r-lg:         24px;
  --ease:         cubic-bezier(.4, 0, .2, 1);
  --t:            220ms;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.88em;
  color: var(--cyan);
}

/* ── NAV ─────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(5, 9, 20, 0.82);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(88, 177, 195, 0.08);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-torch  { color: var(--orange); }
.logo-deploy { color: var(--cyan); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--t) var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover { color: var(--text); }

.nav-gh svg { opacity: 0.7; transition: opacity var(--t); }
.nav-gh:hover svg { opacity: 1; }

/* ── BACKGROUND ELEMENTS ─────────────────── */
.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 177, 195, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 177, 195, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 15%, black 25%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.glow-cyan {
  width: 700px;
  height: 500px;
  top: -80px;
  left: 50%;
  transform: translateX(-55%);
  background: radial-gradient(ellipse, rgba(88, 177, 195, .13) 0%, transparent 65%);
}

.glow-orange {
  width: 400px;
  height: 350px;
  top: 100px;
  right: 0;
  background: radial-gradient(ellipse, rgba(232, 97, 60, .07) 0%, transparent 65%);
}

/* ── HERO ────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 110px 28px 100px;
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 960px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 32px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  flex-shrink: 0;
}

.hero-headline {
  font-family: var(--font-head);
  font-size: clamp(3rem, 7vw, 5.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero-sub {
  color: var(--text-2);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 48px;
}

/* ── DROP ZONE ───────────────────────────── */
.drop-zone {
  width: 100%;
  max-width: 560px;
  min-height: 180px;
  border: 2px dashed var(--cyan-border);
  border-radius: var(--r-lg);
  background: var(--cyan-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    border-color var(--t) var(--ease),
    background var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease);
  position: relative;
  margin-bottom: 40px;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--cyan);
  background: rgba(88, 177, 195, .16);
  box-shadow: 0 0 0 4px rgba(88, 177, 195, .08), inset 0 0 40px rgba(88, 177, 195, .06);
  outline: none;
}

.drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(88, 177, 195, .2);
  box-shadow:
    0 0 0 4px rgba(88, 177, 195, .12),
    0 0 60px rgba(88, 177, 195, .15),
    inset 0 0 40px rgba(88, 177, 195, .08);
  transform: scale(1.01);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 24px;
  user-select: none;
  pointer-events: none;
}

.drop-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  margin-bottom: 8px;
  transition: background var(--t), box-shadow var(--t);
}

.drop-zone.drag-over .drop-icon {
  background: rgba(88, 177, 195, .22);
  box-shadow: 0 0 20px rgba(88, 177, 195, .25);
}

.drop-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.drop-sub {
  font-size: 0.85rem;
  color: var(--text-3);
}

.file-label {
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: all;
  transition: color var(--t);
}
.file-label:hover { color: #7ec8d6; }

/* ── GALLERY DIVIDER ─────────────────────── */
.gallery-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 680px;
  margin-bottom: 12px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.gallery-divider::before,
.gallery-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(88, 177, 195, .12);
}

.gallery-caption {
  font-size: 0.78rem;
  color: var(--text-3);
  max-width: 560px;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── MODEL GALLERY ───────────────────────── */
.model-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 900px;
}

.model-card {
  background: var(--surface-2);
  border: 1px solid rgba(88, 177, 195, .1);
  border-radius: var(--r-md);
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  font-family: var(--font-body);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition:
    border-color var(--t) var(--ease),
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

.model-card:hover {
  border-color: rgba(88, 177, 195, .35);
  transform: translateY(-5px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, .45),
    0 0 0 1px rgba(88, 177, 195, .15),
    0 0 30px rgba(88, 177, 195, .06);
}

.model-card:active { transform: translateY(-2px); }

/* Graph preview area */
.model-card-preview {
  height: 130px;
  background: linear-gradient(160deg, var(--surface-3) 0%, var(--bg) 100%);
  border-bottom: 1px solid rgba(88, 177, 195, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--cyan);
  overflow: hidden;
  transition: background var(--t);
}

.model-card:hover .model-card-preview {
  background: linear-gradient(160deg, var(--surface-3) 0%, rgba(88, 177, 195, .04) 100%);
}

/* Card body */
.model-card-body {
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.model-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.model-name {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.model-meta {
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.01em;
}

.model-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  border-radius: 100px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.model-compare-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 2px;
}

.compare-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
  box-shadow: 0 0 4px var(--orange);
}

/* Arrow affordance */
.model-card-arrow {
  position: absolute;
  bottom: 14px;
  right: 16px;
  color: var(--cyan);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--t), transform var(--t);
}

.model-card {
  position: relative;
}

.model-card:hover .model-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ── VISUALIZER SECTION ──────────────────── */
.viz-section {
  padding: 40px 0 80px;
  position: relative;
}

.viz-section[hidden] { display: none; }

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

.viz-window {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid rgba(88, 177, 195, .15);
  box-shadow:
    0 0 0 1px rgba(88, 177, 195, .06),
    0 32px 80px rgba(0, 0, 0, .6),
    0 0 60px rgba(88, 177, 195, .05);
  animation: slideUp 0.4s var(--ease) both;
}

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

/* macOS window bar */
.window-bar {
  background: var(--surface-2);
  border-bottom: 1px solid rgba(88, 177, 195, .12);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.window-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.window-title {
  flex: 1;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  letter-spacing: 0.01em;
}

.window-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
}
.window-close:hover {
  background: rgba(232, 97, 60, .15);
  color: var(--orange);
  border-color: rgba(232, 97, 60, .3);
}

/* iframe wrapper */
.viz-frame-wrap {
  position: relative;
  width: 100%;
  height: 640px;
  background: var(--bg);
}

#vizFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loading overlay */
.viz-loading {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-3);
  transition: opacity 0.3s;
}

.viz-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(88, 177, 195, .2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── ACTION BAR ──────────────────────────── */
.action-bar {
  background: var(--surface-2);
  border-top: 1px solid rgba(88, 177, 195, .12);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.action-device {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.device-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.device-select {
  appearance: none;
  background: var(--surface-3);
  border: 1px solid rgba(88, 177, 195, .2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 32px 7px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  outline: none;
  transition: border-color var(--t);
}
.device-select:focus { border-color: var(--cyan); }

.select-arrow {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--text-3);
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex: 1;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--t) var(--ease),
    border-color var(--t) var(--ease),
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    opacity var(--t);
  white-space: nowrap;
}

.action-btn:active { transform: scale(0.97); }

.btn-transform {
  background: var(--surface-3);
  border-color: rgba(88, 177, 195, .2);
  color: var(--text-2);
}
.btn-transform:hover {
  background: rgba(88, 177, 195, .1);
  border-color: var(--cyan);
  color: var(--text);
}

.btn-quantize {
  background: var(--surface-3);
  border-color: rgba(232, 97, 60, .2);
  color: var(--text-2);
}
.btn-quantize:hover {
  background: rgba(232, 97, 60, .1);
  border-color: var(--orange);
  color: var(--text);
}

.btn-compile {
  background: linear-gradient(135deg, var(--cyan) 0%, #3a9eb3 100%);
  border-color: transparent;
  color: var(--surface);
  font-weight: 700;
}
.btn-compile:hover {
  opacity: 0.88;
  box-shadow: 0 6px 20px rgba(88, 177, 195, .3);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.action-status {
  font-size: 0.8rem;
  color: var(--cyan);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t);
}

.action-status.warn { color: var(--orange); }
.action-status.ok   { color: #4cce88; }

/* ── FOOTER ──────────────────────────────── */
.footer {
  padding: 40px 0;
  border-top: 1px solid rgba(88, 177, 195, .07);
}

.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.83rem;
  transition: color var(--t);
}
.footer-links a:hover { color: var(--cyan); }

.footer-copy {
  color: var(--text-3);
  font-size: 0.75rem;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 96px 20px 80px; }

  .hero-headline { font-size: clamp(2.4rem, 10vw, 3.4rem); }

  .model-gallery { grid-template-columns: 1fr; max-width: 380px; }

  .model-card-preview { height: 100px; }
  .model-card-arrow { display: none; }

  .action-bar { flex-direction: column; align-items: stretch; }
  .action-device { justify-content: space-between; }
  .action-buttons { flex-wrap: wrap; }
  .action-btn { flex: 1; justify-content: center; }

  .viz-frame-wrap { height: 460px; }

  .section-inner { padding: 0 16px; }
  .nav-inner { padding: 0 20px; }
}

@media (max-width: 400px) {
  .hero-headline { font-size: 2.2rem; }
  .drop-zone { min-height: 150px; }
}
