/* ============================================================
   The Bookshop — anniversary gift
   Palette: dusk-green shop, paper, brass, ink, a single rose.
   TODO: tune all colors + item positions once bg image is in.
   ============================================================ */
:root {
  --green: #24463a;
  --green-deep: #16302a;
  --paper: hsl(38, 42%, 85%);
  --ink: #251f17;
  --brass: hsl(32, 32%, 36%);
  --rose: #b4556a;
  --shadow: 0 12px 40px rgba(10, 20, 15, 0.45);
  --serif: "Book Antiqua", "Big Caslon", "Palatino Linotype", Palatino, Georgia, serif;

  /* Deck category accents — reference-inspired (yellow/navy/grey/pink),
     kept dark enough to double as the card's text color, not just the
     shape fill. */
  --cat-1: #b8801f; /* fun — yellow/gold */
  --cat-2: #1d3461; /* us — navy */
  --cat-3: #6b6358; /* deep — warm grey */
  --cat-4: var(--rose); /* flirty — pink */
  --heart-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>');
  --backdrop-tint: rgba(12, 22, 18, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--green-deep);
  font-family: var(--serif);
  color: var(--ink);
  font-size: 18px;
}

/* ===== Stage: a fixed-px world, scaled to fit the window.
   Dimensions = the background photo's natural pixels, so the image is
   never cropped and stage % coordinates map 1:1 onto photo features.
   transform-origin 0 0 + non-static position are required for
   playhtml's cursors to anchor correctly to a transformed container
   (cursors are stored in container-local px — this fixed space is the
   shared coordinate system both viewers agree on). */
#stage {
  position: absolute;
  width: 964px;
  height: 1280px;
  transform-origin: 0 0;
  background: var(--green-deep);
}

#bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  /* fade the photo's edges into the page background */
  mask-image: radial-gradient(ellipse at center,
    rgb(0 0 0) 45%, rgb(0 0 0 / 0) 100%);
}

/* ===== Shelf items ===== */
.item {
  position: absolute;
  font-size: 64px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
  transition: filter 0.2s ease;
  z-index: 1;
}

.item:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.9));
}

[can-move] { cursor: grab; }
[can-move]:active { cursor: grabbing; }

/* Movables: dragged via % coordinates synced through playhtml */
.movable { cursor: grab; touch-action: none; -webkit-user-drag: none; }
.movable:active { cursor: grabbing; }

/* Positions in % of the stage (= % of the photo), placed on real
   features of the shot. The three .movable homes here must match
   their defaultData in main.js. TODO: fine-tune by eye. */
#dog      { left: 44%; top: 76%; font-size: 80px; } /* on the stairs */
#frame-1  { left: 25%; top: 4%;  }                  /* wall sketch, top left */
#frame-2  { left: 48%; top: 14%; }                  /* ceiling beam */
#lamp-1   { left: 53%; top: 9%; }                  /* hanging lamp */
#lamp-2   { left: 19%;  top: 31%; }                  /* tall lamp */
#lamp-3   { left: 5%;  top: 44%; }                 /* smallest tree painting lamp */
#lamp-4   { left: 49%;  top: 53%; }                 /* big floor lamp */
#plant-1  { left: 33%; top: 85%; }                  /* beside the stairs */
#marker   { left: 36%; top: 49%; font-size: 52px; } /* flower mural */
#boardgame{ left: 62%; top: 62%; font-size: 56px; } /* floor by the stacks */
#book     { left: 71.5%; top: 44.75%; }                  /* left shelf of books */
#fridge   { left: 21%; top: 66%; }                  /* white panel, lower left */
#radio    { left: 66.5%; top: 52%; }                  /* centre floor stacks */
#deck     { left: 42%; top: 87.5%; }                  /* right-hand stacks */
#board    { left: 55%; top: 46%; }                  /* the IIIrd-floor sign */
#cal      { left: 50%; top: 21%; }                  /* book wall, right */

/* Lamps: playhtml's can-toggle flips the .toggled class */
.lamp { opacity: 0.9; }
.lamp .glow {
  position: absolute;
  inset: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 130, 0.55), transparent 50%);
  opacity: 0;
  transition: opacity 1.5s ease;
  pointer-events: none;
}
.lamp.toggled { opacity: 1; }
.lamp.toggled .glow { opacity: 1; }

.item img {
  display: block;
  width: 250px;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#lamp-2 img {
  transform: rotate(-5deg);
}

#lamp-3 img {
  transform: rotate(-4deg);
}

#lamp-4 img {
  width: 120px;
  transform: perspective(300px) rotateX(15deg);
  transform-origin: bottom left;
}

#lamp-4 .glow {
  inset: -10px;
  background: radial-gradient(circle at 50% 25%, rgba(255, 214, 130, 0.55), transparent 30%);
}

#dog img {
  width: 150px;
}

#book img {
  width: 40px;
  transform: rotate(2deg);
}

#spotlight { display: none; }

/* ===== Backdrop + panels ===== */
#backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop-tint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}
#backdrop.open { opacity: 1; pointer-events: auto; }

/* Dims the page background outside the stage (the letterboxed margins)
   by the same tint, so opening a panel dulls the whole screen at once.
   Sits behind #stage in the DOM so it never covers the stage/panels —
   only the margins around it. */
#backdrop-outer {
  position: fixed;
  inset: 0;
  background: var(--backdrop-tint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#backdrop-outer.open { opacity: 1; pointer-events: auto; }

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 720px;
  max-height: 820px;
  transform: translate(-50%, -50%) scale(0.92);
  background: var(--paper);
  border: 1px solid var(--brass);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 32px 36px 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  overflow-y: auto;
}
.panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--green-deep);
}

.panel-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--ink);
}

.panel-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

button {
  font-family: var(--serif);
  font-size: 16px;
  padding: 8px 16px;
  border: 1px solid var(--brass);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: rgba(169, 123, 47, 0.15); }

/* Overrides the class-webring embed's own injected <style> tag — its
   root has an id, so this wins on specificity regardless of load order. */
#class-webring-widget { color: var(--paper); }

input[type="text"], input[type="date"], input[type="time"] {
  font-family: var(--serif);
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid rgba(37, 31, 23, 0.35);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
  flex: 1;
  min-width: 120px;
}

.counter { font-size: 15px; opacity: 0.7; }
.hint { font-size: 14px; opacity: 0.6; margin: 14px 0 0; }
.hidden { display: none !important; }

/* ===== Book ===== */
.book-spread { min-height: 380px; padding: 0 36px; }
.book-title { font-size: 22px; font-style: italic; margin: 0 0 18px; }
.book-page { white-space: pre-line; font-size: 18px; line-height: 1.7; }

/* Flip tabs sit inside the panel, hugging its left/right edges — being
   descendants of .panel they inherit its opacity/pointer-events toggle
   for free, so no separate open/closed rule is needed here. */
.book-flip {
  position: absolute;
  top: 50%;
  padding: 8px 1px;
  border: none;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.book-flip-left  { left: 4px;  transform: translateY(-50%) rotate(-90deg); }
.book-flip-right { right: 4px; transform: translateY(-50%) rotate(90deg); }

/* ===== Fridge poetry ===== */
#fridge-door {
  position: relative;
  min-height: 420px;
  background: #e8eef0;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}
.fridge-word {
  display: inline-block;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #c8ccd0;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);
  font-size: 16px;
  cursor: grab;
  z-index: 1;
}

/* ===== CD player ===== */
#radio img {
  width: 80px;
}

.cd-now { font-size: 18px; font-style: italic; }
#cd-tracks { list-style: none; padding: 0; margin: 16px 0 0; }
#cd-tracks li {
  padding: 8px 10px;
  border-bottom: 1px dashed rgba(37, 31, 23, 0.25);
  cursor: pointer;
}
#cd-tracks li:hover { background: rgba(169, 123, 47, 0.12); }
#cd-tracks li.playing { color: var(--rose); font-weight: 600; }

/* ===== Deck: 4 category variants = color + a corner shape ===== */
#deck img {
  width: 50px;
  transform: rotate(-10deg);
}

.deck-table {
  position: relative;
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
  min-height: 340px;
}
.deck-filters {
  position: absolute;
  right: 85%;
  margin-right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deck-filter {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.deck-filter:hover { transform: scale(1.08); }
.deck-filter.active { opacity: 1; }
.filter-shape { width: 20px; height: 20px; background: currentColor; display: block; }
.deck-filter.cat-1 .filter-shape { color: var(--cat-1); transform: rotate(12deg); }
.deck-filter.cat-2 .filter-shape { color: var(--cat-2); transform: rotate(45deg); }
.deck-filter.cat-3 .filter-shape { color: var(--cat-3); border-radius: 50%; }
.deck-filter.cat-4 .filter-shape {
  color: var(--cat-4);
  -webkit-mask-image: var(--heart-mask);
  mask-image: var(--heart-mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.card {
  position: relative;
  width: 220px;
  height: 320px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 19px;
  line-height: 1.55;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  background: #fff;
}
/* Back design: a scattered collage of the same 4 shapes used on the
   fronts (square/diamond/circle/heart), reference-inspired — bold flat
   color on a cream ground instead of the front's white + corner accent. */
.card.back {
  background: var(--paper);
  overflow: hidden;
}
.card.back::after { display: none; }
.back-shape {
  position: absolute;
  background: currentColor;
}
.back-shape.shape-1 { color: var(--cat-1); width: 130px; height: 130px; top: -35px; left: -35px; transform: rotate(12deg); }
.back-shape.shape-2 { color: var(--cat-2); width: 150px; height: 150px; bottom: -55px; right: -55px; transform: rotate(45deg); }
.back-shape.shape-3 { color: var(--cat-3); width: 90px; height: 90px; border-radius: 50%; top: 46%; left: -30px; }
.back-shape.shape-4 {
  color: var(--cat-4);
  width: 70px;
  height: 70px;
  top: 24px;
  right: 18px;
  background: currentColor;
  -webkit-mask-image: var(--heart-mask);
  mask-image: var(--heart-mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.back-label {
  position: relative;
  z-index: 1;
  background: rgba(245, 238, 221, 0.92);
  color: var(--ink);
  font-size: 18px;
  padding: 10px 18px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.card::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 14px;
  width: 18px;
  height: 18px;
  background: currentColor;
}
.card.cat-1 { color: var(--cat-1); }                               /* square  */
.card.cat-2 { color: var(--cat-2); }                               /* diamond */
.card.cat-2::after { transform: rotate(45deg); }
.card.cat-3 { color: var(--cat-3); }                               /* circle  */
.card.cat-3::after { border-radius: 50%; }
.card.cat-4 { color: var(--cat-4); }                               /* heart   */
.card.cat-4::after {
  top: 11px;
  left: 11px;
  width: 24px;
  height: 24px;
  /* a rounder heart than the Unicode ♥ glyph gives — drawn as a path
     instead of relying on font rendering, so it looks the same everywhere */
  clip-path: path("M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z");
}
.card .cat-name {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}
.card.empty { opacity: 0.35; box-shadow: none; border: 1px dashed var(--ink); }
#deck-pile, #deck-current { cursor: pointer; }

.deck-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
#deck-shuffle {
  padding: 6px;
  width: 34px;
  height: 34px;
  line-height: 1;
  font-size: 16px;
  border: none;
  border-radius: 50%;
}

/* ===== Notice board + dates ===== */
#cal img {
  width: 80px;
}

#board img {
  width: 100px;
}

#board-list, #cal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 420px;
  overflow-y: auto;
}
#board-list li, #cal-list li {
  padding: 10px 6px;
  border-bottom: 1px dashed rgba(37, 31, 23, 0.25);
  font-size: 17px;
}
#board-list .note-author, #cal-list .cal-date {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  display: block;
  margin-bottom: 2px;
}
.entry-delete {
  display: none;
  float: right;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  opacity: 0.45;
  padding: 0 6px;
}
.entry-delete:hover { opacity: 1; color: var(--rose); }
body.admin-mode .entry-delete { display: inline-block; }

#help-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: #fff;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
  z-index: 60;
  transition: opacity 0.2s ease;
}
#help-btn:hover { opacity: 0.75; }

/* Local-only admin toggle: an inconspicuous hit target in the
   corner — not real auth, just hides delete buttons from casual
   visitors. Typing anything into it reveals them (see main.js). */
#admin-controls {
  position: fixed;
  bottom: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  z-index: 100;
}
#admin-controls:focus { opacity: 0.2; background: rgba(255, 255, 255, 0.5); }

/* ===== Profile overlay (unscaled, fixed to viewport) ===== */
#profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 18, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.profile-card {
  width: min(420px, 90vw);
  background: var(--paper);
  border: 1px solid var(--brass);
  border-radius: 8px;
  padding: 36px 40px 40px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
}
.profile-card h1 { margin: 0 0 10px; font-size: 28px; font-weight: 500; }
.profile-card label { font-size: 14px; opacity: 0.75; margin-top: 8px; }
.profile-card button { margin-top: 18px; background: var(--rose); border-color: var(--rose); color: #fff; }
.profile-card button:hover { background: #9c4257; }
