/* OldCores - teaser page with an old Tibia client feeling */

/* self-hosted + preloaded; "block" hides text for a moment instead of
   swapping fonts after paint, so the layout does not jump on load */
@font-face {
  font-family: "Alegreya";
  font-weight: 400;
  font-display: block;
  src: url("fonts/alegreya-400.woff2") format("woff2");
}

@font-face {
  font-family: "Cinzel";
  font-weight: 400 900;
  font-display: block;
  src: url("fonts/cinzel.woff2") format("woff2");
}

@font-face {
  font-family: "Cinzel Decorative";
  font-weight: 900;
  font-display: block;
  src: url("fonts/cinzel-decorative-900.woff2") format("woff2");
}

:root {
  --stone: #5c5c5c;
  --stone-light: #8e8e8e;
  --stone-dark: #262626;
  --console: #1c1c1c;
  --text-outline: #000;
  --msg-white: #f0f0f0;
  --msg-green: #00e000;
  --msg-red: #f84848;
  --msg-yellow: #f0f000;
  --msg-orange: #f08800;
}

* {
  box-sizing: border-box;
}

html {
  background: #000;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* the gradient matches the image colours, so the first paint already looks
     like the night sky and nothing flashes while bg.webp loads */
  background:
    url("bg.webp") center top / cover no-repeat,
    linear-gradient(to bottom, #03040a 0%, #130b10 35%, #2a120e 60%, #000 85%);
  color: var(--msg-white);
  font-family: "Alegreya", Georgia, serif;
  font-size: 16px;
}

/* black 1px outline, like text in the game window */
.broadcast,
.log p,
.tabs button,
.button {
  text-shadow:
    -1px -1px 0 var(--text-outline),
    1px -1px 0 var(--text-outline),
    -1px 1px 0 var(--text-outline),
    1px 1px 0 var(--text-outline);
}

.teaser {
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 56px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- Inventory slot with the demon ---------- */

.slot {
  background: #2c2c2c;
  border: 3px solid;
  border-color: var(--stone-light) var(--stone-dark) var(--stone-dark) var(--stone-light);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 60px rgba(200, 60, 20, 0.25);
}

.slot img {
  display: block;
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

/* ---------- Title ---------- */

.logo {
  margin: 22px 0 0;
  font-family: "Cinzel Decorative", Georgia, serif;
  font-weight: 900;
  font-size: 72px;
  line-height: 1;
  background: linear-gradient(to bottom, #e6e6e6 0%, #a8a8a8 48%, #5e5e5e 52%, #9a9a9a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px #111;
  filter: drop-shadow(2px 3px 0 #000) drop-shadow(0 0 18px rgba(220, 70, 20, 0.35));
}

.broadcast {
  margin: 18px 0 28px;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--msg-red);
}

/* ---------- Client console ---------- */

.client {
  width: 100%;
  padding: 4px;
  text-align: left;
  background: var(--stone);
  border: 2px solid;
  border-color: var(--stone-light) var(--stone-dark) var(--stone-dark) var(--stone-light);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 4px;
}

.tabs button {
  padding: 3px 12px;
  background: #484848;
  border: 1px solid;
  border-color: #6e6e6e #2a2a2a #2a2a2a #6e6e6e;
  color: #c4c4c4;
  font-family: "Cinzel", Georgia, serif;
  font-size: 13px;
  cursor: pointer;
}

.tabs button:hover {
  color: var(--msg-white);
}

.tabs [aria-selected="true"] {
  background: #6a6a6a;
  color: var(--msg-white);
}

/* both panels share one grid cell, so the window keeps the height of the
   longer log and does not jump when switching tabs */
.logs {
  display: grid;
}

.logs > .log {
  grid-area: 1 / 1;
}

.logs > .log[hidden] {
  display: block;
  visibility: hidden;
}

.log {
  padding: 8px 10px;
  background: var(--console);
  border: 2px solid;
  border-color: var(--stone-dark) #7a7a7a #7a7a7a var(--stone-dark);
}

.log p {
  margin: 0 0 3px;
  line-height: 1.45;
}

.log p:last-child {
  margin-bottom: 0;
}

.msg-white { color: var(--msg-white); }
.msg-green { color: var(--msg-green); }
.msg-red { color: var(--msg-red); }
.msg-yellow { color: var(--msg-yellow); }
.msg-orange { color: var(--msg-orange); }

.cursor span {
  animation: blink 1s steps(1) infinite;
}

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

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

.button {
  margin-top: 22px;
  padding: 6px 26px;
  background: var(--stone);
  border: 2px solid;
  border-color: var(--stone-light) var(--stone-dark) var(--stone-dark) var(--stone-light);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--msg-white);
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: #686868;
}

/* pressed: bevel flips like a client button */
.button:active:not(:disabled) {
  border-color: var(--stone-dark) var(--stone-light) var(--stone-light) var(--stone-dark);
}

.button:disabled {
  color: var(--msg-green);
  cursor: default;
}

.waiting {
  width: 100%;
  margin-top: 22px;
}

.waiting-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.waiting .button {
  margin-top: 0;
  flex: none;
}

/* sunken field, like the text input in the client */
.input {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  padding: 6px 10px;
  background: var(--console);
  border: 2px solid;
  border-color: var(--stone-dark) #7a7a7a #7a7a7a var(--stone-dark);
  color: var(--msg-white);
  font-family: "Alegreya", Georgia, serif;
  font-size: 16px;
}

.input::placeholder {
  color: #7a7a7a;
}

.input:focus {
  outline: 1px solid var(--msg-yellow);
}

.waiting.done .input,
.waiting.done .waiting-note {
  display: none;
}

.waiting-note {
  margin: 8px 0 0;
  font-size: 14px;
  color: #b8a89a;
}

.waiting-count.error {
  color: var(--msg-red);
}

.waiting-count {
  min-height: 1.45em;
  margin: 10px 0 0;
  color: var(--msg-yellow);
  text-shadow:
    -1px -1px 0 var(--text-outline),
    1px -1px 0 var(--text-outline),
    -1px 1px 0 var(--text-outline),
    1px 1px 0 var(--text-outline);
}

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

.footer {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: #7a6a62;
}

/* ---------- Mobile ---------- */

@media (max-width: 520px) {
  .teaser {
    padding-top: 36px;
  }

  .logo {
    font-size: 48px;
  }

  .broadcast {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor span {
    animation: none;
  }
}
