/* Mexikah Studio: the games portal. Every colour is defined once in the two token blocks below; nothing after them names a raw colour. */
:root {
  color-scheme: dark light;
  --ce-bg: #0e0c0b;
  --ce-surface: #171312;
  --ce-surface-2: #211b19;
  --ce-line: #342b27;
  --ce-line-strong: #8d7e74;
  --ce-text: #f4ece3;
  --ce-muted: #bcaea3;
  --ce-accent: #f2a31b;
  --ce-on-accent: #1a1006;
  --ce-focus: #f2a31b;
  /* Marks the current page. The accent itself is too pale to be seen as a marker on the light page, so there it is the text colour. */
  --ce-mark: var(--ce-accent);
  --ce-danger: #ff9488;
  --ce-scrim: rgb(14 12 11 / .5);
  --ce-tint-1: #1b4a3c;
  --ce-tint-2: #14505a;
  --ce-tint-3: #5b2230;
  --ce-tint-4: #5a4214;
  --ce-tint-5: #2e2a63;
  --ce-tint-6: #5a3321;
  --ce-media-s: 30%;
  --ce-media-l: 20%;
  --ce-media-ink: 58%;
  --ce-display: var(--wp--preset--font-family--display, ui-sans-serif, system-ui, sans-serif);
  --ce-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ce-radius: 12px;
  --ce-rail: 13.5rem;
  --ce-topbar: 4.5rem;
  --ce-admin: 0px;
  --ce-pad: clamp(1rem, 3vw, 2rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --ce-bg: #f3ebdd;
    --ce-surface: #fffaf0;
    --ce-surface-2: #e9dfcd;
    --ce-line: #d8cbb4;
    --ce-line-strong: #6e6152;
    --ce-text: #1f1812;
    --ce-muted: #54483c;
    --ce-focus: #1f1812;
    --ce-mark: var(--ce-text);
    --ce-danger: #b3261e;
    --ce-scrim: rgb(14 12 11 / .35);
    --ce-tint-1: #c9e3d6;
    --ce-tint-2: #c4e4e6;
    --ce-tint-3: #f2cdd3;
    --ce-tint-4: #f0dfb1;
    --ce-tint-5: #d3d3f0;
    --ce-tint-6: #efd2bf;
    --ce-media-s: 40%;
    --ce-media-l: 82%;
    --ce-media-ink: 36%;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ce-bg);
  color: var(--ce-text);
  font-family: var(--ce-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html.ce-locked, html.ce-locked body { overflow: hidden; }

/* The page is at least one screen tall, so on a short page the footer rests at the bottom. */
.wp-site-blocks { padding: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.wp-site-blocks > * + * { margin-block-start: 0; }
.wp-site-blocks > main { flex: 1 0 auto; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--ce-display); letter-spacing: -.02em; }

:focus-visible { outline: 3px solid var(--ce-focus); outline-offset: 3px; border-radius: 4px; }

.screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* The skip link is WordPress's own (every block theme gets one); it points at the main element's id. */

/* Top bar: brand and search. On a wide screen it stays at the top while the page scrolls. */
body.admin-bar { --ce-admin: 32px; }
@media (max-width: 782px) { body.admin-bar { --ce-admin: 46px; } }
/* The step-fret band (a stepped hook repeated along a line) is drawn once as a mask in fret.svg, so it takes whatever colour the tokens give it. */
.ce-topbar, .ce-footer { position: relative; }
.ce-topbar::after, .ce-footer::before {
  content: ""; position: absolute; left: 0; right: 0; height: 10px; background: var(--ce-line);
  -webkit-mask: url("fret.svg") repeat-x left center / auto 10px; mask: url("fret.svg") repeat-x left center / auto 10px;
}
.ce-topbar::after { bottom: 0; }
.ce-footer::before { top: 0; }
.ce-topbar { display: flex; align-items: center; gap: 1rem; min-height: var(--ce-topbar); padding: 0 var(--ce-pad) 10px; background: var(--ce-bg); }
.ce-brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; min-height: 44px; flex: none; }
.ce-brand__mark { width: 1.75rem; height: 1.75rem; flex: none; }
.ce-brand__mark rect { fill: var(--ce-accent); }
.ce-brand__mark path, .ce-brand__mark circle { fill: var(--ce-on-accent); }
.ce-brand__name { font-family: var(--ce-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.ce-brand__sub { font-weight: 400; color: var(--ce-muted); }
.ce-userbar { display: flex; align-items: center; gap: .5rem; flex: none; }
.ce-nav-link { display: inline-flex; align-items: center; min-height: 44px; padding-inline: .9rem; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--ce-text); }
.ce-nav-link:hover { background: var(--ce-surface); }
.ce-searchform { position: relative; flex: 1 1 auto; max-width: 32rem; margin-inline: auto; }
.ce-searchform__icon { position: absolute; left: .95rem; top: 50%; width: 1.1rem; height: 1.1rem; transform: translateY(-50%); color: var(--ce-muted); pointer-events: none; }
.ce-searchform__input {
  width: 100%; min-height: 48px; padding: .6rem 1rem .6rem 2.7rem; font: inherit;
  background: var(--ce-surface); color: var(--ce-text); border: 1px solid var(--ce-line-strong); border-radius: 999px;
}
.ce-searchform__input::placeholder { color: var(--ce-muted); }

/* Navigation: a strip that scrolls sideways on a phone, a rail down the left on a wide screen. */
.ce-rail { border-bottom: 1px solid var(--ce-line); }
.ce-rail ul { list-style: none; margin: 0; padding: .5rem var(--ce-pad); display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
.ce-rail li { flex: none; }
.ce-rail a {
  display: flex; align-items: center; min-height: 44px; padding-inline: 1rem; white-space: nowrap;
  border: 1px solid var(--ce-line-strong); border-radius: 999px; text-decoration: none; font-weight: 500; color: var(--ce-text);
}
.ce-rail a:hover { background: var(--ce-surface); }
.ce-rail a[aria-current="page"] { background: var(--ce-accent); color: var(--ce-on-accent); border-color: var(--ce-mark); font-weight: 600; }
.ce-rail__label { display: none; }

@media (min-width: 60rem) {
  .wp-site-blocks > header { position: sticky; top: var(--ce-admin); z-index: 30; }
  .ce-rail {
    position: fixed; top: calc(var(--ce-topbar) + var(--ce-admin)); bottom: 0; left: 0; width: var(--ce-rail); overflow-y: auto;
    padding: .75rem .75rem 2rem; border-bottom: 0; border-right: 1px solid var(--ce-line); background: var(--ce-bg);
  }
  .ce-rail ul { display: block; padding: 0; overflow: visible; }
  .ce-rail a { border: 0; border-radius: 8px; padding-inline: .85rem; color: var(--ce-muted); }
  .ce-rail a:hover { color: var(--ce-text); }
  .ce-rail a[aria-current="page"] { background: var(--ce-surface-2); color: var(--ce-text); box-shadow: inset 3px 0 0 var(--ce-mark); }
  .ce-rail__label { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--ce-muted); padding: 1.25rem .85rem .35rem; }
  .ce-main, .wp-site-blocks > footer { margin-left: var(--ce-rail); }
}

/* Pages */
.ce-main { padding: 1.5rem var(--ce-pad) 4rem; min-width: 0; }
.ce-view { max-width: 96rem; }
.ce-view__title { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.1; margin: .25rem 0 .5rem; }
.ce-view__count { margin: 0 0 1.25rem; color: var(--ce-muted); }
.ce-view__intro { color: var(--ce-muted); max-width: 40rem; }
.ce-note { margin: 1rem 0; padding: 2rem 1.25rem; border: 1px dashed var(--ce-line-strong); border-radius: var(--ce-radius); color: var(--ce-muted); font-size: 1.05rem; text-wrap: pretty; }
.ce-note__link { color: var(--ce-text); font-weight: 600; text-underline-offset: 3px; }

/* Collection tiles */
.ce-tiles { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; gap: .75rem; overflow-x: auto; scrollbar-width: none; }
.ce-tiles li { flex: 0 0 clamp(9.5rem, 38vw, 12rem); }
.ce-tile {
  display: flex; align-items: flex-end; min-height: 5rem; padding: .85rem 1rem; border-radius: var(--ce-radius);
  background: var(--tint, var(--ce-tint-1)); color: var(--ce-text); font-family: var(--ce-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-decoration: none;
  transition: transform .15s ease;
}
.ce-tile:hover { transform: translateY(-2px); }
.ce-tiles li:nth-child(6n+1) { --tint: var(--ce-tint-1); }
.ce-tiles li:nth-child(6n+2) { --tint: var(--ce-tint-2); }
.ce-tiles li:nth-child(6n+3) { --tint: var(--ce-tint-3); }
.ce-tiles li:nth-child(6n+4) { --tint: var(--ce-tint-4); }
.ce-tiles li:nth-child(6n+5) { --tint: var(--ce-tint-5); }
.ce-tiles li:nth-child(6n+6) { --tint: var(--ce-tint-6); }

/* Rows and grids of games */
.ce-row { margin-top: 2rem; }
.ce-row__head { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.ce-row__title { font-size: 1.3rem; margin: 0; flex: 1 1 auto; }
.ce-row__all { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ce-muted); text-underline-offset: 3px; }
.ce-row__all:hover { color: var(--ce-text); }
.ce-row__arrows { display: flex; gap: .4rem; }
.ce-arrow {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  background: var(--ce-surface); color: var(--ce-text); border: 1px solid var(--ce-line-strong); border-radius: 50%;
}
.ce-arrow svg { width: 1rem; height: 1rem; }
.ce-arrow:hover:not(:disabled) { background: var(--ce-surface-2); }
.ce-arrow:disabled { opacity: .4; cursor: default; }
.ce-row__track { list-style: none; margin: 0; padding: 0 0 .5rem; display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.ce-row__track .ce-card { flex: 0 0 clamp(9.5rem, 40vw, 13.5rem); scroll-snap-align: start; }
.ce-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); }

.ce-card { margin: 0; }
.ce-card__link { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; }
.ce-media {
  display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--ce-radius);
  background: hsl(var(--h, 220) var(--ce-media-s) var(--ce-media-l)); transition: transform .15s ease;
}
.ce-media img { width: 100%; height: 100%; object-fit: cover; }
.ce-media__initial { font-family: var(--ce-display); font-weight: 700; font-size: 3.5rem; line-height: 1; color: hsl(var(--h, 220) 30% var(--ce-media-ink)); }
.ce-card__link:hover .ce-media { transform: translateY(-3px); }
.ce-card__title { margin-top: .5rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ce-card__meta { color: var(--ce-muted); font-size: .875rem; }

/* A game's page */
.ce-player { margin-top: .75rem; }
.ce-player__stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 80vh; max-height: 80dvh; overflow: hidden;
  border-radius: var(--ce-radius); background: var(--ce-surface);
}
.ce-player--landscape .ce-player__stage { width: min(100%, calc(80dvh * 16 / 9)); }
.ce-player--portrait .ce-player__stage { aspect-ratio: 9 / 16; width: min(100%, calc(78dvh * 9 / 16)); margin-inline: auto; }
.ce-player__stage .ce-media { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; transform: none; }
.ce-player__stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--ce-bg); }
.ce-play { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ce-scrim); text-decoration: none; }
.ce-play__button {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 56px; padding: 0 2rem;
  background: var(--ce-accent); color: var(--ce-on-accent); font-weight: 700; font-size: 1.2rem; border-radius: 999px; transition: transform .15s ease;
}
.ce-play__button svg { width: 1.1rem; height: 1.1rem; }
.ce-play:hover .ce-play__button { transform: scale(1.05); }
.ce-player__bar { display: flex; justify-content: flex-end; padding-top: .6rem; }
.ce-player--landscape .ce-player__bar { width: min(100%, calc(80dvh * 16 / 9)); }
.ce-player--portrait .ce-player__bar { width: min(100%, calc(78dvh * 9 / 16)); margin-inline: auto; }
.ce-player__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.ce-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none;
  background: transparent; color: var(--ce-text); border: 1px solid var(--ce-line-strong); border-radius: 8px;
}
.ce-btn:hover { background: var(--ce-surface); }
.ce-btn--primary { background: var(--ce-accent); color: var(--ce-on-accent); border-color: var(--ce-mark); font-weight: 600; }
.ce-btn--primary:hover { background: var(--ce-accent); filter: brightness(.95); }
.ce-btn--danger { color: var(--ce-danger); border-color: var(--ce-danger); font-weight: 600; }
.ce-player.is-full { display: flex; flex-direction: column; background: var(--ce-bg); padding: .5rem; margin: 0; }
.ce-player.is-theater { position: fixed; inset: 0; z-index: 100; }
.ce-player.is-full .ce-player__stage { flex: 1 1 auto; width: 100%; max-height: none; aspect-ratio: auto; margin: 0; }
.ce-player.is-full .ce-player__bar { width: 100%; }

.ce-about { max-width: 46rem; margin-top: 1.25rem; color: var(--ce-muted); }
.ce-about p { margin: 0 0 1rem; }
.ce-tags { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.ce-tag { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--ce-line-strong); border-radius: 999px; color: var(--ce-text); text-decoration: none; font-weight: 500; }
.ce-tag:hover { background: var(--ce-surface); }

/* Account pages */
.ce-form { display: grid; gap: 1rem; max-width: 26rem; margin-block: 1rem; justify-items: start; }
.ce-form > * { max-width: 100%; }
.ce-field { display: grid; gap: .35rem; width: 100%; }
.ce-field label { font-weight: 600; }
.ce-input { width: 100%; min-height: 48px; padding: .6rem .9rem; font: inherit; background: var(--ce-surface); color: var(--ce-text); border: 1px solid var(--ce-line-strong); border-radius: 8px; }
.ce-input[aria-invalid="true"] { border-color: var(--ce-danger); }
.ce-field__hint, .ce-form__small { margin: 0; color: var(--ce-muted); font-size: .9rem; }
.ce-form .ce-field__error { margin: 0; color: var(--ce-danger); font-weight: 500; }
.ce-alert { margin: 0; padding: .85rem 1rem; border: 1px solid var(--ce-danger); border-radius: var(--ce-radius); background: var(--ce-surface); }
.ce-page .ce-alert { color: var(--ce-text); }
.ce-alert--ok { border-color: var(--ce-mark); margin-block: 1rem; }
.ce-check { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.ce-check input { width: 1.25rem; height: 1.25rem; accent-color: var(--ce-mark); }
.ce-form__alt { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin: 0; }
.ce-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ce-section { margin-top: 2.5rem; }
.ce-section h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
.ce-facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 1rem; }
.ce-facts dt { color: var(--ce-muted); }
.ce-facts dd { margin: 0; overflow-wrap: anywhere; }
.ce-danger { border: 1px solid var(--ce-danger); border-radius: var(--ce-radius); padding: .25rem 1rem 1rem; max-width: 30rem; }
.ce-danger summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--ce-danger); font-weight: 600; }
.ce-save { margin-top: 1rem; }
.ce-save .ce-form { margin: 0; }

/* Footer, plain pages, the 404 */
.ce-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: calc(1.5rem + 10px) var(--ce-pad) 1.5rem; color: var(--ce-muted); font-size: .95rem; }
.ce-footer a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 3px; }
.ce-page { max-width: 46rem; padding-block: 1rem; }
.ce-page h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 1.25rem; }
.ce-page p { color: var(--ce-muted); }
.ce-page__back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ce-text); }

@media (hover: none) { .ce-row__arrows { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .ce-media, .ce-tile, .ce-play__button { transition: none; }
  .ce-card__link:hover .ce-media, .ce-tile:hover, .ce-play:hover .ce-play__button { transform: none; }
}

@media (max-width: 40rem) {
  .ce-userbar__extra { display: none; }
  /* Two rows on a phone: the studio's name with the account link, then a search box as wide as the screen. */
  .ce-topbar { flex-wrap: wrap; row-gap: .25rem; padding-top: .5rem; }
  .ce-userbar { margin-left: auto; }
  .ce-searchform { order: 3; flex: 1 0 100%; max-width: none; margin-inline: 0; }
}
