/* TortaApps_StackDemo -- demo-specific styling (tabs, hero, timeline,
   grouped headings, workflow swimlanes). Built on shared-ui's --td-*
   tokens like styles.css, kept in its own file since it's sizeable and
   specific to this one page rather than general house baseline. */

/* ---- hero ---- */
.hero {
  padding: 40px 0 28px;
  text-align: center;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(45,212,255,0.14), transparent 70%);
  border-radius: var(--td-radius);
  margin-bottom: 8px;
}
.hero-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
  background: linear-gradient(120deg, var(--td-text) 30%, var(--td-accent) 75%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { color: var(--td-text-dim); font-size: 15px; max-width: 560px; margin: 0 auto; }

/* ---- stats strip ---- */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.stat-tile { text-align: center; min-width: 90px; }
.stat-value, .stat-value-static {
  font-size: 30px;
  font-weight: 800;
  color: var(--td-text);
  font-variant-numeric: tabular-nums;
}
.stat-value-static { font-size: 18px; margin-top: 6px; }
.stat-label {
  font-size: 11px;
  color: var(--td-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ---- tabs ---- */
.demo-tabs {
  position: relative;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--td-border);
  margin-bottom: 24px;
}
.demo-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--td-text-dim);
  transition: color 0.2s ease;
}
.demo-tab:hover { color: var(--td-text); border-color: transparent; }
.demo-tab.active { color: var(--td-accent); border-bottom-color: transparent; }
.demo-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--td-accent);
  box-shadow: 0 0 8px rgba(45,212,255,0.6);
  transition: transform 0.25s ease, width 0.25s ease;
}

/* ---- panel transitions ---- */
.demo-panel {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo-panel.panel-in { opacity: 1; transform: translateY(0); }

/* ---- avatars ---- */
.app-avatar {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: 0.3px;
}
.app-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.app-card-headings { flex: 1; min-width: 0; }
.app-card-headings h3 { margin-bottom: 6px; }

/* ---- card hover polish ---- */
.app-card { transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.app-card:hover { transform: translateY(-3px); border-color: var(--td-accent); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }

/* ---- footer ---- */
.demo-footer {
  text-align: center;
  color: var(--td-text-faint);
  font-size: 12.5px;
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--td-border);
}

@media (prefers-reduced-motion: reduce) {
  .demo-panel, .demo-tab, .demo-tab-indicator, .app-card, .timeline-item, .timeline-line-fill, .stat-value {
    transition: none !important;
  }
}

.demo-status {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--td-radius-sm);
  font-size: 13px;
}
.demo-status.err { background: rgba(255,93,93,0.1); border: 1px solid var(--td-danger); color: var(--td-text); }
.demo-status.warn { background: rgba(255,184,77,0.1); border: 1px solid var(--td-warn); color: var(--td-text); }

.timeline-note {
  font-size: 12.5px;
  color: var(--td-text-dim);
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px dashed var(--td-border);
  border-radius: var(--td-radius-sm);
}

/* ---- timeline ---- */
.timeline { position: relative; padding: 20px 0 40px; }
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--td-border) 4%, var(--td-border) 96%, transparent);
  transform: translateX(-50%);
  overflow: hidden;
}
.timeline-line-fill {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 0%;
  background: linear-gradient(to bottom, var(--td-accent), var(--td-accent));
  box-shadow: 0 0 10px rgba(45,212,255,0.5);
  transition: height 0.5s ease-out;
}
.timeline-item {
  position: relative;
  width: 50%;
  padding: 0 40px 36px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: calc(var(--i, 0) * 0.02s);
}
.timeline-item.in-view { opacity: 1; transform: translateY(0); }
.timeline-item.left { left: 0; text-align: right; }
.timeline-item.right { left: 50%; text-align: left; }
.timeline-node {
  position: absolute;
  top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--td-accent);
  box-shadow: 0 0 0 4px var(--td-bg), 0 0 14px 2px rgba(45,212,255,0.6);
}
.timeline-item.left .timeline-node { right: -7px; }
.timeline-item.right .timeline-node { left: -7px; }
.timeline-card {
  display: inline-block;
  background: var(--td-bg-elev);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  padding: 14px 18px;
  max-width: 420px;
  box-shadow: var(--td-shadow);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.timeline-card:hover { transform: translateY(-3px); border-color: var(--td-accent); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.timeline-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.timeline-card .app-avatar { width: 28px; height: 28px; font-size: 11px; border-radius: 7px; }
.timeline-card h3 { margin: 2px 0 6px; font-size: 16px; }
.timeline-date { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: var(--td-accent); text-transform: uppercase; }
.timeline-item.left .timeline-card-head { flex-direction: row-reverse; }

/* milestones and roadmap (v0.17): a diamond on the line instead of an app's
   dot; hollow and dashed once it's below "Today" (not done yet). */
.timeline-track { position: relative; }
/* demo.js (layoutTimeline) sets each entry's top: date-scaled, side by side */
.timeline-track.laid-out .timeline-item { position: absolute; padding-bottom: 0; }
.timeline-track.laid-out .timeline-divider,
.timeline-track.laid-out .timeline-month { position: absolute; left: 0; right: 0; margin: 0; }
.timeline-card { padding: 10px 14px; }
.timeline-item { padding-left: 30px; padding-right: 30px; }
.timeline-card h3 { font-size: 15px; margin: 2px 0 5px; }
.timeline-month { z-index: 1; text-align: center; pointer-events: none; line-height: 1; }
.timeline-month span {
  display: inline-block; background: var(--td-bg); color: var(--td-text-dim);
  border: 1px solid var(--td-border); border-radius: 4px;
  padding: 3px 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; white-space: nowrap;
}
.timeline-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 26px; }
.timeline-filter {
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  background: var(--td-bg-elev); color: var(--td-text-dim);
  border: 1px solid var(--td-border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.timeline-filter:hover { color: var(--td-text); border-color: var(--td-accent); }
.timeline-filter.active { color: var(--td-accent); border-color: var(--td-accent); background: color-mix(in srgb, var(--td-accent) 12%, var(--td-bg-elev)); }
.timeline-item.is-milestone .timeline-node {
  border-radius: 2px; transform: rotate(45deg);
  background: var(--td-ok);
  box-shadow: 0 0 0 4px var(--td-bg), 0 0 12px 1px color-mix(in srgb, var(--td-ok) 55%, transparent);
}
.timeline-item.is-in-progress .timeline-node { background: var(--td-warn); box-shadow: 0 0 0 4px var(--td-bg); }
.timeline-item.is-planned .timeline-node { background: var(--td-bg); border: 2px solid var(--td-text-dim); box-shadow: 0 0 0 4px var(--td-bg); }
.timeline-item.is-milestone .timeline-card { cursor: default; border-left: 3px solid var(--td-ok); }
.timeline-item.is-milestone .timeline-card:hover { transform: none; border-color: var(--td-border); border-left-color: var(--td-ok); box-shadow: var(--td-shadow); }
.timeline-item.is-in-progress .timeline-card,
.timeline-item.is-in-progress .timeline-card:hover { border-style: dashed; border-left-style: solid; border-left-color: var(--td-warn); }
.timeline-item.is-planned .timeline-card,
.timeline-item.is-planned .timeline-card:hover { border-style: dashed; border-left-style: solid; border-left-color: var(--td-text-dim); box-shadow: none; }
.timeline-kind { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--td-text-dim); }
.timeline-divider {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 4px 0 36px; text-align: center;
}
.timeline-divider-pill {
  background: var(--td-bg); color: var(--td-accent);
  border: 1px solid var(--td-accent); border-radius: 999px;
  padding: 5px 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
#timeline-planned .timeline-divider-pill { color: var(--td-text-dim); border-color: var(--td-border); }
.timeline-divider-sub { background: var(--td-bg); padding: 2px 8px; font-size: 12px; color: var(--td-text-dim); }

@media (max-width: 720px) {
  .timeline-line { left: 7px; }
  .timeline-item, .timeline-item.left, .timeline-item.right {
    width: 100%; left: 0; text-align: left; padding: 0 0 28px 34px;
  }
  .timeline-item.left .timeline-node, .timeline-item.right .timeline-node { left: 0; right: auto; }
  .timeline-item.left .timeline-card-head { flex-direction: row; }
  .timeline-filters { justify-content: flex-start; }
  .timeline-divider { align-items: flex-start; text-align: left; padding-left: 34px; }
  .timeline-month { text-align: left; padding-left: 34px; }
  .timeline-track.laid-out .timeline-item { padding-bottom: 0; }
  .hero-title { font-size: 28px; }
}

/* ---- grouped ---- */
#grouped-root h2:first-of-type { margin-top: 0; }

/* ---- workflow ---- */
.workflow-pipeline {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.workflow-lane {
  background: var(--td-bg-elev);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  padding: 14px;
  min-width: 170px;
  flex: 1;
}
.workflow-lane-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--td-text-dim);
  margin-bottom: 10px;
}
.workflow-lane-items { display: flex; flex-wrap: wrap; gap: 6px; }
.workflow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--td-text-faint);
  font-size: 20px;
  min-width: 20px;
}
.workflow-internet-divider {
  flex: none;
  width: 0;
  border-left: 2px dashed var(--td-border);
  margin: 4px 2px;
  position: relative;
}
.workflow-internet-lane { border-color: var(--td-accent); background: linear-gradient(160deg, var(--td-bg-elev), rgba(45,212,255,0.06)); }

@media (max-width: 720px) {
  .workflow-pipeline { flex-direction: column; }
  .workflow-arrow { transform: rotate(90deg); }
  .workflow-internet-divider { width: auto; height: 0; border-left: none; border-top: 2px dashed var(--td-border); }
}

/* ---- workflow: idea-to-scaffold stage row ---- */
.workflow-concept-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 24px;
}
.workflow-stage-card {
  flex: none;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: var(--td-bg-elev);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  padding: 14px 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.workflow-stage-card:hover { transform: translateY(-3px); border-color: var(--td-accent); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.workflow-stage-emoji {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--td-bg-elev-2); border: 1px solid var(--td-border);
}
.workflow-stage-label { font-size: 12.5px; font-weight: 600; line-height: 1.3; }

/* ---- clickable app badges (drill-down) ---- */
.badge-btn { cursor: pointer; border: none; transition: transform 0.12s ease, filter 0.12s ease; }
.badge-btn:hover { filter: brightness(1.2); transform: translateY(-1px); }

/* ---- drill-down modal ---- */
.app-modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,8,12,0.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 40px;
  overflow-y: auto;
}
.app-modal {
  position: relative;
  background: var(--td-bg-elev);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow);
  max-width: 480px;
  width: 100%;
  padding: 26px 22px 22px;
}
.app-modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; padding: 0;
  font-size: 18px; line-height: 1; border-radius: 50%;
}
.modal-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--td-text-dim); margin: 16px 0 8px; }
.modal-divider { border-top: 1px solid var(--td-border); margin: 16px 0; }

/* ---- live demo ---- */
.live-demo-intro { border-color: var(--td-accent); margin-bottom: 18px; }
.live-demo-intro-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
#theme-randomizer-btn { flex: none; white-space: nowrap; }

.theme-controls { display: flex; gap: 20px; flex-wrap: wrap; }
.theme-control { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.theme-control-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--td-text-dim); }
#theme-picker select {
  background: var(--td-bg-elev-2); border: 1px solid var(--td-border); color: var(--td-text);
  border-radius: var(--td-radius-sm); padding: 7px 10px; font-size: 13px; min-width: 160px;
}
.td-theme-picker-loading, .td-theme-picker-empty, .td-theme-picker-error { font-size: 12px; color: var(--td-text-dim); max-width: 220px; display: block; }
.td-theme-picker-error { color: var(--td-danger); margin-top: 4px; }

.stats-chart { width: 100%; max-width: 520px; height: auto; margin-top: 16px; display: block; }
.chart-label { fill: var(--td-text-dim); font-size: 12px; font-family: var(--td-font); }
.chart-count { fill: var(--td-text); font-size: 12px; font-weight: 700; font-family: var(--td-font); }
.chart-bar { transition: width 0.6s ease; }

/* ---- AI & trust ---- */
.trust-intro { border-color: var(--td-accent); margin-bottom: 8px; }
#trust-root h2:first-of-type { margin-top: 24px; }
.trust-audit-summary { border-width: 1px; }
.trust-audit-summary.ok { border-color: var(--td-ok); }
.trust-audit-summary.warn { border-color: var(--td-warn); }
.trust-audit-headline { font-size: 18px; font-weight: 800; }
.trust-audit-summary.ok .trust-audit-headline { color: var(--td-ok); }
.trust-audit-summary.warn .trust-audit-headline { color: var(--td-warn); }

.trust-clean-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.trust-clean-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--td-bg-elev);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-sm);
  padding: 10px;
}
.trust-clean-chip .app-avatar { width: 28px; height: 28px; font-size: 11px; border-radius: 7px; flex: none; }
.trust-clean-chip-body { flex: 1; min-width: 0; }
.trust-clean-chip-name { font-size: 13px; font-weight: 600; margin-bottom: 5px; overflow-wrap: anywhere; }

.trust-policy-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: var(--td-text-dim); }
.trust-policy-list strong { color: var(--td-text); }

/* ---- rendered house-convention markdown (openModal content) ---- */
.convention-md { font-size: 13px; line-height: 1.65; color: var(--td-text-dim); }
.convention-md p { margin: 0 0 12px; }
.convention-md strong { color: var(--td-text); }
.convention-md ul { margin: 0 0 12px; padding-left: 20px; }
.convention-md li { margin-bottom: 6px; }
.convention-md pre {
  background: var(--td-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0 0 12px;
}
.convention-md pre code { background: none; padding: 0; }

/* The showcase brand and navigation need a second line on phones. */
@media (max-width: 720px) {
  #topbar.td-topbar { flex-wrap: wrap; }
  #topbar .td-brand { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; }
}

/* ---- v0.13: Sign in and the "What is Torta Apps" tab ---- */
a.btn { display: inline-block; text-decoration: none; }
a.btn.primary { background: var(--td-accent); border-color: var(--td-accent); color: var(--td-accent-text); font-weight: 700; }
.hero-actions { margin: 18px 0 6px; }
.hero-actions .btn { font-size: 15px; padding: 10px 20px; }
.about h2 { margin-top: 28px; }
.about-lead h2 { margin-top: 0; }
.about-lead p { font-size: 15px; line-height: 1.6; max-width: 760px; margin: 0 0 14px; }
.about-feature h3 { margin: 6px 0; font-size: 16px; }
.about-feature p { font-size: 13.5px; line-height: 1.55; margin: 0; }
.about-icon { font-size: 22px; }
.about-compare-wrap { overflow-x: auto; padding: 0; }
.about-compare { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.about-compare th, .about-compare td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--td-border); vertical-align: top; }
.about-compare thead th { color: var(--td-text-dim); font-weight: 600; }
.about-compare thead th:nth-child(2), .about-compare td:nth-child(2) { color: var(--td-text); font-weight: 600; }
.about-compare td:nth-child(3) { color: var(--td-text-dim); }
.about-compare tbody tr:last-child th, .about-compare tbody tr:last-child td { border-bottom: 0; }
.about-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.about-video { margin: 0; padding: 0; overflow: hidden; }
.about-video video, .about-video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.about-video figcaption { padding: 10px 14px; font-size: 13px; }
.demo-footer a { color: var(--td-accent); }
@media (max-width: 600px) {
  .about-compare { font-size: 12.5px; }
  .about-compare th, .about-compare td { padding: 8px 10px; }
  .about-videos { grid-template-columns: 1fr; }
}

/* ---- v0.14: white papers on the "What is Torta Apps" tab ---- */
a.about-paper { display: block; color: var(--td-text); text-decoration: none; }
a.about-paper:hover { border-color: var(--td-accent); }
.about-paper h3 { margin: 6px 0; font-size: 16px; }
.about-paper p { font-size: 13.5px; line-height: 1.55; margin: 0 0 10px; }
.about-paper-reader { color: var(--td-accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.about-paper-go { color: var(--td-accent); font-size: 13.5px; font-weight: 600; }
.badge.draft { background: color-mix(in srgb, var(--td-warn) 18%, transparent); color: var(--td-warn); letter-spacing: 0; text-transform: none; }
