/* Interactive Search, Ask Glean Answer Stage, and Organic Knowledge Atlas */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.h-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px 0 18px;
  background: var(--surface-elevated);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: text;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.h-field:focus-within {
  border-color: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-soft), var(--shadow-md);
}

.h-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--signal);
  stroke-width: 2;
  stroke-linecap: round;
}

.h-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 17.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  caret-color: var(--signal);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.h-field input::-webkit-search-cancel-button {
  display: none;
}

.h-field input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.h-kbd {
  font: 11.5px ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 8px;
}

.h-field:focus-within .h-kbd,
.h-field.has-value .h-kbd {
  display: none;
}

@media (hover: none) {
  .h-kbd {
    display: none;
  }
}

.s-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--hairline);
  color: var(--ink);
  font-size: 16px;
  line-height: 24px;
  padding: 0;
  flex-shrink: 0;
}

.h-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.h-chips button {
  font: 11.5px ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--muted);
  border: 1px solid var(--hairline);
  background: var(--paper);
  border-radius: 999px;
  padding: 5px 11px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.h-chips button:hover,
.h-chips button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Action rows above search results: "Ask Glean" & "Make a page from these" (mirroring SearchView.swift) */
.s-actions-bar {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  border-top: 1px solid var(--hairline);
}

.s-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--hairline);
  color: var(--signal);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.16s ease, padding-left 0.16s ease;
}

.s-action-row:hover {
  background: var(--signal-soft);
  padding-left: 10px;
  border-radius: 8px;
}

.s-action-left,
.s-action-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.s-action-copy strong {
  color: var(--signal);
  font-size: 14px;
  font-weight: 650;
}

.s-action-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
}

.s-action-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--signal-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.s-action-arrow {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 13px;
  color: var(--signal);
  padding-inline: 4px;
}

/* SearchAnswerCard (Mirrors Features/Search/Sources/SearchAnswerCard.swift) */
.s-answer-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}

.s-reading-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.s-reading-sparkle {
  color: var(--signal);
  display: inline-block;
  animation: sparkle-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes sparkle-pulse {
  from { opacity: 0.45; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.12); }
}

.s-reading-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.s-reading-title {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.22s ease, transform 0.22s ease;
}

.s-reading-title.is-lit {
  color: var(--ink);
  font-weight: 600;
  transform: translateX(4px);
}

.s-written-text {
  font-size: 14.8px;
  line-height: 1.56;
  color: var(--ink);
}

.s-sources-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.s-sources-label,
.s-sources-kicker {
  font: 600 10.5px ui-monospace, "SF Mono", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.s-sources-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.s-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 4px 6px;
  border-radius: 6px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.s-source-item:hover {
  background: var(--signal-soft);
  color: var(--signal);
}

.s-source-num {
  font: 700 11px ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--signal);
}

/* Search Results Drawer */
.h-results {
  margin-top: 8px;
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.s-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.s-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--hairline);
  animation: s-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 22ms);
}

.s-row.cite-flash {
  background: var(--signal-soft);
  border-radius: 8px;
  padding-inline: 8px;
}

.s-row:hover .s-row-title {
  color: var(--signal);
}

.s-row-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -0.01em;
  transition: color 0.15s;
}

.s-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 21px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font: 10px ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--muted);
}

.s-badge svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.s-empty {
  padding: 14px 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.s-empty strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 2px;
}

@keyframes s-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* Interactive Knowledge Atlas SVG */
#s-map {
  width: 100%;
  height: auto;
  overflow: visible;
  cursor: pointer;
}

.s-hull {
  stroke-width: 1.8;
  fill-opacity: 0.14;
  stroke-opacity: 0.6;
  transition: fill-opacity 0.4s, stroke 0.4s, stroke-opacity 0.4s, opacity 0.4s;
}

.s-hull.r0 { fill: #68789B; stroke: #68789B; }
.s-hull.r1 { fill: #5F866F; stroke: #5F866F; }
.s-hull.r2 { fill: #9A8753; stroke: #9A8753; }
.s-hull.r3 { fill: #9B6959; stroke: #9B6959; }
.s-hull.r4 { fill: #8E627F; stroke: #8E627F; }
.s-hull.r5 { fill: #5D8987; stroke: #5D8987; }

[data-theme="dark"] .s-hull {
  fill-opacity: 0.18;
  stroke-opacity: 0.72;
}

.searching .s-hull {
  opacity: 0.32;
}

.searching .s-hull.lit {
  opacity: 1;
  fill-opacity: 0.22;
  stroke: var(--signal);
  stroke-opacity: 0.9;
}

.s-links path {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.8;
  stroke-opacity: 0.55;
  stroke-linecap: round;
  transition: stroke-opacity 0.4s, stroke-width 0.4s;
}

.searching .s-links path {
  stroke-opacity: 0.16;
}

.searching .s-links path.lit {
  stroke-opacity: 0.85;
  stroke-width: 2.3;
}

.s-spokes line {
  stroke: var(--muted);
  stroke-width: 1.1;
  stroke-opacity: 0.45;
  transition: stroke-opacity 0.4s;
}

.searching .s-spokes line {
  stroke-opacity: 0.15;
}

.s-labels text {
  font: 600 9.5px "Inter", -apple-system, sans-serif;
  letter-spacing: 0.12em;
  fill: var(--ink);
  transition: fill 0.35s, opacity 0.35s;
}

.searching .s-labels text {
  opacity: 0.4;
}

.searching .s-labels text.lit {
  opacity: 1;
  fill: var(--signal);
}

.s-nodes circle {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 1.4;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 0.32s, opacity 0.32s, transform 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
  transition-delay: var(--d, 0ms);
}

.s-nodes circle.hub {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 2;
}

.searching .s-nodes circle {
  opacity: 0.2;
  transition-delay: 0ms;
}

.searching .s-nodes circle.hit {
  opacity: 1;
  fill: var(--signal);
  transform: scale(1.48);
  transition-delay: calc(var(--d, 0ms) / 3);
}

.demo .s-nodes circle.hit {
  opacity: 0.85;
}

.s-nodes circle.ping {
  opacity: 1;
  fill: var(--signal);
  transform: scale(2.4);
  transition-delay: 0ms;
}
