/* 4. Exempel på ett utlåtande (biljett 01 statiskt, biljett 04 interaktivt) */

.exempel__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 40px;
  align-items: start;
}

.exempel__intro {
  grid-column: 1 / span 5;
  display: grid;
  gap: 24px;
  justify-items: start;
  position: sticky;
  top: calc(var(--nav-h) + 48px);
}
.exempel__intro .lead { max-width: 24em; }

.tag--example { gap: 8px; }
.tag__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn-dot); }

/* ---------- Utlåtandet ---------- */

.verdict {
  --ease-glide: cubic-bezier(0.2, 0, 0, 1); /* flikindikatorn (Årsväljare) */
  grid-column: 7 / -1;
  min-width: 0;
}

/* Flikar: segmentkontroll med 4 px inre padding. Skrollbar på smala skärmar. */
.verdict__tabs {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 56px);
  margin: 20px 28px 0;
  padding: 4px;
  border-radius: 10px;
  background: rgb(17 18 20 / 0.05);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.verdict__tabs::-webkit-scrollbar { display: none; }

.verdict__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 7px;
  background: var(--card);
  box-shadow: var(--shadow-lift);
  pointer-events: none;
}

.verdict__tabs [role="tab"] {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  transition: color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.verdict__tabs [role="tab"]:hover { color: var(--ink); background: rgb(17 18 20 / 0.05); }
.verdict__tabs [role="tab"][aria-selected="true"] { color: var(--ink); }
.verdict__tabs [role="tab"][aria-selected="true"]:hover { background: transparent; }
.verdict__tabs [role="tab"]:focus-visible { outline-offset: -3px; }

.verdict__dot { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.verdict__dot--ok { background: var(--ok-dot); }
.verdict__dot--warn { background: var(--warn-dot); }
.verdict__dot--no { background: var(--no-dot); }

/* Panel: byter utan att animera höjd */
.verdict__panel { min-width: 0; }

.verdict__head {
  display: grid;
  gap: 6px;
  padding: 20px 28px 22px;
  border-bottom: 1px solid var(--line);
}
.verdict__project {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.verdict__meta { color: var(--ink-3); }
.verdict__month {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: var(--fs-small);
  color: var(--ink-2);
}

/* ---------- Villkor ---------- */

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

.condition {
  position: relative;
  isolation: isolate;
  padding: 0 28px;
  transition: background-color var(--dur-1) ease;
}
.condition + .condition { border-top: 1px solid var(--line); }
.condition:hover { background: rgb(17 18 20 / 0.03); }

/* Bärnstenston på villkoret som väntar på svar. Tonas bort när det är besvarat. */
.condition::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--warn-bg) 35%, transparent);
  opacity: 0;
  pointer-events: none;
}
.condition--open::before { opacity: 1; }

.condition__head { margin: 0; }
.condition__toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 20px 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  text-align: left;
  cursor: default;
}
.is-enhanced .condition__toggle { cursor: pointer; }
.condition__name { flex: 1 1 auto; min-width: 0; font-weight: 600; letter-spacing: -0.01em; }
.condition__chev { display: none; width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.is-enhanced .condition__chev { display: block; }
.condition__toggle[aria-expanded="true"] .condition__chev { transform: rotate(180deg); }

/* Utfällning: höjden 0fr → 1fr. Ihopfälld body är osynlig och inte fokuserbar. */
.condition__body { display: grid; grid-template-rows: 1fr; }
.condition.is-collapsed .condition__body { grid-template-rows: 0fr; visibility: hidden; }
.condition__inner {
  min-height: 0;
  overflow: hidden;
  margin: 0 -8px;
  padding: 0 8px;
}
.condition__inner::after { content: ""; display: block; height: 22px; }

.condition__reason { max-width: 36em; color: var(--ink-2); text-wrap: pretty; }
.condition__sources.source { display: block; margin: 12px 0 0; line-height: 2; }

/* ---------- Källor och utdrag ---------- */

a.source__doc { text-decoration: none; cursor: pointer; }
a.source__doc:hover,
a.source__doc:focus-visible { text-decoration: underline; text-underline-offset: 0.2em; }
a.source__doc[aria-expanded="true"] { background: var(--lime-wash); color: var(--ink); }

.excerpt {
  position: relative;
  display: none;
  margin: 12px 0 0;
  padding: 14px 44px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}
.excerpt.is-open,
#exempel:not(.is-enhanced) .excerpt:target { display: block; }
.excerpt:focus-visible { outline-offset: 2px; }

/* Ritad koppling till källan */
.excerpt::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -7px;
  width: 2px;
  background: var(--green);
  transform-origin: top;
}

.excerpt figcaption { margin-bottom: 8px; color: var(--ink-3); }
.excerpt blockquote {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  line-height: 1.6;
  text-wrap: pretty;
}
.excerpt blockquote p { margin: 0; }
.excerpt mark {
  background: linear-gradient(var(--lime-wash), var(--lime-wash)) no-repeat 0 0 / 100% 100%;
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.excerpt__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.excerpt__close:hover { color: var(--ink); background: rgb(17 18 20 / 0.05); }
.excerpt__close svg { width: 16px; height: 16px; }

/* ---------- Kompletteringsfråga ---------- */

.followup {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
}
.followup__q { color: var(--ink); font-weight: 500; text-wrap: pretty; }
.followup__q .mono { display: block; margin-bottom: 6px; color: var(--ink-3); font-weight: 400; }
.followup__answers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.followup__answer {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
}
.followup__answer:hover { border-color: var(--ink); }
.followup__done { margin-top: 14px; color: var(--ink); font-weight: 500; }

.status__check { width: 12px; height: 12px; flex: none; }
.status__check path { stroke-dasharray: 1; }

.verdict__reset {
  justify-self: start;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}
.verdict__reset:hover { color: var(--ink); }

/* ---------- Modellernas argument ---------- */

.verdict__foot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 18px 28px 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.verdict__foot > p { text-wrap: pretty; }
.verdict__rings { width: 22px; height: 22px; color: var(--green); }
.verdict__foot .debate,
.verdict__reset { grid-column: 1 / -1; }

.debate summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.debate summary::-webkit-details-marker { display: none; }
.debate summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.debate[open] summary::after { transform: translateY(2px) rotate(-135deg); }

.debate__list { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.debate__msg {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
}
.debate__msg > .mono { display: block; margin-bottom: 4px; color: var(--ink-3); }
.debate__msg--b { margin-left: 24px; }
.debate__msg--disagree { border-left: 2px solid var(--warn-dot); }
.debate__outcome { padding-top: 4px; }

/* ---------- Rörelse (bara när besökaren inte begärt minskad rörelse) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .verdict__panel.is-leaving { animation: panel-out 200ms var(--ease-in-out) both; }
  .verdict__panel.is-entering { animation: panel-in 200ms var(--ease-in-out) both; }

  .verdict__tabs.is-ready .verdict__indicator {
    transition: transform 300ms var(--ease-glide), width 300ms var(--ease-glide);
  }

  .verdict__dot { transition: background-color var(--dur-3) var(--ease-out-soft); }
  .verdict .status { transition: color var(--dur-3) var(--ease-out-soft), background-color var(--dur-3) var(--ease-out-soft); }
  .verdict .status::before { transition: background-color var(--dur-3) var(--ease-out-soft); }
  .verdict .status.is-popping { animation: status-pop var(--dur-2) var(--ease-out); }
  .status__check.is-drawing path { animation: check-draw 400ms linear both; }

  .condition::before { transition: opacity var(--dur-3) var(--ease-out-soft); }
  .condition__body { transition: grid-template-rows 300ms var(--ease-in-out), visibility 300ms var(--ease-in-out); }
  .condition__chev { transition: transform 320ms var(--ease-out); }

  /* :target gäller bara utan JS: Chrome uppdaterar inte :target när adressen rensas. */
  .excerpt.is-open,
  #exempel:not(.is-enhanced) .excerpt:target { animation: excerpt-in 320ms var(--ease-std) both; }
  .excerpt.is-open::before,
  #exempel:not(.is-enhanced) .excerpt:target::before { animation: excerpt-line 400ms var(--ease-out) both; }
  .excerpt.is-open mark,
  #exempel:not(.is-enhanced) .excerpt:target mark { animation: mark-sweep 1100ms var(--ease-out) 250ms both; }

  a.source__doc { transition: background-color var(--dur-1) ease, transform var(--dur-press) linear; }
  a.source__doc:active { transform: translateY(1px); }
  .followup__answer { transition: border-color var(--dur-1) ease, transform var(--dur-press) linear; }
  .followup__answer:active { transform: scale(0.98); }

  .followup__answers.is-fading-out { animation: fade-out 200ms linear both; }
  .verdict .is-fading-in { animation: fade-in 200ms var(--ease-out-soft) both; }

  .debate[open] .debate__list > li { animation: debate-in 400ms var(--ease-out) both; }
  .debate[open] .debate__list > li:nth-child(2) { animation-delay: 150ms; }
  .debate[open] .debate__list > li:nth-child(3) { animation-delay: 300ms; }
  .debate[open] .debate__list > li:nth-child(4) { animation-delay: 450ms; }
}

/* Minskad rörelse: inga förflyttningar, bara en kort tonövergång när innehåll byts. */
@media (prefers-reduced-motion: reduce) {
  .verdict__panel.is-entering,
  .excerpt.is-open,
  .followup__done { animation: fade-in 100ms linear; }
}

@keyframes panel-out { to { opacity: 0; transform: translateX(calc(var(--dir) * -16px)); filter: blur(4px); } }
@keyframes panel-in { from { opacity: 0; transform: translateX(calc(var(--dir) * 16px)); filter: blur(4px); } }
@keyframes excerpt-in { from { opacity: 0; transform: translateY(-4px); filter: blur(4px); } }
@keyframes excerpt-line { from { transform: scaleY(0); } }
@keyframes mark-sweep { from { background-size: 0% 100%; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes status-pop { 50% { transform: scale(1.06); } }
@keyframes check-draw { from { stroke-dashoffset: 1; } }
@keyframes debate-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Layout ---------- */

@media (max-width: 960px) {
  .exempel__intro { grid-column: 1 / -1; position: static; }
  .verdict { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .verdict__tabs { margin: 16px 18px 0; max-width: calc(100% - 36px); }
  .verdict__tabs [role="tab"] { min-height: 44px; }
  .verdict__head, .verdict__foot { padding-inline: 18px; }
  .condition { padding-inline: 18px; }
  .excerpt { padding: 14px 40px 16px 16px; }
}
