/* ═══ Reusable LCD components ═══
   Pixel border trick: four 1-offset shadows draw a border with notched (pixel) corners. */

.pixel {
  margin: var(--px);
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink);
}

/* ── Typography (labels use the pixel font small; body text stays readable) ── */
.h-page { font-family: var(--font-pixel); font-size: 15px; line-height: 1.6; letter-spacing: .5px; text-transform: uppercase; }
.h-section {
  display: flex; align-items: center; gap: 10px; margin: 30px 0 14px;
  font-family: var(--font-pixel); font-size: 11px; line-height: 1.5; text-transform: uppercase;
}
.h-section::before { content: ''; width: 10px; height: 10px; background: var(--ink); flex: none; }
.h-section::after { content: ''; flex: 1; height: var(--px); background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 9px); }
.h-section .more { order: 3; }
.muted { color: var(--ink-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 18px; }
.page-head p { color: var(--ink-2); }
.eyebrow { font-family: var(--font-pixel); font-size: 8px; letter-spacing: 1px; color: var(--ink-2); text-transform: uppercase; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; margin: var(--px);
  padding: 9px 14px; cursor: pointer; text-decoration: none; text-transform: uppercase;
  font-family: var(--font-pixel); font-size: 9px; line-height: 1.4; letter-spacing: .5px;
  color: var(--lcd-3); background: var(--lcd-0); border: 0;
  box-shadow: calc(var(--px) * -1) 0 0 0 var(--lcd-0), var(--px) 0 0 0 var(--lcd-0), 0 calc(var(--px) * -1) 0 0 var(--lcd-0), 0 var(--px) 0 0 var(--lcd-0), 3px 6px 0 0 rgba(15, 56, 15, .35);
  transition: transform .1s steps(2), background .1s steps(2);
}
.btn:hover { background: var(--lcd-1); transform: translate(-1px, -1px); }
.btn:active { transform: translate(2px, 3px); box-shadow: calc(var(--px) * -1) 0 0 0 var(--lcd-0), var(--px) 0 0 0 var(--lcd-0), 0 calc(var(--px) * -1) 0 0 var(--lcd-0), 0 var(--px) 0 0 var(--lcd-0); }
.btn.ghost { color: var(--ink); background: transparent; box-shadow: calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink), 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink); }
.btn.ghost:hover { background: var(--lcd-2); }
.btn.danger { background: #7a1f1f; color: #ffe9e9; box-shadow: calc(var(--px) * -1) 0 0 0 #7a1f1f, var(--px) 0 0 0 #7a1f1f, 0 calc(var(--px) * -1) 0 0 #7a1f1f, 0 var(--px) 0 0 #7a1f1f; }
.btn.small { padding: 6px 9px; font-size: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Chips ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 3px 7px; margin: var(--px) 0 var(--px) var(--px);
  font-family: var(--font-pixel); font-size: 8px; line-height: 1.5; text-transform: uppercase;
  color: var(--ink); background: var(--lcd-2);
  box-shadow: -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink), 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink);
}
.chip.solid { background: var(--lcd-0); color: var(--lcd-3); box-shadow: none; }
.chip.live { animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .35; } }
button.chip { cursor: pointer; }
button.chip:hover { background: var(--lcd-4); }
button.chip[aria-pressed="true"] { background: var(--lcd-0); color: var(--lcd-3); }

/* ── Panels ── */
.panel { background: var(--lcd-2); padding: 14px 16px; }
.panel.dark { background: var(--lcd-0); color: var(--lcd-3); box-shadow: none; }
.prose { font-size: 22px; line-height: 1.35; white-space: pre-line; max-width: 72ch; }

/* ── State messages ── */
.state { padding: 40px 12px; text-align: center; font-family: var(--font-pixel); font-size: 10px; line-height: 2; text-transform: uppercase; }
.state .cursor, .cursor { display: inline-block; width: 8px; height: 14px; vertical-align: middle; background: var(--ink); animation: cursor 1s steps(2) infinite; }
@keyframes cursor { 50% { opacity: 0; } }
.state .btn { margin-top: 12px; }
.state p { font-family: var(--font-body); font-size: 21px; text-transform: none; max-width: 46ch; margin: 6px auto; }

/* ── Progressive images ── */
.ph { position: relative; display: block; overflow: hidden; background-color: var(--lcd-1); background-size: cover; background-position: center; }
.ph img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s steps(6); }
.ph.loaded img { opacity: 1; }
.ph.contain img { object-fit: contain; }
.ph.broken { background-image: none; }
.ph.broken::after { content: 'NO IMAGE'; position: absolute; inset: 0; display: grid; place-items: center; font: 8px var(--font-pixel); color: var(--lcd-3); }

/* ── Hero / trainer card ── */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; background: var(--lcd-2); padding: 18px 20px; }
.hero h1 { font-family: var(--font-pixel); font-size: 17px; line-height: 1.6; text-shadow: 2px 2px 0 var(--lcd-3); }
.hero-role { margin: 8px 0 12px; font-size: 22px; line-height: 1.25; color: var(--ink-2); }
.hero-role .cursor { margin-left: 4px; }
.hero-photo { width: 116px; height: 116px; border-radius: 50%; border: var(--px) solid var(--ink); background: var(--lcd-1); overflow: hidden; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; filter: sepia(1) saturate(4) hue-rotate(40deg) brightness(.6); image-rendering: pixelated; }
.hero-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* RPG-style dialog */
.dialog { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin-top: 18px; background: var(--lcd-3); padding: 14px 16px; }
.dialog p { font-size: 22px; }
.dialog .arrow { display: inline-block; animation: nudge .9s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateX(3px); } }
.dialog-actions { display: flex; gap: 6px; }

/* ── Cards grid (projects & events) ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 20px 18px; padding: var(--px); list-style: none; }
.grid > li { display: flex; }

.card {
  position: relative; display: flex; flex-direction: column; width: 100%; margin: var(--px);
  background: var(--lcd-2); color: inherit; text-decoration: none;
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    6px 6px 0 0 rgba(15, 56, 15, .35);
  transition: transform .12s steps(3), background .12s steps(3), box-shadow .12s steps(3);
}
.card:hover, .card:focus-visible {
  background: var(--lcd-4); transform: translate(-3px, -3px);
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    10px 10px 0 0 rgba(15, 56, 15, .4);
}
.card:focus-visible { outline: var(--px) dashed var(--ink); outline-offset: 6px; }
.card:active { transform: translate(2px, 2px); box-shadow: calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink), 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink); }

.card-media { aspect-ratio: 4 / 3; background: var(--lcd-1); border-bottom: var(--px) solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.card-media.wide { aspect-ratio: 16 / 9; }
.card-media .ph { width: 100%; height: 100%; }
.card-media.cartridge { padding: 14px 14px 0; background:
    repeating-conic-gradient(var(--lcd-1) 0 25%, #2c5a2c 0 50%) 0 0 / 16px 16px; }
.card-media.cartridge .ph { background: transparent !important; transition: transform .18s steps(3); overflow: visible; }
.card-media.cartridge .ph img { object-fit: contain; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)); }
.card:hover .card-media.cartridge .ph, .card:focus-visible .card-media.cartridge .ph { transform: translateY(-5px); }
.card-media svg { width: 78%; height: 100%; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)); transition: transform .18s steps(3); }
.card:hover .card-media svg, .card:focus-visible .card-media svg { transform: translateY(-5px); }

.card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; flex: 1; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; font-family: var(--font-pixel); font-size: 8px; color: var(--ink-2); text-transform: uppercase; }
.card-title { font-family: var(--font-pixel); font-size: 11px; line-height: 1.6; text-transform: uppercase; overflow-wrap: anywhere; }
.card:hover .card-title::before, .card:focus-visible .card-title::before { content: '▶ '; }
.card-text { font-size: 20px; line-height: 1.2; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 4px; }
.card-foot .chip { font-size: 7px; }

.event-empty-cover { display: grid; place-items: center; width: 100%; height: 100%;
  background: repeating-linear-gradient(45deg, var(--lcd-1) 0 8px, #2c5a2c 8px 16px);
  font: 26px var(--font-pixel); color: var(--lcd-3); }

.year-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: 6px 0 0; font-family: var(--font-pixel); font-size: 11px; text-transform: uppercase; }
.year-divider::after { content: ''; flex: 1; height: var(--px); background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 9px); }

/* ── Filters ── */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 20px; }
.filters .eyebrow { margin-right: 4px; }

/* ── Detail pages ── */
.back-link { display: inline-block; margin-bottom: 16px; font-family: var(--font-pixel); font-size: 9px; text-decoration: none; text-transform: uppercase; padding: 6px 0; }
.back-link:hover { text-decoration: underline; text-decoration-thickness: var(--px); text-underline-offset: 5px; }

.detail-head { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 22px; align-items: start; margin-bottom: 22px; }
.detail-head.event { grid-template-columns: 1fr; }
.detail-cover { background: var(--lcd-1); aspect-ratio: 4 / 3; }
.detail-cover.wide { aspect-ratio: 21 / 8; }
.detail-cover.cartridge { padding: 14px; background: repeating-conic-gradient(var(--lcd-1) 0 25%, #2c5a2c 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; }
.detail-cover .ph, .detail-cover svg { width: 100%; height: 100%; }
.detail-cover.cartridge .ph { background: transparent; }
.detail-cover.cartridge .ph img { object-fit: contain; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, .35)); }
.detail-cover svg { max-height: 300px; margin: 0 auto; }
.detail-info { display: flex; flex-direction: column; gap: 12px; }
.detail-info .h-page { overflow-wrap: anywhere; }
.detail-info .lead { font-size: 23px; line-height: 1.3; color: var(--ink-2); max-width: 60ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-family: var(--font-pixel); font-size: 9px; text-transform: uppercase; line-height: 1.8; }
.meta-row span::before { content: '◆ '; }
.link-row { display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ── Galleries ── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 14px; padding: var(--px); list-style: none; }
.gallery button { display: block; width: calc(100% - 2 * var(--px)); margin: var(--px); padding: 0; border: 0; cursor: zoom-in; background: var(--lcd-1);
  aspect-ratio: 4 / 3; transition: transform .12s steps(3);
  box-shadow: calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink), 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), 4px 4px 0 0 rgba(15, 56, 15, .35); }
.gallery button:hover, .gallery button:focus-visible { transform: translate(-2px, -2px); }
.gallery .ph { width: 100%; height: 100%; }
.gallery figcaption { font-size: 18px; margin: 6px 4px 0; color: var(--ink-2); }

.lightbox { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-rows: auto 1fr auto; background: rgba(8, 26, 8, .96); color: var(--lcd-3); animation: view-in .18s steps(4) both; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-family: var(--font-pixel); font-size: 10px; }
.lightbox-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 64px; }
.lightbox-stage .ph { max-width: 100%; max-height: 100%; background-color: transparent; }
.lightbox-stage img { width: auto; height: auto; max-width: min(100%, 1400px); max-height: calc(100vh - 170px); object-fit: contain; }
.lightbox-stage .ph { display: grid; place-items: center; width: 100%; height: 100%; }
.lightbox .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .prev { left: 8px; }
.lightbox .next { right: 8px; }
.lightbox-caption { min-height: 44px; padding: 10px 16px 16px; text-align: center; font-size: 22px; }
.lightbox .btn { background: var(--lcd-3); color: var(--lcd-0); box-shadow: calc(var(--px) * -1) 0 0 0 var(--lcd-3), var(--px) 0 0 0 var(--lcd-3), 0 calc(var(--px) * -1) 0 0 var(--lcd-3), 0 var(--px) 0 0 var(--lcd-3); }
.lightbox .btn:hover { background: #fff; }
.lightbox :focus-visible { outline-color: var(--gold); box-shadow: none; }

/* ── About: stats, skills ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; padding: var(--px); }
.stat { background: var(--lcd-2); padding: 10px 14px 12px; }
.stat dt { font-family: var(--font-pixel); font-size: 8px; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.stat dd { font-size: 22px; line-height: 1.15; }

.cert-list, .skill-grid { display: grid; gap: 14px; padding: var(--px); list-style: none; }
.cert-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cert-list li { display: flex; gap: 12px; align-items: center; background: var(--lcd-2); padding: 10px 14px; }
.cert-list .badge { font-size: 22px; }
.cert-list strong { display: block; font-weight: normal; font-size: 21px; line-height: 1.15; }
.cert-list small { font-size: 18px; color: var(--ink-2); }
.skill-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.skill { background: var(--lcd-2); padding: 10px 14px 12px; }
.skill-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.skill-name { font-size: 22px; line-height: 1.1; }
.skill-type { font-family: var(--font-pixel); font-size: 7px; text-transform: uppercase; color: var(--ink-2); margin: 4px 0 8px; }
.meter { height: 12px; background: var(--lcd-3); box-shadow: 0 0 0 2px var(--ink); }
.meter span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px); animation: fill 1s steps(10) both; }
@keyframes fill { from { width: 0 !important; } }
.pp { font-family: var(--font-pixel); font-size: 8px; color: var(--ink-2); white-space: nowrap; }

.contact-list { display: grid; gap: 14px; padding: var(--px); list-style: none; max-width: 640px; }
.contact-link { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--lcd-2); text-decoration: none; transition: transform .12s steps(3), background .12s steps(3); }
.contact-link:hover, .contact-link:focus-visible { background: var(--lcd-4); transform: translateX(4px); }
.contact-link .icon { min-width: 46px; font-family: var(--font-pixel); font-size: 10px; text-align: center; }
.contact-link .label { display: block; font-family: var(--font-pixel); font-size: 8px; color: var(--ink-2); text-transform: uppercase; }
.contact-link .value { font-size: 22px; overflow-wrap: anywhere; }
.contact-link .go { margin-left: auto; font-family: var(--font-pixel); }

/* ── Battle mini-game ── */
.battle { position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; background-color: var(--lcd-3);
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(15, 56, 15, .07) 3px 4px); overflow: hidden; }
.b-arena { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.b-ground { position: absolute; border-radius: 50%; background: var(--lcd-1); opacity: .4; }
.b-ground.enemy { top: calc(6% + clamp(100px, 22vh, 200px) - 6px); right: 4%; width: clamp(80px, 16%, 160px); height: 14px; }
.b-ground.player { bottom: calc(20% - 8px); left: 4%; width: clamp(100px, 18%, 180px); height: 18px; }
.b-hud { position: absolute; width: clamp(190px, 35%, 340px); padding: 10px 14px; background: var(--lcd-2); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.b-hud.enemy { top: 12px; left: 12px; }
.b-hud.player { bottom: 18%; right: 12px; text-align: right; }
.b-hud-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.b-name { font: clamp(8px, 1.4vw, 13px) var(--font-pixel); }
.b-lv { font: clamp(6px, 1vw, 10px) var(--font-pixel); color: var(--ink-2); }
.b-hp { display: flex; align-items: center; gap: 8px; font: clamp(6px, 1vw, 10px) var(--font-pixel); }
.b-hp-bg { flex: 1; height: 10px; background: var(--lcd-1); border: 2px solid var(--ink); }
.b-hp-bar { height: 100%; width: 100%; background: var(--ink); transition: width .5s steps(8); }
.b-sprite { position: absolute; }
.b-sprite img { image-rendering: pixelated; filter: sepia(1) saturate(4) hue-rotate(40deg) brightness(.55); }
.b-sprite.enemy { top: 6%; right: 8%; }
.b-sprite.enemy img { height: clamp(100px, 22vh, 200px); animation: enter-enemy .6s ease-out both; }
.b-sprite.player { bottom: 20%; left: 8%; }
.b-sprite.player img { height: clamp(120px, 28vh, 240px); transform: scaleX(-1); animation: enter-player .6s ease-out .2s both; }
@keyframes enter-enemy { from { opacity: 0; transform: translateX(40px); } }
@keyframes enter-player { from { opacity: 0; transform: scaleX(-1) translateX(-40px); } }
.b-sprite.enemy.shake img { animation: shake .35s steps(2) !important; }
.b-sprite.player.shake img { animation: shake-flip .35s steps(2) !important; }
.b-sprite.flash img { animation: flash .25s steps(2) !important; }
.b-sprite.enemy.faint img { animation: faint .6s steps(3) forwards !important; }
.b-sprite.player.win img { animation: win .45s steps(2) infinite alternate !important; }
@keyframes shake { 33% { transform: translateX(-12px); } 66% { transform: translateX(12px); } }
@keyframes shake-flip { 33% { transform: scaleX(-1) translateX(-12px); } 66% { transform: scaleX(-1) translateX(12px); } }
@keyframes flash { 50% { opacity: .08; } }
@keyframes faint { to { opacity: 0; transform: translateY(50px); } }
@keyframes win { to { transform: scaleX(-1) translateY(-12px); } }

.b-bottom { display: flex; flex-shrink: 0; height: clamp(120px, 24vh, 210px); border-top: 3px solid var(--ink); }
.b-dialog { position: relative; flex: 1; display: flex; align-items: center; padding: 14px 18px; background: var(--lcd-2); border-right: 3px solid var(--ink); }
.b-text { font-family: var(--font-pixel); font-size: clamp(8px, 1.3vw, 14px); line-height: 2.2; white-space: pre-line; }
.b-menu { width: clamp(180px, 32%, 320px); display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 10px; background: var(--lcd-2); }
.b-menu .row { display: none; flex-direction: column; gap: 8px; height: 100%; }
.b-menu .row.visible { display: flex; }
.b-menu .moves.visible { display: grid; grid-template-columns: 1fr 1fr; }
.b-btn { flex: 1; background: var(--lcd-0); color: var(--lcd-3); border: 2px solid var(--lcd-1); cursor: pointer; font: clamp(7px, 1.1vw, 11px) var(--font-pixel); line-height: 1.7; padding: 4px 6px; }
.b-btn:hover { background: var(--lcd-1); }
.b-btn.alt { background: var(--lcd-1); }
.b-btn small { display: block; font-size: .75em; color: var(--lcd-2); }
.battle :focus-visible { outline-color: var(--gold); box-shadow: none; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photo { order: -1; width: 96px; height: 96px; }
  .detail-head { grid-template-columns: 1fr; }
  .detail-cover.cartridge { max-width: 340px; }
  .h-page { font-size: 13px; }
  .lightbox-stage { padding: 0 8px; }
  .lightbox .nav-btn { top: auto; bottom: -8px; transform: none; }
  .b-hud.enemy, .b-hud.player { width: 62%; }
  .b-menu { width: 46%; }
}
