/* Roost landing page. Colours: ink #120D24, purple #241B3D / #3A2F5E, gold #FFC94D, paper #F1E3C4. */
@font-face { font-family: "Press Start 2P"; src: url("../fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Fredoka"; font-weight: 400; src: url("../fonts/Fredoka-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Fredoka"; font-weight: 600; src: url("../fonts/Fredoka-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Fredoka"; font-weight: 700; src: url("../fonts/Fredoka-Bold.ttf") format("truetype"); font-display: swap; }

:root { --ink: #120D24; --deep: #241B3D; --purple: #3A2F5E; --gold: #FFC94D; --paper: #F1E3C4; --px: "Press Start 2P", monospace; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* everything below is in rem, so large monitors scale the whole UI up from here; % keeps the visitor's own font size */
html { font-size: 100%; }
@media (min-width: 1024px) and (min-height: 501px) { html { font-size: clamp(100%, 0.55vw + 0.5rem, 175%); } }

body {
  margin: 0; background: var(--ink); color: var(--paper);
  font-family: "Fredoka", system-ui, sans-serif; font-size: 1rem; line-height: 1.3;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
/* the scenery fills the window down to the top of the HUD bar (sized in app.js) */
#scene { position: fixed; top: 0; left: 0; z-index: -1; }
canvas, #wp-img { image-rendering: crisp-edges; image-rendering: pixelated; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; box-shadow: 0 0 0 6px var(--ink); }

/* ------------------------------------------------------------ hero */
main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: 8vh 1rem 1rem; padding-top: 8svh; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.brand { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
/* the icon is 32 art pixels across: sizes are multiples of 32 px so every art pixel lands on whole screen pixels */
.brand img { order: -1; width: 96px; height: auto; aspect-ratio: 1; border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink); box-sizing: content-box; }
h1 { margin: 0 0 8px; font: 400 clamp(32px, 12vw, 56px)/1 var(--px); color: var(--paper); letter-spacing: .04em;
  text-shadow: 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 4px 0 var(--ink), 0 -4px 0 var(--ink),
    4px 4px 0 var(--ink), -4px 4px 0 var(--ink), 4px -4px 0 var(--ink), -4px -4px 0 var(--ink), 0 8px 0 var(--ink); }
.tag { margin: 0; padding: .35rem .75rem; background: var(--ink); color: var(--paper); font-weight: 600; font-size: clamp(.9rem, 4.6vw, 1.125rem); }

.cta { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 20rem; margin-top: .5rem; }
.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  min-height: 3rem; padding: .6rem .75rem; margin: 0 0 4px; border: 4px solid var(--ink); border-radius: 0; box-shadow: 0 4px 0 var(--ink);
  font: 400 .75rem/1.3 var(--px); text-decoration: none; text-align: center; cursor: pointer; color: var(--ink); background: var(--paper); }
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn.android { background: var(--gold); }
.btn.ios[aria-disabled="true"] { background: var(--purple); color: var(--paper); border-style: dashed; border-color: var(--paper); cursor: not-allowed; }
.btn.ios[aria-disabled="true"]:active { transform: none; box-shadow: 0 4px 0 var(--ink); }
.btn small { font: 600 .8rem/1 "Fredoka", sans-serif; }
.btn:disabled { background: var(--purple); color: var(--paper); border-style: dashed; cursor: not-allowed; }
.btn:hover:not(:disabled):not([aria-disabled="true"]) { filter: brightness(1.08); }

/* ------------------------------------------------------------ HUD: a bar along the bottom of the window
   Phones: clock, scenery name, Pause / slider, Now. Wider: one row. The Now button always keeps its place
   (invisible while live), so the slider never moves under the pointer. */
.hud { position: sticky; bottom: 0; z-index: 1; width: 100%; background: var(--ink); color: var(--paper); border-top: 4px solid var(--purple);
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem;
  padding: .25rem .75rem calc(.25rem + env(safe-area-inset-bottom)); }
#clock { order: 1; font: 400 1rem/1 var(--px); color: var(--gold); white-space: nowrap; }
.colon { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.today { order: 2; flex: 1 1 0; min-width: 0; font-size: .95rem; line-height: 1.15; text-align: left; }
#pause { order: 3; }
.scrub { order: 4; flex: 1 1 calc(100% - 6rem); display: flex; align-items: center; }
#now { order: 5; }
.mini { min-height: 2.75rem; min-width: 2.75rem; padding: .3rem .6rem; border: 2px solid var(--paper); border-radius: 0; background: var(--deep); color: var(--paper);
  font: 400 .625rem/1 var(--px); cursor: pointer; }
.mini:hover { background: var(--purple); }
.mini:active { transform: translateY(2px); }
.mini.off { visibility: hidden; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 2.75rem; margin: 0; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: .5rem; background: var(--purple); border: 2px solid var(--paper); }
input[type=range]::-moz-range-track { height: .25rem; background: var(--purple); border: 2px solid var(--paper); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1rem; height: 1.5rem; margin-top: calc(-.5rem - 3px); background: var(--gold); border: 3px solid var(--ink); border-radius: 0; box-shadow: 0 0 0 2px var(--paper); }
input[type=range]::-moz-range-thumb { width: .625rem; height: 1.125rem; background: var(--gold); border: 3px solid var(--ink); border-radius: 0; box-shadow: 0 0 0 2px var(--paper); }

/* ------------------------------------------------------------ layouts */
@media (max-width: 399px) { .today span { display: none; } }
@media (min-width: 600px) {
  .brand img { width: 128px; }
  h1 { font-size: 64px; }
  .cta { flex-direction: row; flex-wrap: wrap; max-width: 34rem; justify-content: center; }
  .cta .btn { flex: 1 1 14rem; }
  .cta .wall { flex: 0 1 50%; }
  .hud { flex-wrap: nowrap; padding-left: max(.75rem, calc(50% - 22rem)); padding-right: max(.75rem, calc(50% - 22rem)); }
  .today { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #now { order: 3; } #pause { order: 4; }
  .scrub { order: 5; flex: 1 1 8rem; }
}
@media (min-width: 1024px) {
  main { padding-top: 10vh; }
  h1 { font-size: clamp(72px, 6vw, 128px); }
  .brand img { width: 160px; width: round(down, clamp(128px, 10vw, 224px), 32px); }
}
/* phone landscape: two columns, one thin HUD row */
@media (max-height: 500px) and (min-width: 480px) {
  main { max-width: 46rem; padding: .75rem 1rem; display: grid; grid-template: "brand cta" auto "tag cta" auto / 1fr minmax(15rem, 18rem); align-content: center; align-items: center; justify-items: center; gap: .75rem 1.25rem; }
  .brand { grid-area: brand; flex-direction: row; }
  .brand img { width: 64px; }
  h1 { font-size: 32px; margin: 0; }
  .tag { grid-area: tag; font-size: 1rem; }
  .cta { grid-area: cta; flex-direction: column; flex-wrap: nowrap; margin: 0; max-width: none; }
  .cta .btn, .cta .wall { flex: none; min-height: 48px; padding: .3rem .5rem; }
  .hud { flex-wrap: nowrap; border-top-width: 2px; padding: 0 .75rem env(safe-area-inset-bottom); }
  .today { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #now { order: 3; } #pause { order: 4; }
  .scrub { order: 5; flex: 1 1 8rem; }
}

/* ------------------------------------------------------------ wallpaper dialog */
dialog { background: var(--ink); color: var(--paper); border: 4px solid var(--paper); border-radius: 0; padding: 0; width: min(68rem, 94vw); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(18, 13, 36, .8); }
dialog header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; padding: .5rem 1rem; background: var(--deep); border-bottom: 4px solid var(--paper); }
dialog header form { margin: 0; }
h2 { margin: 0; font: 400 .9rem/1.3 var(--px); color: var(--gold); }
.wp { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 1fr); gap: 1.25rem; padding: 1rem; align-items: start; }
.wp-preview { position: sticky; top: 5.25rem; text-align: center; }
/* the preview canvas is sized in app.js to a whole multiple of its pixel grid, so it is as crisp as the download */
.box { height: min(56vh, 34rem); background: #0B0A1E; border: 2px solid var(--purple); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.box canvas { flex: none; }
.cap { margin: .5rem 0 0; font-size: .95rem; }
.err { margin: .5rem 0; color: var(--ink); background: var(--gold); font-weight: 600; padding: .3rem .6rem; }
.err:empty { display: none; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; justify-content: center; }
.get .btn { flex: 1 1 12rem; }
#wp-result { margin-top: 1rem; text-align: center; }
#wp-img { max-width: 100%; max-height: 40vh; border: 4px solid var(--paper); }

.field { margin: 0 0 1.1rem; display: grid; gap: .5rem; }
.field > label:not(.check), legend { font: 400 .7rem/1.4 var(--px); color: var(--gold); }
.field output { color: var(--paper); margin-left: .5rem; }
select, input[type=number] { width: 100%; min-height: 2.75rem; padding: .3rem .5rem; border: 3px solid var(--paper); border-radius: 0; background: var(--paper); color: var(--ink); font: 600 1rem "Fredoka", sans-serif; }
.wh { flex-wrap: nowrap; justify-content: stretch; }
.wh label { flex: 1; min-width: 0; font-weight: 600; text-align: left; }
.field .row { justify-content: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { min-height: 2.75rem; min-width: 2.75rem; padding: .2rem .7rem; border: 2px solid var(--paper); border-radius: 0; background: var(--deep); color: var(--paper); font: 600 .95rem "Fredoka", sans-serif; cursor: pointer; }
.chips button:hover { background: var(--purple); }
.check { display: flex; align-items: center; gap: .5rem; min-height: 2.75rem; font-weight: 600; cursor: pointer; }
input[type=checkbox] { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--gold); flex: none; }
fieldset { margin: 0; padding: .25rem .6rem; border: 2px solid var(--purple); display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0 .5rem; }

@media (max-height: 500px) { .box { height: min(56vh, calc(92vh - 9rem)); } }
@media (max-width: 699px) {
  dialog { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; border: 0; margin: 0; }
  .wp { grid-template-columns: minmax(0, 1fr); }
  .wp-preview { position: static; }
  .box { height: 38vh; }
}
/* tall phones: the preview stays in view under the title while the options scroll */
@media (max-width: 699px) and (min-height: 560px) {
  .wp-preview { position: sticky; top: 4.25rem; z-index: 1; background: var(--ink); margin: -1rem -1rem 0; padding: .5rem 1rem; border-bottom: 2px solid var(--purple); }
  .box { height: 30vh; }
}

.noscript { position: relative; margin: 1rem; padding: .75rem; background: var(--ink); color: var(--paper); }
.noscript a { color: var(--gold); }
pre#selftest { margin: 0; padding: 1rem; background: var(--ink); color: var(--paper); white-space: pre-wrap; position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .colon { animation: none; }
  .btn:active, .mini:active { transform: none; }
}
