/* Tiny Design Shop — guide detail pages (shared layout) */

img {
  display: block;
  max-width: 100%;
}

.guide-wrap,
.guide-page .wrap:not(.related),
body:has(.guide-shell) .wrap:not(.related) {
  width: min(1040px, calc(100% - var(--layout-gutter)));
  margin: 0 auto;
}

.guide-hero,
.guide-page .hero,
body:has(.guide-shell) .hero {
  padding: var(--s-16) 0 var(--s-13);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--background));
}

.breadcrumb,
.section-label,
.step-num {
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.breadcrumb {
  margin: 0 0 var(--layout-eyebrow-mb);
  color: var(--ink-4);
  font-size: var(--fs-ui-sm);
  line-height: 1.3;
  text-transform: uppercase;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--layout-chip-gap);
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumb-separator {
  color: var(--ink-4);
}

.breadcrumb [aria-current="page"] {
  color: var(--ink-4);
}

.guide-page .hero h1,
.guide-hero h1,
body:has(.guide-shell) .hero h1 {
  max-width: 860px;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.94;
}

.guide-page .hero .intro,
.guide-hero .intro,
body:has(.guide-shell) .hero .intro {
  max-width: 70ch;
  margin: var(--s-12) 0 0;
}

.guide-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--s-14);
  padding: 30px 0 56px;
  align-items: start;
}

.article {
  display: grid;
  gap: var(--s-13);
}

.guide-section {
  padding: var(--s-11);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  scroll-margin-top: var(--guide-scroll-margin, 96px);
}

.guide-section h2 {
  font-size: var(--fs-tool-number);
  line-height: 1.2;
}

.guide-section h3 {
  margin-top: var(--s-10);
  font-size: var(--fs-body);
  line-height: 1.3;
}

.guide-section p {
  margin: var(--s-7) 0 0;
  color: var(--ink-2);
}

.guide-section ol,
.guide-section ul {
  margin: var(--s-9) 0 0;
  padding-left: 22px;
  color: var(--ink-2);
}

.guide-section li + li {
  margin-top: var(--s-4);
}

.support-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-9);
}

.support-list div {
  padding: var(--s-7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
}

.support-list h3 {
  margin: 0;
  font-size: var(--fs-body-sm);
}

.support-list ul {
  margin-top: var(--s-5);
  padding-left: var(--s-11);
  font-size: var(--fs-body-sm);
  line-height: 1.5;
}

.comparison-table-wrap {
  margin-top: var(--s-9);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
  line-height: 1.5;
}

.comparison-table th,
.comparison-table td {
  padding: var(--s-7);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.comparison-table thead th {
  background: var(--secondary);
  font-size: var(--fs-ui-sm);
  font-weight: 700;
  white-space: nowrap;
}

.comparison-table tbody th {
  font-weight: 700;
}

.comparison-table tbody tr:first-child {
  background: var(--accent-soft-home);
}

.comparison-table tr:last-child th,
.comparison-table tr:last-child td {
  border-bottom: 0;
}

.related {
  margin-top: var(--s-13);
  margin-bottom: var(--s-13);
}

/* Match guide .wrap width (1040px), not site.css .wrap (1120px). Span article column only on desktop. */
body:has(.guide-shell) section.related.wrap {
  width: min(1040px, calc(100% - var(--layout-gutter)));
  margin-inline: auto;
  margin-top: var(--s-13);
  margin-bottom: var(--s-13);
}

@media (min-width: 821px) {
  body:has(.guide-shell) section.related.wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: var(--s-14);
    align-items: start;
  }

  body:has(.guide-shell) section.related.wrap > * {
    grid-column: 1;
  }
}

.related h2 {
  margin: 0 0 var(--s-7);
  font-size: var(--fs-body);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
}

.related-card {
  display: block;
  padding: var(--s-7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-decoration: none;
}

.related-card:hover,
.related-card:focus {
  border-color: var(--foreground);
}

.related-card h3 {
  margin: 0;
  color: var(--foreground);
  font-size: var(--fs-body-sm);
}

.related-card p {
  margin: var(--s-4) 0 0;
  color: var(--muted-foreground);
  font-size: var(--fs-ui);
  line-height: 1.45;
}

@media (max-width: 640px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

.screenshot {
  margin: var(--s-10) 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
}

.screenshot img {
  width: 100%;
  height: auto;
}

.screenshot figcaption {
  padding: var(--s-5) var(--s-7);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--fs-ui);
}

.remote-shot {
  width: min(320px, 100%);
}

.guide-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: var(--s-7);
}

.toc-tabs {
  padding: var(--s-9) 0 var(--s-9) var(--s-9);
  border-left: 1px solid var(--border-strong);
}

.toc-head h2 {
  margin: 0 0 var(--s-5);
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: var(--fs-ui-sm);
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
}

.toc-head-actions .toc-action {
  display: none;
}

@media (min-width: 821px) {
  .toc-tabs {
    display: flex;
    flex-direction: column;
  }

  .toc-head {
    display: contents;
  }

  .toc-head-actions {
    order: -1;
    width: 100%;
  }
}

.toc-list {
  display: grid;
  gap: var(--s-1);
}

.toc-list a {
  position: relative;
  display: block;
  padding: var(--s-4) var(--s-5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted-foreground);
  font-size: var(--fs-ui);
  font-weight: 620;
  line-height: 1.25;
  text-decoration: none;
}

.toc-list a::before {
  position: absolute;
  top: var(--s-4);
  bottom: var(--s-4);
  left: -15px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  content: "";
}

.toc-list a:hover,
.toc-list a:focus,
.toc-list a.is-active {
  background: var(--secondary);
  color: var(--foreground);
}

.toc-list a.is-active::before {
  background: var(--accent-foreground);
}

.side-note {
  padding: var(--s-9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.side-note h2 {
  font-size: var(--fs-body);
}

.side-note p {
  margin: var(--s-4) 0 0;
  color: var(--muted-foreground);
  font-size: var(--fs-body-sm);
}

.side-note .button {
  width: 100%;
  margin-top: var(--s-7);
}

.guide-shell .side-note > a.button {
  border-color: var(--button-accent);
  background: var(--button-accent);
  color: var(--button-accent-foreground);
}

.guide-shell .side-note > a.button:hover,
.guide-shell .side-note > a.button:focus {
  background: var(--button-accent-hover);
  border-color: var(--button-accent-hover);
}

.mobile-page-title {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: var(--fs-ui);
  font-weight: var(--fw-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  body:has(.guide-shell) {
    overflow-x: clip;
  }

  .guide-wrap,
  .guide-page .wrap,
  body:has(.guide-shell) .wrap {
    width: min(100% - var(--layout-gutter-mobile), 1040px);
  }

  body:has(.guide-shell) section.related.wrap {
    width: min(100% - var(--layout-gutter-mobile), 1040px);
  }

  .mobile-page-title {
    max-width: 100%;
  }

  .is-guide-scrolled .nav-links {
    display: none;
  }

  .is-guide-scrolled .mobile-page-title {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
  }

  body.is-guide-scrolled .nav-inner {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--s-5);
    min-height: var(--layout-nav-height);
    padding: var(--s-5) 0;
  }

  body.is-guide-scrolled .logo {
    flex-shrink: 0;
  }

  body.is-guide-scrolled .logo > span:not(.logo-mark) {
    display: none;
  }

  .guide-shell {
    display: flex;
    flex-direction: column;
    gap: var(--s-11);
    padding-top: 0;
    min-width: 0;
  }

  .article {
    order: 0;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .guide-sidebar {
    display: contents;
  }

  .toc-tabs {
    position: sticky;
    top: var(--guide-nav-height, 0px);
    z-index: 40;
    order: -1;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    width: 100vw;
    min-width: 0;
    margin-inline: calc(50% - 50vw);
    /* Match .wrap viewport inset so header + tabs align with guide cards. */
    padding: var(--s-4) calc((100vw - 100%) / 2);
    border-left: 0;
    border-bottom: 1px solid var(--border);
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
  }

  .toc-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .toc-head h2 {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toc-head-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    min-width: 0;
    max-width: 100%;
  }

  .toc-head-actions .lang-switcher[data-placement="sidebar"] {
    margin: 0;
  }

  .toc-head-actions .lang-switcher[data-placement="sidebar"] .lang-switcher-value,
  .toc-head-actions .lang-switcher[data-placement="sidebar"] .lang-switcher-caret {
    display: none;
  }

  .toc-head-actions .lang-switcher[data-placement="sidebar"] .lang-switcher-trigger {
    width: var(--layout-nav-link-min-h);
    height: var(--layout-nav-link-min-h);
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .toc-head-actions .lang-switcher[data-placement="sidebar"] .lang-switcher-menu {
    left: auto;
    right: 0;
    min-width: 9rem;
  }

  .toc-list {
    display: flex;
    gap: var(--s-9);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 1px;
    padding-inline-end: calc((100vw - 100%) / 2);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .toc-list::-webkit-scrollbar {
    display: none;
  }

  .toc-list a {
    flex: 0 0 auto;
    padding: var(--s-5) 0;
    border-radius: 0;
    background: transparent;
    font-size: var(--fs-ui-sm);
    white-space: nowrap;
  }

  .toc-list a::before {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 2px;
  }

  .toc-list a:hover,
  .toc-list a:focus,
  .toc-list a.is-active {
    background: transparent;
    color: var(--foreground);
  }

  .toc-head-actions .toc-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--layout-nav-link-min-h);
    padding: 0 var(--s-7);
    border: 1px solid var(--button-accent);
    border-radius: var(--radius-sm);
    background: var(--button-accent);
    color: var(--button-accent-foreground);
    font-size: var(--fs-ui-sm);
    font-weight: 700;
    line-height: var(--lh-tight);
    text-decoration: none;
    white-space: nowrap;
  }

  .toc-head-actions .toc-action:hover,
  .toc-head-actions .toc-action:focus {
    border-color: var(--button-accent-hover);
    background: var(--button-accent-hover);
    color: var(--button-accent-foreground);
  }

  .side-note {
    order: 1;
    width: 100%;
  }

  .support-list {
    grid-template-columns: 1fr;
  }
}
