/*
 * Vital SEO — Website Architecture & Crawl Depth Explorer
 * Scoped 3D visualisation styles.
 * Existing shared tool styles remain unchanged.
 */

#tool-website-architecture-explorer .crawl-map-canvas {
  position: relative;
  isolation: isolate;
}

#tool-website-architecture-explorer .architecture-webgl {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #f8fbff;
  cursor: grab;
  touch-action: none;
}

#tool-website-architecture-explorer .architecture-webgl:active {
  cursor: grabbing;
}

#tool-website-architecture-explorer .architecture-webgl canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline-offset: -3px;
}

#tool-website-architecture-explorer .architecture-webgl[hidden] {
  display: none;
}

#tool-website-architecture-explorer .crawl-map-canvas:has(
  .architecture-webgl:not([hidden])
) #crawlMapSvg {
  visibility: hidden;
  pointer-events: none;
}

#tool-website-architecture-explorer .crawl-map-progress {
  z-index: 3;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
:is(.crawl-map-visualisation, .crawl-map-canvas, .crawl-map-progress) {
  background: #102238;
  border-color: #35516d;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .architecture-webgl {
  background: #102238;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-details {
  background: #192d43;
  border-color: #35516d;
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
:is(.crawl-map-details h3, .crawl-map-details p, .crawl-map-details dd) {
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
:is(.crawl-map-details dt, .crawl-map-detail-explanation) {
  color: #b5c6d9;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-toolbar button {
  background: #192d43;
  border-color: #45617e;
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-toolbar button:hover {
  background: #25415e;
}

@media (prefers-reduced-motion: reduce) {
  #tool-website-architecture-explorer .architecture-webgl {
    scroll-behavior: auto;
  }
}


/* Architecture Explorer — inherited visualiser styling */

/* Compact,
accessible explanation beneath the URL field. */
#tool-website-architecture-explorer .spl-checking-explanation,
#tool-website-architecture-explorer .spl-checking-explanation {
  margin: 18px 0 22px;
  padding: 15px 18px;
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: #f8fbff;
}
#tool-website-architecture-explorer .spl-checking-explanation summary {
  cursor: pointer;
  font-weight: 700;
  color: #183d72;
  line-height: 1.5;
}
#tool-website-architecture-explorer .spl-checking-explanation[open] summary {
  margin-bottom: 14px;
}
#tool-website-architecture-explorer .spl-checking-explanation p {
  margin: 0 0 12px;
  line-height: 1.65;
}
#tool-website-architecture-explorer .spl-checking-explanation p:last-child {
  margin-bottom: 0;
}
/* Shared checking explanation — dark-mode contrast. */
html[data-theme="dark"] #tool-website-architecture-explorer .spl-checking-explanation,
html[data-theme="dark"] #tool-website-architecture-explorer .spl-checking-explanation {
  background: #172638;
  border-color: #3b536b;
  color: #c8d2df;
}
html[data-theme="dark"] #tool-website-architecture-explorer .spl-checking-explanation summary {
  color: #dcecff;
}
html[data-theme="dark"] #tool-website-architecture-explorer .spl-checking-explanation p {
  color: #c8d2df;
}

/* Vital SEO — crawl depth selector layout */
#tool-website-architecture-explorer .crawl-map-depth-preview {
  flex: 0 0 185px;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

#tool-website-architecture-explorer .crawl-map-depth-preview label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#tool-website-architecture-explorer #crawlMapDepth {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: .65rem .55rem;
  border: 1px solid #b8c9d9;
  border-radius: 8px;
  background: #fff;
  color: #253e52;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}

#tool-website-architecture-explorer #crawlMapDepthNote {
  display: none;
  margin: .65rem 0 0;
  font-size: .88rem;
  line-height: 1.5;
}

#tool-website-architecture-explorer .crawl-map-form:has(
  #crawlMapDepth option[value="5"]:checked
) #crawlMapDepthNote {
  display: block;
}

html[data-theme="dark"] #tool-website-architecture-explorer #crawlMapDepth {
  background: #102238;
  border-color: #45617e;
  color: #f1f6fc;
}

@media (max-width: 600px) {
  #tool-website-architecture-explorer .crawl-map-depth-preview {
    flex: 0 0 auto;
    width: 100%;
  }

  #tool-website-architecture-explorer #crawlMapDepth {
    min-height: 48px;
  }
}

/* Architecture Explorer — animated hero network */

.service-vector-hero:has(#architectureHeroNetwork)
.architecture-hero-network {
  position: relative;
  display: block;
  width: 100%;
  height: 330px;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
}

#architectureHeroNetwork .architecture-network-field {
  position: absolute;
  inset: 8% 5%;
  transform-origin: center;
  animation: architectureNetworkDrift 12s ease-in-out infinite;
}

#architectureHeroNetwork .architecture-network-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(47, 128, 237, .1),
    rgba(47, 128, 237, .55),
    rgba(47, 128, 237, .1)
  );
  transform-origin: left center;
  opacity: .75;
  animation: architectureLinePulse 5s ease-in-out infinite;
}

#architectureHeroNetwork .architecture-network-node {
  position: absolute;
  width: var(--node-size, 18px);
  height: var(--node-size, 18px);
  border-radius: 50%;
  background: radial-gradient(
    circle at 32% 28%,
    #d8f0ff 0%,
    #64b4f5 35%,
    #2777c7 75%,
    #155a9d 100%
  );
  box-shadow:
    0 0 0 5px rgba(65, 148, 235, .08),
    0 5px 15px rgba(23, 100, 188, .22),
    inset -3px -4px 7px rgba(9, 59, 119, .2);
  transform: translate(-50%, -50%);
  animation: architectureNodeFloat
    var(--node-duration, 6s) ease-in-out infinite;
  animation-delay: var(--node-delay, 0s);
}

#architectureHeroNetwork .architecture-network-node.is-primary {
  background: radial-gradient(
    circle at 30% 25%,
    #e7f8ff,
    #67c5ff 38%,
    #267ed7 76%,
    #1555a3
  );
  box-shadow:
    0 0 0 9px rgba(47, 128, 237, .08),
    0 0 30px rgba(47, 128, 237, .22),
    inset -4px -5px 9px rgba(9, 59, 119, .2);
}

#architectureHeroNetwork .architecture-network-node.is-secondary {
  background: radial-gradient(
    circle at 30% 25%,
    #e9f9ff,
    #91d5ed 38%,
    #368db7 80%
  );
}

@keyframes architectureNetworkDrift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-1deg); }
  50% { transform: translate3d(0, -7px, 0) rotate(1deg); }
}

@keyframes architectureNodeFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-6px); }
}

@keyframes architectureLinePulse {
  0%, 100% { opacity: .4; }
  50% { opacity: .85; }
}

html[data-theme="dark"]
#architectureHeroNetwork .architecture-network-line {
  background: linear-gradient(
    90deg,
    rgba(104, 185, 255, .1),
    rgba(104, 185, 255, .65),
    rgba(104, 185, 255, .1)
  );
}

html[data-theme="dark"]
#architectureHeroNetwork .architecture-network-node {
  box-shadow:
    0 0 0 5px rgba(65, 148, 235, .12),
    0 0 22px rgba(65, 148, 235, .28),
    inset -3px -4px 7px rgba(9, 59, 119, .2);
}

@media (prefers-reduced-motion: reduce) {
  #architectureHeroNetwork .architecture-network-field,
  #architectureHeroNetwork .architecture-network-line,
  #architectureHeroNetwork .architecture-network-node {
    animation: none !important;
  }
}


/* Vital SEO — Architecture Explorer fullscreen controls */

#tool-website-architecture-explorer .crawl-map-fullscreen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: .5rem;
}

#tool-website-architecture-explorer .crawl-map-fullscreen-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 12px;
  overflow: hidden;
  background: #f8fbff;
  box-sizing: border-box;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-summary {
  flex: none;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-toolbar {
  flex: none;
  margin-bottom: 8px;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-visualisation {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-canvas {
  min-height: 0;
  height: 100%;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-details {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) #crawlMapSvg {
  width: 100%;
  height: 100%;
  min-height: 0;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) {
  background: #102238;
}

@media (max-width: 600px) {
  #tool-website-architecture-explorer .crawl-map-zoom-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #tool-website-architecture-explorer .crawl-map-fullscreen-button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
  }

  #tool-website-architecture-explorer .crawl-map-results:is(
    :fullscreen,
    .crawl-map-expanded
  ) {
    padding: 8px;
  }

  #tool-website-architecture-explorer .crawl-map-results:is(
    :fullscreen,
    .crawl-map-expanded
  ) .crawl-map-visualisation {
    display: flex;
    flex-direction: column;
  }

  #tool-website-architecture-explorer .crawl-map-results:is(
    :fullscreen,
    .crawl-map-expanded
  ) .crawl-map-canvas {
    flex: 1 1 auto;
    min-height: 0;
  }

  #tool-website-architecture-explorer .crawl-map-results:is(
    :fullscreen,
    .crawl-map-expanded
  ) .crawl-map-details {
    flex: 0 0 auto;
    max-height: 24%;
    overflow-y: auto;
  }
}


/* Vital SEO — Explorer input and summary theme refinements */

/* Match the established URL-field shape on all screen sizes. */
#tool-website-architecture-explorer .crawl-map-input-row input {
  min-width: 0;
  border-radius: 10px;
}

@media (max-width: 600px) {
  #tool-website-architecture-explorer .crawl-map-input-row input {
    flex: 0 0 auto;
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    box-sizing: border-box;
  }
}

/* Match the existing Internal Link Visualiser dark palette. */
html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-input-row input {
  background: #102238;
  border-color: #45617e;
  color: #f1f6fc;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-input-row input::placeholder {
  color: #a0b2c7;
  opacity: 1;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-summary > div {
  background: #192d43;
  border-color: #35516d;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-summary strong {
  color: #8cc8ff;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .crawl-map-summary span {
  color: #b5c6d9;
}


/* Vital SEO — Explorer fullscreen content boundary */
/* Keep statistics, toolbar, graph, Overview and crawl status visible. */
#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) > :is(
  #crawlMapConnections,
  #architectureFindings,
  #crawlMapSeoTip
) {
  display: none !important;
}

/* Show crawl status directly beneath the fullscreen visualisation. */
#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) > #crawlMapStatus {
  display: block;
  flex: 0 0 auto;
  margin: 6px 0 0;
  padding: 0 4px;
}

/* Vital SEO — Architecture Explorer colour controls and legend */

#tool-website-architecture-explorer .architecture-colour-control {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}

#tool-website-architecture-explorer .architecture-colour-control label {
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}

#tool-website-architecture-explorer .architecture-colour-control select {
  min-height: 44px;
  max-width: 100%;
  padding: .55rem .75rem;
  border: 1px solid #b9ccdd;
  border-radius: 10px;
  background: #fff;
  color: #18324b;
  font: inherit;
  cursor: pointer;
}

#tool-website-architecture-explorer .architecture-colour-control select:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

#tool-website-architecture-explorer .architecture-colour-legend {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin: 0 0 .75rem;
  padding: .85rem 1rem;
  border: 1px solid #d3e0ec;
  border-radius: 10px;
  background: #f8fbff;
  color: #18324b;
}

#tool-website-architecture-explorer .architecture-legend-categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1.15rem;
}

#tool-website-architecture-explorer .architecture-legend-categories > span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  line-height: 1.4;
}

#tool-website-architecture-explorer .architecture-legend-swatch {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8994a5;
}

#tool-website-architecture-explorer .architecture-status-success {
  background: #279b57;
}

#tool-website-architecture-explorer .architecture-status-redirect {
  background: #eab308;
}

#tool-website-architecture-explorer .architecture-status-client-error {
  background: #dc3545;
}

#tool-website-architecture-explorer .architecture-status-server-error {
  background: #8b3dbb;
}

#tool-website-architecture-explorer .architecture-status-unknown {
  background: #8994a5;
}

#tool-website-architecture-explorer .architecture-legend-explanation {
  margin: 0;
  font-size: .8rem;
  line-height: 1.5;
  color: #526579;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .architecture-colour-control label {
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .architecture-colour-control select {
  background: #192d43;
  border-color: #45617e;
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .architecture-colour-legend {
  background: #192d43;
  border-color: #35516d;
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer .architecture-legend-explanation {
  color: #b5c6d9;
}

@media (max-width: 600px) {
  #tool-website-architecture-explorer .architecture-colour-control {
    width: 100%;
    justify-content: space-between;
  }

  #tool-website-architecture-explorer .architecture-colour-control select {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
  }

  #tool-website-architecture-explorer .architecture-colour-legend {
    padding: .75rem;
  }

  #tool-website-architecture-explorer .architecture-legend-categories {
    gap: .55rem .85rem;
  }
}

/* Vital SEO — Architecture Explorer balanced graph layout */

/*
 * Keep the desktop graph and Overview at a consistent height.
 * The Overview scrolls independently rather than stretching the
 * entire grid row.
 */
@media (min-width: 801px) {
  #tool-website-architecture-explorer
  .crawl-map-results:not(:fullscreen):not(.crawl-map-expanded)
  .crawl-map-visualisation {
    height: 620px;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  #tool-website-architecture-explorer
  .crawl-map-results:not(:fullscreen):not(.crawl-map-expanded)
  .crawl-map-canvas {
    height: 100%;
    min-height: 0;
  }

  #tool-website-architecture-explorer
  .crawl-map-results:not(:fullscreen):not(.crawl-map-expanded)
  .crawl-map-details {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #tool-website-architecture-explorer
  .crawl-map-results:not(:fullscreen):not(.crawl-map-expanded)
  #crawlMapSvg {
    height: 100%;
    min-height: 0;
  }
}

/*
 * Retain the existing stacked layout and normal page scrolling
 * on tablets and phones.
 */
@media (max-width: 800px) {
  #tool-website-architecture-explorer
  .crawl-map-results:not(:fullscreen):not(.crawl-map-expanded)
  .crawl-map-details {
    max-height: none;
    overflow: visible;
  }
}

/* Vital SEO — Architecture legend inline colour selector */

/*
 * Desktop: status indicators left, colour selector right,
 * explanatory text on a separate row.
 */
@media (min-width: 801px) {
  #tool-website-architecture-explorer .architecture-colour-legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1rem;
    row-gap: .6rem;
  }

  #tool-website-architecture-explorer .architecture-legend-categories {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  #tool-website-architecture-explorer .architecture-colour-control {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    flex: none;
  }

  #tool-website-architecture-explorer .architecture-legend-explanation {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/*
 * Tablet and mobile: maintain readable, naturally wrapping controls.
 */
@media (max-width: 800px) {
  #tool-website-architecture-explorer .architecture-colour-legend {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #tool-website-architecture-explorer .architecture-colour-control {
    align-self: flex-end;
  }
}

@media (max-width: 600px) {
  #tool-website-architecture-explorer .architecture-colour-control {
    align-self: stretch;
  }
}

/* Vital SEO — Architecture mobile and dark-mode refinements */

/* Maintain clear keyboard focus across graph controls. */
#tool-website-architecture-explorer
.crawl-map-toolbar button:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* Tablet: keep the legend readable without forcing horizontal scrolling. */
@media (min-width: 601px) and (max-width: 800px) {
  #tool-website-architecture-explorer
  .architecture-colour-control {
    max-width: 100%;
  }
}

/* Phones: a predictable three-row toolbar. */
@media (max-width: 600px) {
  #tool-website-architecture-explorer .crawl-map-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
  }

  #tool-website-architecture-explorer
  .crawl-map-toolbar .crawl-map-page-search {
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  #tool-website-architecture-explorer
  .crawl-map-toolbar .crawl-map-zoom-controls {
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .35rem;
    min-width: 0;
  }

  #tool-website-architecture-explorer
  .crawl-map-toolbar .crawl-map-export-controls {
    grid-row: 3;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    min-width: 0;
  }

  #tool-website-architecture-explorer
  .crawl-map-toolbar button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: .55rem .25rem;
    font-size: clamp(.7rem, 2.8vw, .85rem);
    white-space: nowrap;
  }

  #tool-website-architecture-explorer
  .architecture-colour-legend {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #tool-website-architecture-explorer
  .architecture-legend-categories {
    min-width: 0;
    gap: .55rem .8rem;
  }

  #tool-website-architecture-explorer
  .architecture-colour-control {
    width: 100%;
    min-width: 0;
    gap: .65rem;
  }

  #tool-website-architecture-explorer
  .architecture-colour-control select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }
}

/* Dark-mode focus and interactive contrast. */
html[data-theme="dark"]
#tool-website-architecture-explorer
.crawl-map-toolbar button:focus-visible,
html[data-theme="dark"]
#tool-website-architecture-explorer
.architecture-colour-control select:focus-visible {
  outline-color: #8cc8ff;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
.architecture-colour-control select:hover {
  background: #25415e;
  border-color: #8aa9c7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
.architecture-colour-legend {
  color: #e7eef7;
}

html[data-theme="dark"]
#tool-website-architecture-explorer
.architecture-legend-explanation {
  color: #c3d2e2;
}


/* Vital SEO — Explorer fullscreen bottom boundary */
/* Reserve breathing room so the graph's bottom border remains visible. */
#tool-website-architecture-explorer .crawl-map-results:is(
  :fullscreen,
  .crawl-map-expanded
) .crawl-map-visualisation {
  margin-bottom: 2px;
  box-sizing: border-box;
}
