/* FAQ accordion — Tilitoimistokilpailutus (see docs/DESIGN.md) */

.section--faq {
  --faq-accent: #00685f;
  --faq-accent-bright: #008378;
  --faq-accent-soft: #6bd8cb;
  --faq-accent-dark: #005049;
  /* Closed = dark green; open = lighter green */
  --faq-green-closed: #00685f;
  --faq-green-closed-dark: #005049;
  --faq-green-open: #008378;
  --faq-green-open-light: #6bd8cb;
  --faq-shadow-closed: 0, 80, 73;
  --faq-shadow-closed-mid: 0, 104, 95;
  --faq-shadow-open: 0, 131, 120;
  --faq-shadow-open-light: 107, 216, 203;
  --faq-surface: #ffffff;
  --faq-surface-section: #f2f4f6;
  --faq-border: #eceef0;
  --faq-border-closed: rgba(0, 104, 95, 0.28);
  --faq-border-open: rgba(0, 131, 120, 0.38);
  --faq-text: #191c1e;
  --faq-text-muted: #3d4947;
  --faq-font-display: "Hanken Grotesk", system-ui, sans-serif;
  --faq-font-sans: "Inter", system-ui, sans-serif;
  --faq-space-md: 1rem;
  --faq-space-lg: 1.5rem;
  --faq-space-xl: 2rem;
  --faq-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.section--faq .section__title {
  position: relative;
  margin: 0 0 var(--faq-space-md);
  padding-bottom: var(--faq-space-md);
  font-family: var(--faq-font-display);
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.section--faq .section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3.5rem;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--faq-accent) 0%, var(--faq-accent-bright) 100%);
}

.faq {
  max-width: 44rem;
  margin-inline: auto;
}

.faq--stacked {
  margin-top: var(--faq-space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--faq-space-md);
}

.faq__panel-outer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.48s cubic-bezier(0.33, 1, 0.68, 1);
}

.faq__item.is-open .faq__panel-outer {
  grid-template-rows: 1fr;
}

.faq__panel-inner {
  min-height: 0;
  overflow: hidden;
}

.faq__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--faq-space-md);
  padding: var(--faq-space-lg) 0;
  font-family: var(--faq-font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--faq-transition);
}

.faq__trigger:focus-visible {
  outline: 2px solid var(--faq-accent);
  outline-offset: 2px;
}

.faq__icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  position: relative;
  color: var(--faq-green-closed);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq__icon::before,
.faq__icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}

.faq__icon::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  margin-top: -1px;
}

.faq__icon::after {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
  transition: opacity var(--faq-transition);
}

.faq__trigger[aria-expanded="true"] .faq__icon {
  transform: rotate(45deg);
}

.faq__panel {
  padding: 0 0 var(--faq-space-lg);
}

.faq__panel p {
  margin: 0 0 0.75rem;
  font-family: var(--faq-font-sans);
  font-size: 1rem;
  line-height: 1.65;
}

.faq__panel p:last-child {
  margin-bottom: 0;
}

.section--faq .section__title--faq {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  color: var(--faq-text);
  font-weight: 700;
}

.section--faq .section__title--faq::after {
  left: 50%;
  transform: translateX(-50%);
  width: 3.75rem;
  background: linear-gradient(
    90deg,
    var(--faq-accent-dark) 0%,
    var(--faq-accent-bright) 50%,
    var(--faq-accent) 100%
  );
}

.section--faq .section__subtitle {
  text-align: center;
  margin: -0.25rem 0 var(--faq-space-xl);
  font-family: var(--faq-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--faq-text-muted);
}

.section--faq .faq__item {
  position: relative;
  background: var(--faq-surface);
  border: 1px solid var(--faq-border-closed);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 2px 4px rgba(var(--faq-shadow-closed), 0.06),
    0 8px 18px rgba(var(--faq-shadow-closed-mid), 0.08);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.section--faq .faq__item:hover {
  box-shadow:
    0 2px 5px rgba(var(--faq-shadow-closed), 0.08),
    0 10px 22px rgba(var(--faq-shadow-closed-mid), 0.1);
}

.section--faq .faq__item.is-open {
  border-color: var(--faq-border-open);
  box-shadow:
    0 2px 5px rgba(var(--faq-shadow-open), 0.06),
    0 12px 26px rgba(var(--faq-shadow-open-light), 0.12);
}

.section--faq .faq__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(
    180deg,
    var(--faq-green-closed) 0%,
    var(--faq-green-closed-dark) 100%
  );
  border-radius: 12px 0 0 12px;
  z-index: 1;
  pointer-events: none;
  box-shadow: 2px 0 8px rgba(var(--faq-shadow-closed-mid), 0.1);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.section--faq .faq__item.is-open::before {
  background: linear-gradient(
    180deg,
    var(--faq-green-open-light) 0%,
    var(--faq-green-open) 100%
  );
  box-shadow: 2px 0 10px rgba(var(--faq-shadow-open-light), 0.16);
}

.section--faq .faq__trigger {
  position: relative;
  z-index: 0;
  padding: var(--faq-space-md) var(--faq-space-xl) var(--faq-space-md) calc(4px + var(--faq-space-lg));
  color: var(--faq-text);
  font-size: 1.05rem;
  font-weight: 600;
}

.section--faq .faq__trigger:hover {
  color: var(--faq-accent-dark);
}

.section--faq .faq__trigger:hover .faq__icon {
  color: var(--faq-green-closed);
}

.section--faq .faq__icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--faq-green-closed);
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.35s ease;
}

.section--faq .faq__item.is-open .faq__icon {
  color: var(--faq-green-open);
}

.section--faq .faq__item.is-open .faq__trigger:hover .faq__icon {
  color: var(--faq-green-open-light);
}

.section--faq .faq__panel {
  padding: 0 var(--faq-space-xl) var(--faq-space-md) calc(4px + var(--faq-space-lg));
  color: var(--faq-text-muted);
  border-top: 1px solid var(--faq-border-closed);
  opacity: 0;
  transform: translateY(-0.45rem);
  transition:
    opacity 0.22s ease,
    transform 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

.section--faq .faq__item.is-open .faq__panel {
  opacity: 1;
  transform: translateY(0);
  border-top-color: color-mix(in srgb, var(--faq-green-open) 25%, var(--faq-border));
  transition:
    opacity 0.42s ease 0.06s,
    transform 0.48s cubic-bezier(0.33, 1, 0.68, 1) 0.02s,
    border-color 0.3s ease,
    color 0.3s ease;
}

.section--faq .faq__panel p {
  font-size: 0.98rem;
  line-height: 1.7;
}

/* Decorative mascot — right of FAQ, outside content flow */
.section--faq {
  position: relative;
  overflow: visible;
}

.section--faq > .max-w-\[800px\] {
  position: relative;
  z-index: 1;
}

.faq-section__mascot-wrap {
  position: absolute;
  top: 55%;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

.faq-section__mascot-wrap--right {
  right: clamp(0.25rem, 2.5vw, 2rem);
  transform: translateY(-50%);
}

.faq-section__mascot-wrap::after {
  content: "";
  position: absolute;
  left: 44%;
  bottom: 15%;
  z-index: -1;
  width: 48%;
  height: clamp(0.5rem, 1.2vw, 0.85rem);
  transform: translateX(-50%);
  background-color: #021d1f;
  border-radius: 50%;
  opacity: 0.5;
  filter: blur(0.5px);
}

.faq-section__mascot {
  position: relative;
  display: block;
  width: clamp(9.5rem, 16vw, 13.5rem);
  height: auto;
  max-height: min(40vh, 260px);
  object-fit: contain;
}

@media (prefers-reduced-motion: reduce) {
  .faq__panel-outer,
  .faq__panel,
  .faq__icon {
    transition-duration: 0.01ms !important;
  }
}
