/* ============================================
   idalurie.com — Global Styles
   ============================================ */

:root {
  --color-bg: #fafafa;
  --color-bg-alt: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-accent: #3b5fc0;
  --color-accent-hover: #2d4a9e;
  --color-border: #e8e8e8;
  --color-card-shadow: rgba(0, 0, 0, 0.06);
  --color-card-shadow-hover: rgba(0, 0, 0, 0.12);
  --color-correct: #22863a;
  --color-incorrect: #d73a49;
  --color-incorrect-bg: rgba(215, 58, 73, 0.1);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --max-width: 900px;
  --radius: 8px;
  --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #111111;
    --color-bg-alt: #1a1a1a;
    --color-text: #e8e8e8;
    --color-text-muted: #999999;
    --color-accent: #6b8de6;
    --color-accent-hover: #8aa4f0;
    --color-border: #2a2a2a;
    --color-card-shadow: rgba(0, 0, 0, 0.2);
    --color-card-shadow-hover: rgba(0, 0, 0, 0.4);
    --color-correct: #56d364;
    --color-incorrect: #f85149;
    --color-incorrect-bg: rgba(248, 81, 73, 0.15);
  }
}

/* ---- Reset ---- */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---- Base ---- */

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

body {
  font-family: var(--font-stack);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

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

/* ---- Layout ---- */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
}

/* ---- Header / Nav ---- */

.site-header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__logo {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.site-header__logo:hover {
  color: var(--color-text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.nav-toggle__icon {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-text);
  position: relative;
  transition: background-color var(--transition);
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-text);
  position: absolute;
  transition: transform var(--transition);
}

.nav-toggle__icon::before {
  top: -7px;
}

.nav-toggle__icon::after {
  top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon {
  background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.site-nav__list {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.site-nav__link {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  color: var(--color-text);
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
    order: 3;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
    padding: 1rem 0 0.5rem;
  }

  .site-nav__item {
    border-top: 1px solid var(--color-border);
  }

  .site-nav__link {
    display: block;
    padding: 0.75rem 0;
  }

  .site-header .container {
    flex-wrap: wrap;
  }
}

/* ---- Hero ---- */

.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero__name {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero__subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.hero__intro {
  max-width: 540px;
  margin: 0 auto;
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* Secret dot above the I */

.hero__i-wrap {
  position: relative;
  display: inline-block;
}

.hero__secret-dot {
  position: absolute;
  top: 0.05em;
  left: 50%;
  transform: translateX(-50%);
  width: 0.16em;
  height: 0.16em;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  cursor: default;
  display: block;
}

.hero__secret-dot:hover {
  cursor: pointer;
  opacity: 0.5;
}

.hero__secret-dot:focus {
  outline: none;
}

/* ---- Section ---- */

.section {
  padding: 3rem 0;
}

.section__title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.section__title--center {
  text-align: center;
}

/* ---- Cards ---- */

.card-grid {
  display: grid;
  gap: 1.5rem;
}

.card-grid--2 {
  grid-template-columns: 1fr;
}

.card-grid--3 {
  grid-template-columns: 1fr;
}

@media (min-width: 540px) {
  .card-grid--2,
  .card-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 800px) {
  .card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: 0 4px 20px var(--color-card-shadow-hover);
  transform: translateY(-2px);
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card__description {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.card__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-accent);
}

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

/* ---- Button ---- */

.btn {
  display: inline-block;
  padding: 0.625rem 1.5rem;
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-align: center;
  line-height: 1.5;
}

.btn:hover {
  background: var(--color-accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

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

.btn--secondary {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.btn--small {
  padding: 0.4rem 1rem;
  font-size: 0.8125rem;
}

/* ---- About Page ---- */

.about-layout {
  display: grid;
  gap: 3rem;
  padding: 3rem 0;
}

@media (min-width: 640px) {
  .about-layout {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

.about-text h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.about-text p {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.about-image-placeholder {
  background: var(--color-border);
  border-radius: var(--radius);
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ---- Games Hub ---- */

.games-intro {
  max-width: 600px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.games-intro p {
  color: var(--color-text-muted);
  line-height: 1.8;
}

/* ---- Game Page Common ---- */

.game-page__back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.game-page__back:hover {
  color: var(--color-accent);
}

.game-page__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.game-page__description {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.game-area {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* ---- Toolbar ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.toolbar label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.toolbar select,
.toolbar input[type="color"] {
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
}

.toolbar input[type="color"] {
  width: 36px;
  height: 30px;
  padding: 2px;
  cursor: pointer;
}

.toolbar__group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toolbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.toolbar__toggle.is-active {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

/* ---- Pixel Art ---- */

.pixel-grid-wrap {
  display: flex;
  justify-content: center;
}

.pixel-grid {
  display: grid;
  border: 1px solid var(--color-border);
  user-select: none;
  touch-action: none;
  max-width: 100%;
}

.pixel-cell {
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  cursor: crosshair;
  aspect-ratio: 1;
  min-width: 0;
}

.pixel-cell:hover {
  opacity: 0.85;
}

/* ---- Story Generator ---- */

.story-output {
  min-height: 180px;
  padding: 2rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-text {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--color-text);
  max-width: 640px;
  animation: storyFade 0.5s ease;
}

.story-placeholder {
  color: var(--color-text-muted);
  font-style: italic;
}

@keyframes storyFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Color Palette ---- */

.palette-display {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.palette-swatch {
  flex: 1;
  min-width: 100px;
  text-align: center;
}

.palette-swatch__color {
  height: 140px;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  transition: transform var(--transition);
  cursor: pointer;
}

.palette-swatch__color:hover {
  transform: scale(1.03);
}

.palette-swatch__hex {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition);
}

.palette-swatch__hex:hover {
  color: var(--color-accent);
}

.palette-copied {
  font-size: 0.8125rem;
  color: var(--color-correct);
  text-align: center;
  min-height: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 540px) {
  .palette-display {
    flex-direction: column;
  }

  .palette-swatch__color {
    height: 80px;
  }
}

/* ---- Typing Test ---- */

.typing-display {
  font-size: 1.125rem;
  line-height: 2;
  padding: 1.5rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  word-break: break-word;
}

.typing-display .char--correct {
  color: var(--color-correct);
}

.typing-display .char--incorrect {
  color: var(--color-incorrect);
  background: var(--color-incorrect-bg);
  border-radius: 2px;
}

.typing-display .char--current {
  border-bottom: 2px solid var(--color-accent);
}

.typing-display .char--pending {
  color: var(--color-text-muted);
  opacity: 0.5;
}

.typing-input {
  width: 100%;
  padding: 1rem;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 1rem;
}

.typing-input:focus {
  border-color: var(--color-accent);
}

.typing-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.typing-stat {
  text-align: center;
}

.typing-stat__value {
  font-size: 2rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.typing-stat__label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.typing-results {
  text-align: center;
  padding: 2rem;
  animation: fadeIn 0.4s ease;
}

/* ---- Memory Pulse (Secret) ---- */

.memory-game {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--color-bg);
}

.memory-game__info {
  text-align: center;
  margin-bottom: 2rem;
}

.memory-game__round {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.memory-game__status {
  font-size: 1rem;
  color: var(--color-text-muted);
  min-height: 1.5rem;
}

.memory-game__board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.memory-pad {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.memory-pad:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

.memory-pad--0 { background: #4d96ff; }
.memory-pad--1 { background: #51cf66; }
.memory-pad--2 { background: #ffd43b; }
.memory-pad--3 { background: #ff6b6b; }

.memory-pad.is-lit {
  opacity: 1;
  transform: scale(1.1);
}

.memory-pad--0.is-lit { box-shadow: 0 0 30px rgba(77, 150, 255, 0.6); }
.memory-pad--1.is-lit { box-shadow: 0 0 30px rgba(81, 207, 102, 0.6); }
.memory-pad--2.is-lit { box-shadow: 0 0 30px rgba(255, 212, 59, 0.6); }
.memory-pad--3.is-lit { box-shadow: 0 0 30px rgba(255, 107, 107, 0.6); }

.memory-pad:hover:not(.is-lit) {
  opacity: 0.6;
}

.memory-game__overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 10;
  animation: fadeIn 0.5s ease;
}

.memory-game__overlay.is-visible {
  display: flex;
}

.memory-game__overlay-content {
  text-align: center;
}

.memory-game__overlay-title {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.memory-game__overlay-sub {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

@media (max-width: 400px) {
  .memory-pad {
    width: 80px;
    height: 80px;
  }
}

/* Confetti */

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Footer ---- */

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

/* ---- Page Header ---- */

.page-header {
  padding: 3rem 0 1rem;
}

.page-header__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---- Utilities ---- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
