/* Loaded after tr's bundled style.css via site.rkt's 'head — only what tr
   doesn't already provide: the search UI (built by fullTextSearch.js) and
   literate Agda highlighting. */

.Agda {
  text-autospace: no-autospace;
}

/* `margin: auto` can put a dialog in the middle of screen */
#search-dialog {
  margin: auto;
  width: min(48rem, 92vw);
  max-height: min(70dvh, 44rem);
  padding: 0;
  border: 1px solid #e3e3e8;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(20, 20, 50, 0.18);
  background: #fff;
  overflow: hidden;
}
#search-dialog[open] {
  display: flex;
  flex-direction: column;
}
.search-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #eee;
}
.search-home {
  flex: none;
  color: #555;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #e3e3e8;
  border-radius: 8px;
  white-space: nowrap;
}
.search-home:hover {
  background: #9094fbff;
  border-color: #9094fbff;
  color: #fff;
}
#search-bar {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.4rem 0.1rem;
}
#search-result {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.4rem;
}
a.search-result-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  line-height: 1.35;
}
.search-result-item .sr-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
a.search-result-item.selected {
  background: #eef0ff;
  box-shadow: inset 0 0 0 1px #9094fbff;
}
.search-result-item .sr-id {
  flex: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #8c8c8c;
}
.search-result-item .sr-taxon {
  flex: none;
  color: #8c8c8c;
}
.search-result-item .sr-title {
  color: #222;
}
.search-result-item .sr-excerpt {
  color: #666;
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-item .sr-excerpt mark {
  background: #fff0a8;
  color: inherit;
  border-radius: 2px;
}
.search-empty {
  padding: 1rem 0.6rem;
  color: #888;
}
.search-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid #eee;
  font-size: 0.8rem;
  color: #888;
}
.search-footer kbd {
  font-size: 0.72rem;
}

kbd {
  border: 2px solid #cdcdcd;
  border-radius: 0.25rem;
  box-shadow: inset 0 -1px 0 0 #cdcdcd;
  font-size: 0.825rem;
  padding: 0.25rem;
}

.Agda {
  --agda-foreground:  black;
  --agda-accent:      #831bd9;
  --agda-accent2:     #6666ff;
  --agda-comment:     hsl(0, 0%, 50%);
  --agda-hover-bg:    #ccc;
  --agda-defined:     var(--agda-foreground);
  --agda-literal:     var(--agda-accent);
  --agda-keyword:     var(--agda-foreground);
  --agda-symbol:      var(--agda-foreground);
  --agda-module:      var(--agda-literal);
  --agda-constructor: var(--agda-literal);
}

/* Aspects. */
.Agda .Comment       { color: var(--agda-comment) }
.Agda .Background    {}
.Agda .Markup        {}
.Agda .Keyword       { color: var(--agda-keyword); font-weight: bold; }
.Agda .String        { color: var(--agda-literal) }
.Agda .Number        { color: var(--agda-literal) }
.Agda .Symbol        { color: var(--agda-symbol) }
.Agda .PrimitiveType { color: var(--agda-defined) }
.Agda .Pragma        { color: var(--agda-keyword) }
.Agda .Operator      {}
.Agda .Hole          { background: #e4cbef }

/* NameKinds. */
.Agda .Bound                  { color: var(--agda-accent2) }
.Agda .Generalizable          { color: var(--agda-accent2) }
.Agda .InductiveConstructor   { color: var(--agda-constructor) }
.Agda .CoinductiveConstructor { color: var(--agda-constructor) }
.Agda .Datatype               { color: var(--agda-defined) }
.Agda .Field                  { color: var(--agda-constructor) }
.Agda .Function               { color: var(--agda-defined) }
.Agda .Macro                  { color: var(--agda-defined) }
.Agda .Module                 { color: var(--agda-module) }
.Agda .Postulate              { color: var(--agda-defined) }
.Agda .Primitive              { color: var(--agda-defined) }
.Agda .Record                 { color: var(--agda-defined) }

/* OtherAspects. */
.Agda .DottedPattern        {}
.Agda .UnsolvedMeta         { color: var(--agda-foreground); background: yellow         }
.Agda .UnsolvedConstraint   { color: var(--agda-foreground); background: yellow         }
.Agda .TerminationProblem   { color: var(--agda-foreground); background: #FFA07A        }
.Agda .IncompletePattern    { color: var(--agda-foreground); background: #F5DEB3        }
.Agda .Error                { color: red;   text-decoration: underline }
.Agda .TypeChecks           { color: var(--agda-foreground); background: #ADD8E6        }
.Agda .Deadcode             { color: var(--agda-foreground); background: #808080        }
.Agda .ShadowingInTelescope { color: var(--agda-foreground); background: #808080        }

/* Standard attributes. */
.Agda a { text-decoration: none }
.Agda a[href]:hover { background-color: var(--agda-hover-bg); }
.Agda [href].hover-highlight { background-color: var(--agda-hover-bg); }
