/* page-experiment-02 - extracted from the template so every rule
   lives in a .css file, enqueued conditionally in functions.php.
   Viola Cherchi, 2025-26 */

/* ============================================
   EXPERIMENT 02 - THE FONT YOU FORGOT
   ============================================ */

/* --- intro --- */
[data-exp-intro] {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--s-xl) var(--s-m);
}

[data-exp-intro] h1 {
  font-size: clamp(2.5rem, 2rem + 6vw, 8rem);
  margin-block-end: var(--s-m);
}

[data-exp-intro] p {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  max-inline-size: var(--measure-narrow, 45ch);
  margin-block-end: var(--s-s);
}

/* --- the input field --- */
[data-exp-input-wrap] {
  width: min(90vw, 700px);
  margin: var(--s-xl) auto var(--s-l);
  position: sticky;
  top: var(--s-m);
  z-index: 100;
}

[data-exp-input] {
  width: 100%;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.2vw + 0.5rem, 1.4rem);
  color: var(--white);
  background: var(--dark);
  border: 1px solid var(--mid);
  padding: var(--s-s) var(--s-m);
  outline: none;
  caret-color: var(--red-text);
  transition: border-color 0.3s;
}

[data-exp-input]:focus {
  border-color: var(--red-text);
}

[data-exp-input]::placeholder {
  color: var(--grey);
  font-style: italic;
}

[data-exp-input-hint] {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--grey);
  margin-block-start: var(--s-xs);
  text-align: center;
  letter-spacing: 0.05em;
}

/* --- specimen grid --- */
[data-specimen-grid] {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: min(95vw, 1200px);
  margin-inline: auto;
  padding-block: var(--s-m);
}

@media (min-width: 48em) {
  [data-specimen-grid] {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- individual specimen --- */
[data-specimen] {
  position: relative;
  padding: var(--s-l) var(--s-m);
  border-bottom: 1px solid var(--mid);
  cursor: pointer;
  /* JS drives entry (data-enter) and idle drift (--drift-y);
     the visual rules composing them live here */
  opacity: 1;
  transform: translateY(calc(var(--drift-y, 0px) + var(--enter-y, 0px)));
  transition:
    background-color 0.4s ease,
    border-color 0.3s ease,
    opacity 0.5s ease,
    transform 0.5s ease;
  overflow: hidden;
  container-type: inline-size;
}

/* pre-entry state - removed by JS on a stagger */
[data-specimen][data-enter] {
  opacity: 0;
  --enter-y: 12px;
}

@media (min-width: 48em) {
  [data-specimen]:nth-child(odd) {
    border-right: 1px solid var(--mid);
  }
}

[data-specimen]:hover,
[data-specimen]:focus-visible {
  background: var(--dark);
}

/* --- specimen number --- */
[data-specimen-num] {
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--grey);
  letter-spacing: 0.1em;
  margin-block-end: var(--s-s);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- the text sample --- */
[data-specimen-text] {
  /* the typeface arrives as a custom property set per specimen */
  font-family: var(--specimen-font, inherit);
  font-size: clamp(1.4rem, 1.2rem + 1.5vw, 2.4rem);
  line-height: 1.2;
  color: var(--off-white);
  transition: color 0.4s;
  min-height: 2.5em;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* --- the font's back-story note --- */
[data-specimen-name] em {
  font-style: italic;
  color: var(--grey);
  font-size: 0.6rem;
  line-height: 1.4;
  display: inline-block;
  margin-top: 0.4em;
}

/* --- font name (hidden until revealed) --- */
[data-specimen-name] {
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--grey);
  margin-block-start: var(--s-s);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
  letter-spacing: 0.05em;
}

[data-specimen]:hover [data-specimen-name],
[data-specimen][data-revealed] [data-specimen-name] {
  opacity: 1;
  transform: translateY(0);
}

/* --- verdict tag --- */
[data-verdict] {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.15em 0.5em;
  border-radius: 2px;
  margin-inline-start: var(--s-s);
}

[data-verdict="default"] {
  background: var(--mid);
  color: var(--grey);
}

[data-verdict="choice"] {
  background: var(--red);
  color: var(--white);
}

[data-verdict="forgotten"] {
  background: transparent;
  border: 1px solid var(--grey);
  color: var(--grey);
}

/* --- revealed state styling --- */
[data-specimen][data-revealed][data-type="default"] {
  background: rgba(42, 42, 42, 0.4);
}

[data-specimen][data-revealed][data-type="default"] [data-specimen-text] {
  color: var(--grey);
  text-decoration: line-through;
  text-decoration-color: var(--red-text);
  text-decoration-thickness: 2px;
}

[data-specimen][data-revealed][data-type="choice"] {
  background: rgba(230, 59, 46, 0.06);
}

[data-specimen][data-revealed][data-type="choice"] [data-specimen-text] {
  color: var(--white);
}

[data-specimen][data-revealed][data-type="forgotten"] {
  background: rgba(42, 42, 42, 0.2);
}

[data-specimen][data-revealed][data-type="forgotten"] [data-specimen-text] {
  opacity: 0.35;
}

/* --- stats bar --- */
[data-exp-stats] {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--grey);
  background: var(--black);
  border-top: 1px solid var(--mid);
  padding: var(--s-xs) var(--s-m);
  display: flex;
  justify-content: center;
  gap: var(--s-l);
  z-index: 100;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: opacity 0.4s;
  opacity: 0;
}

[data-exp-stats][data-visible] {
  opacity: 1;
}

[data-exp-stats] span[data-count-choice] { color: var(--red-text); }
[data-exp-stats] span[data-count-default] { color: var(--grey); }
[data-exp-stats] span[data-count-forgotten] { color: var(--light); }

/* --- reveal all button --- */
[data-reveal-all] {
  display: block;
  margin: var(--s-xl) auto;
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--red-text);
  background: none;
  border: 1px solid var(--red);
  padding: var(--s-s) var(--s-l);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background 0.3s, color 0.3s;
}

[data-reveal-all]:hover,
[data-reveal-all]:focus-visible {
  background: var(--red);
  color: var(--white);
}

/* --- closing --- */
[data-exp-closing] {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--s-xl) var(--s-m);
}
[data-exp-closing] p {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1rem + 3vw, 4rem);
  color: var(--red);
  text-transform: uppercase;
  line-height: 1;
  max-inline-size: 20ch;
  text-wrap: balance;
}
[data-exp-closing] p + p {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  text-transform: none;
  margin-block-start: var(--s-l);
  max-inline-size: var(--measure-narrow, 45ch);
  line-height: 1.65;
}
/* nav styling handled by main.css [data-exp-nav] */

/* --- mobile readability --- */
@media (max-width: 640px) {
  /* the back-story notes were 0.6rem - below comfortable on a phone */
  [data-specimen-name] em {
    font-size: 0.75rem;
  }

  [data-verdict] {
    font-size: 0.65rem;
  }
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  [data-specimen],
  [data-specimen-name],
  [data-specimen-text] {
    transition: none !important;
  }
}
[data-reduced-motion] [data-specimen],
[data-reduced-motion] [data-specimen-name],
[data-reduced-motion] [data-specimen-text] {
  transition: none !important;
}
