/* =========================================================
   FIGURER OG SYMMETRI
   Kun styles som er spesifikke for dette verktøyet.
   Felles verktøystil styres av school-tool-standard.css
   ========================================================= */


/* TEMA-VELGER */

.topic-picker {
  width: min(100%, 720px);
  margin: 0 auto;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 10px;
}

.topic-button {
  min-height: 88px;

  padding: 14px 16px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface);
  color: var(--text);

  text-align: left;

  cursor: pointer;
}

.topic-button strong,
.topic-button span {
  display: block;
}

.topic-button strong {
  margin-bottom: 4px;

  font-size: 14px;
  font-weight: 700;
}

.topic-button span {
  color: var(--muted);

  font-size: 12px;
  line-height: 1.35;
}

.topic-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}


/* PANELER */

.topic-panel[hidden] {
  display: none;
}


/* KORTE FORKLARINGER */

.learning-intro {
  width: min(100%, 640px);
  margin: 0 auto 24px;

  padding: 14px 16px;

  border: 1px solid var(--line);
  border-radius: 9px;

  background: var(--surface-soft);
}

.learning-intro strong,
.learning-intro span {
  display: block;
}

.learning-intro strong {
  margin-bottom: 4px;

  color: var(--text);

  font-size: 14px;
}

.learning-intro span {
  color: var(--muted);

  font-size: 13px;
  line-height: 1.45;
}


/* 2D / 3D */

.figure-type-picker {
  width: min(100%, 420px);
  margin: 0 auto 18px;

  display: grid;
  grid-template-columns: repeat(2, 1fr);

  gap: 10px;
}

.figure-type-button {
  min-height: 46px;

  padding: 10px 14px;

  border: 1px solid var(--line);
  border-radius: 9px;

  background: var(--surface);
  color: var(--text);

  font-weight: 700;

  cursor: pointer;
}

.figure-type-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}


/* FIGURKORT */

.figure-grid {
  width: min(100%, 720px);
  margin: 0 auto;

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 10px;
}

.figure-grid[hidden] {
  display: none;
}

.figure-card {
  min-height: 82px;

  padding: 12px 14px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface);
  color: var(--text);

  text-align: left;

  cursor: pointer;
}

.figure-card strong,
.figure-card span {
  display: block;
}

.figure-card strong {
  margin-bottom: 4px;

  font-size: 14px;
  font-weight: 700;
}

.figure-card span {
  color: var(--muted);

  font-size: 12px;
  line-height: 1.35;
}

.figure-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}


/* RESULTAT / FORKLARING */

.learning-result {
  width: min(100%, 640px);
  margin: 24px auto 0;

  padding: 18px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface-soft);
}

.learning-result h3 {
  margin: 0 0 10px;
}

.learning-result p {
  margin: 0 0 10px;

  line-height: 1.55;
}

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


/* SYMMETRI */

.symmetry-demo {
  width: min(100%, 640px);
  margin: 0 auto;

  text-align: center;
}

.symmetry-shape {
  position: relative;

  width: 220px;
  height: 160px;

  margin: 0 auto 20px;

  border: 3px solid var(--accent);
  border-radius: 18px;

  background: var(--surface-soft);
}

.symmetry-line {
  position: absolute;

  top: 12px;
  bottom: 12px;
  left: 50%;

  border-left: 2px dashed var(--muted);
}

.symmetry-demo p {
  margin: 0 auto;

  max-width: 520px;

  color: var(--muted);

  line-height: 1.55;
}


/* FLYTT, SPEIL OG ROTER */

.transform-picker {
  width: min(100%, 520px);
  margin: 0 auto 20px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);

  gap: 10px;
}

.transform-button {
  min-height: 46px;

  padding: 10px 14px;

  border: 1px solid var(--line);
  border-radius: 9px;

  background: var(--surface);
  color: var(--text);

  font-weight: 700;

  cursor: pointer;
}

.transform-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.transform-stage {
  position: relative;

  width: min(100%, 620px);
  height: 240px;

  margin: 0 auto;

  overflow: hidden;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--surface-soft);
}

.transform-shape {
  position: absolute;

  width: 82px;
  height: 82px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 3px solid var(--accent);
  border-radius: 10px;

  background: var(--surface);
  color: var(--text);

  font-size: 28px;
  font-weight: 800;

  transition:
    left .35s ease,
    right .35s ease,
    transform .35s ease;
}

.transform-shape.original {
  left: 90px;
  top: 78px;
}

.transform-shape.result {
  right: 90px;
  top: 78px;
}


/* HOVER */

@media (hover: hover) and (pointer: fine) {
  .topic-button:hover,
  .figure-type-button:hover,
  .figure-card:hover,
  .transform-button:hover {
    border-color: var(--accent);
  }
}


/* MOBIL */

@media (max-width: 700px) {

  .topic-picker {
    grid-template-columns: 1fr;
  }

  .figure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transform-picker {
    grid-template-columns: 1fr;
  }

  .transform-stage {
    height: 220px;
  }

  .transform-shape.original {
    left: 34px;
    top: 70px;
  }

  .transform-shape.result {
    right: 34px;
    top: 70px;
  }

}


@media (max-width: 430px) {

  .figure-grid {
    grid-template-columns: 1fr;
  }

  .transform-stage {
    height: 300px;
  }

  .transform-shape.original {
    left: 50%;
    top: 42px;

    transform: translateX(-50%);
  }

  .transform-shape.result {
    left: 50%;
    right: auto;
    top: 166px;

    transform: translateX(-50%);
  }

}

/* =========================================================
   FORBEDRET FLYTT / SPEIL / ROTER
   ========================================================= */

.transform-grid {
  width: min(100%, 720px);
  margin: 0 auto;
}

.transform-svg {
  display: block;

  width: 100%;
  height: auto;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--surface-soft);
}

.grid-background {
  fill: var(--surface-soft);
}

.grid-line {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.geometry-shape polygon {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linejoin: round;
}

.original-shape polygon {
  fill: var(--surface);
}

.result-shape polygon {
  fill: var(--surface);
}

.original-shape {
  opacity: .65;
}

.result-shape {
  opacity: 1;
}

.mirror-line {
  stroke: var(--muted);
  stroke-width: 3;
  stroke-dasharray: 10 8;
}

.rotation-point {
  fill: var(--accent);
}

.transform-arrow-line {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
}

.transform-arrow-head {
  fill: var(--accent);
}

.rotation-arrow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
}

.transform-label {
  fill: var(--text);

  font-size: 15px;
  font-weight: 800;
}

.transform-explanation-highlight {
  margin-top: 14px;

  padding: 12px 14px;

  border-left: 4px solid var(--accent);
  border-radius: 7px;

  background: var(--surface);
}

.transform-explanation-highlight strong {
  display: block;
  margin-bottom: 4px;
}


/* MOBIL */

@media (max-width: 700px) {

  .learning-split,
  .learning-copy,
  .learning-copy-card,
  .learning-visual-panel,
  .learning-visual-wrap,
  .transform-grid {
    min-width: 0;
    max-width: 100%;
  }

  .learning-visual-panel {
    width: auto;
    overflow: hidden;
  }

  .learning-visual-wrap,
  .transform-grid {
    width: 100%;
    overflow-x: hidden;
  }

  .learning-visual-wrap svg,
  .transform-svg {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
  }

}

/* Skjul SVG-elementer som ikke hører til aktiv demonstrasjon */
.transform-svg [hidden] {
  display: none !important;
}

.rotation-point {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 4;
}

.rotation-arrow-head {
  fill: var(--accent);
}

.rotation-info-label,
.rotation-point-label {
  fill: var(--text);
  font-weight: 800;
  text-anchor: middle;
}

.rotation-info-label {
  font-size: 18px;
}

.rotation-point-label {
  font-size: 13px;
}

.rotation-turn-symbol {
  fill: var(--accent);
  font-size: 52px;
  font-weight: 700;
  text-anchor: middle;
}

/* =========================================================
   FORBEDRET SYMMETRI-VISNING
   ========================================================= */

.symmetry-svg {
  display: block;
  width: min(100%, 620px);
  height: auto;
  margin: 0 auto 22px;
}

.symmetry-outline {
  fill: var(--surface-soft);
  stroke: var(--accent);
  stroke-width: 4;
}

.symmetry-center-line {
  stroke: var(--muted);
  stroke-width: 3;
  stroke-dasharray: 10 8;
}

.symmetry-point {
  fill: var(--accent);
}

.symmetry-distance-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.symmetry-distance-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
}

.symmetry-text {
  width: min(100%, 620px);
  margin: 0 auto;
  text-align: center;
}

.symmetry-text p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.55;
}

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

/* =========================================================
   FELLES LÆRINGSOPPSETT
   Forklaring til venstre + visuell forklaring til høyre
   ========================================================= */

.learning-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 28px;
  align-items: start;
}

.learning-copy {
  min-width: 0;
}

.learning-copy-card {
  padding: 20px 22px;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--surface);
}

.learning-copy-card h3 {
  margin: 0 0 14px;

  font-size: 20px;
}

.learning-copy-card p {
  margin: 0 0 12px;

  color: var(--muted);

  line-height: 1.6;
}

.learning-copy-card p:last-child {
  margin-bottom: 0;
}

.learning-visual-panel {
  position: sticky;
  top: 24px;

  padding: 20px;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--surface);
}

.learning-visual-eyebrow {
  margin: 0 0 6px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.learning-visual-panel h3 {
  margin: 0 0 18px;
}

.learning-visual-wrap {
  width: 100%;
}

.learning-visual-wrap svg {
  display: block;

  width: 100%;
  height: auto;
}

.learning-visual-help {
  margin-top: 14px;

  padding-top: 14px;

  border-top: 1px solid var(--line);
}

.learning-visual-help p {
  margin: 0 0 9px;

  color: var(--muted);

  line-height: 1.5;
}

.learning-visual-help p:last-child {
  margin-bottom: 0;
}


/* MOBIL */

@media (max-width: 820px) {

  .learning-split {
    grid-template-columns: 1fr;
  }

  .learning-visual-panel {
    position: static;
  }

}

/* Større visuell flate for Flytt / Speil / Roter */
#flytt-speil-roter-panel .learning-split {
  grid-template-columns: minmax(280px, .75fr) minmax(520px, 1.25fr);
}

#flytt-speil-roter-panel .learning-visual-panel {
  padding: 24px;
}

#flytt-speil-roter-panel .transform-grid {
  width: 100%;
}

#flytt-speil-roter-panel .transform-svg {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 900px) {
  #flytt-speil-roter-panel .learning-split {
    grid-template-columns: 1fr;
  }
}

/* Korrigert bredde for Flytt / Speil / Roter */
#flytt-speil-roter-panel .learning-split {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
}

#flytt-speil-roter-panel .learning-copy,
#flytt-speil-roter-panel .learning-visual-panel {
  min-width: 0;
}

#flytt-speil-roter-panel .learning-visual-panel {
  width: auto;
  max-width: 100%;
}

#flytt-speil-roter-panel .transform-grid {
  width: 100%;
  max-width: 100%;
}

#flytt-speil-roter-panel .transform-svg {
  width: 100%;
  height: auto;
}

@media (max-width: 900px) {
  #flytt-speil-roter-panel .learning-split {
    grid-template-columns: 1fr;
  }
}


/* Tydeligere innhold i Flytt / Speil / Roter uten å skalere koordinatene */
#flytt-speil-roter-panel .transform-label {
  font-size: 18px;
  font-weight: 800;
}

#flytt-speil-roter-panel .transform-arrow-line {
  stroke-width: 5;
}

#flytt-speil-roter-panel .rotation-info-label,
#flytt-speil-roter-panel .rotation-point-label {
  font-size: 17px;
  font-weight: 800;
}

#flytt-speil-roter-panel .rotation-turn-symbol {
  font-size: 58px;
}

/* Ryddig etikett under rotasjonspunktet */
#flytt-speil-roter-panel .rotation-point-label {
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
}


/* Ryddig etikett under rotasjonspunktet */
#flytt-speil-roter-panel .rotation-point-label {
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
}


/* Tydeligere etikett for rotasjonspunkt */
#flytt-speil-roter-panel .rotation-point-label {
  font-size: 15px;
  font-weight: 800;
  text-anchor: middle;
}


/* Ryddigere etikett for rotasjonspunkt */
#flytt-speil-roter-panel .rotation-point-label {
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
}

