/* Plotteren på forsiden: tekst til venstre, maskinen i et varmt «studio» til høyre.
   Bruker palettens variabler (--ink, --paper, --rose, --sage, --y) med reserveverdier, så seksjonen også kan stå alene. */

.plotter {
  --pl-ink: var(--ink, #1f2418);
  --pl-papir: var(--paper, #fff9d6);
  --pl-rosa: var(--rose, #d8a2a2);
  --pl-studio: #f6ead0;
  display: grid; gap: clamp(28px, 4vw, 64px);
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(56px, 8vw, 120px) var(--gutter, 24px);
  background: var(--pl-papir); color: var(--pl-ink);
}
@media (min-width: 1000px) {
  .plotter { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.5fr); align-items: center; }
}

.plotter__tekst { max-width: 34rem; }
.plotter__tekst .big { margin-bottom: .3em; font-size: clamp(2.6rem, 4.4vw, 4.6rem); }
.plotter__lede { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.45; margin: 0 0 1.6em; max-width: 26ch; }
.plotter .plotter__prøv { margin: 1.4em 0 0; font-weight: 600; visibility: hidden; }
.plotter.er-klar .plotter__prøv { visibility: visible; }
.plotter__lenke {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.plotter__lenke:hover { text-decoration-style: wavy; }

/* ── Scenen ─────────────────────────────────────── */
.plotter__ramme { min-width: 0; }
.plotter__scene {
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 5 / 4;
  border: 3px solid var(--pl-ink); border-radius: 32px;
  background:
    radial-gradient(120% 90% at 38% 30%, #fffaf0 0%, rgba(255, 250, 240, 0) 62%),
    radial-gradient(90% 70% at 80% 100%, rgba(216, 162, 162, .28), rgba(216, 162, 162, 0) 70%),
    var(--pl-studio);
}
@media (max-width: 720px) { .plotter__scene { aspect-ratio: 4 / 5; border-radius: 24px; } }
.plotter__plakat, .plotter__lerret { position: absolute; inset: 0; width: 100%; height: 100%; }
.plotter__plakat { object-fit: cover; transition: opacity .6s ease; }
.plotter__lerret { opacity: 0; transition: opacity .6s ease; outline: none; cursor: grab; }
.plotter__lerret:active { cursor: grabbing; }
.plotter.er-klar .plotter__lerret { opacity: 1; }
.plotter.er-klar .plotter__plakat { opacity: 0; pointer-events: none; }
.plotter.laster .plotter__scene::after {
  content: "Henter plotteren …"; position: absolute; left: 20px; top: 18px;
  font: 600 .9rem/1 var(--sans, sans-serif); background: var(--pl-papir); padding: 8px 12px; border-radius: 999px;
}

.plotter__status {
  position: absolute; left: 16px; top: 16px; margin: 0; z-index: 2;
  font: 600 .85rem/1 var(--sans, sans-serif); font-variant-numeric: tabular-nums;
  background: rgba(255, 249, 214, .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 8px 12px; border-radius: 999px; border: 1.5px solid rgba(31, 36, 24, .18);
}
.plotter__status:empty { display: none; }
.plotter__hint {
  position: absolute; left: 50%; top: 50%; z-index: 3; margin: 0; pointer-events: none;
  transform: translate(-50%, -50%) scale(.96); opacity: 0; transition: opacity .25s, transform .25s;
  background: var(--pl-ink); color: var(--pl-papir); font: 600 .95rem/1.2 var(--sans, sans-serif);
  padding: 12px 18px; border-radius: 999px; max-width: 80%; text-align: center;
}
.plotter__hint.er-synlig { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ── Kontrollstripen nederst i scenen ─────────────────── */
.plotter__bar {
  position: absolute; left: 50%; bottom: 14px; z-index: 2; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px; max-width: calc(100% - 24px);
  background: var(--pl-ink); color: var(--pl-papir); border-radius: 999px;
  box-shadow: 0 14px 30px -14px rgba(31, 36, 24, .55);
}
.plotter__bar[hidden] { display: none; }
.plotter__bar button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center;
  padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: inherit; font: 600 .95rem/1 var(--sans, sans-serif); white-space: nowrap;
  transition: background .2s, color .2s, transform .3s var(--pop, ease);
}
.plotter__bar button:hover { background: rgba(255, 249, 214, .14); }
.plotter__bar button:focus-visible { outline: 3px solid var(--pl-rosa); outline-offset: 1px; }
.plotter__bar .ikon { width: 20px; height: 20px; flex: none; }
.plotter__spill { background: var(--pl-papir) !important; color: var(--pl-ink) !important; padding: 0 !important; width: 44px; }
.plotter__spill:hover { transform: scale(1.06); }
.plotter__spill .ikon { fill: currentColor; width: 22px; height: 22px; }
.plotter__spill .ikon--pause, .plotter__spill.er-pause .ikon--spill { display: none; }
.plotter__spill.er-pause .ikon--pause { display: block; }
.plotter__knapp[aria-pressed="true"] { background: var(--pl-rosa) !important; color: var(--pl-ink); }
.plotter__fart { display: flex; padding: 3px; border-radius: 999px; background: rgba(255, 249, 214, .12); margin: 0 4px; }
.plotter__fart button { min-width: 42px; min-height: 38px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.plotter__fart button[aria-pressed="true"] { background: var(--pl-papir); color: var(--pl-ink); }
.plotter__fremdrift { position: absolute; left: 26px; right: 26px; bottom: 2px; height: 2px; border-radius: 2px; overflow: hidden; background: rgba(255, 249, 214, .16); }
.plotter__fremdrift span { position: absolute; inset: 0; background: var(--pl-rosa); transform-origin: 0 50%; transform: scaleX(0); }
@media (max-width: 860px) {
  .plotter__knapp span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .plotter__knapp { padding: 0 !important; width: 44px; }
}
@media (max-width: 440px) {
  .plotter__bar { gap: 2px; padding: 4px; bottom: 10px; }
  .plotter__fart { margin: 0 2px; }
  .plotter__fart button { min-width: 34px; padding: 0 4px; }
  .plotter__knapp { width: 40px; min-width: 40px !important; }
  .plotter__status { font-size: .74rem; left: 10px; top: 10px; right: 10px; width: max-content; max-width: calc(100% - 20px); }
}

/* ── Motivene og navnet under scenen ─────────────────── */
.plotter__valg { margin-top: 18px; display: grid; gap: 14px; }
/* Plassen er satt av fra start, så resten av siden ikke hopper når plotteren er klar */
.plotter:not(.er-klar) .plotter__valg { visibility: hidden; }
.plotter.er-statisk .plotter__valg { display: none; }
.plotter__statisk { display: none; margin: 14px 0 0; font-size: .95rem; }
.plotter.er-statisk .plotter__statisk { display: block; }
.plotter__motiver { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plotter__etikett { flex: none; font: 400 1.15rem/1 var(--fat, sans-serif); margin-right: 6px; }
.plotter__motiver button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--pl-ink); border-radius: 999px; background: transparent; color: var(--pl-ink);
  font: 600 1rem/1 var(--sans, sans-serif); cursor: pointer; transition: background .2s, color .2s, transform .35s var(--pop, ease);
}
.plotter__motiver button:hover { transform: rotate(-2deg); }
.plotter__motiver button[aria-pressed="true"] { background: var(--pl-ink); color: var(--pl-papir); }
.plotter__motiver .ikon { width: 18px; height: 18px; }
@media (max-width: 720px) {
  .plotter__motiver { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter, 16px)); padding: 2px var(--gutter, 16px) 6px; }
  .plotter__motiver::-webkit-scrollbar { display: none; }
  .plotter__motiver button { flex: none; }
}

.plotter__navn { display: grid; gap: 8px; background: #fff; border: 2px solid var(--pl-ink); border-radius: 22px; padding: 16px; }
.plotter__navn[hidden] { display: none; }
.plotter__navn label { font-weight: 800; }
.plotter__navnrad { display: flex; gap: 10px; flex-wrap: wrap; }
.plotter__navnrad input {
  flex: 1 1 200px; min-height: 52px; padding: 0 16px; border: 2px solid var(--pl-ink); border-radius: 14px;
  font: 400 1.15rem/1 var(--sans, sans-serif); color: var(--pl-ink); background: var(--pl-papir);
}
.plotter__navnrad .btn { padding: 14px 24px; font-size: 1.15rem; }
.plotter__liten { margin: 0; font-size: .92rem; line-height: 1.4; opacity: .82; }
.plotter__styring { display: none; }
.plotter.er-klar .plotter__styring { display: block; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .plotter__plakat, .plotter__lerret, .plotter__hint, .plotter__bar button, .plotter__motiver button { transition: none; }
}

/* Kortkoden med tekst="nei" (for eksempel på produktsider): bare scenen og kontrollene */
.plotter--uten-tekst { grid-template-columns: minmax(0, 1fr) !important; }
