/* ============================================================
   haunt.love — main stylesheet
   two fonts only: times new roman (the voice), courier new
   (the machine). palette: near-black, off-white, one bruised
   red. default-blue links, kept on purpose.
   no rounded corners. no shadows. no transitions. on purpose.
   underlying grid: 8px spacing unit, 12 columns on the
   product page. things sit "wrong" on it, not off it.
   ============================================================ */

:root {
  --ink: #131210;        /* near-black */
  --bone: #f1ede4;       /* off-white */
  --bruise: #6e1423;     /* the one accent. dried red. */
  --link-blue: #0000ee;  /* the browser default, chosen, not inherited */
  --rule: 1px solid var(--ink);
}

/* ---- noct: the same site, lights off --------------------- */
/* everything below reads from the variables, so swapping them
   here inverts the whole site — hovers and rules included. */
html.noct {
  --ink: #f1ede4;        /* the bone, by night */
  --bone: #131210;       /* the dark itself */
  --bruise: #b04a5e;     /* brighter, so the wound still reads */
  --link-blue: #8a8aff;  /* default blue drowns in the dark. lifted. */
}

/* ---- reset, minimal ------------------------------------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--bone);
  scroll-behavior: auto; /* no smooth scroll, ever */
}

body {
  font-family: "Times New Roman", Times, serif;
  color: var(--ink);
  background: var(--bone);
  line-height: 1.4;
  min-height: 100vh;
}

.mono {
  font-family: "Courier New", Courier, monospace;
}

/* author display rules below would otherwise beat the browser's
   own [hidden] handling. they don't get to. */
[hidden] {
  display: none !important;
}

a {
  color: var(--link-blue);
}

a:visited {
  color: var(--link-blue); /* the site does not remember you */
}

/* ---- focus: visible and ugly, as promised ---------------- */

:focus-visible {
  outline: 3px solid var(--bruise);
  outline-offset: 2px;
}

/* ---- shared header (catalogue, product) ------------------ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: var(--rule);
  padding: 8px 16px;
}

.wordmark-link {
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark-link:visited {
  color: var(--ink);
}

.wordmark-link:hover {
  background: var(--ink);
  color: var(--bone);
}

.header-meta {
  text-align: right;
}

.region-label {
  font-size: 12px;
}

/* the light switch. small text, under the location data.
   .quiet-button borrows the look for other small verbs (the séance's
   "step out" and "conduct") without borrowing the light switch's job. */
.noct-toggle,
.quiet-button {
  background: none;
  border: 0;
  padding: 0;
  font-size: 11px;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

.noct-toggle:hover,
.quiet-button:hover {
  background: var(--ink);
  color: var(--bone);
}

.landing-noct {
  margin: 24px 0 0 8.333%;      /* same column as the regions */
  font-size: 11px;
}

/* ---- page 1: landing. generous dead space. --------------- */

.landing {
  position: relative;
  min-height: calc(100vh - 32px);
  margin: 16px;                 /* the frame floats inside the viewport */
  border: var(--rule);
  padding: 24px;
}

.wordmark {
  font-size: 20px;
  font-weight: normal;
  letter-spacing: 0.04em;
}

.region-select {
  margin-top: 33vh;             /* deliberately too far down */
  margin-left: 8.333%;          /* one column in, off-center */
}

.region-instruction {
  font-size: 12px;
  margin-bottom: 24px;
}

.region-list {
  list-style: none;
}

.region-list li {
  margin-bottom: 8px;
}

.region-list a {
  display: inline-block;
  font-size: 28px;
  padding: 0 8px 0 0;
}

.region-list a:hover {
  background: var(--ink);
  color: var(--bone);
}

.region-index {
  font-size: 12px;
  margin-right: 16px;
  vertical-align: 4px;
}

.landing-whisper {
  position: absolute;
  right: 16px;
  bottom: 8px;
  font-size: 10px;
}

/* ---- page 1b: the hall. the same frame, further in. -------- */

/* the hall borrows the landing's bones. its wordmark is a way out. */
.wordmark .wordmark-link {
  font-size: inherit;
  letter-spacing: inherit;
}

/* a door that doesn't open. present, named, and not a link. */
.door-closed {
  font-size: 28px;
  color: var(--ink);
  opacity: 0.45;
}

.door-closed .door-closed-name {
  text-decoration: line-through;
}

.door-closed .door-closed-note {
  font-size: 12px;
}

/* ---- page 2: catalogue. oppressive density. --------------- */

.catalogue-title {
  font-size: clamp(56px, 14vw, 176px);
  font-weight: normal;
  letter-spacing: -0.04em;
  line-height: 0.9;
  padding: 8px 16px 0;
  border-bottom: var(--rule);
}

.catalogue-note {
  font-size: 12px;
  padding: 8px 16px;
  border-bottom: var(--rule);
}

.product-list {
  list-style: none;
}

.product-row {
  border-bottom: var(--rule);
}

.product-link {
  display: grid;
  grid-template-columns: 4ch 1fr auto auto auto;
  gap: 16px;
  align-items: baseline;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
}

.product-link:visited {
  color: var(--ink);
}

/* nothing else until hover. then everything inverts. */
.product-link:hover,
.product-link:focus {
  background: var(--ink);
  color: var(--bone);
}

.product-index {
  font-size: 12px;
}

.product-link .product-name {
  font-size: 24px;
}

.product-whisper {
  font-style: italic;
  font-size: 14px;
  visibility: hidden;
  text-align: right;
}

.product-link:hover .product-whisper,
.product-link:focus .product-whisper {
  visibility: visible;
}

.product-link .product-stock {
  font-size: 12px;
  text-align: right;
}

.product-link .product-price {
  font-size: 14px;
  text-align: right;
  min-width: 14ch;
}

/* ---- the key. lives on the correspondence page now. --------- */
/* one thing to verify. the machine font, throughout. */

.keyblock {
  padding: 16px;
}

.key-meta {
  list-style: none;
  font-size: 13px;
}

.key-meta li {
  padding: 8px 0;
  display: grid;
  grid-template-columns: 12ch 1fr;
  gap: 16px;
}

.key-meta .key-field {
  color: var(--bruise);
}

/* the armored block. it overflows on purpose if it must; the key is
   the key. select-all is the only interaction it offers. */
.key-armor {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  padding: 16px;
  margin: 16px;
  -webkit-user-select: all;
  user-select: all;
}

.key-download {
  font-size: 13px;
  padding: 0 16px 24px;
}

/* ---- page 2c: correspondence. the letterbox and the key. ---- */

.corr-block {
  padding: 0 16px;
  max-width: 72ch;
}

/* the form came from the product page; here it needs no border above */
.corr-form {
  margin-top: 24px;
  border-top: 0;
  padding-top: 0;
}

.corr-seal-line {
  font-size: 13px;
  margin-bottom: 8px;
}

.corr-seal-line input {
  margin-right: 8px;
}

/* a second catalogue-note, mid-page, introducing the key */
.corr-key-title {
  font-weight: normal;
  border-top: var(--rule);
  margin-top: 32px;
}

/* ---- page 3: product. dead space again. ------------------- */

.back-line {
  padding: 16px;
}

.product-layout {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding: 0 32px 64px 16px; /* extra right room for the marginalia */
}

/* the "photograph": a bordered box with words in it */
.product-image {
  grid-column: 1 / 7;
  border: var(--rule);
  min-height: 64vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 13px;
}

.product-image img {
  display: block;
  width: 100%;
  height: auto;
}

.product-details {
  grid-column: 8 / 13;          /* column 7 stays empty. it's fine. */
  padding-top: 8vh;             /* details start lower than the image. also fine. */
}

.product-details .product-name {
  font-size: 40px;
  font-weight: normal;
  letter-spacing: -0.02em;
}

.product-details .product-price {
  font-size: 16px;
  margin: 8px 0;
  padding-bottom: 8px;
  border-bottom: var(--rule);
}

.product-details .product-stock {
  font-size: 12px;
  margin-bottom: 24px;
}

.product-copy p {
  font-size: 17px;
  margin-bottom: 8px;
  max-width: 36ch;
}

.product-options {
  margin: 32px 0;
}

.option-label {
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.option-select {
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: var(--ink);
  background: var(--bone);
  border: var(--rule);
  padding: 8px 12px;
  min-width: 16ch;
}

.no-options {
  font-size: 12px;
}

/* the form that replaced the purchase link. a declaration, not a checkout. */
.intent-form {
  margin-top: 40px;
  border-top: var(--rule);
  padding-top: 24px;
}

.intent-title {
  font-size: 22px;
  font-weight: normal;
  margin-bottom: 16px;
}

.intent-input,
.intent-textarea {
  display: block;
  width: 100%;
  max-width: 36ch;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: var(--ink);
  background: var(--bone);
  border: var(--rule);
  padding: 8px 12px;
  margin-bottom: 16px;
}

.intent-input::placeholder,
.intent-textarea::placeholder {
  color: var(--ink);
  opacity: 0.45; /* flavor text, not instructions. the labels do the work. */
}

.intent-textarea {
  resize: vertical;
}

.purchase-button {
  display: inline-block;
  border: var(--rule);
  background: var(--ink);
  color: var(--bone);
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  padding: 16px 56px;
  text-decoration: none;
  cursor: pointer;
}

.purchase-button:visited {
  color: var(--bone);
}

.purchase-button:hover {
  background: var(--bruise);
}

.purchase-note {
  font-size: 11px;
  margin-top: 8px;
}

/* the field humans never see. bots see everything. */
.leave-blank {
  position: absolute;
  left: -10000px;
}

/* faint vertical marginalia down the right edge */
.marginalia {
  position: fixed;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-size: 10px;
  color: var(--bruise);
}

/* ---- footer ----------------------------------------------- */

.site-footer {
  border-top: var(--rule);
}

.footer-strip {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  padding: 4px 16px;
  border-bottom: var(--rule);
}

.footer-line {
  font-size: 13px;
  padding: 8px 16px 24px;
}

/* ---- gone -------------------------------------------------- */

/* a stock string that leads with zero. the listing stays;
   only the color concedes. */
.stock-gone {
  color: var(--bruise);
}

/* on hover the whole row inverts, wound included. */
.product-link:hover .stock-gone,
.product-link:focus .stock-gone {
  color: var(--bone);
}

/* ---- errors ------------------------------------------------ */

.error-note {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  color: var(--bruise);
  padding: 16px;
}

/* ---- page 4: the séance. the room. ------------------------- */
/* same bones as everything else: one rule, two fonts, and the
   bruise where a hand has been. the log is the only thing on the
   site that moves on its own, so it gets a border to live inside. */

.seance-join,
.seance-room {
  padding: 16px;
  max-width: 88ch;
}

.room-note {
  font-size: 12px;
  color: var(--bruise);
  margin-bottom: 8px;
}

/* who is in the room. a register, not a roster. */
.presence-line {
  font-size: 12px;
  margin-bottom: 8px;
}

.presence-label {
  color: var(--bruise);
  margin-right: 8px;
}

.presence-mod {
  color: var(--bruise);
}

.chat-log {
  list-style: none;
  border: var(--rule);
  height: 48vh;
  min-height: 240px;
  overflow-y: auto;
  padding: 8px 12px;
  margin-bottom: 16px;
}

.chat-row {
  font-size: 15px;
  margin-bottom: 4px;
}

/* the hour hides until you lean in — same manner as the catalogue's
   whispers. visibility, not display, so nothing shifts when it shows.
   (on touch, a tap counts as leaning in.) */
.chat-time {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  margin-right: 8px;
  opacity: 0.6;
  visibility: hidden;
}

.chat-row:hover .chat-time,
.chat-row:focus-within .chat-time {
  visibility: visible;
}

.chat-name {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  margin-right: 8px;
}

.chat-name.chat-mod {
  color: var(--bruise);
}

.chat-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* the quote an answer carries: a small door back to the original */
.chat-quote {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  font-size: 11px;
  color: var(--bruise);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}

.chat-quote:hover {
  background: var(--ink);
  color: var(--bone);
}

/* the answer verb: hidden like the hour, shown on the same lean-in */
.chat-reply {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 8px;
  font-size: 11px;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
  visibility: hidden;
}

.chat-row:hover .chat-reply,
.chat-row:focus-within .chat-reply {
  visibility: visible;
}

.chat-reply:hover {
  background: var(--ink);
  color: var(--bone);
}

/* the landing flash when a quote is followed home. no fade — a look.
   it wears the night's bruise (#b04a5e) in both worlds: on the dark
   page that is simply the bruise; on the light page it is borrowed,
   so the flash reads the same wherever you are. */
.chat-row.chat-found {
  outline: 3px solid #b04a5e;
  outline-offset: -1px;
}

/* when the house speaks, it speaks in italics, from the walls */
.chat-house .chat-name,
.chat-house .chat-body {
  font-style: italic;
  color: var(--bruise);
}

/* ordinary arrivals are noticed in the same voice, plain ink */
.chat-notice .chat-name,
.chat-notice .chat-body {
  font-style: italic;
}

.say-input {
  max-width: 100%;
  margin-bottom: 8px;
}

/* the composer's memory of what it is answering */
.reply-line {
  font-size: 11px;
  color: var(--bruise);
  margin-bottom: 8px;
}

.reply-line .quiet-button {
  margin-left: 8px;
}

.say-hint {
  font-size: 11px;
  opacity: 0.6;
  margin-bottom: 8px;
}

.you-line {
  font-size: 12px;
  margin: 8px 0 24px;
}

/* ---- the conduct: small tools for a small room -------------- */

.conduct {
  border-top: var(--rule);
  padding-top: 16px;
}

.conduct-form {
  margin-top: 16px;
}

.mod-panel {
  border-top: var(--rule);
  margin-top: 24px;
  padding-top: 16px;
}

.panel-row {
  margin-bottom: 16px;
}

.panel-input {
  display: inline-block;
  width: auto;
  min-width: 12ch;
  margin: 0 8px 0 0;
  vertical-align: middle;
}

/* the small verbs: unsay, silence, banish, release, allow */
.mod-act {
  background: none;
  border: var(--rule);
  color: var(--ink);
  font-size: 11px;
  padding: 2px 8px;
  margin-left: 8px;
  cursor: pointer;
}

.mod-act:hover {
  background: var(--bruise);
  color: var(--bone);
}

.panel-row .mod-act:first-child {
  margin-left: 0;
}

.ledger-title {
  font-size: 12px;
  font-weight: normal;
  color: var(--bruise);
  margin: 16px 0 8px;
}

.ledger-list {
  list-style: none;
  font-size: 12px;
}

.ledger-row {
  padding: 4px 0;
  border-bottom: 1px dotted var(--ink);
}

.ledger-name {
  margin-right: 16px;
}

.ledger-hash {
  opacity: 0.6;
  margin-right: 8px;
}

/* ---- small screens ----------------------------------------- */

@media (max-width: 720px) {
  .product-layout {
    grid-template-columns: 1fr;
  }

  .product-image {
    grid-column: 1;
    min-height: 40vh;
  }

  .product-details {
    grid-column: 1;
    padding-top: 0;
  }

  .product-link {
    grid-template-columns: 4ch 1fr auto auto;
  }

  .product-whisper {
    display: none;              /* no hover on touch. the whisper stays home. */
  }

  .region-select {
    margin-left: 0;
  }

  .landing-noct {
    margin-left: 0;
  }

  .marginalia {
    display: none;
  }

  .chat-log {
    height: 40vh;
  }
}

/* the souls line breathes: names fade in and out instead of the
   whole list snapping with each poll */
#presence-names .soul {
  opacity: 1;
  transition: opacity 0.6s ease;
}
#presence-names .soul + .soul::before {
  content: ", ";
}
#presence-names .soul-in,
#presence-names .soul-out {
  opacity: 0;
}
