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


/* FIGURVELGER */

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

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

  gap: 10px;
}

.shape-button {
  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;
}

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

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

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

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

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

.shape-button.active {
  border-color: var(--accent);

  box-shadow: inset 0 0 0 1px var(--accent);
}


/* KORT FOR FORSKJELLEN PÅ AREAL OG OMKRETS */

.geometry-explainer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 10px;

  margin-bottom: 26px;
}

.geometry-explainer-item {
  padding: 14px 16px;

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

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

.geometry-explainer-item strong {
  display: block;

  margin-bottom: 4px;

  color: var(--text);

  font-size: 14px;
}

.geometry-explainer-item span {
  color: var(--muted);

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


/* INPUTS */

.shape-inputs {
  width: min(100%, 560px);
  margin: 0 auto;

  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 220px));

  gap: 18px;

  justify-content: center;
}

.shape-inputs[hidden] {
  display: none;
}

.shape-inputs label {
  display: block;

  margin-bottom: 8px;

  color: var(--muted);

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

.shape-inputs input {
  width: 100%;
  height: 50px;

  padding: 0 14px;

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

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

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

.shape-inputs input::placeholder {
  font-size: 14px;
  font-weight: 400;

  opacity: .7;
}


/* KVADRAT HAR KUN ETT FELT */

#square-inputs {
  grid-template-columns: minmax(140px, 220px);
}


/* TREKANT */

#triangle-inputs {
  grid-template-columns: repeat(2, minmax(140px, 220px));
}



/* HOVER */

@media (hover: hover) and (pointer: fine) {
  .shape-button:hover {
    border-color: var(--accent);
  }
}


/* DARK MODE */

@media (prefers-color-scheme: dark) {
  .shape-inputs input {
    color-scheme: dark;
  }
}


/* MOBIL */

@media (max-width: 700px) {

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

  .geometry-explainer {
    grid-template-columns: 1fr;
  }

  .shape-inputs,
  #triangle-inputs {
    grid-template-columns: 1fr;
  }

  .shape-inputs > div,
  #triangle-inputs > div:last-child {
    width: min(100%, 240px);

    margin: 0 auto;

    grid-column: auto;
  }

}


/* =========================================================
   TREKANTVISUALISERING
   ========================================================= */

.triangle-solution-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  align-items: start;
}

.triangle-solution-steps {
  min-width: 0;
}

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

  padding: 20px;

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

  background: var(--surface);
}

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

  color: var(--muted);

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

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

.triangle-svg-wrap {
  width: 100%;
  overflow: hidden;
}

.triangle-svg {
  display: block;

  width: 100%;
  height: auto;
}

.triangle-shape {
  fill: var(--surface-soft);
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linejoin: round;
}

.triangle-height-line {
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 7 6;
}

.triangle-right-angle {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

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

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

.triangle-label-base {
  text-anchor: middle;
}

.triangle-label-left {
  text-anchor: start;
}

.triangle-label-right {
  text-anchor: end;
}

.triangle-label-height {
  text-anchor: start;
}

.triangle-visual-help {
  margin-top: 12px;

  padding-top: 14px;

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

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

  color: var(--muted);

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

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

.triangle-not-scale {
  margin: 14px 0 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.4;
}


@media (max-width: 900px) {

  .triangle-solution-layout {
    grid-template-columns: 1fr;
  }

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

}

/* =========================================================
   SAMMENSATT FIGUR
   ========================================================= */

.composite-inputs {
  grid-template-columns: repeat(2, minmax(140px, 220px));
}

.composite-unit-field {
  grid-column: 1 / -1;
  width: min(100%, 220px);
  margin: 0 auto;
}

.composite-inputs select {
  width: 100%;
  height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.solution-section.composite-mode .tool-width {
  max-width: 1080px;
}

.composite-solution-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  gap: 28px;
  align-items: start;
}

.composite-solution-steps {
  min-width: 0;
}

.composite-visual-panel {
  position: sticky;
  top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.composite-visual-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

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

.composite-svg-wrap {
  width: 100%;
  overflow: hidden;
}

.composite-svg {
  display: block;
  width: 100%;
  height: auto;
}

.composite-shape {
  fill: var(--surface-soft);
  stroke: var(--text);
  stroke-width: 3;
}

.composite-part-a {
  fill: var(--surface-soft);
  stroke: none;
}

.composite-part-b {
  fill: var(--surface-soft);
  stroke: none;
}

.composite-split-line {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.composite-part-label {
  fill: var(--text);
  font-size: 28px;
  font-weight: 900;
  text-anchor: middle;
}

.composite-dimension,
.composite-cutout-label {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.composite-visual-help {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.composite-visual-help p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.5;
}

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

.composite-not-scale {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .solution-section.composite-mode .tool-width {
    max-width: 820px;
  }

  .composite-solution-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .composite-inputs {
    grid-template-columns: 1fr;
  }

  .composite-unit-field {
    grid-column: auto;
  }

  .composite-inputs > div {
    width: min(100%, 240px);
    margin: 0 auto;
  }
}

.composite-visual-step {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.composite-visual-step:first-child {
  border-top: 0;
  padding-top: 0;
}

.composite-visual-step > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.composite-visual-step p {
  margin: 4px 0;
}

.composite-visual-math {
  color: var(--text) !important;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.composite-visual-total {
  padding-top: 14px;
}

.composite-visual-total .composite-visual-math {
  color: var(--accent) !important;
  font-size: 18px;
}

.composite-label-leader {
  stroke: var(--accent);
  stroke-width: 2;
}

.composite-part-label-outside {
  font-size: 22px;
  fill: var(--accent);
}

.composite-cutout-label-outside {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.composite-part-a {
  fill: var(--accent);
  fill-opacity: .08;
}

.composite-part-b {
  fill: var(--accent);
  fill-opacity: .16;
}

.composite-part-name {
  fill: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.composite-part-name-small {
  font-size: 12px;
}

.composite-part-name-vertical {
  font-size: 13px;
}

.composite-part-pointer {
  stroke: var(--accent);
  stroke-width: 2;
}

.composite-part-tag {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.composite-part-tag-text {
  fill: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.composite-part-key {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.composite-part-key p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

.composite-part-key p:last-child {
  margin-bottom: 0;
}

.geometry-unit-field {
  width: min(100%, 300px);
  margin: 0 auto 24px;
}

.geometry-unit-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.geometry-unit-field select {
  width: 100%;
  height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.geometry-unit-field p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
