/* ============================================================
   Glupus Rettskriving â€“ Responsive & WCAG-compliant styles
   ============================================================ */

/* Visually hidden but accessible to screen readers (WCAG 1.3.1) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators for all interactive elements (WCAG 2.4.7 / 2.4.11) */
*:focus-visible {
  outline: 3px solid var(--emphasis-color, #e76f3a);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('./fonts/OpenDyslexic-Regular.woff2') format('woff2'),
        url('./fonts/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bgcolor);
  color: var(--color);
}

body {
  font-family: 'OpenDyslexic', sans-serif;
  font-weight: normal;
  font-style: normal;
}

/* ---- Settings cog ---- */
#cog {
  height: 44px;
  width: 44px;
  min-height: 44px;
  min-width: 44px;
  position: fixed;
  top: calc(var(--header-height, 2.3rem) + 0.5rem);
  right: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--panel-color);
  color: var(--color);
  border: var(--button-border) solid var(--color);
  border-radius: var(--button-border-radius);
  cursor: pointer;
  padding: 0;
}

#cog:hover {
  background-color: var(--hover-bg-color);
}

/* ---- Settings panel ---- */
.settings {
  width: min(300px, 90vw);
  max-height: 70vh;
  overflow-y: auto;
  position: fixed;
  background-color: var(--panel-color);
  border: var(--button-border, 1px) solid var(--color);
  border-radius: var(--border-radius, 3px);
  top: calc(var(--header-height, 2.3rem) + 4rem);
  right: 1rem;
  padding: 1rem;
  color: var(--color);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9;
}

.settings.open {
  visibility: visible;
  opacity: 1;
}

/* ---- Layout ---- */
.parent {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 100%;
  /* leave room for fixed header and footer */
  min-height: calc(100vh - var(--header-height, 2.3rem) - 2rem);
  padding-top: calc(var(--header-height, 2.3rem) + 1rem);
  padding-bottom: 3rem;
  box-sizing: border-box;
  color: var(--color);
  flex-direction: column;
  gap: 1.5rem;
}

.child {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--panel-color);
  border-style: groove;
  border-color: var(--color);
  border-radius: 10px;
  padding: clamp(0.75rem, 3vw, 2rem);
  /* fluid width: fills up to 700px, shrinks on small screens */
  width: min(90vw, 700px);
  box-sizing: border-box;
  text-align: center;
}

/* ---- Feedback text ---- */
.wrongDiv {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: #a0411d;
  min-height: 1.8em;
  margin-bottom: 0.5rem;
}

/* ---- Play button ---- */
#playButton {
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--color);
  margin-bottom: 0.5rem;
}

.playButtonIcon {
  width: clamp(40px, 8vw, 80px);
  height: clamp(40px, 8vw, 80px);
  display: block;
  fill: #237763;
}

#glupusHeader[data-darkmode="enabled"] ~ .parent .wrongDiv {
  color: var(--emphasis-color, #ffba3b);
}

#glupusHeader[data-darkmode="enabled"] ~ .parent .playButtonIcon {
  fill: #59cdb3;
}

/* ---- Word input ---- */
.uiElement {
  border-radius: 10px;
  padding: 0.25em 0.5em;
  text-align: center;
  font-family: 'OpenDyslexic', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: clamp(1.2rem, 5vw, 3rem);
  width: 90%;
  background-color: var(--bgcolor);
  color: var(--color);
  border: var(--button-border) solid var(--color);
  margin-bottom: 2.5%;
  box-sizing: border-box;
}

.checkButton {
  min-height: 44px;
  width: 90%;
  padding: 0.65rem 1.25rem;
  font-family: 'OpenDyslexic', sans-serif;
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: #111;
  background-color: #59cdb3;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.checkButton:hover {
  filter: brightness(0.92);
}

.checkButton:active {
  transform: translateY(1px);
}

/* ---- Progress counter ---- */
#infoDiv {
  min-width: 100%;
  text-align: center;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--color);
}

/* ---- Reset button ---- */
.resetbutton {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
}

/* ---- Unused legacy rules (kept for compatibility) ---- */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 100%;
  min-height: 100%;
}

.userInputs {
  display: inline-block;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 600px) {
  .child {
    border-radius: 6px;
  }

  #infoDiv {
    margin-top: 0;
  }
}
