/* Home page ("Rachel's Brain"). Fixed 1440×1024 design, scaled to fit the window. */

html, body { margin: 0; height: 100%; background: var(--paper); }
body { overflow: hidden; font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }

.viewport { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
/* The 1440×1024 design frame. Only the canvas scales; the sidebar and bars stay at real size. */
.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 1024px;
  overflow: visible;
  transform-origin: 0 0;
}

/* ---------- Canvas ---------- */
.desk { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1500px;
  height: 1100px;
  transform-origin: 0 0;
  transition: transform 720ms cubic-bezier(.4,0,.2,1);   /* same curve as the pictures, so zoom and spread move together */
}
.world.is-live { transition: none; }

.obj {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  transform-origin: 0 0;
  transition: transform 720ms cubic-bezier(.4,0,.2,1), opacity 320ms ease;
  -webkit-tap-highlight-color: transparent;
}
.obj img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.obj:focus-visible { outline-width: 1px; }

/* Sticky note: the one-line blurb, links to the primary destination */
.stk {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  background: var(--sticky);
  color: var(--ink);
  font-family: var(--pen);
  font-weight: 400;
  text-decoration: none;
  z-index: 300;
  transition: opacity 140ms ease;
  /* handwritten feel: centred on the note, lines balanced */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-wrap: balance;
}
.stk:hover { filter: brightness(1.02); }

/* Link pills on the canvas, sized in world units */
.cbtn {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 300;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  text-decoration: none;
  transition: opacity 140ms ease;
}
.cbtn .aura { background: var(--aura-blue); }
.cbtn:hover .aura, .cbtn:focus-visible .aura { opacity: 1; }
.cbtn[aria-disabled="true"] { color: var(--muted); border-color: var(--dim); }
.cbtn[aria-disabled="true"] .aura { display: none; }

.stack-label {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  text-align: center;
  z-index: 5;
  font-size: 13px;
  line-height: 16px;
  color: var(--ink);
  pointer-events: none;
  transition: opacity 280ms ease;
}

/* Cursor by state */
.desk.c-grab { cursor: var(--cur-grab); }
.desk.c-grabbing, .desk.c-grabbing * { cursor: var(--cur-grabbing) !important; }
.desk.c-zout { cursor: var(--cur-zout); }
.obj.c-zin { cursor: var(--cur-zin); }
.obj.c-def { cursor: var(--cur-arrow); }

/* ---------- Sidebar panels ---------- */
.panel--index { padding: 8px 16px 12px; }
.filters { display: flex; justify-content: space-between; border-bottom: 1px solid var(--hairline); padding-bottom: 4px; }
.filters .word { font-size: 14px; }
.rows { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
  font: 400 14px/20px var(--font);
  color: var(--ink);
  transition: color 200ms ease;
}
.row .word { justify-self: start; padding: 0; font: inherit; color: inherit; }
.row:hover .gl, .row:focus-visible .gl { opacity: 1; }
.row .yr { text-align: right; color: var(--muted); white-space: nowrap; }
.row.is-dim { color: var(--dim); }
.row.is-dim .yr { color: var(--dim); }

.panel--contact { padding: 12px 16px 16px; }
.contact { display: flex; flex-direction: column; gap: 10px; margin: 0; font-size: 16px; line-height: 22px; }
.fld-wrap { display: block; }
.fld-wrap > span { font-size: 12px; line-height: 16px; color: var(--muted); }
.fld {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  padding: 6px 0 7px;
  font: 400 16px/22px var(--font);
  color: var(--ink);
  outline: none;
  resize: none;
}
.fld:focus { border-bottom-color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.send-row { display: flex; justify-content: flex-end; margin-top: 4px; }
#send { padding: 0 22px; font-size: 16px; }
#send[disabled] { opacity: .6; }
.form-err { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.contact[hidden], .sent[hidden] { display: none; }   /* after sending, only the thank-you shows */
.sent { padding: 8px 0 4px; }
.sent__thanks { font-family: var(--pen); font-size: 24px; line-height: 28px; }
.sent p { margin: 10px 0 14px; font-size: 16px; line-height: 22px; }

/* ---------- Bottom bar ---------- */
.bar-center { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; } /* centred on the window */
.bar-btn { font-size: 14px; padding: 0 14px; }
.bar-btn--org { min-width: 120px; font-size: 16px; padding: 0 22px; }
.bar-btn--sq { width: 36px; padding: 0; font-size: 16px; }
.bar-btn--pct { width: 64px; padding: 0; }
.bar-right { position: absolute; right: 24px; bottom: 26px; display: flex; gap: 6px; align-items: center; z-index: 20; }
.zoom { display: flex; gap: 6px; }
.zoom[hidden] { display: none; }

.chip {
  position: absolute;
  left: 24px;
  bottom: 24px;
  padding: 7px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
  z-index: 10;
}

/* the hint would run into the centred organize button on narrower windows */
@media (max-width: 960px) { .chip { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .world, .obj { transition-duration: 1ms !important; }
}

/* Hovering a cluster: soft light-blue aura behind it */
.cluster-aura {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(168, 222, 255, .9) 0%, rgba(168, 222, 255, .6) 55%, rgba(168, 222, 255, 0) 100%);
  opacity: 0;
  transition: opacity 240ms ease;
}
.cluster-aura.is-on { opacity: 1; }

/* Sidebar at real size, same place as the About page; scrolls inside if the window is short */
.viewport > .sidebar { max-height: calc(100% - 96px); overflow-y: auto; scrollbar-width: none; }
.viewport > .sidebar::-webkit-scrollbar { display: none; }
@media (max-width: 759px) {
  .viewport > .sidebar { width: auto; right: 16px; left: 16px; top: 16px; }
  .chip { display: none; }
  .zoom { display: none !important; }              /* pinch to zoom on phones */
  .bar-center { left: 16px; transform: none; }
  .bar-right { right: 16px; }
}

/* ---------- Phones: open-project sheet (note + big link buttons + prev/next) ---------- */
.m-sheet { display: none; }
@media (max-width: 759px) {
  .m-sheet:not([hidden]) {
    display: flex; flex-direction: column; gap: 8px;
    position: absolute; left: 16px; right: 16px; bottom: 84px; z-index: 25;
    padding: 10px 12px 12px; box-sizing: border-box;
    border: 1px solid var(--ink); border-radius: 6px; background: var(--paper);
    font-family: var(--font); color: var(--ink);
  }
  .m-sheet__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .m-sheet__name { font-size: 16px; line-height: 22px; text-align: center; flex: 1; }
  .m-arrow { width: 36px; height: 36px; padding: 0; font-size: 15px; flex: none; }
  .m-sheet__blurb { margin: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
  .m-sheet__btns { display: flex; flex-wrap: wrap; gap: 6px; }
  .m-btn { height: 40px; padding: 0 16px; font-size: 15px; flex: 1 1 auto; }
  body.has-sheet .viewport > .sidebar .panel--id { display: none; }
}

/* ---------- Phones: contact is its own page; index rows easier to tap ---------- */
@media (max-width: 759px) {
  body.pg-contact .desk, body.pg-index .desk,
  body.pg-contact .bar-center, body.pg-index .bar-center,
  body.pg-contact .bar-right, body.pg-index .bar-right,
  body.pg-contact .m-sheet, body.pg-index .m-sheet,
  body.pg-index .viewport > .sidebar .panel--id { display: none !important; }   /* contact keeps the intro on top */
  body.pg-contact .viewport > .sidebar,
  body.pg-index .viewport > .sidebar { position: absolute; bottom: 16px; max-height: none; overflow-y: auto; }
  body.pg-contact .panel--contact { padding-bottom: 8px; }
  .row { padding-block: 9px; }
}
