/* 3D Carousel Studio Guide Styles · MotionVibe Design System */

:root {
  --side-width: 280px;
}

body.guide-doc-page {
  background: var(--page);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--side-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  color: var(--ink);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] .sidebar {
  background: #0d121c;
  border-right-color: var(--line);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.sidebar .brand img,
.sidebar .brand svg {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
}

.sidebar .brand small {
  display: block;
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-top: 3px;
  text-transform: uppercase;
}

/* Search */
.search-wrap {
  padding: 14px 16px;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.search-wrap input {
  width: 100%;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-hint {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin: 6px 4px 0;
}

.search-results {
  position: absolute;
  top: 52px;
  left: 16px;
  right: 16px;
  max-height: 65vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 50;
}

.search-results:empty {
  display: none;
}

.search-hit {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.search-hit:hover,
.search-hit:focus {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.search-hit strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.search-hit small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.no-results {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* Contents list */
.contents-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: var(--muted);
  padding: 14px 20px 8px;
}

.chapter-nav {
  overflow-y: auto;
  flex: 1;
  padding: 0 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.chapter-nav a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.chapter-nav a:hover {
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.chapter-nav a[aria-current="page"] {
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.chapter-nav a[aria-current="page"] .num {
  color: rgba(255, 255, 255, 0.85);
}

.chapter-nav .num {
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  color: var(--muted);
  padding-top: 1px;
}

/* Shell & Toolbar */
.shell {
  margin-left: var(--side-width);
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
}

.toolbar {
  height: 52px;
  position: sticky;
  top: var(--header-height);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toolbar .crumb {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.toolbar .menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.toolbar .menu-toggle:hover {
  background: var(--surface-soft);
}

.reading-progress {
  position: fixed;
  left: var(--side-width);
  right: 0;
  top: calc(var(--header-height) + 51px);
  height: 2px;
  z-index: 31;
  background: transparent;
}

.reading-progress span {
  display: block;
  height: 100%;
  background: var(--brand);
  width: 0;
}

/* Workspace */
.workspace {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 36px 64px;
  flex: 1;
}

/* Welcome Card */
.welcome {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  min-height: 280px;
  margin: 0 0 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.welcome > img {
  position: absolute;
  width: 65%;
  height: 100%;
  right: 0;
  top: 0;
  object-fit: cover;
  object-position: center;
}

.welcome::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 38%, color-mix(in srgb, var(--surface) 90%, transparent) 55%, transparent 85%);
}

.welcome-copy {
  position: relative;
  z-index: 1;
  max-width: 55%;
  padding: 36px;
}

.welcome h2 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 12px 0 10px;
  font-weight: 800;
  color: var(--ink);
}

.welcome p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 380px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.welcome .publisher-note {
  font-size: 12px;
  margin: 10px 0 16px;
  color: var(--muted);
}

.welcome .publisher-note a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome .cover-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cover-buttons a {
  font-size: 13px;
  font-weight: 600;
  background: var(--brand);
  color: #ffffff;
  border-radius: 10px;
  padding: 9px 16px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cover-buttons a:hover {
  background: var(--brand-hover);
  text-decoration: none;
}

.cover-buttons a.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.cover-buttons a.secondary:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

/* Chapters & Typography */
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--brand);
  display: block;
}

.chapter-header {
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.chapter-header h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 8px 0 10px;
  font-weight: 800;
  color: var(--ink);
}

.chapter-description {
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  color: var(--ink-soft);
  max-width: 820px;
}

.chapter-content {
  background: var(--surface);
  padding: 32px 36px 40px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.chapter-content > p:first-child {
  margin-top: 0;
}

.chapter-content a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chapter-content a:hover {
  color: var(--brand-hover);
}

.content-section {
  margin: 40px 0 0;
  scroll-margin-top: 160px;
}

.content-section:first-child {
  margin-top: 0;
}

.content-section h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  font-weight: 700;
  color: var(--ink);
}

.content-section h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  margin-bottom: 12px;
}

.content-section h3 {
  font-size: 17px;
  margin: 24px 0 12px;
  font-weight: 700;
  color: var(--ink);
}

.note {
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  background: var(--brand-soft);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}

.note > strong {
  display: block;
  color: var(--brand);
  margin-bottom: 4px;
}

.note p {
  margin: 4px 0 0;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 24px 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 20px 44px;
  min-height: 42px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.steps li strong {
  color: var(--ink);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 50%;
  text-align: center;
  line-height: 26px;
  font-size: 12px;
  font-weight: 700;
}

.steps li:last-child {
  padding-bottom: 0;
}

/* Figures & Images */
figure {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-soft);
}

.image-zoom {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
  position: relative;
  cursor: zoom-in;
}

.image-zoom::after {
  content: "Enlarge ↗";
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.image-zoom:hover::after,
.image-zoom:focus-visible::after {
  opacity: 1;
}

.image-zoom img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 30px;
  background: var(--surface-soft);
}

figcaption {
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 16px;
  color: var(--muted);
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
}

.figure-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.figure-pair figure {
  margin: 12px 0 20px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.photo-grid figure {
  margin: 0 0 10px;
}

.photo-grid figcaption {
  font-size: 11px;
  padding: 8px 10px;
}

.photo-grid img {
  aspect-ratio: 3/4;
  object-fit: cover;
}

.dialog-image {
  max-width: 580px;
  margin: 24px auto;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin: 20px 0 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  line-height: 1.65;
  min-width: 500px;
}

thead {
  background: var(--surface-soft);
}

thead th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
}

tbody th,
tbody td {
  padding: 13px 16px;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

tbody th {
  width: 28%;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
}

tbody td {
  width: 36%;
  color: var(--ink-soft);
}

tbody tr:hover td,
tbody tr:hover th {
  background: var(--surface-soft);
}

/* Template Catalogue */
.catalog-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 12px 16px;
  border-radius: 10px;
  margin: 24px 0 32px;
  font-size: 13px;
}

.catalog-tools label {
  font-weight: 600;
  color: var(--ink);
}

.catalog-tools select {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  max-width: 260px;
}

.catalog-tools > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.template-family {
  margin: 34px 0;
}

.family-title {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: 12px !important;
  font-weight: 700;
}

.family-title::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

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

.template-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface);
  scroll-margin-top: 160px;
  box-shadow: var(--shadow-sm);
}

.template-card h3 {
  font-size: 17px;
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.template-card figure {
  margin: 0 0 14px;
  border-radius: 8px;
}

.template-card figcaption {
  display: none;
}

.template-card p {
  font-size: 13px;
  line-height: 1.7;
  margin: 10px 0;
  color: var(--ink-soft);
}

.template-controls {
  background: var(--surface-soft);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px !important;
  color: var(--muted);
}

.template-controls strong {
  color: var(--ink);
}

.template-card .text-link {
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  margin-top: 4px;
  color: var(--brand);
}

/* Pagination */
.chapter-pagination {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  margin: 32px 0 0;
  padding: 24px 0 0;
}

.chapter-pagination a {
  max-width: 50%;
  font-size: 14px;
  line-height: 1.6;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.chapter-pagination small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  margin-bottom: 4px;
}

.chapter-pagination .next {
  text-align: right;
}

/* Visibility */
.js .chapter {
  display: none;
}

.js .chapter.active {
  display: block;
}

[hidden] {
  display: none !important;
}

.search-focus {
  animation: target-flash 1.8s ease-out;
}

@keyframes target-flash {
  0% {
    box-shadow: 0 0 0 8px var(--brand-soft);
    background: var(--brand-soft);
  }
  100% {
    box-shadow: none;
  }
}

/* Image Dialog */
.image-dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(1500px, 96vw);
  max-width: 96vw;
  max-height: 95vh;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overflow: auto;
}

.image-dialog::backdrop {
  background: rgba(8, 14, 24, 0.85);
  backdrop-filter: blur(4px);
}

.image-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}

.image-dialog-head p {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  color: var(--ink);
}

.image-dialog-head button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.image-dialog > img {
  display: block;
  max-width: none;
  width: 100%;
  height: auto;
}

.image-dialog .image-original {
  width: auto;
  min-width: 100%;
  max-width: 2100px;
}

/* Installer Options */
.installer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.installer-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.installer-option strong {
  font-size: 16px;
  color: var(--ink);
}

.installer-option span {
  font-size: 13px;
  color: var(--brand);
}

.installer-option:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.mobile-backdrop {
  display: none;
}

/* Responsive */
@media (max-width: 900px) {
  :root {
    --side-width: 0px;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.open {
    transform: none;
  }

  .toolbar .menu-toggle {
    display: block;
  }

  .mobile-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
  }

  .toolbar {
    padding: 0 16px;
  }

  .toolbar .crumb {
    margin-right: auto;
    margin-left: 12px;
  }

  .workspace {
    padding: 24px 16px 48px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .figure-pair,
  .template-grid,
  .installer-options {
    grid-template-columns: 1fr;
  }

  .welcome > img {
    width: 100%;
    opacity: 0.2;
  }

  .welcome::after {
    background: var(--surface);
    opacity: 0.9;
  }

  .welcome-copy {
    max-width: 100%;
    padding: 24px;
  }

  .welcome h2 {
    font-size: 26px;
  }

  .chapter-header h1 {
    font-size: 28px;
  }

  .chapter-content {
    padding: 20px 16px;
  }
}
