/*
 * Procesguide (ordered step-by-step process guide) styles.
 *
 * Consumes the design tokens from tokens.css. Do not hard-code colours,
 * fonts or spacing here; reference the custom properties so the site
 * stays themeable.
 *
 * Two predefined layouts only: Horisontal (connected step line) and
 * Interaktiv (expandable step cards). No Vertikal variant.
 */

.procesguide {
  width: 100%;
  /* Anchor CTAs scroll this element flush to the viewport top, hiding it
     under the fixed header/pill and message bar; reserve that space
     (matches afdelingskort.css/faq.css). */
  scroll-margin-top: calc(var(--padis-header-height, 5rem) + var(--padis-operational-height, 0px) + var(--padis-space-md));
}

.procesguide__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Icon badge shared by both variants. Icons are decorative (aria-hidden);
   glyph is a CSS mask against an SVG in wwwroot/icons/, so it inherits the
   theme's icon colour. */
.procesguide__icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 3.9rem;
  height: 3.9rem;

  border: 2px dashed var(--padis-color-primary);
  border-radius: 50%;
  background: var(--padis-color-surface);
  color: var(--padis-color-primary);
}

.procesguide__icon {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;

  /* Umbraco icon SVGs use currentColor stroke/fill, which only works inline,
     not via <img>. Rendering as a CSS mask lets the glyph pick up the
     badge's theme colour instead. */
  background-color: currentColor;
  -webkit-mask-image: var(--procesguide-icon-url);
  mask-image: var(--procesguide-icon-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.procesguide__title {
  font-family: var(--padis-font-heading);
  font-weight: 700;
  color: var(--padis-color-text);
}

.procesguide__description {
  margin: 0.25rem 0 0;
  color: var(--padis-color-text-muted);
  font-size: 0.9em;
}

.procesguide__link,
.procesguide__cta {
  color: var(--padis-color-primary);
  font-weight: 700;
}

.procesguide__link:focus-visible,
.procesguide__cta:focus-visible,
.procesguide__toggle:focus-visible {
  outline: 2px solid var(--padis-color-primary);
  outline-offset: 2px;
}

.procesguide--horisontal .procesguide__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--padis-space-lg);
}

.procesguide--horisontal .procesguide__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  position: relative;
  width: 12rem;
  gap: var(--padis-space-sm);
}

/* Connecting line spans from badge-center to badge-center: half the column's
   empty space (12rem - 3.9rem badge) on each side, plus the flex gap -
   otherwise it falls short of reaching the next badge. */
.procesguide--horisontal .procesguide__step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 1.95rem;
  right: calc(50% + 1.95rem);
  width: calc(12rem - 3.9rem + var(--padis-space-lg));
  border-top: 1px solid var(--padis-color-border);
}

.procesguide--interaktiv .procesguide__list {
  display: flex;
  flex-direction: column;
  gap: var(--padis-space-md);
}

.procesguide--interaktiv .procesguide__step {
  border: 1px solid var(--padis-color-border);
  border-radius: var(--padis-radius);
  background: var(--padis-color-surface);
  overflow: hidden;
}

.procesguide__toggle {
  display: flex;
  align-items: center;
  gap: var(--padis-space-sm);
  width: 100%;
  padding: var(--padis-space-md);

  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.procesguide__panel {
  padding: 0 var(--padis-space-md) var(--padis-space-md);
}

.procesguide__panel[hidden] {
  display: none;
}

@media (max-width: 40rem) {
  .procesguide--horisontal .procesguide__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
  }

  /* Narrower step width so short guides (2-3 steps) fit within the
     viewport without triggering a sideways scrollbar; longer guides still
     overflow and scroll via .procesguide__list above. */
  .procesguide--horisontal .procesguide__step {
    flex: 0 0 auto;
    width: 7rem;
  }

  .procesguide--horisontal .procesguide__step:not(:first-child)::before {
    top: 1.95rem;
    right: calc(50% + 1.95rem);
    width: calc(7rem - 3.9rem + var(--padis-space-lg));
  }
}
