/* Help refinements for the existing Read the Docs theme. */
.wy-nav-side {
  background: #343131;
}

.wy-side-nav-search,
.wy-nav-top {
  background: #287bb1;
  color: #fff;
}

.wy-side-nav-search {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 1.25rem 1rem 0.9rem;
  border-bottom: 1px solid #246fa4;
  box-shadow: 0 2px 5px rgba(12, 27, 47, 0.18);
}

.wy-side-nav-search > a,
.wy-nav-top > a,
.wy-nav-top > i {
  color: #fff;
}

.wy-side-nav-search > a {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.wy-side-nav-search > a.icon-home::before,
.wy-nav-top > a::before {
  content: "";
  display: inline-block;
  width: 1.8rem;
  height: 1.8rem;
  margin-right: 0.4rem;
  background: url("../images/sauron-eye.png") center / contain no-repeat;
  vertical-align: middle;
}

.wy-side-nav-search input[type="text"] {
  border: 1px solid #b6c9dd;
  border-radius: 0.35rem;
}

.wy-menu-vertical p.caption {
  color: #c6c1c1;
  letter-spacing: 0.08em;
}

.wy-menu-vertical > ul > li > a {
  color: #f2f2f2;
}

.wy-menu-vertical a:hover {
  background: #4e4a4a;
  color: #fff;
}

.wy-menu-vertical li.current > a {
  border-right: 0;
  background: #e3e3e3;
  color: #343131;
  font-weight: 700;
  box-shadow: inset 4px 0 #287bb1;
}

.wy-menu-vertical a:focus-visible {
  position: relative;
  z-index: 1;
  background: #fff;
  color: #173b67;
  outline: 3px solid #287bb1;
  outline-offset: -3px;
}

.wy-side-nav-search > a:focus-visible,
.wy-nav-top > a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.wy-side-nav-search input[type="text"]:focus-visible {
  outline: 2px solid #173b67;
  outline-offset: 2px;
}

.wy-nav-content {
  max-width: 980px;
  padding: 2rem 3rem;
}

.rst-content a {
  color: #1b5b9c;
  overflow-wrap: anywhere;
}

.rst-content a.sauron-external-link::after {
  content: "";
  display: inline-block;
  width: 0.82em;
  height: 0.82em;
  margin-left: 0.28em;
  background-color: currentColor;
  vertical-align: -0.04em;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6m0-6L10 14m10-1v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6m0-6L10 14m10-1v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rst-content table.docutils thead th {
  background: #edf3fa;
  color: #172b4d;
}

.rst-content h1,
.rst-content h2,
.rst-content h3,
.rst-content h4 {
  color: #172b4d;
  font-family: Lato, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  line-height: 1.25;
}

.rst-content h1 {
  margin-bottom: 0.65rem;
  font-size: 2.25rem;
}

.rst-content h1#welcome-to-sauron::before,
.rst-content h1#sauron-console::before {
  content: "";
  display: inline-block;
  width: 2rem;
  height: 2rem;
  margin-right: 0.55rem;
  background: url("../images/sauron-eye.png") center / contain no-repeat;
  vertical-align: -0.1rem;
}

.rst-content h2 {
  margin-top: 2.1rem;
  margin-bottom: 0.8rem;
  font-size: 1.5rem;
}

.rst-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-size: 1.2rem;
}

.rst-content h4 {
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.rst-content img {
  max-width: 100%;
  height: auto;
}

.rst-content img.sauron-zoomable-image {
  cursor: zoom-in;
}

.rst-content img.sauron-zoomable-image:focus {
  outline: 3px solid #2f7cbd;
  outline-offset: 3px;
}

.rst-content .sauron-help-diagram {
  margin: 1.25rem 0 2rem;
  overflow: hidden;
  border: 1px solid #d6e1eb;
  border-radius: 8px;
  background: #fff;
}

.rst-content .sauron-help-diagram > a {
  display: block;
  cursor: zoom-in;
}

.rst-content .sauron-help-diagram img {
  display: block;
  width: 100%;
}

.rst-content .sauron-help-diagram figcaption {
  padding: 0.55rem 0.8rem;
  border-top: 1px solid #d6e1eb;
  background: #f7f9fc;
  color: #52677e;
  font-size: 0.86rem;
}

.sauron-diagram-dialog {
  width: min(96vw, 1500px);
  max-width: 96vw;
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid #b8cada;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 60px rgb(12 35 63 / 28%);
}

.sauron-diagram-dialog::backdrop {
  background: rgb(12 30 52 / 72%);
}

.sauron-diagram-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem 0.65rem 1rem;
  border-bottom: 1px solid #d6e1eb;
  color: #172b4d;
  font: 700 0.95rem Lato, "Helvetica Neue", Arial, sans-serif;
}

.sauron-diagram-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sauron-diagram-controls {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
}

.sauron-diagram-controls button {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid #cddbe8;
  border-radius: 5px;
  background: #f7f9fc;
  color: #344c68;
  cursor: pointer;
  font: 700 0.85rem Lato, "Helvetica Neue", Arial, sans-serif;
}

.sauron-diagram-controls button:hover,
.sauron-diagram-controls button:focus-visible {
  background: #eaf1f8;
}

.sauron-diagram-controls button:disabled {
  opacity: 0.5;
  cursor: default;
}

.sauron-diagram-zoom-label {
  min-width: 3.25rem;
  text-align: center;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
}

.sauron-diagram-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #344c68;
  cursor: pointer;
  font: 400 1.7rem Arial, sans-serif;
  line-height: 1;
}

.sauron-diagram-close:hover,
.sauron-diagram-close:focus-visible {
  background: #eaf1f8;
}

.sauron-diagram-view {
  display: block;
  overflow: auto;
  max-height: calc(94vh - 3.5rem);
  padding: 0.75rem;
}

.sauron-diagram-view img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: calc(94vh - 5rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.rst-content .wy-table-responsive {
  max-width: 100%;
  overflow-x: auto;
}

.rst-content .wy-table-responsive table.docutils th,
.rst-content .wy-table-responsive table.docutils td {
  white-space: normal;
  overflow-wrap: break-word;
}

.rst-content .wy-table-responsive table.docutils th:first-child,
.rst-content .wy-table-responsive table.docutils td:first-child {
  min-width: 8rem;
  overflow-wrap: normal;
  word-break: normal;
}

.rst-content .highlight {
  max-width: 100%;
  overflow-x: auto;
}

.rst-content .highlight pre {
  max-width: 100%;
  overflow-x: auto;
}

/* Keep short terms calm in prose and make every example easy to scan. */
.rst-content :not(pre) > code {
  padding: 0.08rem 0.28rem;
  border: 1px solid #dce5ef;
  border-radius: 0.22rem;
  background: #f1f5f9;
  color: #24476b;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

/* Keep role names and API paths intact; their table can scroll on phones. */
.rst-content table.docutils td code,
.rst-content table.docutils th code {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.rst-content pre {
  max-width: 100%;
  margin: 0 0 1.2rem;
  padding: 0.95rem 1.1rem;
  overflow-x: auto;
  border: 1px solid #d7e2ee;
  border-radius: 0.4rem;
  background: #f7f9fc;
  box-shadow: 0 1px 2px rgba(20, 43, 71, 0.04);
  color: #24364b;
  font-size: 0.9rem;
  line-height: 1.55;
  tab-size: 2;
}

.rst-content pre code,
.rst-content pre code.hljs {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: inherit;
  line-height: inherit;
}

.rst-content .sauron-code-block {
  max-width: 100%;
  margin: 0 0 1.25rem;
  overflow: hidden;
  border: 1px solid #d7e2ee;
  border-radius: 0.45rem;
  background: #f7f9fc;
  box-shadow: 0 1px 3px rgba(20, 43, 71, 0.06);
}

.rst-content .sauron-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  padding: 0.25rem 0.7rem 0.25rem 1rem;
  border-bottom: 1px solid #e2eaf3;
  background: #edf3f9;
}

.rst-content .sauron-code-language {
  color: #526981;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rst-content .sauron-code-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid #cbd9e8;
  border-radius: 0.375rem;
  background: #fff;
  color: #1b4d80;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.rst-content .sauron-code-copy:hover {
  border-color: #7ca8d4;
  background: #f6faff;
}

.rst-content .sauron-code-copy:focus-visible {
  outline: 2px solid #2762aa;
  outline-offset: 2px;
}

.rst-content .sauron-code-block pre,
.rst-content .highlight .sauron-code-block pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.rst-content .sauron-lead {
  margin: 0 0 1.4rem;
  color: #344b68;
  font-size: 1.16rem;
  line-height: 1.6;
}

.rst-content .sauron-help-callout {
  padding: 0.9rem 1.1rem;
  border-left: 4px solid #2762aa;
  border-radius: 0.25rem;
  background: #edf4fc;
}

.rst-content .sauron-task-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.1rem 0 1.5rem;
  border: 1px solid #d8e2ef;
  border-radius: 0.45rem;
  background: #f7f9fc;
}

.rst-content .sauron-task-summary > div {
  min-width: 0;
  padding: 0.85rem 1rem;
}

.rst-content .sauron-task-summary > div + div {
  border-left: 1px solid #d8e2ef;
}

.rst-content .sauron-task-summary strong,
.rst-content .sauron-task-summary span {
  display: block;
}

.rst-content .sauron-task-summary strong {
  margin-bottom: 0.3rem;
  color: #235684;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rst-content .sauron-task-summary span {
  color: #263b54;
  font-size: 1rem;
  line-height: 1.45;
}

.rst-content .sauron-task-note {
  margin: 1rem 0 1.25rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid #a66b18;
  border-radius: 0.25rem;
  background: #fff8ed;
  color: #3f3427;
  line-height: 1.5;
}

.rst-content .sauron-task-note strong {
  color: #74490f;
}

.rst-content .sauron-paths,
.rst-content .sauron-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.4rem 0 1.8rem;
}

.rst-content .sauron-path {
  display: block;
  min-height: 10rem;
  padding: 1.35rem;
  border: 1px solid #d8e2ef;
  border-radius: 0.55rem;
  background: #f5f8fc;
  color: #172b4d;
  text-decoration: none;
}

.rst-content .sauron-path:hover,
.rst-content .sauron-path:focus-visible {
  border-color: #2762aa;
  background: #edf4fc;
  color: #123f76;
  text-decoration: none;
}

.rst-content .sauron-path:focus-visible {
  outline: 3px solid #2762aa;
  outline-offset: 3px;
}

.rst-content .sauron-path strong,
.rst-content .sauron-path span {
  display: block;
}

.rst-content .sauron-path strong {
  margin-bottom: 0.5rem;
  font-size: 1.28rem;
  line-height: 1.3;
}

.rst-content .sauron-path span {
  line-height: 1.5;
}

.rst-content .sauron-flow {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #d8e2ef;
  border-bottom: 1px solid #d8e2ef;
}

.rst-content .sauron-flow > div {
  position: relative;
  padding: 1.1rem 1.5rem 1.1rem 0;
}

.rst-content .sauron-flow > div:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 1.2rem;
  right: 0.55rem;
  color: #2762aa;
  font-weight: bold;
}

.rst-content .sauron-flow strong,
.rst-content .sauron-flow span {
  display: block;
}

.rst-content .sauron-flow strong {
  margin-bottom: 0.35rem;
  color: #172b4d;
}

.rst-content .sauron-steps {
  margin: 1.3rem 0 1.8rem;
}

.rst-content details.sauron-details {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d8e2ef;
  border-radius: 0.35rem;
  background: #f5f8fc;
}

.rst-content details.sauron-details summary {
  color: #173b67;
  font-weight: 700;
  cursor: pointer;
}

.rst-content details.sauron-details[open] summary {
  margin-bottom: 0.75rem;
}

.rst-content footer [role="contentinfo"] {
  color: #455a74;
  font-size: 0.9rem;
}

.rst-content .sauron-steps section {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid #e5ebf2;
}

.rst-content .sauron-steps h3 {
  margin: 0 0 0.45rem;
}

.rst-content .sauron-steps p:last-child {
  margin-bottom: 0;
}

.rst-content .sauron-step-number {
  display: inline-flex;
  flex: 0 0 2.2rem;
  align-items: center;
  justify-content: center;
  height: 2.2rem;
  border-radius: 50%;
  background: #e6f0fc;
  color: #174f91;
  font-weight: bold;
}

@media (max-width: 720px) {
  .wy-nav-content {
    padding: 1.35rem;
  }

  .rst-content h1 {
    font-size: 2rem;
  }

  .rst-content .wy-table-responsive table.docutils {
    min-width: 34rem;
  }

  .rst-content .wy-table-responsive::before {
    content: "Swipe table sideways to see all columns →";
    display: block;
    margin-bottom: 0.5rem;
    color: #455a74;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .rst-content .wy-table-responsive table.docutils th,
  .rst-content .wy-table-responsive table.docutils td {
    min-width: 9rem;
  }

  .rst-content .sauron-paths,
  .rst-content .sauron-flow,
  .rst-content .sauron-task-summary {
    grid-template-columns: 1fr;
  }

  .rst-content .sauron-task-summary > div + div {
    border-top: 1px solid #d8e2ef;
    border-left: 0;
  }

  .rst-content .sauron-path {
    min-height: auto;
  }

  .rst-content .sauron-flow > div {
    padding: 0.85rem 0;
  }

  .rst-content .sauron-flow > div:not(:last-child)::after {
    content: none;
  }
}
