:root {
  color-scheme: light;
  --page: #f6f6f4;
  --surface: #ffffff;
  --surface-subdued: #f1f2f0;
  --ink: #1c1d1f;
  --ink-subdued: #61646a;
  --ink-faint: #8a8d93;
  --rule: #d9dbd7;
  --rule-strong: #b9bdb7;
  --action: #005bd3;
  --action-hover: #004299;
  --action-soft: #e8f1ff;
  --success: #087443;
  --success-soft: #e7f5ed;
  --note: #5b3da5;
  --note-soft: #f2edff;
  --focus: #2c6ecb;
  --topbar-height: 72px;
  --sidebar-width: 286px;
  --rail-width: 224px;
  --content-width: 760px;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --shadow: 0 12px 32px rgba(29, 31, 33, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 24px);
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

a {
  color: var(--action);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--action-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 160ms ease-out;
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

.topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(260px, 640px) 1fr;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 28px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-subdued);
  font-size: 12px;
}

.search {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface-subdued);
  color: var(--ink-subdued);
  transition:
    border-color 150ms ease-out,
    background 150ms ease-out,
    box-shadow 150ms ease-out;
}

.search:focus-within {
  border-color: var(--focus);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(44, 110, 203, 0.13);
}

.search svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search input::placeholder {
  color: #70737a;
}

.search kbd {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border: 1px solid var(--rule);
  border-bottom-color: var(--rule-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-subdued);
  font: 12px/1 var(--font);
}

.shopify-link {
  justify-self: end;
  color: var(--ink-subdued);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.shopify-link span {
  margin-left: 3px;
}

.icon-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-subdued);
}

.icon-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--rail-width);
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.sidebar {
  position: fixed;
  z-index: 20;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  background: var(--surface);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.guide-count {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
}

.nav-group {
  padding: 6px 12px 13px;
}

.nav-group + .nav-group {
  border-top: 1px solid var(--rule);
  padding-top: 17px;
}

.nav-group-title {
  margin: 0 10px 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.055em;
  line-height: 1.4;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  margin: 1px 0;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-subdued);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-subdued);
  color: var(--ink);
}

.nav-link[aria-current="page"] {
  background: var(--action-soft);
  color: #003d91;
  font-weight: 680;
}

.sidebar-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.4;
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer-link {
  color: var(--ink-subdued);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
}

.sidebar-scrim {
  display: none;
}

#main-content {
  grid-column: 2;
  min-width: 0;
  padding: 58px clamp(32px, 6vw, 88px) 96px;
}

#main-content:focus {
  outline: none;
}

.article,
.home,
.search-results,
.error-state {
  max-width: var(--content-width);
  margin: 0 auto;
}

.article-header {
  margin-bottom: 50px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.article-kicker,
.home-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--action);
  font-size: 13px;
  font-weight: 720;
}

.article-kicker::before,
.home-kicker::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

h1,
h2,
h3 {
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4.2rem);
  font-weight: 760;
}

.article h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.55rem);
}

.article h2 {
  margin: 62px 0 18px;
  padding-top: 4px;
  font-size: clamp(1.45rem, 3vw, 1.8rem);
  font-weight: 740;
}

.article h3 {
  margin: 36px 0 12px;
  font-size: 1.15rem;
}

.article p,
.article li {
  color: #34363a;
}

.article p {
  max-width: 72ch;
  margin: 0 0 18px;
}

.article ol,
.article ul {
  margin: 0 0 24px;
  padding-left: 1.45rem;
}

.article li {
  padding-left: 6px;
  margin-bottom: 10px;
}

.article li::marker {
  color: var(--ink-faint);
  font-weight: 700;
}

.article strong {
  color: var(--ink);
  font-weight: 700;
}

.article code {
  padding: 2px 5px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--surface-subdued);
  color: #3b255f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* Wide tables scroll inside their own box instead of widening the page. */
.table-scroll {
  margin: 0 0 24px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.article th,
.article td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  color: #34363a;
  text-align: left;
  vertical-align: top;
}

.article th {
  background: var(--surface-subdued);
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.article tbody tr:last-child td {
  border-bottom: 0;
}

.developer-note {
  margin: 28px 0 !important;
  padding: 18px 20px;
  border: 1px solid #d7cdf4;
  border-radius: 13px;
  background: var(--note-soft);
  color: #35265d !important;
}

.developer-note strong {
  color: #2d1f50;
}

.screenshot-placeholder {
  display: grid;
  min-height: 176px;
  place-items: center;
  margin: 20px 0 28px;
  padding: 30px;
  border: 1px dashed var(--rule-strong);
  border-radius: 14px;
  background: var(--surface-subdued);
  text-align: center;
}

.screenshot-placeholder::before {
  display: block;
  width: 34px;
  height: 28px;
  margin: 0 auto 14px;
  border: 2px solid #8d9198;
  border-radius: 5px;
  background: linear-gradient(
      135deg,
      transparent 48%,
      #8d9198 49% 53%,
      transparent 54%
    )
    4px 7px / 24px 15px no-repeat;
  content: "";
}

.screenshot-placeholder figcaption {
  max-width: 55ch;
  color: var(--ink-subdued);
  font-size: 13px;
  line-height: 1.5;
}

.screenshot {
  margin: 20px 0 32px;
}

.screenshot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface-subdued);
}

.screenshot figcaption {
  margin-top: 10px;
  color: var(--ink-subdued);
  font-size: 13px;
  line-height: 1.5;
}

.home {
  padding-top: 12px;
}

.home-intro {
  max-width: 660px;
  margin: 24px 0 48px;
  color: var(--ink-subdued);
  font-size: 19px;
  line-height: 1.55;
}

.home-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-subdued);
  font-size: 12px;
  font-weight: 650;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 52px;
}

.home-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
}

.home-action:hover {
  border-color: var(--ink-faint);
}

.home-action-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.home-start {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 54px;
}

.home-start-card {
  padding: 26px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
}

.home-start-card-accent {
  border-color: #d7cdf4;
  background: var(--note-soft);
}

.home-card-kicker {
  margin: 0 0 8px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 740;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.home-start-card h2 {
  max-width: 20ch;
  margin: 0 0 12px;
  font-size: 20px;
}

.home-start-card p:not(.home-card-kicker) {
  margin: 0;
  color: var(--ink-subdued);
  font-size: 14px;
  line-height: 1.55;
}

.home-card-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--action);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
}

.guide-directory {
  border-top: 1px solid var(--rule-strong);
}

.directory-group {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) 1fr;
  gap: 30px;
  padding: 30px 0;
  border-bottom: 1px solid var(--rule);
}

.directory-group h2 {
  margin: 0;
  font-size: 16px;
}

.directory-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 24px;
}

.directory-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 590;
  text-decoration: none;
}

.directory-link::after {
  color: var(--ink-faint);
  content: "→";
  transition: transform 140ms ease-out;
}

.directory-link:hover::after {
  transform: translateX(3px);
}

.search-results h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.search-summary {
  margin: 15px 0 38px;
  color: var(--ink-subdued);
}

.result-list {
  border-top: 1px solid var(--rule-strong);
}

.result {
  display: block;
  padding: 23px 0 25px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.result:hover .result-title {
  color: var(--action);
}

.result-category {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.result-title {
  display: block;
  margin: 5px 0 6px;
  font-size: 18px;
  font-weight: 720;
}

.result-excerpt {
  display: block;
  color: var(--ink-subdued);
  font-size: 14px;
  line-height: 1.5;
}

.empty-results {
  padding: 44px 0;
  border-top: 1px solid var(--rule-strong);
  color: var(--ink-subdued);
}

.page-rail {
  grid-column: 3;
  padding: 56px 28px 56px 0;
}

.page-rail-inner {
  position: sticky;
  top: calc(var(--topbar-height) + 36px);
}

.page-rail p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.page-link {
  display: block;
  padding: 5px 0;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
}

.page-link:hover {
  color: var(--action);
}

.page-rail-empty {
  color: var(--ink-faint);
  font-size: 12px;
}

.loading-state {
  max-width: var(--content-width);
  margin: 24px auto 0;
}

.loading-line {
  display: block;
  width: 62%;
  height: 15px;
  margin: 13px 0;
  border-radius: 5px;
  background: #e3e4e1;
  animation: breathe 1.1s ease-in-out infinite alternate;
}

.loading-line-wide {
  width: 80%;
  height: 46px;
  margin-bottom: 32px;
}

.loading-line-short {
  width: 42%;
}

.error-state {
  padding-top: 36px;
}

.error-state h1 {
  font-size: 2.2rem;
}

.error-state code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-subdued);
}

.noscript-message {
  position: fixed;
  z-index: 90;
  inset: auto 20px 20px;
  max-width: 620px;
  margin: auto;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
}

@keyframes breathe {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: var(--sidebar-width) minmax(240px, 1fr) auto;
  }

  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .page-rail {
    display: none;
  }
}

@media (max-width: 800px) {
  :root {
    --topbar-height: 64px;
  }

  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 8px;
    padding: 0 14px;
  }

  .icon-button {
    display: inline-flex;
  }

  .brand {
    margin-right: 4px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand > span:last-child {
    display: none;
  }

  .search {
    height: 39px;
  }

  .search kbd,
  .shopify-link {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    top: 0;
    z-index: 50;
    width: min(88vw, 320px);
    padding-top: 12px;
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 45;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(20, 22, 24, 0.46);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease-out;
  }

  body.nav-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  #main-content {
    padding: 40px 22px 72px;
  }

  .article-header {
    margin-bottom: 38px;
  }

  .article h2 {
    margin-top: 50px;
  }

  .home-start {
    grid-template-columns: 1fr;
  }

  .directory-group {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .directory-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .screenshot-placeholder {
    min-height: 140px;
    padding: 22px 18px;
  }

  .screenshot img {
    border-radius: 10px;
  }

  .home-intro {
    font-size: 17px;
  }
}

@media print {
  .topbar,
  .sidebar,
  .page-rail,
  .sidebar-scrim {
    display: none !important;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  #main-content {
    padding: 0;
  }

  .article {
    max-width: none;
  }

  .screenshot,
  .screenshot-placeholder {
    break-inside: avoid;
  }
}

.screenshot img {
  cursor: zoom-in;
}

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 24px;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: auto;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.lightbox-caption {
  max-width: 80ch;
  margin: 0;
  font-size: 13px;
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
}
