/* Spotlight-søgning. Alt er scopet under #ddk-spotlight, så det ikke rammer eller rammes af resten af style.css */

html.ddk-sp-lock {
    overflow: hidden;
  }
  
  #ddk-spotlight {
    /* Tilpas accentfarven til dianalund.dk's brandfarve */
    --sp-accent: var(--primary-color);
    --sp-accent-text: var(--primary-bg-color);
  
    --sp-bg: rgba(255, 255, 255, 0.86);
    --sp-text: #1d1d1f;
    --sp-muted: #6e6e73;
    --sp-line: rgba(0, 0, 0, 0.1);
    --sp-hover: rgba(0, 0, 0, 0.06);
    --sp-mark: rgba(255, 196, 0, 0.4);
  
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    box-sizing: border-box;
    font: 400 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-transform: none;
    letter-spacing: normal;
  }
  
  @media (prefers-color-scheme: dark) {
    #ddk-spotlight {
      --sp-bg: rgba(40, 40, 44, 0.86);
      --sp-text: #f5f5f7;
      --sp-muted: #a1a1a6;
      --sp-line: rgba(255, 255, 255, 0.12);
      --sp-hover: rgba(255, 255, 255, 0.08);
      --sp-mark: rgba(255, 196, 0, 0.35);
    }
  }
  
  #ddk-spotlight[hidden],
  #ddk-spotlight [hidden] {
    display: none !important;
  }
  
  #ddk-spotlight *,
  #ddk-spotlight *::before,
  #ddk-spotlight *::after {
    box-sizing: border-box;
  }
  
  #ddk-spotlight .ddk-sp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: ddk-sp-fade 0.15s ease-out;
  }
  
  #ddk-spotlight .ddk-sp-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    max-height: 76vh;
    max-height: 76dvh;
    overflow: hidden;
    color: var(--sp-text);
    background: var(--sp-bg);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--sp-line);
    animation: ddk-sp-in 0.16s ease-out;
  }
  
  /* Søgefelt */
  #ddk-spotlight .ddk-sp-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid var(--sp-line);
  }
  
  #ddk-spotlight .ddk-sp-icon {
    display: flex;
    flex: none;
    color: var(--sp-muted);
  }
  
  #ddk-spotlight .ddk-sp-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    font: inherit;
    font-size: 22px; /* mindst 16px, så iOS ikke zoomer */
    color: var(--sp-text);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
  }
  
  #ddk-spotlight .ddk-sp-input::placeholder {
    color: var(--sp-muted);
    opacity: 1;
  }
  
  #ddk-spotlight .ddk-sp-close {
    flex: none;
    margin: 0;
    padding: 3px 8px;
    font: inherit;
    font-size: 12px;
    line-height: 1.3;
    color: var(--sp-muted);
    text-transform: none;
    background: transparent;
    border: 1px solid var(--sp-line);
    border-radius: 6px;
    cursor: pointer;
  }
  
  #ddk-spotlight .ddk-sp-close:hover,
  #ddk-spotlight .ddk-sp-close:focus-visible {
    background: var(--sp-hover);
    outline: 0;
  }
  
  /* Tynd statuslinje under feltet mens der søges */
  #ddk-spotlight.is-loading .ddk-sp-row::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 30%;
    height: 2px;
    background: var(--sp-accent);
    animation: ddk-sp-load 0.9s ease-in-out infinite;
  }
  
  /* Status og resultater */
  #ddk-spotlight .ddk-sp-status {
    flex: none;
    padding: 18px 20px 6px;
    color: var(--sp-muted);
  }
  
  #ddk-spotlight .ddk-sp-results {
    flex: 1;
    min-height: 0;
    padding: 6px 8px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  
  #ddk-spotlight .ddk-sp-results:empty {
    display: none;
  }
  
  #ddk-spotlight .ddk-sp-heading {
    padding: 10px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sp-muted);
  }
  
  #ddk-spotlight a.ddk-sp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    color: var(--sp-text);
    text-decoration: none;
    border: 0;
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
    height: auto;       /* overstyrer a { height: fit-content } */
    line-height: 1.4;   /* overstyrer a { line-height: 0 } */
  }
  
  #ddk-spotlight a.ddk-sp-item.is-active {
    color: var(--sp-accent-text);
    background: var(--sp-accent);
  }
  
  #ddk-spotlight .ddk-sp-thumb {
    display: block;
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0;
    object-fit: cover;
    background: var(--sp-hover);
    border-radius: 8px;
  }
  
  #ddk-spotlight .ddk-sp-thumb--ph {
    display: grid;
    place-items: center;
    font-weight: 600;
    color: var(--sp-muted);
  }
  
  #ddk-spotlight .is-active .ddk-sp-thumb--ph {
    color: var(--sp-accent-text);
    background: rgba(255, 255, 255, 0.2);
  }
  
  #ddk-spotlight .ddk-sp-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  
  #ddk-spotlight .ddk-sp-title {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  #ddk-spotlight .ddk-sp-meta {
    font-size: 13px;
    color: var(--sp-muted);
  }
  
  #ddk-spotlight .is-active .ddk-sp-meta {
    color: rgba(255, 255, 255, 0.82);
  }
  
  #ddk-spotlight mark {
    padding: 0 1px;
    color: inherit;
    background: var(--sp-mark);
    border-radius: 3px;
  }
  
  #ddk-spotlight .is-active mark {
    background: rgba(255, 255, 255, 0.28);
  }
  
  #ddk-spotlight .ddk-sp-all {
    margin-top: 6px;
  }
  
  @media (max-width: 600px) {
    #ddk-spotlight {
      padding-top: 8vh;
    }
  
    #ddk-spotlight .ddk-sp-input {
      font-size: 18px;
    }
  }
  
  @keyframes ddk-sp-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
  }
  
  @keyframes ddk-sp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  
  @keyframes ddk-sp-load {
    from { transform: translateX(-100%); }
    to   { transform: translateX(340%); }
  }
  
  @media (prefers-reduced-motion: reduce) {
    #ddk-spotlight .ddk-sp-backdrop,
    #ddk-spotlight .ddk-sp-panel,
    #ddk-spotlight.is-loading .ddk-sp-row::after {
      animation: none;
    }
  }