/* =========================================================
   ENKLESVAR — Delt designsystem
   Alle sider laster KUN denne filen. Ikke lag nye stilark
   per verktøy — legg heller til komponenter her slik at
   alle verktøy fortsetter å se like ut.
   ========================================================= */

:root {
  /* Farger — nøytral, lys palett med én rolig aksentfarge */
  --paper: #faf9f7;      /* sidebakgrunn */
  --surface: #ffffff;    /* kort, bokser */
  --ink: #17181c;        /* primær tekst / primærknapp */
  --ink-soft: #35362e;   /* hover på mørke flater */
  --muted: #6f6d66;      /* sekundær tekst */
  --line: #e5e3df;       /* rammer/delelinjer */
  --line-strong: #d3d0c9;
  --accent: #3a6b5c;     /* signalfarge — lenker, fokus, fremhevet resultat */
  --accent-soft: #eaf1ee;
  --accent-ink: #ffffff;
  --danger: #b3432b;
  --warning: #a8752c;    /* "nesten der" — f.eks. litt ustemt streng */

  /* Typografi */
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono:
    ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas,
    monospace;

  /* Layout */
  --tool-width: 560px;
  --page-width: 1040px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(23, 24, 28, 0.05);
  --shadow: 0 6px 20px -8px rgba(23, 24, 28, 0.15);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Header / Footer (samme på alle sider) ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header__inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.wordmark:hover {
  text-decoration: none;
  color: var(--ink);
}

.wordmark span {
  color: var(--accent);
}

.site-header__nav a {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.site-header__nav a:hover {
  color: var(--ink);
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px;
}

.site-footer__inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}

/* ---------- Annonseplass ----------
   Reserverer plass FØR annonsen laster, slik at innholdet ikke
   hopper rundt når Google AdSense fyller inn annonsen (unngår
   Cumulative Layout Shift). Ikke fjern min-height. */
.ad-slot {
  max-width: var(--page-width);
  margin: 32px auto;
  padding: 0 20px;
}

.ad-slot__inner {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

@media (max-width: 480px) {
  .ad-slot__inner {
    min-height: 100px;
  }
}

.ad-slot--bottom {
  margin-top: 48px;
}

/* ---------- Side-annonser ("skyscraper") ----------
   Faste annonser i margene ved siden av innholdet — vises KUN når
   vinduet er bredt nok til at de har plass uten å trenge seg inn
   på noe (se breddegrense i media query under). */
.ad-rail {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  z-index: 5;
}

.ad-rail__inner {
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-rail--left {
  left: 24px;
}

.ad-rail--right {
  right: 24px;
}

@media (min-width: 1500px) {
  .ad-rail {
    display: block;
  }
}

/* ---------- Verktøy-side (felles skjelett) ---------- */

.tool {
  max-width: var(--tool-width);
  margin: 0 auto;
  padding: 56px 20px 40px;
}

.tool__eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.tool__title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tool__description {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
}

.tool__section {
  margin-top: 32px;
}

.tool__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.label-row .tool__label {
  margin-bottom: 0;
}

.label-row__value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn {
  flex: 1;
}

/* ---------- Valgknapper (option group) ---------- */

.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.option-btn:hover {
  border-color: var(--line-strong);
}

.option-btn[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ---------- Readout — den store "avlesningen" (svaret) ---------- */
/* Dette er signaturkomponenten. Selve svaret skal alltid vises
   monospace, stort og tydelig — som et digitalt display. */

.readout {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.readout__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout__value {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  word-break: break-word;
  transition: opacity 0.12s ease;
}

.readout__value--sm {
  font-size: 1.6rem;
}

.readout__note {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Knapper ---------- */

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--ink);
  color: #fff;
  width: 100%;
}

.btn--primary:hover {
  background: var(--ink-soft);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* ---------- Skjemaelementer ---------- */

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 0.92rem;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
}

/* Tekst-/tallfelt — brukes der en slider ikke passer (frie verdier) */
.input {
  width: 100%;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.input--mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Nedtrekksmeny med samme utseende som .input — behold pilen */
select.input {
  appearance: auto;
  cursor: pointer;
}

/* Flerlinje-tekstfelt med samme utseende som .input */
textarea.input {
  resize: vertical;
  min-height: 130px;
  line-height: 1.5;
  font-family: inherit;
}

/* ---------- Steg-liste (kun når rekkefølge faktisk betyr noe) ---------- */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.steps li:first-child {
  border-top: none;
}

.steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Forside: hero + kort-grid ---------- */

.hero {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 64px 20px 40px;
}

.hero__title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.hero__title em {
  font-style: normal;
  color: var(--accent);
}

.hero__subtitle {
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 46ch;
}

/* ---------- Søkefelt (på linje med hero-tittelen) ---------- */

.hero__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.site-search {
  position: relative;
  width: 260px;
}

.site-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.site-search .input {
  padding: 8px 12px 8px 32px;
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .site-search {
    width: 150px;
  }
}

/* hidden-attributtet skal alltid vinne, også over .grid o.l. */
[hidden] {
  display: none !important;
}

/* ---------- Tekstliste over alle verktøy (/alle-verktoy) ---------- */

.toollist {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 40px;
}

.toollist li {
  padding: 6px 0;
  break-inside: avoid;
  font-size: 0.95rem;
}

.toollist a {
  font-weight: 600;
  color: var(--ink);
}

.toollist a:hover {
  color: var(--accent);
}

.toollist span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1px;
}

@media (max-width: 640px) {
  .toollist {
    columns: 1;
  }
}

.search-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0 24px;
}

.catalog {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 20px 80px;
}

.catalog__group-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 40px 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

a.card {
  color: var(--ink);
  display: block;
}

a.card:hover {
  text-decoration: none;
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card__icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  margin-bottom: 14px;
}

.card__name {
  font-weight: 600;
  font-size: 1rem;
}

.card__desc {
  margin-top: 4px;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.45;
}

.card--soon {
  opacity: 0.55;
  cursor: default;
}

.card--soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

.badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- Meter (f.eks. styrkeindikator) ---------- */

.meter {
  display: flex;
  gap: 4px;
  margin-top: 16px;
}

.meter__segment {
  height: 6px;
  flex: 1;
  border-radius: 3px;
  background: var(--line);
}

.meter__segment.is-filled {
  background: var(--accent);
}

.meter--weak .meter__segment.is-filled {
  background: var(--danger);
}

.meter__label {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: left;
}

/* ---------- Toast (f.eks. "Kopiert!") ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Gitartuner: strengliste ---------- */

.fretboard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.string {
  all: unset;
  display: grid;
  grid-template-columns: 1.4rem 1fr 3.6rem;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.string:hover,
.string:focus-visible {
  background: var(--accent-soft);
}

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

.string__num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.string__line {
  width: 100%;
  height: 26px;
  display: block;
}

.string__line path {
  fill: none;
  stroke: var(--line-strong);
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.string.is-playing .string__line path,
.string.is-live-match .string__line path {
  stroke: var(--accent);
}

.string.is-live-match {
  background: var(--accent-soft);
}

.string__note {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  text-align: right;
  color: var(--ink);
}

.string__note small {
  display: block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.status {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
  margin: 14px 0 0;
}

/* ---------- Gitartuner: mikrofon-panel og stemme-meter ---------- */

.mic-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-sm);
}

.readout__value.tune-good { color: var(--accent); }
.readout__value.tune-warn { color: var(--warning); }
.readout__value.tune-bad { color: var(--danger); }

.tuner-meter {
  width: 100%;
  max-width: 320px;
}

.tuner-meter__track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.tuner-meter__center {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 2px;
  height: 14px;
  background: var(--muted);
  transform: translateX(-50%);
}

.tuner-meter__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transform: translate(-50%, -50%);
  transition: left 0.08s linear, background 0.2s ease;
}

.tuner-meter__dot.tune-good { background: var(--accent); }
.tuner-meter__dot.tune-warn { background: var(--warning); }
.tuner-meter__dot.tune-bad { background: var(--danger); }

.tuner-meter__labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mic-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
  text-align: center;
  margin: 0;
}

/* ---------- Utils ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .tool {
    padding-top: 36px;
  }
  .readout__value {
    font-size: 2.1rem;
  }
}
