/*
  vfd-swipe.css
  Delt styling til VFD swipe-øvelser (motor: vfd-swipe.js).

  Følger projektets styling-regler (vfd-ai-coding-guidelines):
  - Typografi (font-family, font-size, font-weight, line-height) arves fra
    Umbraco/SDCC. Standard-tags (h2, h3, p, ul, li) styles ikke direkte.
  - Farver, gradienter og temaer fra Umbraco genbruges. Her defineres kun den
    layout og interaktion, som swipe-mekanikken kræver, og som ikke findes i de
    eksisterende ressourcer (kortstak, drag-feedback, bunke-layout).
  - Alt er scopet under .vfd-swipe og bruger vfd-prefix.
  - Mobile-first.
*/

.vfd-swipe {
  /* Kun layout-tokens — ingen brandfarver/typografi der konkurrerer med Umbraco. */
  --vfd-radius-lg: 14px;
  --vfd-radius-md: 10px;
  --vfd-control-size: 48px;
  --vfd-line: rgba(0, 0, 0, 0.14);
  --vfd-line-soft: rgba(0, 0, 0, 0.06);
  --vfd-card-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  --vfd-card-shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.08);

  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  box-sizing: border-box;
  isolation: isolate;
}

.vfd-swipe *,
.vfd-swipe *::before,
.vfd-swipe *::after {
  box-sizing: inherit;
}

/* ---- Header ---- */
.vfd-swipe__header {
  display: grid;
  gap: 0.65rem;
  max-width: none;
  margin: 0 auto 1.25rem;
  text-align: center;
}

.vfd-swipe__eyebrow {
  margin: 0;
}

.vfd-swipe__title {
  margin: 0;
}

.vfd-swipe__intro {
  margin: 0 auto;
  max-width: 52ch;
}

/* ---- Progress ---- */
.vfd-swipe__progress-wrap {
  display: grid;
  gap: 0.55rem;
  margin: 1.3rem auto 15px;
  max-width: none;
}

.vfd-swipe__counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.vfd-swipe__progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--vfd-line-soft);
  margin-bottom: 1rem;
}

.vfd-swipe__progress-bar {
  width: var(--vfd-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.65;
  transition: width 220ms ease-out;
}

/* ---- Kortstak ---- */
.vfd-swipe__container {
  position: relative;
  width: min(100%, 620px);
  min-height: clamp(210px, 34vh, 285px);
  margin: 0 auto 1.35rem;
  perspective: 1200px;
  touch-action: pan-y;
  z-index: 5;
}

.vfd-swipe__live-layout {
  display: block;
}

.vfd-swipe__live-pile {
  display: none;
  position: relative;
  z-index: 1;
}

.vfd-swipe__card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--vfd-card-shadow);
  cursor: grab;
  user-select: none;
  transition: transform 170ms cubic-bezier(.2,.8,.2,1), opacity 170ms ease-out, box-shadow 170ms ease-out;
  transform-origin: center bottom;
  z-index: 10;
  will-change: transform;
}

.vfd-swipe__card::before {
  content: none;
}

.vfd-swipe__card:active {
  cursor: grabbing;
}

.vfd-swipe .vfd-swipe__container .vfd-swipe__card:focus-visible,
.vfd-swipe .vfd-swipe__container .vfd-swipe__card:focus {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: var(--vfd-card-shadow) !important;
  border-color: var(--vfd-line) !important;
}

.vfd-swipe__card[data-position="1"] {
  z-index: 9;
  transform: translateX(-12px) translateY(14px) scale(0.955) rotate(-4.5deg);
  opacity: 0.78;
  box-shadow: var(--vfd-card-shadow-soft);
}

.vfd-swipe__card[data-position="2"] {
  z-index: 8;
  transform: translateX(14px) translateY(30px) scale(0.91) rotate(5deg);
  opacity: 0.50;
  box-shadow: none;
}

.vfd-swipe__card--fly-left {
  transform: translateX(-115%) rotate(-16deg) !important;
  opacity: 0;
}

.vfd-swipe__card--fly-right {
  transform: translateX(115%) rotate(16deg) !important;
  opacity: 0;
}

.vfd-swipe__card-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.vfd-swipe__category {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  border: 1px solid var(--vfd-line);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
}

.vfd-swipe__category-dot {
  width: 0.62rem;
  height: 0.62rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background-color: var(--vfd-card-accent, currentColor);
}

.vfd-swipe__hint {
  white-space: nowrap;
  opacity: 0.7;
}

.vfd-swipe--hide-category .vfd-swipe__category {
  display: none;
}

.vfd-swipe--hide-category .vfd-swipe__card-topline {
  justify-content: center;
}

.vfd-swipe--hide-category .vfd-swipe__card-topline > span:first-child {
  display: none;
}

/* ---- Korttype: statement (udsagn) ---- */
.vfd-swipe__text {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 60px;
  font-weight: 600;
}

.vfd-swipe__by {
  position: relative;
  z-index: 1;
  margin: 1.2rem 0 0;
}

/* ---- Korttype: food (fødevare) ---- */
.vfd-swipe__food {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
}

.vfd-swipe__food-emoji {
  font-size: clamp(3.2rem, 16vw, 5.5rem);
  line-height: 1;
}

.vfd-swipe__food-img {
  width: clamp(8rem, 42vw, 12rem);
  height: clamp(8rem, 42vw, 12rem);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.vfd-swipe__food-name {
  margin: 0;
}

.vfd-swipe__food-stamps {
  position: relative;
  width: 100%;
  min-height: 2.55rem;
  margin-top: 0.25rem;
}

.vfd-swipe__food-portion {
  margin: 0;
}

/* ---- Stempel (drag-feedback) ---- */
.vfd-swipe__stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62%;
  padding: 0.65rem 1rem;
  border: 4px solid currentColor;
  border-radius: var(--vfd-radius-md);
  background: rgba(255, 255, 255, 0.82);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -50%) scale(0);
  transition: opacity 100ms ease-out, transform 100ms ease-out;
}

.vfd-swipe__card--food-type .vfd-swipe__stamp {
  top: 0;
  left: 50%;
  min-width: auto;
  border-width: 3px;
  transform: translateX(-50%) scale(0);
}

/* ---- Handlinger ---- */
.vfd-swipe__actions-row {
  display: grid;
  gap: 0.9rem;
  max-width: none;
  margin: 0 auto;
}

.vfd-swipe__undo {
  display: flex;
  justify-content: center;
}

.vfd-swipe__undo-button {
  min-height: 40px;
  padding: 0.52rem 0.95rem;
  background-color: transparent;
  border: 1px solid var(--vfd-line);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: background-color 160ms ease-out, transform 160ms ease-out, opacity 160ms ease-out;
}

.vfd-swipe__undo-button:hover:not(:disabled) {
  background-color: var(--vfd-line-soft);
  transform: translateY(-1px);
}

.vfd-swipe__undo-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vfd-swipe__controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.vfd-swipe__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--vfd-control-size);
  width: 100%;
  padding: 0.85rem 1.1rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease-out, background-color 160ms ease-out;
}

.vfd-swipe__button:hover {
  transform: translateY(-2px);
  background-color: var(--vfd-line-soft);
}

.vfd-swipe__button:active {
  transform: translateY(0) scale(0.99);
}

.vfd-swipe__button:focus-visible,
.vfd-swipe__undo-button:focus-visible,
.vfd-swipe__results-button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.vfd-swipe__microcopy {
  margin: 0.25rem auto 0;
  max-width: 52ch;
  text-align: center;
}

/* ---- Feedback-modal over øvelsen (food-øvelsen) ---- */
.vfd-swipe__deck-content {
  transition: filter 180ms ease-out;
}

.vfd-swipe--feedback-open .vfd-swipe__deck-content {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.vfd-swipe__feedback-modal[hidden] {
  display: none;
}

.vfd-swipe__feedback-modal {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.vfd-swipe__feedback-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(96, 96, 96, 0.42);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.vfd-swipe__feedback {
  position: relative;
  width: min(100%, 680px);
  max-height: min(82vh, 720px);
  overflow: auto;
  margin: 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-lg);
  background: #ffffff;
  box-shadow: var(--vfd-card-shadow);
  min-height: 3.25rem;
}

.vfd-swipe__feedback-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  margin: 0 0 0.8rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--vfd-line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.vfd-swipe__feedback-close:hover {
  background: var(--vfd-line-soft);
}

.vfd-swipe__feedback-heading {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.vfd-swipe__feedback-body {
  margin: 0.35rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.vfd-swipe__feedback-status,
.vfd-swipe__feedback-expected {
  display: inline-block;
  padding: 0.12rem 0.42rem;
  border-radius: 0.45rem;
  font-size: 0.92em;
}

.vfd-swipe__feedback-status--correct {
  background: #e7f7ed;
  color: #1f6b3b;
}

.vfd-swipe__feedback-status--incorrect {
  background: #fff0f0;
  color: #8a2e2e;
}

.vfd-swipe__feedback-expected {
  background: #f6f6f6;
  color: #333333;
}

.vfd-swipe__feedback-expected--correct {
  background: #e7f7ed;
  color: #1f6b3b;
}

.vfd-swipe__feedback-expected--incorrect {
  background: #fff0f0;
  color: #8a2e2e;
}

.vfd-swipe__feedback-sep {
  font-weight: 600;
}

.vfd-swipe__feedback-text {
  margin: 0.45rem 0 0;
}

.vfd-swipe__score {
  margin: 0.95rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-md);
  background: #ffffff;
}

/* ---- Resultat med to bunker ---- */
.vfd-swipe__results {
  display: none;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  text-align: center;
}

.vfd-swipe__results--active {
  display: block;
}

.vfd-swipe__results-hero {
  margin-bottom: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-lg);
  background: #ffffff;
  box-shadow: var(--vfd-card-shadow-soft);
}

.vfd-swipe__results-kicker {
  margin: 0 0 0.45rem;
}

.vfd-swipe__results-title {
  margin: 0 0 0.75rem;
}

.vfd-swipe__results-subtitle {
  max-width: 56ch;
  margin: 0 auto;
}

.vfd-swipe__piles {
  display: grid;
  gap: 1.1rem;
  margin: 0 0 1.6rem;
}

.vfd-swipe__pile {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-lg);
  background: #ffffff;
  box-shadow: var(--vfd-card-shadow-soft);
  text-align: left;
}

.vfd-swipe__pile-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.85rem;
}

.vfd-swipe__pile-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 0.5rem;
  border: 1px solid var(--vfd-line);
  border-radius: 999px;
}

.vfd-swipe__pile-items {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.vfd-swipe__pile-item {
  width: 100%;
  text-align: left;
  background: #ffffff;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-md);
}

.vfd-swipe__pile-item:hover,
.vfd-swipe__pile-item:focus-visible {
  background: #f8f8f8;
}

.vfd-swipe__pile-item:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.vfd-swipe__pile-item--correct {
  border-color: #1f6b3b;
  background: #e7f7ed;
  color: #1f6b3b;
}

.vfd-swipe__pile-item--incorrect {
  border-color: #8a2e2e;
  background: #fff0f0;
  color: #8a2e2e;
}

.vfd-swipe__pile-empty {
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed var(--vfd-line);
  border-radius: var(--vfd-radius-md);
}

.vfd-swipe__results-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--vfd-control-size);
  padding: 0.85rem 1.65rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease-out, background-color 160ms ease-out;
}

.vfd-swipe__results-button:hover {
  transform: translateY(-2px);
  background-color: var(--vfd-line-soft);
}

/* ---- Modal med fødevare-info ---- */
.vfd-swipe__modal[hidden] {
  display: none;
}

.vfd-swipe__modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.vfd-swipe__modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.vfd-swipe__modal-dialog {
  position: relative;
  width: min(100%, 640px);
  max-height: min(85vh, 760px);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-lg);
  background: #ffffff;
  box-shadow: var(--vfd-card-shadow);
  text-align: left;
}

.vfd-swipe__modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.3rem;
  margin-bottom: 0.8rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--vfd-line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.vfd-swipe__modal-close:hover {
  background: var(--vfd-line-soft);
}

.vfd-swipe__modal-close:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.vfd-swipe__modal-title {
  margin: 0 0 0.75rem;
}

.vfd-swipe__modal-note {
  margin: 0;
}

.vfd-swipe__modal-image-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(140px, 24vh, 220px);
  max-height: clamp(220px, 46vh, 360px);
  margin: 0 0 0.85rem;
  padding: 0.5rem;
  border: 1px solid var(--vfd-line);
  border-radius: var(--vfd-radius-md);
  background: #ffffff;
}

.vfd-swipe__modal-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: clamp(200px, 42vh, 330px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.vfd-swipe--error {
  padding: 1.5rem;
  text-align: center;
}

/* ---- Responsiv ---- */
@media (min-width: 560px) {
  .vfd-swipe__controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .vfd-swipe {
    padding: 2.25rem;
  }

  .vfd-swipe__piles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .vfd-swipe__live-layout {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(0, 620px) minmax(190px, 1fr);
    gap: 1rem;
    align-items: start;
  }

  .vfd-swipe__container {
    width: min(100%, 434px);
    margin-bottom: 0.9rem;
  }

  .vfd-swipe__live-pile {
    display: block;
    max-height: clamp(360px, 52vh, 470px);
    overflow: auto;
    padding: 0.8rem;
    border: 1px solid var(--vfd-line);
    border-radius: var(--vfd-radius-lg);
    background: #ffffff;
    box-shadow: var(--vfd-card-shadow-soft);
    transition: background-color 120ms ease-out;
  }

  .vfd-swipe__live-pile--drag-target {
    background: #f2f2f2;
  }

  .vfd-swipe__live-pile-title {
    margin: 0 0 0.65rem;
    padding: 0.12rem 0.38rem;
  }

  .vfd-swipe__live-pile-items {
    margin: 0;
    margin-left: 0;
    margin-inline-start: 0;
    display: grid;
    gap: 0.12rem;
  }

  .vfd-swipe__live-pile-item {
    display: block;
    margin: 0;
    margin-left: 0;
    margin-inline-start: 0;
    padding: 0.12rem 0.38rem;
    border-radius: 0.35rem;
  }

  .vfd-swipe__live-pile-empty {
    margin: 0;
    padding: 0.65rem;
    border: 1px dashed var(--vfd-line);
    border-radius: var(--vfd-radius-md);
  }

  .vfd-swipe__live-pile--yes {
    border-color: color-mix(in srgb, currentColor 24%, var(--vfd-line));
  }

  .vfd-swipe__live-pile--no {
    border-color: color-mix(in srgb, currentColor 16%, var(--vfd-line));
  }

  .vfd-swipe__container {
    min-height: clamp(360px, 52vh, 470px);
  }

  .vfd-swipe__card {
    padding-block: clamp(1.8rem, 3vw, 2.4rem);
  }
}
