/* ---------- Fonts ---------- */
@font-face {
  font-family: "Rando Mono";
  src: url("assets/fonts/RandoMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Rando Mono";
  src: url("assets/fonts/RandoMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Rando Mono";
  src: url("assets/fonts/RandoMono-Italic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
}
@font-face {
  font-family: "Rando Mono Chonk";
  src: url("assets/fonts/RandoMono-Chonk.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

/* ---------- Reset / base ---------- */
:root {
  --heading-blue: #0000b1;
}

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  background-color: var(--heading-blue);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--heading-blue);
  font-family: "Rando Mono", monospace;
  font-weight: 400;
  color: #060606;
}

.chonk {
  font-family: "Rando Mono", monospace;
  font-weight: 700;
}

/* ---------- Header / BSOD hero ---------- */
.bsod {
  background: var(--heading-blue);
  color: #f9f9f4;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
}

.bsod__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  max-width: 980px;
  width: 100%;
}

.bsod__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.bsod__smiley {
  font-family: "Rando Mono", monospace;
  font-weight: 700;
  font-size: 88px;
  letter-spacing: -8.8px;
  margin: 0;
  line-height: normal;
}

.bsod__headline {
  width: 937px;
  max-width: 100%;
  font-size: 32px;
  line-height: 0;
  margin: 0;
}

.bsod__headline p {
  margin: 0;
  line-height: normal;
}

.bsod__headline-line--mobile {
  display: none;
}

.bsod__start-code {
  font-size: 16px;
  line-height: normal;
  white-space: nowrap;
  margin: 0;
}

.bsod__cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.download-btn {
  background: #ffffff;
  color: #0000b1;
  font-family: "Rando Mono Chonk", "Rando Mono", monospace;
  font-weight: 400;
  font-size: 24px;
  padding: 8px 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}

.download-btn .aalt-glyph {
  white-space: pre;
}

.download-btn:active {
  background: #d9d9d9;
}

.bsod__footer {
  font-weight: 400;
  font-size: 16px;
  line-height: normal;
  margin: 0;
  white-space: nowrap;
}

/* ---------- Preview section ---------- */
/* Fluid grid of character containers with centered feature blocks */
.preview-section {
  background: #ffffff;
  --preview-cell-size: clamp(24px, 8vw, 40px);
  --preview-glyph-size: clamp(18px, 6vw, 30px);
  min-height: 100vh;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, var(--preview-cell-size));
  gap: 0;
  width: fit-content;
  margin: 0 auto;
}

.preview-section__char {
  width: var(--preview-cell-size);
  height: var(--preview-cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0000b1; /* Same blue as header */
  font-family: "Rando Mono", monospace;
  font-size: var(--preview-glyph-size);
  line-height: 1;
  user-select: none;
  overflow: hidden;
  position: relative;
}

.preview-section__glyph {
  display: block;
  width: 100%;
  text-align: center;
  letter-spacing: 0;
}

.preview-section__char--feature {
  background-color: #0000b1; /* Same blue as header */
  color: #ffffff;
  font-family: "Rando Mono", monospace;
  font-size: var(--preview-glyph-size);
  font-weight: 700;
  line-height: normal;
}

/* ---------- Character showcase ---------- */
/* Full-bleed grid of random glyphs from the font's own character set,
   evenly distributed edge-to-edge with zero gaps (populated by script.js). */
.showcase {
  background: #ffffff;
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.showcase__grid {
  display: grid;
  width: 100%;
  height: 100%;
}

.showcase__char {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0000b1;
  font-family: "Rando Mono", monospace;
  line-height: 1;
  user-select: none;
  overflow: hidden;
}

/* ---------- Section 1 / playground ---------- */
.section1 {
  background: #d3d3d3;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
}

/* ---------- fun.exe dialog (Windows 95 style) ---------- */
.dialog {
  --dialog-scale: 1;
  position: relative;
  width: 400px;
  border: 2px solid #797979;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  transform-origin: top left;
}

.dialog__titlebar {
  background: #0000b1;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog--download .dialog__titlebar {
  background: #44c21a;
}

.dialog--no .dialog__titlebar {
  background: #da9514;
}

.dialog--negative .dialog__titlebar {
  background: #b10000;
}

.dialog--party .dialog__titlebar {
  background: #da14cd;
}

.dialog__title {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
  letter-spacing: -2.4px;
}

.dialog__close {
  background: #ffffff;
  border: 1px solid #797979;
  width: 40px;
  height: 40px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000000;
  font-family: inherit;
  font-size: 24px;
  letter-spacing: -2.4px;
  cursor: pointer;
}

.dialog__close:active {
  background: #d9d9d9;
}

.dialog__body {
  background: #f0f0f0;
  padding: 12px;
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 155px;
}

.dialog__question {
  margin: 0;
  color: #060606;
  font-size: 24px;
  letter-spacing: normal;
  text-align: center;
  width: 320px;
}

.dialog--download .dialog__question {
  width: 258px;
}

.dialog--no .dialog__question {
  width: 246px;
  font-size: 20px;
}

.dialog--negative .dialog__question {
  width: 228px;
}

.dialog--party .dialog__question {
  width: 246px;
  font-size: 20px;
}

.dialog__actions {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.dialog__button {
  background: #ffffff;
  border: 1px solid #797979;
  padding: 8px;
  color: #000000;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: normal;
  white-space: nowrap;
  cursor: pointer;
}

.dialog__button:active {
  background: #e6e6e6;
}

.dialog__close:focus:not(:focus-visible),
.dialog__button:focus:not(:focus-visible) {
  outline: none;
}

/* Inactive / bouncing state */
.dialog--inactive {
  border-color: #797979;
}

.dialog--inactive .dialog__body {
  background: #ebebeb;
}

.dialog--inactive .dialog__question {
  color: #060606;
}

.dialog--inactive .dialog__close {
  background: #ffffff;
  border-color: #797979;
  color: #000000;
}

.dialog--inactive .dialog__button {
  background: #ffffff;
  border-color: #797979;
  color: #000000;
}

/* When the bounce is running, the dialog is pulled out of layout flow
   and positioned absolutely within .section1 so it can move freely.
   z-index keeps it above every ghost copy regardless of DOM order. */
.dialog--bouncing {
  position: absolute;
  top: 0;
  left: 0;
  cursor: default;
  z-index: 10000;
}

/* Ghost trail copies left behind during the bounce, always layered
   beneath the live dialog. */
.dialog-ghost {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  border: 2px solid #000000;
  background: #f0f0f0;
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 600px) {
  body {
    overflow-x: hidden;
  }

  .preview-section {
    --preview-cell-size: 46.8px;
    --preview-glyph-size: 32px;
    background: #ededed;
    min-height: calc(86 * var(--preview-cell-size));
    align-items: flex-start;
    justify-content: flex-start;
  }

  .preview-section__grid {
    margin: 0;
  }

  .bsod {
    min-height: 100svh;
    padding: 48px 16px;
  }

  .bsod__content {
    gap: 24px;
  }

  .bsod__smiley {
    font-size: clamp(56px, 20vw, 88px);
    letter-spacing: -0.1em;
  }

  .bsod__headline {
    width: 100%;
    font-size: clamp(22px, 6vw, 32px);
  }

  .bsod__headline-line--desktop {
    display: none;
  }

  .bsod__headline-line--mobile {
    display: block;
  }

  .bsod__start-code {
    max-width: 100%;
    font-size: clamp(12px, 4vw, 16px);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .download-btn {
    font-size: clamp(18px, 6vw, 24px);
  }

  .bsod__footer {
    max-width: 100%;
    font-size: 14px;
    white-space: normal;
  }

  .section1 {
    min-height: 100svh;
    padding: 48px 16px;
  }

  .dialog,
  .dialog-ghost {
    --dialog-scale: 0.75;
    width: min(400px, calc(100vw - 32px));
  }

  .dialog__titlebar {
    padding: 8px;
  }

  .dialog__title {
    font-size: 20px;
    letter-spacing: -2px;
  }

  .dialog__body {
    padding: 12px 8px;
  }

  .dialog__question {
    width: min(320px, 100%);
  }

  .dialog--download .dialog__question {
    width: min(258px, 100%);
  }

  .dialog--no .dialog__question {
    width: min(246px, 100%);
  }

  .dialog--negative .dialog__question {
    width: min(228px, 100%);
  }

  .dialog--party .dialog__question {
    width: min(246px, 100%);
  }

  .dialog__actions {
    width: 100%;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }

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