/* howl-engine — shared look for all three artworks.
   macOS dark-mode Terminal: near-black desktop, translucent pure-black
   panes with opaque chrome, monochrome traffic lights, no blur. */
:root {
  /* stage size — set by the engine; below 1024px viewport width the whole
     desktop lays out at 1024 wide and is scaled down to fit */
  --stage-w: 100vw;
  --stage-h: 100vh;
  --desktop: #111111;
  --glass: rgba(0, 0, 0, 0.8);
  --fg: #E8E8E8;
  --dim: #9A9A9A;
  --faint: #6A6A6A;
  --bar: #1C1C1E;
  --bar-unfocused: #121214;
  --bar-border: rgba(0,0,0,.45);
  --titletext: #B9B9BE;
  --titletext-dim: #6E6E73;
  --light: #8A8A8A;
  --light-dim: #4E4E52;
  --cursor: #C8C8C8;
  --outline: rgba(255,255,255,.20);
  --outline-dim: rgba(255,255,255,.16);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--desktop);
  font-family: "Courier New", Courier, monospace;
  font-size: 10pt;
  line-height: normal;
  position: relative;
}
#desktop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.window {
  position: absolute;
  width: min(660px, calc(var(--stage-w) * 0.92));
  height: min(440px, calc(var(--stage-h) * 0.78));
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--glass);
  box-shadow: 0 28px 70px rgba(0,0,0,.65), 0 0 0 1px var(--outline);
  transition: box-shadow .25s ease, filter .25s ease;
  animation: spawn .28s ease-out;
}
@keyframes spawn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .window { animation: none; }
}

.titlebar {
  height: 28px;
  flex: none;
  background: var(--bar);
  border-bottom: 1px solid var(--bar-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  position: relative;
  user-select: none;
}
/* mac-faithful lights: three circles, all dimmed by default (unavailable
   controls dim, they don't disappear — per the HIG). only the close circle
   ever undims, once its poem's output is done; never on the boot window */
.lights { display: flex; gap: 8px; }
.light {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--light);
  opacity: .35;
  position: relative;
}
.light.closable { opacity: 1; cursor: pointer; }
.light.closable:hover::after {
  content: "×";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px; line-height: 1;
  color: var(--bar);
}
.titletext {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: var(--titletext);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 60px;
}

/* unfocused macOS window */
.window.unfocused {
  box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 1px var(--outline-dim);
}
.window.unfocused .titlebar { background: var(--bar-unfocused); }
.window.unfocused .light { background: var(--light-dim); }
.window.unfocused .titletext { color: var(--titletext-dim); }
.window.unfocused .screen { opacity: .6; }
.window.unfocused .cursor { animation: none; opacity: .45; }
/* the boot window stays at full brightness even when unfocused */
.window.boot.unfocused .screen { opacity: 1; }

.screen {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
  color: var(--fg);
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* old Edge */
}
.screen::-webkit-scrollbar { display: none; }  /* WebKit */

/* selected text inverts: background becomes the text color and vice versa */
.screen ::selection,
.screen::selection {
  background: var(--fg);
  color: var(--glass);
}

/* hanging indent: strophes start flush, wrapped continuations indent —
   the typography of the original book */
.line {
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 4ch;
  text-indent: -4ch;
}
.line:empty { min-height: 1.15em; }  /* blank lines actually take a row */
/* banners may use block glyphs (█ ░) that Courier New lacks — render them
   in a monospace that has them, so the frame stays on grid. never wrap
   preformatted art: it overflows instead, and the engine scales it down */
.line.banner {
  font-family: "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
  white-space: pre;
  padding-left: 0;
  text-indent: 0;
}
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.cursor {
  display: inline-block;
  width: .62em; height: 1.05em;
  background: var(--cursor);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---- print: only the hidden sheet, black on white, whatever the theme */
#printsheet { display: none; }
@page { margin: 12mm; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  /* center the sheet on the page, both axes (poems fit one page) */
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }
  #desktop { display: none; }
  /* line spacing identical to the console window: line-height normal,
     no margins between lines. fixed 9px type for everything, no scaling.
     the measure is capped at ~70 characters — the book's narrow column —
     so strophes wrap into hanging-indented lines instead of running the
     full page width */
  #printsheet {
    display: block;
    color: #000;
    font-family: "Courier New", Courier, monospace;
    font-size: 9px;
    line-height: normal;
    width: fit-content;   /* as wide as banner or poem column, centered as one block */
    max-width: 100%;
  }
  #printsheet .print-line { max-width: 70ch; }
  #printsheet .print-title { font-weight: bold; margin-bottom: 1em; }
  #printsheet .print-header {
    white-space: pre;
    margin-bottom: 4.6em;  /* ~4 lines of air before the verse */
    font-family: "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
  }
  #printsheet .print-line {
    white-space: pre-wrap;
    padding-left: 4ch;
    text-indent: -4ch;
  }
  #printsheet .print-footer { margin-top: 2em; color: #555; }
}
