@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: italic;
  font-weight: 400;
  src: url("/assets/noto-ikea-400i.latin-ext.5f8f91ea-38745bc9.woff2") format("woff2");
  unicode-range:u + 0100-024f, u + 0259, u + 1e??, u + 2020, u + 20a0-20ab, u + 20ad-20cf, u + 2113, u + 2c60-2c7f, u + a720-a7ff
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: italic;
  font-weight: 400;
  src: url("/assets/noto-ikea-400i.latin.10395910-cf414569.woff2") format("woff2");
  unicode-range:u + 00??, u + 0131, u + 0152-0153, u + 02bb-02bc, u + 02c6, u + 02da, u + 02dc, u + 2000-206f, u + 2074, u + 20ac, u + 2122, u + 2191, u + 2193, u + 2212, u + 2215, u + feff, u + fffd
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: italic;
  font-weight: 700;
  src: url("/assets/noto-ikea-700i.latin-ext.3637155a-68fd0322.woff2") format("woff2");
  unicode-range:u + 0100-024f, u + 0259, u + 1e??, u + 2020, u + 20a0-20ab, u + 20ad-20cf, u + 2113, u + 2c60-2c7f, u + a720-a7ff
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: italic;
  font-weight: 700;
  src: url("/assets/noto-ikea-700i.latin.29eb18bb-36e65011.woff2") format("woff2");
  unicode-range:u + 00??, u + 0131, u + 0152-0153, u + 02bb-02bc, u + 02c6, u + 02da, u + 02dc, u + 2000-206f, u + 2074, u + 20ac, u + 2122, u + 2191, u + 2193, u + 2212, u + 2215, u + feff, u + fffd
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: normal;
  font-weight: 400;
  src: url("/assets/noto-ikea-400.latin-ext.edd421f4-f33ae767.woff2") format("woff2");
  unicode-range:u + 0100-024f, u + 0259, u + 1e??, u + 2020, u + 20a0-20ab, u + 20ad-20cf, u + 2113, u + 2c60-2c7f, u + a720-a7ff
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: normal;
  font-weight: 400;
  src: url("/assets/noto-ikea-400.latin.647e877d-430c77e5.woff2") format("woff2");
  unicode-range:u + 00??, u + 0131, u + 0152-0153, u + 02bb-02bc, u + 02c6, u + 02da, u + 02dc, u + 2000-206f, u + 2074, u + 20ac, u + 2122, u + 2191, u + 2193, u + 2212, u + 2215, u + feff, u + fffd
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: normal;
  font-weight: 700;
  src: url("/assets/noto-ikea-700.latin-ext.97f0d455-3a51381f.woff2") format("woff2");
  unicode-range:u + 0100-024f, u + 0259, u + 1e??, u + 2020, u + 20a0-20ab, u + 20ad-20cf, u + 2113, u + 2c60-2c7f, u + a720-a7ff
}

@font-face {
  font-display: swap;
  font-family: 'Noto IKEA';
  font-style: normal;
  font-weight: 700;
  src: url("/assets/noto-ikea-700.latin.d7277c39-2167f25e.woff2") format("woff2");
  unicode-range:u + 00??, u + 0131, u + 0152-0153, u + 02bb-02bc, u + 02c6, u + 02da, u + 02dc, u + 2000-206f, u + 2074, u + 20ac, u + 2122, u + 2191, u + 2193, u + 2212, u + 2215, u + feff, u + fffd
}

:root {
  --clr-white: #fff;
  --clr-black: #000;
  --clr-dark-yellow: #F0B902;
  --clr-medium-yellow: #FFDE52;
  --clr-light-yellow: #FFF3AE;
  --clr-text-highlight: #CCE8FE;

  --clr-error: #0058a3;
  
  --ff-ikea: "Noto IKEA", "Noto Sans", "Roboto", "Open Sans", system-ui, sans-serif;
  
  --shadow: 0px 0px 10px 2px rgba(0,0,0,0.1); 

  --fs-s: 1.4rem;
  --fs-base: 1.6rem;
  --fs-lg: 1.8rem;
  --fs-xl: 2.8rem;
  --fs-2xl: 3.2rem;
  --fs-3xl: 4.0rem;
  --fs-4xl: 9.0rem;

  font: 10px/1.3 var(--ff-ikea);
}

.turbo-progress-bar {
  height: 3px;
  background-color: #0058a3;
}

header {
  view-transition-name: none;
}

main {
  view-transition-name: main;
}

footer {
  view-transition-name: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;          /* takes them out of the overlay tree */
}

::view-transition-old(main) {
  z-index: 1;
}

::view-transition-new(main) {
  z-index: 2;
}

@keyframes slide-in {
  from {
    transform: translateY(100dvh);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes slide-out {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-100dvh);
  }
}
/* Forward nav (normal clicks) */
html[data-turbo-visit-direction="forward"] {
  &::view-transition-new(main) { animation: slide-in  .3s ease-out both; }
  &::view-transition-old(main) { animation: slide-out .3s ease-in  both; }
}

/* Back button reverses the sense */
html[data-turbo-visit-direction="back"] {
  &::view-transition-new(main) { animation: none }
  &::view-transition-old(main) { animation: none }
}

body {
  background-color: var(--clr-dark-yellow);
  color: var(--clr-black);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100dvh;  
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;

  background-image: var(--bg-landscape);
  background-position: center center;
  background-attachment: fixed;
  background-repeat: no-repeat; 
  background-size: cover;

  @media (orientation: portrait) {
    background-image: var(--bg-portrait);
  }
}

ul[class] {
  margin: 0 auto;
  padding: 0;
  list-style: none;
}


header {
  padding: 1.2rem;
  flex-grow: 0;  
  z-index: 11;
  position: absolute;
  & svg {
    width: 203px;
    height: auto;
    max-width: 60vw;
  }
}

path.logo-text {
  fill: var(--clr-white);
}


:has(main .with-backdrop) {
  & header path.logo-text {
    fill: var(--clr-black);
  }
  & footer {
    color: var(--clr-black);
  }  
}

footer {
  position: fixed;
  font-size: 1.2rem;
  line-height: 1.2;
  right: 1.2rem;
  top: 1.2rem;  
  font-family: var(--ff-ikea);
  writing-mode: vertical-rl;  
  text-orientation: mixed;
  z-index: 10;
  color: var(--clr-white);
}


.language__selector-select {
  position: relative;
  display: inline-block;  
}


.hidden-select {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
  z-index: 1;
  font-size: var(--fs-base);
  border: 2px solid red;
}

.hidden-select-value {
  background-color: var(--clr-black);
  color: var(--clr-white);
  font-size: var(--fs-base);
  font-weight: 700;
  font-family: var(--ff-ikea);
  line-height: 1;
  border-radius: 400px;
  height: 43px;  
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  

  & > div {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;  
    pointer-events: none;
  }

  & svg {
    width: 8px;
    height: auto;
  }
}

.button__base {
  appearance: none;
  background-color: var(--clr-black);
  border: 2px solid var(--clr-black);
  color: var(--clr-white);
  font-size: var(--fs-base);
  font-family: var(--ff-ikea);
  font-weight: 700;
  height: 4.4rem;
  border-radius: 4.4rem;  
  width: 100%;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;    
  justify-content: center;
  padding: 0 1em;
  box-sizing: border-box;
  transition: transform 0.08s ease-in-out;  
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  
  &:not(.wiggle):active {    
    transform: scale(0.96);
  }
  
}

@keyframes wiggle {
    0%, 100% { transform: translateX(0);     }
    15%      { transform: translateX(-6px); }
    30%      { transform: translateX(6px);  }
    45%      { transform: translateX(-4px); }
    60%      { transform: translateX(4px);  }
    75%      { transform: translateX(-2px); }
  }

.wiggle {
  animation: wiggle 0.45s ease-in-out;
}

.button__base-light {
  background-color: transparent;
  color: var(--clr-black);
}


main {
  padding: 50px 1.2rem 1.6rem 1.2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;  

  &:has(.with-backdrop) {
    background-color: var(--clr-dark-yellow);
  }
    

}


.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  & img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    
    
    &.loaded {
      opacity: 1;
    }
  }
}

@media (min-width: 474px) {
  main {
    justify-content: center;
  }  
}

.intro-container {
  display: grid;
  grid-template-columns: 1;
  grid-template-rows: auto;
  /*gap: 8px;*/
}

.intro-content-container, 
.question-container {
  display: grid;
  grid-template-columns: 1;
  grid-template-rows: auto;
  /*gap: 8px;*/
  width: 100%;
}

.intro-container,
.question-container {
  max-width: 450px;
  margin: 0 auto;
}

.intro-content-header, 
.intro-content-body {
  padding: 1.6rem 1.2rem;
  border-radius: 1.2rem;    
}


.intro-content-header {
  background-color: var(--clr-white);  
  font-size: var(--fs-2xl);
  line-height: 1.2;
  font-weight: 700;  
}

.intro-content-body {
  background-color: var(--clr-medium-yellow);  
  font-size: var(--fs-base);
  line-height: 1.4;  
}


.question-step {
  font-size: var(--fs-s);
  font-weight: 700;
  line-height: 1;
  display: flex;
  & div {
    background-color: var(--clr-medium-yellow);    
    padding: 1rem 1.2rem;
    border-radius: 400px;
  }
}

.question-header {
  background-color: var(--clr-medium-yellow);    
  border-radius: 1.6rem;
  font-size: var(--fs-xl);
  line-height: 1.2;
  font-weight: 700;
  padding: 1.6rem 1.2rem;
}

.error {
  padding: 1.6rem 1.2rem;
  border-radius: 1.6rem;
  background-color: var(--clr-text-highlight);
  color: var(--clr-black);
  font-size: var(--fs-s);
  line-height: 1.2;
  
}

.question-answer {
    
  font-size: var(--fs-lg);
  line-height: 1.4;
  

  & label {
    display: block;
    padding: 1.6rem 1.2rem;
    border-radius: 1.6rem;
    background-color: var(--clr-white);    
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;  

    & div {
      position: relative;
      display: inline-block; 
      padding: 0 0.2em;
      margin: 0 -0.2em;    
    }

    & div::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--clr-text-highlight);
      clip-path: inset(0 100% 0 0);
      transition: clip-path 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
      z-index: 1;
      mix-blend-mode: darken;
    }
  }  

  & input[type=radio] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
  }

  &:has(input[type=radio]:checked) {
    
    & label>div::after {
      clip-path: inset(0 0 0 0);
    }

  }

  & + .question-answer {
    margin-top: 8px;
  }

}

.question-container {
  & em {
    font-style: normal;
    background-color: var(--clr-text-highlight);
    padding: 1px 2px;
    margin-right: -2px;
  }

  & strong {
    font-weight: 700;
  }
  
}


.question-result, .result-stats {
  background-color: var(--clr-medium-yellow);    
  border-radius: 1.2rem;
  font-size: var(--fs-base);
  line-height: 1.4;
  padding: 1.6rem 1.2rem;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;

  & a {
    background-color: var(--clr-medium-yellow);
    border-color: var(--clr-medium-yellow);
    color: var(--clr-black)
  }
}

.answers-distribution {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  

  height: 45dvh;
  max-height: 300px;

  & > div {
    box-sizing: border-box;
    padding: 1.6rem 1.2rem;
    background-color: var(--clr-medium-yellow);  
    border-radius: 1.2rem;
    color: var(--clr-dark-yellow);
    font-size: var(--fs-s);
    font-weight: 700;
    line-height: 1.3;   
    
    align-self: end;
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0;

    transition: background-color 200ms ease-in-out, color 200ms ease-in-out;

    &.answered {
      background-color: var(--clr-white);  
      color: var(--clr-black);
    }
  }

  & .explanation {
    display: none;
  }

  & .percentage {
    font-size: var(--fs-4xl);
    line-height: 1;  
    opacity: 0;  
    
    &::after {
      content: '%';
      font-size: 4rem;
    }
  }
}

.breakable {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}


.result-msg {
  background-color: var(--clr-white);
  border-radius: 1.2rem;
  font-size: var(--fs-base);
  line-height: 1.4;
  padding: 2.0rem 1.2rem;

  & h1 {
    font-size: var(--fs-3xl);
    line-height: 1.1;
    margin: 0 0 0.4em 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
  }

  & div:first-child {
    font-weight: 700;
  }
}


label.question-answer {
  display: flex;
  align-items: start;
  height: 10.8rem;
  cursor: pointer;  
  padding: 1.6rem 1.2rem;
  border-radius: 1.6rem;
  background-color: var(--clr-white);        

  & input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: var(--fs-lg);
    line-height: 1.4;
    padding: 0; 
  }

  &:has(.field_with_errors) {
    outline: 4px solid var(--clr-text-highlight);
    outline-offset: -4px;
  }
}

label {
  cursor: pointer;
}

.animation-element {
  box-sizing: border-box;  
  opacity: 0;
  padding-top: 8px;

  &:last-child {
    padding-top: 12px; 
  }

  & > * {
    box-sizing: border-box;
  }
}

.typewriter-cursor::after {
  content: '|';
  animation: typewriter-blink 1s infinite;
  color: currentColor;
  font-weight: 400;
  position: absolute;
}

@keyframes typewriter-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
/*.cursor {
  animation: blink 1000ms infinite;
  color: var(--clr-black);
  font-weight: 400;  
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}*/


@media (min-width: 815px) {
  header {
    top: 2rem;
    left: 3rem;
      
  }

  main {
    padding: calc(50px + 2rem) 2rem 3rem 2rem;
  }

  footer {
    top: 2rem;
    right: 3rem;
    
  }
  
}

[data-locale] {
  display: none;
}

html[lang="en"] [data-locale='en'],
html[lang="zh"] [data-locale='zh'],
html[lang="hr"] [data-locale='hr'],
html[lang="cs"] [data-locale='cs'],
html[lang="da"] [data-locale='da'],
html[lang="nl"] [data-locale='nl'],
html[lang="fi"] [data-locale='fi'],
html[lang="fr"] [data-locale='fr'],
html[lang="fr-CA"] [data-locale='fr-CA'],
html[lang="de"] [data-locale='de'],
html[lang="hu"] [data-locale='hu'],
html[lang="it"] [data-locale='it'],
html[lang="ja"] [data-locale='ja'],
html[lang="ko"] [data-locale='ko'],
html[lang="nb"] [data-locale='nb'],
html[lang="pl"] [data-locale='pl'],
html[lang="pt"] [data-locale='pt'],
html[lang="ro"] [data-locale='ro'],
html[lang="sr"] [data-locale='sr'],
html[lang="sk"] [data-locale='sk'],
html[lang="sl"] [data-locale='sl'],
html[lang="es"] [data-locale='es'],
html[lang="sv"] [data-locale='sv'],
html[lang="uk"] [data-locale='uk'] {
  display: revert;
}
