/* ==========================================================================
   DUM Studio · windows.css
   Retro RPG-style windows (black box, thick white rounded border, pixel font,
   title set into the top border). Reusable on any page:
     <section class="rpg"><h2 class="rpg__title">TITLE</h2> ... </section>
   ========================================================================== */

:root {
  --rpg-bg: #000;
  --rpg-fg: #f4f2ef;
  --rpg-dim: #9a9690;
}

/* the layer that holds a set of windows */
.windows {
  position: absolute; z-index: 5;
  display: grid; gap: var(--rpg-gap) var(--rpg-gap);
  align-content: start; align-items: start;
  overflow: auto; overscroll-behavior: contain;
  padding: calc(var(--rpg-size) * .9 + 8px) 8px 8px;   /* room for the titles and the outer black ring */
  pointer-events: auto;
  scrollbar-width: none;
}
.windows::-webkit-scrollbar { display: none; }
.windows[hidden] { display: none; }
.windows--trio  { grid-template-columns: fit-content(50%) minmax(0, 1fr); grid-template-areas: "a b" "c c"; }   /* first window takes what it needs (up to half) */
.windows--pair  { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);     grid-template-areas: "a b"; }
.windows--stack { grid-template-columns: minmax(0, 1fr);                     grid-template-areas: "a" "b" "c" "d"; }
.windows--form  { grid-template-columns: minmax(0, 1fr); }

/* ---------- the window ---------- */
.rpg {
  --rpg-b: max(3px, calc(var(--u, 1px) * 8));
  position: relative; min-width: 0;
  margin: 0;
  padding: 1.5em 1.2em 1.2em;
  background: var(--rpg-bg); color: var(--rpg-fg);
  border: var(--rpg-b) solid var(--rpg-fg);
  border-radius: calc(var(--rpg-b) * 2.4);
  box-shadow: 0 0 0 var(--rpg-b) var(--rpg-bg);            /* black ring outside the white border */
  font: 400 var(--rpg-size)/1.75 var(--pixel);
  letter-spacing: .02em;
  -webkit-font-smoothing: none; font-smooth: never;
}
.rpg.is-opening { animation: rpg-open .22s steps(4, end) both; }
@keyframes rpg-open {
  from { clip-path: inset(50% 0 50% 0); }
  to   { clip-path: inset(-20px); }
}

/* title cut into the top border */
.rpg__title {
  position: absolute; top: 0; left: 50%;
  translate: -50% -58%;
  margin: 0; padding: 0 .5em;
  background: var(--rpg-bg);
  font: inherit; line-height: 1; white-space: nowrap;
}

/* ---------- stats: two columns, values right-aligned ---------- */
.rpg__stats { display: grid; grid-template-columns: auto auto; justify-content: space-between; gap: .35em 1.5em; margin: 0; }
.rpg__stats dt, .rpg__stats dd { margin: 0; }
.rpg__stats dd { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- list with a ▶ cursor ---------- */
.rpg__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55em; }
.rpg__list li { position: relative; padding-left: 1.3em; }
.rpg__list li::before {
  content: ""; position: absolute; left: 0; top: .3em;
  width: .6em; height: .75em; background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  visibility: hidden;
}
.rpg__list li.is-cursor::before { visibility: visible; animation: rpg-blink 1s steps(1) infinite; }
.rpg__list li:hover::before { visibility: visible; }

/* ---------- image ---------- */
.rpg--image { padding: 1.3em; }
.rpg__img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; max-width: 100%; background: #111; }

/* ---------- video: a little CRT inside the window ---------- */
.rpg__screen { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: #0a0a0a; }
.rpg__vid { display: block; width: 100%; height: 100%; object-fit: cover; max-width: 100%;
  animation: crt-flicker 3.2s steps(1) infinite; }
.rpg__crt { position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.3) 0 1px, transparent 1px 3px),
    radial-gradient(125% 115% at 50% 50%, transparent 55%, rgba(0,0,0,.7) 100%);
  box-shadow: inset 0 0 1.4em rgba(0,0,0,.85); }
.rpg__crt::after {                                   /* slow rolling hum bar */
  content: ""; position: absolute; left: 0; right: 0; height: 28%; top: -28%;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.07) 50%, transparent);
  animation: crt-roll 7s linear infinite; }
@keyframes crt-roll { to { top: 100%; } }
@keyframes crt-flicker { 0%,100% { opacity: 1; } 37% { opacity: .93; } 38% { opacity: 1; } 71% { opacity: .96; } 72% { opacity: 1; } }

/* ---------- dialog ---------- */
.rpg--dialog { cursor: var(--cur-link); padding: 1.7em 1.5em 2.6em; }
.rpg__body { display: grid; font-size: .85em; line-height: 1.85; }          /* dialog text a touch smaller */
.rpg__body > * { grid-area: 1 / 1; margin: 0; white-space: pre-wrap; }
.rpg__ghost { visibility: hidden; }
.rpg__more {
  position: absolute; right: 1em; bottom: .7em;
  width: .8em; height: .55em; background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: rpg-blink .8s steps(1) infinite;
}
.rpg__more[hidden] { display: none; }
.rpg__page { position: absolute; left: 1.2em; bottom: .5em; font-size: .7em; color: var(--rpg-dim); }
.rpg--dialog:focus-visible { outline: 2px dashed var(--rpg-fg); outline-offset: calc(var(--rpg-b) * 2); }

@keyframes rpg-blink { 50% { opacity: 0; } }

/* ==========================================================================
   Form windows (Contact)
   ========================================================================== */
.rpg-form {
  display: grid; gap: calc(var(--rpg-gap) + var(--rpg-size) * .6) var(--rpg-gap);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  grid-template-areas: "you msg" "band msg" "art send";
  align-items: stretch;
  font-size: .85em;
}
.rpg--field { padding: 1.5em 1.2em 1.1em; }
.rpg-form .rpg { font-size: calc(var(--rpg-size) * .78); }
.rpg--msg { display: flex; flex-direction: column; }

.field { position: relative; display: grid; gap: .45em; padding-left: 1.3em; }
.field + .field { margin-top: .8em; }
.field label { font-size: .8em; color: var(--rpg-dim); letter-spacing: .04em; }
/* ▶ cursor marks the field you're in, like the game menus */
.field::before {
  content: ""; position: absolute; left: 0; top: .15em;
  width: .6em; height: .75em; background: var(--rpg-fg);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  visibility: hidden;
}
.field:focus-within::before { visibility: visible; animation: rpg-blink 1s steps(1) infinite; }
.field:focus-within label { color: var(--rpg-fg); }
.field input, .field textarea {
  width: 100%; min-width: 0; margin: 0; padding: .45em .2em;
  background: transparent; color: var(--rpg-fg);
  border: 0; border-bottom: 2px dotted var(--rpg-fg); border-radius: 0;
  font: inherit; line-height: 1.5; caret-color: var(--rpg-fg);
  outline: none; cursor: text;
}
.field textarea { resize: none; min-height: 5.5em; flex: 1; border: 2px dotted var(--rpg-fg); padding: .6em; }
.field--grow { flex: 1; grid-template-rows: auto 1fr; }
.field input:focus, .field textarea:focus { border-bottom-style: solid; }
.field textarea:focus { border-style: solid; }
.field ::placeholder { color: var(--rpg-dim); opacity: .7; }
.field.is-bad label { color: #ff7a6b; }
.field.is-bad input, .field.is-bad textarea { border-color: #ff7a6b; }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--rpg-fg); box-shadow: 0 0 0 100px var(--rpg-bg) inset; }

/* artwork drop zone + thumbnails */
.drop {
  display: grid; gap: .5em; place-items: center; width: 100%;
  padding: .8em .8em; margin: 0;
  background: transparent; color: var(--rpg-fg);
  border: 2px dashed var(--rpg-fg); font: inherit;
}
.drop small { font-size: .7em; color: var(--rpg-dim); }
.drop__cue::before { content: ""; display: inline-block; width: .55em; height: .7em; margin-right: .6em; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.drop:hover, .drop:focus-visible, .drop.is-over { background: #fff1; outline: none; border-style: solid; }
.drop.is-busy .drop__cue { animation: rpg-blink .6s steps(1) infinite; }
.thumbs { list-style: none; margin: .9em 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6em, 1fr)); gap: .6em; }
.thumbs:empty { display: none; }
.thumbs li { position: relative; border: 2px solid var(--rpg-fg); background: #111; }
.thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumb__size { position: absolute; left: 0; bottom: 0; padding: .2em .3em; background: #000c; font-size: .55em; }
.thumb__x { position: absolute; top: -.6em; right: -.6em; width: 1.6em; height: 1.6em; padding: 0; border: 2px solid var(--rpg-fg); border-radius: 50%; background: var(--rpg-bg); color: var(--rpg-fg); font: inherit; font-size: .6em; line-height: 1; }
.thumb__x:hover, .thumb__x:focus-visible { background: var(--rpg-fg); color: var(--rpg-bg); outline: none; }
.meter { display: flex; align-items: center; gap: .7em; margin-top: .9em; font-size: .7em; }
.meter__bar { flex: 1; height: .9em; border: 2px solid var(--rpg-fg); padding: 1px; }
.meter__bar i { display: block; height: 100%; width: 0; background: var(--rpg-fg); transition: width .3s steps(8); }
.meter__txt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fine { margin: .9em 0 0; font-size: .6em; line-height: 1.6; color: var(--rpg-dim); }

/* send */
.rpg--send { display: flex; flex-direction: column; }
.send {
  align-self: flex-start; position: relative;
  padding: .7em 1.2em .7em 2em; margin: .2em 0 0;
  background: transparent; color: var(--rpg-fg);
  border: 2px solid var(--rpg-fg); font: inherit; letter-spacing: .1em;
}
.send::before { content: ""; position: absolute; left: .8em; top: 50%; translate: 0 -50%; width: .55em; height: .7em; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.send:hover::before, .send:focus-visible::before { animation: rpg-blink .8s steps(1) infinite; }
.send:hover, .send:focus-visible { background: var(--rpg-fg); color: var(--rpg-bg); outline: none; }
.send:disabled { opacity: .45; }
.status { margin: 1em 0 0; min-height: 3.4em; line-height: 1.7; }
.status.is-ok { color: #8dff7a; }
.status.is-err { color: #ff9a8b; }

@media (max-width: 760px), (max-aspect-ratio: 17/20) {
  .rpg-form { grid-template-columns: minmax(0, 1fr); grid-template-areas: "you" "band" "msg" "art" "send"; }
  .field input, .field textarea { font-size: max(16px, 1em); }       /* stops iOS zooming into fields */
}

@media (prefers-reduced-motion: reduce) {
  .rpg.is-opening { animation: none; }
  .rpg__more, .rpg__list li.is-cursor::before, .rpg__vid, .rpg__crt::after,
  .field:focus-within::before, .drop.is-busy .drop__cue, .send::before { animation: none !important; }
}
