/* ARUNA · availability map (A5) — css/availability.css
   Styles the SVG built by js/availability.js inside section#availability:
   villa polygons, numbered pins, tooltip, legend swatches, counters
   and the 90° board rotation on portrait phones.
   Never sets a transform on .avail-board (A7 animates it with GSAP). */

.avail,
.avail-tooltip {
  --av-gold: #A78143;
  --av-gold-pale: #D9C49A;
  --av-stone: #8C8275;
  --av-taupe: #6B6358;
  --av-greige: #BCAB90;
  --av-ivory: #FAF7F2;
  --av-espresso: #211E1A;
  --av-line: #E2D9CC;
  --av-sans: var(--font-sans, 'Manrope', 'Century Gothic', system-ui, sans-serif);
  --av-display: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  --av-ease: var(--ease, cubic-bezier(.22, .61, .36, 1));
}

/* ---------- board: aerial + SVG overlay (landscape / desktop) ---------- */
.avail-board { position: relative; }
.avail-rot { position: relative; }
.avail-rot .avail-aerial {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1448 / 914;
}
.avail-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---------- villas ---------- */
.villa {
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.villa-shape {
  fill: var(--av-gold);
  fill-opacity: .28;
  stroke: var(--av-ivory);
  stroke-opacity: .9;
  stroke-width: 1.2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity .22s var(--av-ease), stroke .22s var(--av-ease), stroke-width .22s var(--av-ease);
}
.villa.is-reserved .villa-shape {
  fill: var(--av-stone);
  fill-opacity: .35;
}
/* :focus-visible (keyboard) rather than :focus, and hover only where hover exists,
   so a tapped villa does not stay highlighted on touch screens */
.villa:focus-visible .villa-shape,
.villa.is-active .villa-shape,
.villa.is-hl .villa-shape {
  fill-opacity: .45;
  stroke: var(--av-gold);
  stroke-opacity: 1;
  stroke-width: 1.6;
}
.villa.is-reserved:focus-visible .villa-shape,
.villa.is-reserved.is-active .villa-shape,
.villa.is-reserved.is-hl .villa-shape { fill-opacity: .5; }
@media (hover: hover) {
  .villa:hover .villa-shape {
    fill-opacity: .45;
    stroke: var(--av-gold);
    stroke-opacity: 1;
    stroke-width: 1.6;
  }
  .villa.is-reserved:hover .villa-shape { fill-opacity: .5; }
}

/* keyboard focus ring: thicker gold outline on the plot + gold ring on the pin */
.villa:focus-visible .villa-shape {
  stroke: var(--av-gold);
  stroke-width: 2.8;
}
.villa:focus-visible .villa-pin {
  stroke: var(--av-gold);
  stroke-width: 3;
}

.villa-pin {
  fill: var(--av-ivory);
  stroke: var(--av-espresso);
  stroke-width: 1.4;
  transition: fill .22s var(--av-ease), stroke .22s var(--av-ease);
}
.villa.is-reserved .villa-pin {
  fill: var(--av-espresso);
  stroke: var(--av-ivory);
}
.villa-num {
  font-family: var(--av-sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0;
  fill: var(--av-espresso);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.villa.is-reserved .villa-num { fill: var(--av-ivory); }

/* ---------- tooltip (position: fixed, placed by availability.js) ---------- */
.avail-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  display: block;
  max-width: calc(100vw - 16px);
  padding: 9px 14px 9px 13px;
  background: var(--av-ivory);
  border: 1px solid var(--av-line);
  border-left: 1px solid var(--av-gold);
  box-shadow: 0 6px 18px rgba(33, 30, 26, .12), 0 1px 2px rgba(33, 30, 26, .06);
  color: var(--av-espresso);
  font-family: var(--av-sans);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: avail-tip-in .18s var(--av-ease) both;
}
.avail-tooltip[hidden] { display: none; }
@keyframes avail-tip-in {
  from { opacity: 0; translate: 0 4px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---------- legend swatches (pin + plot tint, as on the map) ---------- */
.avail-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--av-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--av-taupe);
}
.legend-item::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--av-ivory);
  border: 1.5px solid var(--av-espresso);
  box-shadow: 0 0 0 4px rgba(167, 129, 67, .28);
}
.legend-item.is-reserved::before {
  background: var(--av-espresso);
  border-color: var(--av-espresso);
  box-shadow: 0 0 0 4px rgba(140, 130, 117, .35);
}

/* ---------- counters (spans created by availability.js) ---------- */
.avail-counters .count-num {
  display: block;
  font-family: var(--av-display);
  font-weight: 400;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--av-espresso);
  font-variant-numeric: lining-nums tabular-nums;
}
.avail-counters .count-label {
  display: block;
  margin-top: 8px;
  font-family: var(--av-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--av-taupe);
}

/* ---------- portrait phones: rotate the aerial 90° to use the full width ----------
   .avail-board keeps the rotated footprint (aspect 914/1448). .avail-rot is sized as
   the un-rotated aerial (H wide x W tall), centred, then turned 90° so it fills the
   board exactly. Pin numbers are counter-rotated (SVG attribute, see js) so they read upright. */
@media (max-width: 899px) and (orientation: portrait) {
  .avail-board {
    position: relative;
    width: 100%;
    aspect-ratio: 914 / 1448;
  }
  .avail-rot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * 1448 / 914);
    height: calc(100% * 914 / 1448);
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
  }
  .avail-rot .avail-aerial {
    width: 100%;
    height: 100%;
  }
  /* js/availability.js sets r="24" on the pins and rotate(-90 cx cy) on the numbers here (SVG
     attributes: WebKit ignores transform-box / r on SVG text and circles). Only the size is CSS. */
  .villa-num { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .villa-shape,
  .villa-pin { transition: none; }
  .avail-tooltip { animation: none; }
}
