/* =========================================================
   LaunchMD Framework Showcase — style.css
   Aesthetic: Utilitarian Editorial — like a design catalog
   ========================================================= */

:root {
  --bg: #0e0e0e;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.18);
  --text-primary: #f0ede8;
  --text-secondary: #9a9690;
  --text-muted: #5c5956;
  --accent: #e8e0d0;
  --accent-glow: rgba(232, 224, 208, 0.06);

  /* Tag palette */
  --tag-specialty: rgba(96, 130, 182, 0.15);
  --tag-specialty-text: #a0b8d8;
  --tag-specialty-border: rgba(96, 130, 182, 0.3);

  --tag-warm: rgba(190, 130, 80, 0.12);
  --tag-warm-text: #d4a872;
  --tag-warm-border: rgba(190, 130, 80, 0.28);

  --tag-tech: rgba(0, 200, 190, 0.1);
  --tag-tech-text: #4dd8d0;
  --tag-tech-border: rgba(0, 200, 190, 0.25);

  --tag-spa: rgba(100, 190, 190, 0.1);
  --tag-spa-text: #7ccece;
  --tag-spa-border: rgba(100, 190, 190, 0.25);

  --tag-luxury: rgba(200, 170, 100, 0.1);
  --tag-luxury-text: #c8aa6a;
  --tag-luxury-border: rgba(200, 170, 100, 0.25);

  --tag-alpine: rgba(60, 100, 70, 0.12);
  --tag-alpine-text: #7ebd8a;
  --tag-alpine-border: rgba(60, 100, 70, 0.28);

  --tag-kinetic: rgba(200, 90, 40, 0.12);
  --tag-kinetic-text: #e08050;
  --tag-kinetic-border: rgba(200, 90, 40, 0.28);

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-ui: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --max-width: 1280px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   PROGRESS BAR
   ========================================================= */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 14, 14, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.wordmark-main {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.wordmark-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.header-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.cta-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  transition: color 0.2s;
  white-space: nowrap;
}

.cta-link:hover {
  color: var(--text-primary);
}

.header-rule {
  height: 1px;
  background: var(--border);
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 40px 60px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.hero-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.hero-tag span:last-child {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(42px, 5.5vw, 68px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.hero-headline em {
  font-style: italic;
  color: var(--text-secondary);
}

.hero-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 420px;
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 28px;
}

.stat:first-child {
  padding-left: 0;
}

.stat-num {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border-bright);
  flex-shrink: 0;
}

/* Hero right — index panel */
.hero-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 280px;
}

.hero-index {
  border: 1px solid var(--border);
  background: var(--surface);
}

.index-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  gap: 16px;
}

.index-item:last-child {
  border-bottom: none;
}

.index-item:hover {
  background: var(--surface-2);
}

.index-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.index-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.index-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-align: right;
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
}

.scroll-line {
  display: block;
  width: 32px;
  height: 1px;
  background: var(--border-bright);
}

.scroll-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* =========================================================
   TEMPLATES SECTION
   ========================================================= */
.templates-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px 80px;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* =========================================================
   TEMPLATE BLOCK
   ========================================================= */
.template-block {
  padding: 80px 0;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.template-block.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.template-header {
  margin-bottom: 48px;
}

.template-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.template-index-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  letter-spacing: 0.08em;
}

.template-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
}

.tag--dark {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tag--specialty { background: var(--tag-specialty); color: var(--tag-specialty-text); border: 1px solid var(--tag-specialty-border); }
.tag--warm { background: var(--tag-warm); color: var(--tag-warm-text); border: 1px solid var(--tag-warm-border); }
.tag--tech { background: var(--tag-tech); color: var(--tag-tech-text); border: 1px solid var(--tag-tech-border); }
.tag--spa { background: var(--tag-spa); color: var(--tag-spa-text); border: 1px solid var(--tag-spa-border); }
.tag--luxury { background: var(--tag-luxury); color: var(--tag-luxury-text); border: 1px solid var(--tag-luxury-border); }
.tag--alpine { background: rgba(60, 100, 70, 0.12); color: #7ebd8a; border: 1px solid rgba(60, 100, 70, 0.28); }
.tag--kinetic { background: var(--tag-kinetic); color: var(--tag-kinetic-text); border: 1px solid var(--tag-kinetic-border); }

.template-link-badge {
  margin-left: auto;
}

.live-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border-bright);
  padding: 6px 14px;
  letter-spacing: 0.06em;
  transition: all 0.2s;
}

.live-link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.template-name {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.template-descriptor {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* Template body layout */
.template-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

/* Reversed: swap column order with CSS order, no direction tricks */
.template-body--reversed .template-preview-col {
  order: 2;
}

.template-body--reversed .template-info-col {
  order: 1;
}

/* =========================================================
   IFRAME PREVIEW
   ========================================================= */
.template-preview-col {
  /* Constrain so the iframe shell never exceeds this column */
  min-width: 0;
  width: 100%;
}

.preview-frame-wrapper {
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  position: relative;
  width: 100%;
  /* Height is set dynamically by JS; fallback keeps it visible */
  height: 446px;
}

.preview-frame-chrome {
  height: 36px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 6px;
  position: relative;
  z-index: 2;
}

.chrome-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-bright);
  flex-shrink: 0;
}

.chrome-url {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clipping shell sits below the chrome bar and clips the scaled iframe */
.iframe-clip {
  position: relative;
  width: 100%;
  /* height set by JS to match scaled iframe height */
  overflow: hidden;
}

/* Screenshot fallback — used when iframe embedding is blocked */
.screenshot-clip {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.template-screenshot {
  display: block;
  width: 100%;
  /* Match the iframe preview aspect ratio (1280x820 = ~64%) */
  aspect-ratio: 1280 / 820;
  object-fit: cover;
  object-position: top center;
}


.template-iframe {
  /* Natural size — JS will scale it down via transform */
  width: 1280px;
  height: 820px;
  border: none;
  transform-origin: top left;
  /* scale(1) default; JS overrides per container width */
  transform: scale(0.5);
  display: block;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
}

.iframe-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent, rgba(14, 14, 14, 0.95));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 20px;
  opacity: 0;
  transition: opacity 0.3s;
}

.preview-frame-wrapper:hover .iframe-overlay,
.iframe-clip:hover .iframe-overlay,
.screenshot-clip:hover .iframe-overlay {
  opacity: 1;
}

.iframe-cta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-bright);
  padding: 8px 18px;
  transition: background 0.2s;
}

.iframe-cta:hover {
  background: var(--surface-2);
}

/* =========================================================
   TEMPLATE INFO COL
   ========================================================= */
.template-info-col {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-list li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
  letter-spacing: 0.02em;
}

.info-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.best-for-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bf-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
}

.template-cta-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--accent);
  padding: 12px 24px;
  border: 1px solid var(--accent);
  transition: all 0.2s;
  margin-top: 8px;
  align-self: flex-start;
}

.template-cta-btn:hover {
  background: transparent;
  color: var(--accent);
}

/* =========================================================
   COMPARISON TABLE
   ========================================================= */
.comparison-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 80px 40px;
}

.comparison-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.comparison-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 40px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.comparison-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  color: var(--text-primary);
}

.comparison-table-wrapper {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-bright);
}

.comparison-table tbody td {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-table tbody tr:hover td {
  background: var(--surface-2);
}

.col-label {
  color: var(--text-primary) !important;
  font-weight: 500;
  white-space: nowrap;
}

.table-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 10px;
}

.table-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.table-link:hover {
  color: var(--text-primary);
}

/* =========================================================
   FOOTER CTA
   ========================================================= */
.footer-cta {
  padding: 100px 40px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-cta-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.fcta-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.fcta-headline {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
}

.fcta-headline em {
  font-style: italic;
  color: var(--text-secondary);
}

.fcta-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.fcta-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--accent);
  padding: 14px 28px;
  border: 1px solid var(--accent);
  transition: all 0.2s;
}

.fcta-btn:hover {
  background: transparent;
  color: var(--accent);
}

/* =========================================================
   SITE FOOTER
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-wordmark {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* =========================================================
   FLOATING NAV
   ========================================================= */
.float-nav {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.float-nav.is-active {
  opacity: 1;
  pointer-events: all;
}

.float-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  group: true;
}

.fn-num {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.fn-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
  white-space: nowrap;
}

.float-nav-item:hover .fn-name,
.float-nav-item.is-current .fn-name {
  opacity: 1;
  transform: translateX(0);
}

.float-nav-item:hover .fn-num,
.float-nav-item.is-current .fn-num {
  color: var(--text-primary);
}

.float-nav-item.is-current .fn-name {
  color: var(--text-primary);
}

/* Pip indicator */
.float-nav-item::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
  order: -1;
}

.float-nav-item.is-current::before {
  background: var(--accent);
  transform: scale(1.4);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .float-nav {
    display: none;
  }

  .template-body,
  .template-body--reversed {
    grid-template-columns: 1fr;
  }

  /* Force consistent order on mobile: preview always on top, info always below */
  .template-body .template-preview-col,
  .template-body--reversed .template-preview-col {
    order: 1;
  }

  .template-body .template-info-col,
  .template-body--reversed .template-info-col {
    order: 2;
  }

  /* Prevent JS-set height from adding dead space below screenshot images */
  .preview-frame-wrapper:has(.screenshot-clip) {
    height: auto !important;
  }

  .screenshot-clip {
    height: auto !important;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .footer-cta-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 48px 24px 40px;
  }

  .templates-section {
    padding: 0 24px 60px;
  }

  .template-block {
    padding: 60px 0;
  }

  .comparison-section {
    padding: 60px 24px;
  }

  .footer-cta {
    padding: 60px 24px;
  }

  .header-inner {
    padding: 0 24px;
  }

  .footer-inner {
    padding: 20px 24px;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .stat {
    padding: 0 16px;
  }

  .stat-divider {
    display: none;
  }

  .template-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .template-link-badge {
    margin-left: 0;
  }
}
