/* Архив — карти с формули за равнинни фигури и 3D тела */
.fs-section {
  --fs-a: #13a35a;
  --fs-b: #e5484d;
  --fs-c: #7c3aed;
  --fs-h: #e07f00;
  --fs-r: #0891b2;
  --fs-d: #0369a1;
  --fs-l: #a16207;
  --fs-k: #c026d3;
  --fs-n: #1f5eea;
  grid-column: 1 / -1;
}

.fs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.fs-head h2 {
  margin: 4px 0 0;
}

.fs-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fs-filters button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d6deee;
  border-radius: 999px;
  background: #fff;
  color: #33415f;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.fs-filters button i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--g, #1f5eea);
}

.fs-filters button[aria-pressed="true"] {
  border-color: #0b1f4b;
  background: #0b1f4b;
  color: #fff;
}

.fs-grid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px;
}

.fs-card {
  position: relative;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #e3e8f3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(11, 31, 75, 0.06);
}

.fs-card[hidden] {
  display: none;
}

.fs-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--g, #1f5eea);
}

.fs-pic {
  position: relative;
  display: grid;
  place-items: center;
  padding: 16px 6px 28px 12px;
  background: linear-gradient(180deg, #f7f9ff, #eef2fb);
}

.fs-svg {
  width: 100%;
  max-width: 128px;
  height: auto;
  overflow: visible;
}

.fs-tag {
  position: absolute;
  left: 12px;
  right: 6px;
  bottom: 8px;
  color: var(--g, #1f5eea);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.fs-body {
  min-width: 0;
  padding: 14px 14px 14px 12px;
}

.fs-body h3 {
  margin: 0;
  color: #14213d;
  font-size: 1.05rem;
  line-height: 1.2;
}

.fs-sub {
  margin: 3px 0 10px;
  color: #5b6785;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.fs-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.fs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 10px;
  background: #f4f6fb;
  color: #14213d;
  font-size: 0.92rem;
}

.fs-lbl {
  flex: 0 0 auto;
  min-width: 72px;
  white-space: nowrap;
  color: #7a86a3;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-transform: uppercase;
}

.is-solid .fs-lbl {
  display: inline-flex;
  min-width: 64px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 6px;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.7rem;
}

.fs-lbl.is-base { background: #eef1f6; color: #4b5874; }
.fs-lbl.is-lateral { background: #e8efff; color: #1f4fc2; }
.fs-lbl.is-total { background: #f1eaff; color: #6a32bd; }
.fs-lbl.is-volume { background: #e6f7ee; color: #0d7a50; }

.fs-fx {
  min-width: 0;
  padding: 2px 0;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.fs-fx .math-frac {
  vertical-align: middle;
}

.fs-v {
  padding: 0 1px;
  border-radius: 4px;
  font-style: italic;
  font-weight: 800;
  cursor: default;
  transition: background-color 0.15s ease;
}

.fs-V {
  color: #14213d;
  font-weight: 800;
}

.fs-v.is-a, .fs-label.is-a { color: var(--fs-a); fill: var(--fs-a); }
.fs-v.is-b, .fs-label.is-b { color: var(--fs-b); fill: var(--fs-b); }
.fs-v.is-c, .fs-label.is-c { color: var(--fs-c); fill: var(--fs-c); }
.fs-v.is-h, .fs-label.is-h { color: var(--fs-h); fill: var(--fs-h); }
.fs-v.is-r, .fs-label.is-r { color: var(--fs-r); fill: var(--fs-r); }
.fs-v.is-d, .fs-label.is-d,
.fs-v.is-d1, .fs-label.is-d1,
.fs-v.is-d2, .fs-label.is-d2 { color: var(--fs-d); fill: var(--fs-d); }
.fs-v.is-l, .fs-label.is-l { color: var(--fs-l); fill: var(--fs-l); }
.fs-v.is-k, .fs-label.is-k { color: var(--fs-k); fill: var(--fs-k); }
.fs-v.is-n, .fs-label.is-n { color: var(--fs-n); fill: var(--fs-n); }

.fs-v.is-lit {
  background: color-mix(in srgb, currentColor 16%, transparent);
}

/* Чертеж */
.fs-label {
  font-family: inherit;
  font-style: italic;
  font-weight: 800;
  text-anchor: middle;
  paint-order: stroke fill;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
  transition: font-size 0.15s ease;
}

.fs-label.is-lit {
  font-size: 19px;
}

.fs-edge,
.fs-edge-c {
  fill: none;
  stroke: #14213d;
  stroke-width: 3px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.fs-fill.fs-edge-c {
  fill: var(--fs-fill);
}

.fs-seg {
  stroke-linecap: round;
  transition: stroke-width 0.15s ease, filter 0.15s ease;
}

.fs-seg.is-a { stroke: var(--fs-a); color: var(--fs-a); }
.fs-seg.is-b { stroke: var(--fs-b); color: var(--fs-b); }
.fs-seg.is-c { stroke: var(--fs-c); color: var(--fs-c); }
.fs-seg.is-h { stroke: #ff9d16; color: #ff9d16; }
.fs-seg.is-r { stroke: var(--fs-r); color: var(--fs-r); }
.fs-seg.is-d,
.fs-seg.is-d1,
.fs-seg.is-d2 { stroke: var(--fs-d); color: var(--fs-d); }
.fs-seg.is-l { stroke: var(--fs-l); color: var(--fs-l); }
.fs-seg.is-k { stroke: var(--fs-k); color: var(--fs-k); }

.fs-edge.is-dashed,
.fs-seg.is-dashed {
  stroke-dasharray: 5 5;
}

.fs-edge.is-dashed {
  stroke: #64748b;
}

.fs-seg.is-lit {
  stroke-width: 6px;
  filter: drop-shadow(0 0 4px currentColor);
}

.fs-hidden {
  fill: none;
  stroke: #14213d;
  stroke-width: 1.6px;
  stroke-dasharray: 4 4;
}

.fs-ra {
  fill: none;
  stroke: #14213d;
  stroke-width: 1.6px;
}

.fs-fill { fill: var(--fs-fill); --fs-fill: #e8efff; }
.fs-fill.is-orange { --fs-fill: #fff4e0; }
.fs-fill.is-sky { --fs-fill: #e0f4fb; }
.fs-fill.is-sky2 { --fs-fill: #c9ecf8; }
.fs-fill.is-blue { --fs-fill: #eef3ff; }
.fs-fill.is-blue2 { --fs-fill: #dbe6ff; }
.fs-fill.is-blue3 { --fs-fill: #c9d8fb; }
.fs-fill.is-green { --fs-fill: #e1f7ef; }
.fs-fill.is-green2 { --fs-fill: #c7efe0; }
.fs-fill.is-violet { --fs-fill: #f1e9ff; }
.fs-fill.is-violet2 { --fs-fill: #e3d6ff; }
.fs-fill.is-violet3 { --fs-fill: #d3c2fb; }
.fs-fill.is-red { --fs-fill: #ffecec; }

/* Връзка към 3D моделите */
.fs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.fs-link3d {
  color: #1f5eea;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
}

.fs-link3d:hover {
  text-decoration: underline;
}

.fs-filters button:focus-visible,
.fs-link3d:focus-visible {
  outline: 3px solid rgba(255, 157, 22, 0.85);
  outline-offset: 2px;
}

.fs-hint {
  margin: 14px 0 0;
  color: #5b6785;
  font-size: 0.85rem;
}

/* Легенда при 3D телата */
.fs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.fs-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid #e3e8f3;
  border-radius: 10px;
  background: #fff;
  color: #4a587a;
  font-size: 0.82rem;
  font-weight: 700;
}

.fs-legend b {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 4px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.75rem;
}

.fs-legend .is-base { background: #64748b; }
.fs-legend .is-lateral { background: #1f5eea; }
.fs-legend .is-total { background: #7c3aed; }
.fs-legend .is-volume { background: #13a35a; }
.fs-legend .is-perimeter { background: #14213d; }

@media (max-width: 520px) {
  .fs-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .fs-pic {
    padding: 12px 4px 30px 10px;
  }

  .fs-tag {
    font-size: 0.52rem;
  }

  .fs-body {
    padding: 12px 10px 12px 8px;
  }

  .fs-row {
    padding: 4px 6px;
    font-size: 0.86rem;
  }

  .fs-lbl {
    min-width: 56px;
    font-size: 0.54rem;
    letter-spacing: 0;
  }

  .is-solid .fs-lbl {
    min-width: 54px;
    font-size: 0.62rem;
  }

  .fs-legend span {
    font-size: 0.76rem;
    padding: 5px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fs-v,
  .fs-label,
  .fs-seg {
    transition: none;
  }
}
