/* ================================================================
   elith.co — FireRed-style personal site
   ================================================================ */

@font-face {
  font-family: 'Press Start 2P';
  src: url('../assets/fonts/press-start-2p.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1a1c24;
  --bg-grid: #20232d;
  --ink: #33323e;
  --paper: #fff8f0;
  --paper-frame: #f8d8a8;
  --red: #e8433f;
  --red-dark: #b02824;
  --cream: #f8f0dc;
  --blue-gray: #7890a8;
  --hp-green: #58d080;
  --hp-yellow: #f8d030;
  --hp-red: #f05030;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Press Start 2P', monospace;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--cream);
  line-height: 1.9;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

img { image-rendering: pixelated; }

::selection { background: var(--red); color: #fff; }

.gba-frame {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

/* ================= HERO ================= */

.hero { text-align: center; margin-bottom: 64px; }

.hero-pretitle {
  font-size: 10px;
  color: var(--blue-gray);
  margin-bottom: 28px;
  letter-spacing: 1px;
}

.hero-title {
  font-size: clamp(26px, 7.5vw, 56px);
  line-height: 1.35;
  color: #fff;
  text-shadow: 3px 3px 0 var(--red-dark), 6px 6px 0 rgba(0,0,0,.4);
}

.hero-title .line { display: block; }

/* the pokéball O */
.pokeball-o {
  font-size: inherit;
  display: inline-block;
  width: .92em;
  height: .92em;
  margin: 0 .04em;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  vertical-align: 0.02em;
  filter: drop-shadow(3px 3px 0 var(--red-dark));
  animation: ball-idle 5s ease-in-out infinite;
}
.pokeball-o svg { width: 100%; height: 100%; display: block; }
.pokeball-o:hover, .pokeball-o:focus-visible {
  animation: ball-wobble .6s ease-in-out infinite;
}
.pokeball-o:focus-visible { outline: 3px dashed var(--red); outline-offset: 4px; }

@keyframes ball-idle {
  0%, 86%, 100% { transform: none; }
  88% { transform: rotate(-12deg); }
  91% { transform: rotate(10deg); }
  94% { transform: rotate(-8deg); }
  97% { transform: rotate(6deg); }
}
@keyframes ball-wobble {
  0%, 100% { transform: rotate(0) scale(1.08); }
  25% { transform: rotate(-14deg) scale(1.08); }
  75% { transform: rotate(14deg) scale(1.08); }
}

.hero-subtitle {
  margin-top: 24px;
  font-size: 10px;
  color: var(--blue-gray);
  letter-spacing: 1px;
}

/* ================= DIALOG BOXES ================= */

.dialog-box {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 3px #fff,
    inset 0 0 0 6px var(--paper-frame),
    0 6px 0 rgba(0,0,0,.35);
  padding: 22px 24px;
  font-size: 11px;
  line-height: 2.1;
  text-align: left;
}

.hero-dialog { margin-top: 36px; min-height: 96px; }

.dialog-arrow {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-size: 10px;
  color: var(--red);
  animation: arrow-bounce 0.7s steps(2) infinite;
}
@keyframes arrow-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(3px); }
}

/* ================= SECTIONS ================= */

.section { margin-bottom: 56px; }

.section-title {
  display: inline-block;
  font-size: 13px;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  padding: 10px 16px 8px;
  margin-bottom: 20px;
  letter-spacing: 1px;
}

/* ---- trainer card ---- */

.trainer-stats { margin-bottom: 16px; }
.trainer-stats > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 2px dotted #d8c8b0;
}
.trainer-stats dt { color: var(--red-dark); font-size: 10px; }
.trainer-stats dd { text-align: right; font-size: 10px; }

.trainer-flavor { font-size: 10px; color: #5a5648; }

/* ---- jobs ---- */

.job { margin-bottom: 20px; }

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.job-company { font-size: 14px; color: var(--ink); }
.job-level { font-size: 9px; color: var(--blue-gray); }
.job-role { font-size: 9px; color: var(--red-dark); margin: 8px 0 10px; }
.job-desc { font-size: 10px; color: #5a5648; margin-bottom: 14px; }

.type-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.type-tags li {
  font-size: 8px;
  color: #fff;
  background: var(--blue-gray);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 5px 8px 3px;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}

/* ---- contact ---- */

.contact-menu { display: flex; flex-direction: column; gap: 6px; }
.contact-menu a {
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  padding: 8px 6px;
}
.contact-menu .cursor {
  display: inline-block;
  width: 1.4em;
  color: var(--red);
  opacity: 0;
}
.contact-menu a:hover .cursor,
.contact-menu a:focus-visible .cursor { opacity: 1; }
.contact-menu a:hover, .contact-menu a:focus-visible { color: var(--red-dark); }

/* ================= FOOTER ================= */

.footer { text-align: center; font-size: 8px; color: #58607a; line-height: 2.4; }
.footer-fine { color: #414861; }

/* ================================================================
   BATTLE OVERLAY
   ================================================================ */

[hidden] { display: none !important; }

.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.battle-overlay.flash { animation: battle-flash .5s steps(1) 2; }
@keyframes battle-flash {
  0% { background: #000; }
  50% { background: #fff; }
}

.music-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 10;
  font-family: inherit;
  font-size: 10px;
  color: var(--cream);
  background: none;
  border: 2px solid var(--cream);
  border-radius: 4px;
  padding: 7px 10px 5px;
  cursor: pointer;
  opacity: .6;
}
.music-btn:hover, .music-btn:focus-visible { opacity: 1; }
.music-btn.off { opacity: .35; text-decoration: line-through; }

/* GBA logical screen: 240x160, integer-scaled by JS via --scale */
.battle-stage {
  width: 240px;
  height: 160px;
  transform: scale(var(--scale, 2));
  image-rendering: pixelated;
  display: flex;
  flex-direction: column;
}

.battle-field {
  position: relative;
  flex: 1;
  background:
    radial-gradient(ellipse 70px 18px at 178px 62px, #a8d878 98%, transparent 100%),
    radial-gradient(ellipse 85px 22px at 62px 126px, #98c868 98%, transparent 100%),
    linear-gradient(#c8e8f8 0 34px, #b0e090 34px);
  overflow: hidden;
}

.enemy-sprite {
  position: absolute;
  top: 4px;
  right: 20px;
  width: 56px;
  height: 56px;
}
.player-sprite {
  position: absolute;
  bottom: -6px;
  left: 14px;
  width: 64px;
  height: 64px;
}

.enemy-sprite.enter { animation: enemy-enter .5s steps(8) both; }
@keyframes enemy-enter {
  from { transform: translateX(120px); }
  to { transform: translateX(0); }
}
.player-sprite.enter { animation: player-enter .5s steps(8) both; }
@keyframes player-enter {
  from { transform: translateX(-120px); }
  to { transform: translateX(0); }
}

.sprite-hit { animation: sprite-hit .4s steps(2) 2; }
@keyframes sprite-hit {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.sprite-faint { animation: sprite-faint .6s steps(6) both; }
@keyframes sprite-faint {
  to { transform: translateY(40px); opacity: 0; }
}

.sprite-caught { animation: sprite-caught .35s steps(5) both; }
@keyframes sprite-caught {
  to { transform: scale(0); opacity: .4; }
}

/* info boxes */
.info-box {
  position: absolute;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 8px;
  line-height: 1.6;
  color: var(--ink);
  min-width: 92px;
}
.enemy-info { top: 10px; left: 8px; }
.player-info { bottom: 12px; right: 8px; }

.mon-name { font-size: 8px; }

.hp-row { display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.hp-label { font-size: 6px; color: var(--red-dark); }
.hp-track {
  flex: 1;
  height: 5px;
  background: #585858;
  border: 1px solid var(--ink);
  border-radius: 2px;
  overflow: hidden;
}
.hp-bar {
  height: 100%;
  width: 100%;
  background: var(--hp-green);
  transition: width .5s steps(12);
}
.hp-bar.mid { background: var(--hp-yellow); }
.hp-bar.low { background: var(--hp-red); }

.hp-num { font-size: 6px; text-align: right; margin-top: 1px; }

/* thrown ball */
.thrown-ball {
  position: absolute;
  bottom: 60px;
  left: 60px;
  width: 14px;
  height: 14px;
}
.thrown-ball svg { width: 100%; height: 100%; display: block; }
.thrown-ball.throw { animation: ball-throw .6s steps(12) both; }
@keyframes ball-throw {
  0% { transform: translate(0, 0); }
  50% { transform: translate(60px, -55px); }
  100% { transform: translate(110px, -18px); }
}
.thrown-ball.rock { animation: ball-rock .8s steps(4) 1; }
@keyframes ball-rock {
  0%, 100% { transform: translate(110px, -18px) rotate(0); }
  30% { transform: translate(110px, -18px) rotate(-25deg); }
  70% { transform: translate(110px, -18px) rotate(25deg); }
}
.thrown-ball.pop { animation: ball-pop .3s steps(3) both; }
@keyframes ball-pop {
  from { transform: translate(110px, -18px) scale(1); opacity: 1; }
  to { transform: translate(110px, -18px) scale(1.8); opacity: 0; }
}
.thrown-ball.still { transform: translate(110px, -18px); }

/* bottom panel */
.battle-panel {
  position: relative;
  height: 48px;
  background: var(--paper);
  border-top: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px var(--paper-frame);
  padding: 7px 10px;
  color: var(--ink);
}

.battle-text { font-size: 8px; line-height: 1.7; }

.battle-arrow { right: 8px; bottom: 4px; font-size: 7px; }

.battle-menu {
  position: absolute;
  inset: 0;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px var(--paper-frame);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 6px 10px;
}
.action-menu { left: 46%; border-left: 3px solid var(--ink); }

.battle-menu button {
  font-family: inherit;
  font-size: 8px;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 2px 2px 2px 10px;
  position: relative;
  line-height: 1.4;
}
.battle-menu button.selected::before {
  content: '▶';
  position: absolute;
  left: 0;
  font-size: 7px;
  color: var(--ink);
}

/* ================= MISC ================= */

@media (max-width: 480px) {
  .gba-frame { padding-top: 32px; }
  .dialog-box { padding: 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pokeball-o, .dialog-arrow { animation: none; }
  html { scroll-behavior: auto; }
}
