/* Ask Away: every question is a poster. One flat colour fills the screen and the
   question is set huge, flush left from the top. app.js sets --bg and --ink for each question from its kind's colour family
   and floods the new colour out from where you tap. */

@font-face {
  font-family: "Fredoka";
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/fredoka.woff2) format("woff2");
}

:root {
  --bg: #FFD166;
  --ink: #1c1626;
  --margin: clamp(20px, 5vw, 72px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: minmax(0, 1fr);   /* a long word never widens the page while the text is being sized */
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

::selection { background: var(--ink); color: var(--bg); }

/* The question fills whatever space is left above the buttons; app.js sizes the text to fit. */
main {
  min-height: 0;
  min-width: 0;
  padding:
    max(var(--margin), env(safe-area-inset-top))
    max(var(--margin), env(safe-area-inset-right))
    calc(var(--margin) * 0.5)
    max(var(--margin), env(safe-area-inset-left));
}

.question {
  margin: 0;
  max-width: 100%;
  font-size: 64px;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-align: left;
  text-wrap: pretty;
  overflow-wrap: normal;   /* app.js shrinks the text until every word fits whole */
  hyphens: manual;
}

/* First visit only: a smaller line under the name saying how to move on. */
.hint {
  margin: 0.6em 0 0;
  font-size: clamp(1.25rem, 3.2vw, 2.25rem);
  font-weight: 500;
  line-height: 1.2;
}

/* Back sits on the same left edge as the question; Next sits on the right edge, under the thumb. */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding:
    0
    max(var(--margin), env(safe-area-inset-right))
    max(calc(var(--margin) * 0.75), env(safe-area-inset-bottom))
    max(var(--margin), env(safe-area-inset-left));
}

button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 48px;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease-out;
}

button:active { transform: scale(0.96); }

button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.arrow {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.next {
  background: var(--ink);
  color: var(--bg);
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  padding: 0.45em 0.75em 0.45em 0.95em;
  border-radius: 0.3em;
}

.next:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.next:focus-visible { outline-color: var(--ink); }

.back {
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  padding: 0.45em 0.6em 0.45em 0;
}

.back:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
.back:disabled { visibility: hidden; }

/* The colour flood (app.js): switch off the browser's own cross-fade so the new screen
   arrives only through the growing circle. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
