
/* Texture tutorial — scoped to .tutorial-texture-root (@scope limits selectors to subtree) */
@scope (.tutorial-texture-root) {
  :scope {
    /* Align with app workspace / home panel (see .app-root[data-current-tool="home"] + .workspace) */
    --bg: #262626;
    --surface: #2a2a2a;
    --border: #404040;
    --border-hi: #525252;
    --text: #f5f5f5;
    --muted: #a3a3a3;
    --accent: #60a5fa;
    --accent-dim: #2a3d6e;
    --green: #3ecf7a;
    --yellow: #f0c040;
    --tag-bg: #333333;
    background: var(--bg);
    color: var(--text);
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    min-height: min-content;
  }

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

  * {
    margin: 0;
    padding: 0;
  }

  /* ── LAYOUT ── */
    .page-wrap {
      display: grid;
      grid-template-columns: 220px 1fr;
      max-width: 1100px;
      margin: 0 auto;
      padding: 0 24px;
      gap: 0;
    }

    /* ── SIDEBAR ── */
    aside {
      padding: 40px 0 80px;
      position: sticky;
      top: 0;
      max-height: calc(100vh - 48px); align-self: start;
      overflow-y: auto;
      border-right: 1px solid var(--border);
      scrollbar-width: none;
    }
    aside::-webkit-scrollbar { display: none; }

    .sidebar-label {
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: var(--muted);
      padding: 0 20px 8px;
      margin-top: 24px;
    }
    .sidebar-label:first-child { margin-top: 0; }

    aside a {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 20px;
      font-size: 13.5px;
      color: var(--muted);
      text-decoration: none;
      border-right: 2px solid transparent;
      transition: color 0.12s, border-color 0.12s, background 0.12s;
      margin-right: -1px;
    }
    aside a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
    aside a.active { color: var(--text); border-right-color: var(--accent); }

    .step-dot {
      width: 18px; height: 18px;
      border-radius: 50%;
      background: var(--tag-bg);
      border: 1.5px solid var(--border-hi);
      font-size: 10px;
      font-family: 'DM Mono', monospace;
      display: flex; align-items: center; justify-content: center;
      color: var(--muted);
      flex-shrink: 0;
    }
    aside a.active .step-dot {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }

    /* ── MAIN CONTENT ── */
    main {
      padding: 48px 0 80px 52px;
      max-width: 720px;
    }

    /* breadcrumb */
    .breadcrumb {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 28px;
      font-family: 'DM Mono', monospace;
    }
    .breadcrumb a { color: var(--muted); text-decoration: none; }
    .breadcrumb a:hover { color: var(--text); }
    .breadcrumb span { color: var(--border-hi); }

    /* hero */
    .tutorial-hero {
      margin-bottom: 48px;
    }

    .tag-row {
      display: flex;
      gap: 8px;
      margin-bottom: 16px;
    }

    .tag {
      font-size: 11px;
      font-family: 'DM Mono', monospace;
      padding: 3px 9px;
      border-radius: 4px;
      background: var(--tag-bg);
      border: 1px solid var(--border-hi);
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .tag.green { color: var(--green); border-color: rgba(62,207,122,0.25); background: rgba(62,207,122,0.07); }
    .tag.blue  { color: var(--accent); border-color: rgba(91,140,255,0.25); background: rgba(91,140,255,0.07); }

    h1 {
      font-family: 'Syne', sans-serif;
      font-size: 34px;
      font-weight: 800;
      letter-spacing: -0.8px;
      line-height: 1.2;
      margin-bottom: 14px;
      color: var(--text);
    }

    .hero-desc {
      font-size: 15px;
      color: #9aa0b0;
      line-height: 1.7;
      max-width: 560px;
      margin-bottom: 24px;
    }

    .meta-row {
      display: flex;
      align-items: center;
      gap: 20px;
      font-size: 12.5px;
      color: var(--muted);
      font-family: 'DM Mono', monospace;
    }
    .meta-row span { display: flex; align-items: center; gap: 5px; }

    /* divider */
    hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 40px 0;
    }

    /* step section */
    .step-section {
      margin-bottom: 56px;
      scroll-margin-top: 80px;
    }

    .step-header {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-bottom: 20px;
    }

    .step-num {
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      color: var(--accent);
      background: rgba(91,140,255,0.1);
      border: 1px solid rgba(91,140,255,0.25);
      border-radius: 5px;
      padding: 3px 8px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      flex-shrink: 0;
    }

    h2 {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: -0.3px;
      color: var(--text);
    }

    p {
      color: #9aa0b0;
      margin-bottom: 16px;
      font-size: 14.5px;
    }

    /* callout boxes */
    .callout {
      border-radius: 9px;
      padding: 14px 18px;
      margin: 20px 0;
      font-size: 13.5px;
      line-height: 1.6;
      display: flex;
      gap: 12px;
    }
    .callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
    .callout-:scope { color: #9aa0b0; }
    .callout-body strong { color: var(--text); font-weight: 500; }

    .callout.tip {
      background: rgba(91,140,255,0.07);
      border: 1px solid rgba(91,140,255,0.18);
    }
    .callout.note {
      background: rgba(240,192,64,0.06);
      border: 1px solid rgba(240,192,64,0.18);
    }
    .callout.success {
      background: rgba(62,207,122,0.06);
      border: 1px solid rgba(62,207,122,0.18);
    }

    /* mock viewport illustration */
    .viewport-mock {
      background: #0a0b0d;
      border: 1px solid var(--border-hi);
      border-radius: 10px;
      overflow: hidden;
      margin: 24px 0;
    }

    .viewport-toolbar {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 8px 14px;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .vt-label {
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.6px;
    }

    .vt-pill {
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 4px;
      background: var(--tag-bg);
      border: 1px solid var(--border-hi);
      color: var(--muted);
    }
    .vt-pill.on {
      color: var(--accent);
      border-color: rgba(91,140,255,0.3);
      background: rgba(91,140,255,0.1);
    }

    .viewport-:scope {
      padding: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 160px;
      position: relative;
    }

    /* 3-D mesh wireframe illustration */
    .mesh-illustration {
      width: 100%;
    }

    /* UI element callout overlay */
    .ui-label {
      position: absolute;
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      color: var(--accent);
      background: rgba(13,14,16,0.85);
      border: 1px solid rgba(91,140,255,0.35);
      border-radius: 4px;
      padding: 2px 7px;
      white-space: nowrap;
    }

    /* step list */
    ol.steps {
      list-style: none;
      counter-reset: step;
      margin: 20px 0;
    }
    ol.steps li {
      counter-increment: step;
      display: flex;
      gap: 14px;
      margin-bottom: 14px;
      font-size: 14px;
      color: #9aa0b0;
      align-items: flex-start;
    }
    ol.steps li::before {
      content: counter(step);
      display: flex;
      align-items: center;
      justify-content: center;
      min-width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--surface);
      border: 1.5px solid var(--border-hi);
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      color: var(--muted);
      flex-shrink: 0;
      margin-top: 1px;
    }
    ol.steps li strong { color: var(--text); font-weight: 500; }

    /* inline code / kbd */
    code {
      font-family: 'DM Mono', monospace;
      font-size: 12px;
      color: var(--accent);
      background: rgba(91,140,255,0.08);
      border: 1px solid rgba(91,140,255,0.2);
      border-radius: 4px;
      padding: 1px 6px;
    }

    kbd {
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      color: var(--text);
      background: var(--surface);
      border: 1px solid var(--border-hi);
      border-bottom-width: 2px;
      border-radius: 5px;
      padding: 2px 7px;
    }

    /* channel grid */
    .channel-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin: 20px 0;
    }

    .channel-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 14px;
      transition: border-color 0.15s;
    }
    .channel-card:hover { border-color: var(--border-hi); }

    .channel-swatch {
      width: 36px;
      height: 36px;
      border-radius: 7px;
      margin-bottom: 10px;
    }

    .channel-name {
      font-family: 'Syne', sans-serif;
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
    }

    .channel-desc {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.5;
      margin: 0;
    }

    /* export preset table */
    .preset-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
      margin: 20px 0;
    }
    .preset-table th {
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--muted);
      text-align: left;
      padding: 8px 12px;
      border-bottom: 1px solid var(--border);
    }
    .preset-table td {
      padding: 10px 12px;
      color: #9aa0b0;
      border-bottom: 1px solid var(--border);
      vertical-align: top;
    }
    .preset-table tr:last-child td { border-bottom: none; }
    .preset-table tr:hover td { background: rgba(255,255,255,0.02); }
    .preset-table td:first-child { font-weight: 500; color: var(--text); }

    .engine-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      padding: 2px 7px;
      border-radius: 4px;
      background: var(--tag-bg);
      border: 1px solid var(--border-hi);
      color: var(--muted);
      margin: 1px 2px;
    }

    /* next/prev navigation */
    .tutorial-nav {
      display: flex;
      gap: 12px;
      margin-top: 64px;
      padding-top: 32px;
      border-top: 1px solid var(--border);
    }

    .nav-card {
      flex: 1;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 16px 20px;
      cursor: pointer;
      text-decoration: none;
      display: flex;
      flex-direction: column;
      gap: 4px;
      transition: border-color 0.15s;
    }
    .nav-card:hover { border-color: var(--border-hi); }
    .nav-card.next { align-items: flex-end; text-align: right; }

    .nav-card-label {
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--muted);
    }
    .nav-card-title {
      font-family: 'Syne', sans-serif;
      font-size: 14px;
      font-weight: 700;
      color: var(--text);
    }

    

    /* scroll progress bar (width set from JS; scroll container is #home-panel) */
    .tutorial-texture-progress {
      position: sticky;
      top: 0;
      height: 2px;
      width: 0%;
      background: var(--accent);
      z-index: 5;
      margin: 0;
      padding: 0;
      border: none;
      border-radius: 1px;
    }

    /* smooth reveal animations */
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(16px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .step-section { animation: fadeUp 0.4s ease both; }
    .step-section:nth-child(1) { animation-delay: 0.05s; }
    .step-section:nth-child(2) { animation-delay: 0.1s; }
    .step-section:nth-child(3) { animation-delay: 0.15s; }
    .step-section:nth-child(4) { animation-delay: 0.2s; }
    .step-section:nth-child(5) { animation-delay: 0.25s; }
}

/* Light theme: match body / workspace (#fcfcfc) and home marketing tokens */
body[data-theme="light"] .tutorial-texture-root {
  --bg: #fcfcfc;
  --surface: #fafafa;
  --border: #d4d4d8;
  --border-hi: #a1a1aa;
  --text: #171717;
  --muted: #525252;
  --tag-bg: #f4f4f5;
  --accent: #2563eb;
  --accent-dim: #dbeafe;
  --green: #16a34a;
  --yellow: #ca8a04;
}

body[data-theme="light"] .tutorial-texture-root aside a:hover {
  background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .tutorial-texture-root .preset-table tr:hover td {
  background: rgba(0, 0, 0, 0.03);
}

/* Embedded in Home: menu offset is handled by #home-panel — avoid stacking duplicate top padding from standalone page layout */
.home-static-page--tutorial-texture .tutorial-texture-root main {
  padding-top: 24px;
}
.home-static-page--tutorial-texture .tutorial-texture-root aside {
  padding-top: 24px;
  max-height: calc(100vh - var(--trumble-menu-bar-height, 40px) - var(--trumble-status-bar-height, 32px) - 8px);
}
