/* =====================================================================
   HostelHub — flat plan system
   Floor plans, room layouts, bed glyphs and the live availability board.
   Everything here is 2D: crisp SVG line work over a light, premium surface.
   ===================================================================== */

/* ---------------------------------------------------------------
   1. Status keys — one source of truth for every bed colour
   --------------------------------------------------------------- */
:root {
  --bed-free:  #34d399;
  --bed-busy:  #fb7185;
  --bed-hold:  #fbbf24;
  --bed-maint: #cbd5e1;

  --bed-free-ink:  #059669;
  --bed-busy-ink:  #e11d48;
  --bed-hold-ink:  #d97706;
  --bed-maint-ink: #94a3b8;
}

/* ---------------------------------------------------------------
   2. Legend
   --------------------------------------------------------------- */
.bed-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-500);
}

.bed-legend span { display: inline-flex; align-items: center; gap: 7px; }

.bed-legend i {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex: none;
}

.bed-legend .k-free  { background: var(--bed-free);  box-shadow: inset 0 0 0 1px var(--bed-free-ink); }
.bed-legend .k-busy  { background: var(--bed-busy);  box-shadow: inset 0 0 0 1px var(--bed-busy-ink); }
.bed-legend .k-hold  { background: var(--bed-hold);  box-shadow: inset 0 0 0 1px var(--bed-hold-ink); }
.bed-legend .k-maint { background: var(--bed-maint); box-shadow: inset 0 0 0 1px var(--bed-maint-ink); }

/* ---------------------------------------------------------------
   3. Beds
   --------------------------------------------------------------- */
.bed2d {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .2s var(--ease), filter .2s var(--ease);
}

.bed2d--pick { cursor: pointer; }

.bed2d--pick:hover,
.bed2d--pick:focus-visible {
  transform: scale(1.09);
  filter: drop-shadow(0 5px 12px rgba(5, 150, 105, .38));
  outline: none;
}

.bed2d--staff { opacity: .55; pointer-events: none; }

.bed2d-icon { display: inline-block; vertical-align: middle; }

/* Free beds are called out by colour alone. No idle loop runs on the plan —
   a drawing with thirty-odd beds in it has to sit still to stay readable. */

/* ---------------------------------------------------------------
   4. Whole-property floor plan
   --------------------------------------------------------------- */
.fplan-card {
  border-radius: var(--r-lg);
  overflow: hidden;
}

.fplan-card__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-soft), var(--surface));
}

.fplan-card__hint { display: inline-flex; align-items: center; gap: 6px; }

.fplan-card__stage {
  padding: 18px 16px 22px;
  background:
    radial-gradient(110% 80% at 50% 0%, rgba(var(--brand-rgb), .06), transparent 62%),
    var(--bg-soft);
}

.fplan { position: relative; }

.fplan__stage {
  max-width: 560px;
  margin: 0 auto;
}

.fplan__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fplan__zonetag { pointer-events: none; }

.fplan__roomtag {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .22s var(--ease), filter .22s var(--ease);
}

.fplan a { cursor: pointer; }

.fplan a:hover .fplan__roomtag,
.fplan a:focus-visible .fplan__roomtag {
  transform: translateY(-2px) scale(1.05);
  filter: drop-shadow(0 6px 14px rgba(11, 16, 32, .3));
}

.fplan__north { pointer-events: none; }

/* compact thumbnail used on cards */
.fplan--compact .fplan__stage { max-width: none; }

/* the plan fades up and its beds drop in, once, on first sight */
.is-revealed .fplan__svg { animation: planIn .8s var(--ease) both; }

.is-revealed .fplan .bed2d {
  animation: bedIn .46s var(--ease) both;
  animation-delay: calc(.3s + var(--bi, 0) * .018s);
}

@keyframes planIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(7px); }
  to   { opacity: 1; transform: none;                         filter: blur(0);   }
}

@keyframes bedIn {
  from { opacity: 0; filter: blur(9px); transform: scale(1.06); }
  to   { opacity: 1; filter: blur(0);   transform: none;        }
}

/* ---------------------------------------------------------------
   5. Single room layout
   --------------------------------------------------------------- */
.room2d {
  position: relative;
  border-radius: var(--r);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(var(--brand-rgb), .06), transparent 65%),
    var(--bg-soft);
  padding: 14px;
}

.room2d__stage { max-width: 280px; margin: 0 auto; }

.room2d--detail { padding: 22px; }
.room2d--detail .room2d__stage { max-width: 360px; }

.room2d__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.is-revealed .room2d .bed2d {
  animation: bedIn .44s var(--ease) both;
  animation-delay: calc(var(--bi, 0) * .05s);
}

/* ---------------------------------------------------------------
   6. Live availability board (landing hero)
   --------------------------------------------------------------- */
.hh-board-wrap { position: relative; }

.hh-board {
  position: relative;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow:
    0 34px 70px -28px rgba(16, 24, 40, .30),
    0 4px 14px -6px rgba(16, 24, 40, .10);
  overflow: hidden;
}

.hh-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(var(--brand-rgb), .10), transparent 46%);
  pointer-events: none;
}

.hh-board__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.hh-board__headline {
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink-600);
}

.hh-board__headline b { color: var(--ink-900); font-weight: 800; }

.hh-board__block {
  position: relative;
  display: block;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--base);
}

.hh-board__block:hover { background: rgba(var(--brand-rgb), .045); }

.hh-board__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hh-board__name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: .95rem;
  color: var(--ink-900);
}

.hh-board__dot {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: var(--c, var(--brand));
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--brand)) 18%, transparent);
}

.hh-board__free {
  font-size: .74rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.hh-board__free.is-open { color: #05674a; background: #d9f7ec; }
.hh-board__free.is-full { color: #9f1239; background: #ffe4e6; }

.hh-board__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.hh-bit {
  width: 15px;
  height: 19px;
  border-radius: 4px;
  flex: none;
  transition: transform .18s var(--ease);
}

.hh-bit--free  { background: var(--bed-free);  box-shadow: inset 0 0 0 1px var(--bed-free-ink); }
.hh-bit--busy  { background: var(--bed-busy);  box-shadow: inset 0 0 0 1px var(--bed-busy-ink); }
.hh-bit--hold  { background: var(--bed-hold);  box-shadow: inset 0 0 0 1px var(--bed-hold-ink); }
.hh-bit--maint { background: var(--bed-maint); box-shadow: inset 0 0 0 1px var(--bed-maint-ink); }

.hh-board__block:hover .hh-bit--free { transform: translateY(-2px); }

.hh-board__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--ink-400);
}

.hh-board__meta b { color: var(--ink-700); }

.hh-board__go {
  margin-left: auto;
  color: var(--brand);
  transition: transform var(--base);
}

.hh-board__block:hover .hh-board__go { transform: translateX(4px); }

.hh-board__key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 13px 20px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-400);
  background: var(--bg-soft);
}

.hh-board__key span { display: inline-flex; align-items: center; gap: 6px; }

.hh-board__key i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}

.hh-board__key .k-free  { background: var(--bed-free); }
.hh-board__key .k-busy  { background: var(--bed-busy); }
.hh-board__key .k-hold  { background: var(--bed-hold); }
.hh-board__key .k-maint { background: var(--bed-maint); }

/* every bit flicks on in sequence when the board first appears */
.hh-bit {
  animation: bitIn .34s var(--ease) both;
  animation-delay: calc(.35s + var(--i, 0) * .012s);
}

@keyframes bitIn {
  from { opacity: 0; filter: blur(7px); transform: translateY(5px); }
  to   { opacity: 1; filter: blur(0);   transform: none;            }
}

@media (max-width: 991px) {
  .hh-board-wrap { max-width: 520px; margin-inline: auto; }
}

@media (max-width: 480px) {
  .hh-bit { width: 13px; height: 17px; }
  .hh-board__block { padding: 15px 16px; }
  .hh-board__head, .hh-board__key { padding-inline: 16px; }
}

/* ---------------------------------------------------------------
   7. Reduced motion
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fplan .bed2d__g,
  .room2d .bed2d__g { animation: none !important; }

  .is-revealed .fplan__svg,
  .is-revealed .fplan .bed2d,
  .is-revealed .room2d .bed2d,
  .hh-bit { animation: none !important; }
}

/* ---------------------------------------------------------------
   8. Room index strip under a plan
   --------------------------------------------------------------- */
.fplan-card__index {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.fplan-chip {
  flex: 0 1 178px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--base), box-shadow var(--base), transform var(--base);
}

.fplan-chip:hover {
  border-color: rgba(var(--brand-rgb), .45);
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
}

.fplan-chip__no {
  width: 27px;
  height: 27px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ink-900);
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
}

.fplan-chip__body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.fplan-chip__body b { font-size: .85rem; color: var(--ink-900); }
.fplan-chip__body small { font-size: .68rem; color: var(--ink-400); font-weight: 600; white-space: nowrap; }

.fplan-chip__free {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 800;
  color: #05674a;
  background: #d9f7ec;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.fplan-chip.is-full .fplan-chip__free { color: #9f1239; background: #ffe4e6; }
.fplan-chip.is-full .fplan-chip__no   { background: var(--ink-400); }

@media (max-width: 640px) {
  .fplan-card__index { padding: 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
