/* ==========================================================
   H.A.N.K. Universal UI Components
   Canonical shared layer for all H.A.N.K. apps.
   D&D-specific styling must not live here.
   ========================================================== */

/* ---------- Page shell / growth / scrolling ---------- */

html,
body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

#tiles,
.hank-tiles,
.hank-tile-stage,
.hank-page {
  height: auto;
  min-height: 100vh;
  overflow: visible;
  box-sizing: border-box;
}

.hank-page-safe-bottom {
  padding-bottom: 140px;
}

/* ---------- Buttons ---------- */

.hank-button,
button.hank-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  max-height: 72px;
  height: auto;
  padding: 16px 24px;
  box-sizing: border-box;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  color: #f4f7f2;
}

.hank-button-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.hank-button-stack .hank-button,
.hank-button-stack button.hank-button {
  width: 100%;
}

.hank-button.danger-button,
button.hank-button.danger-button {
  background: #7a1c1c;
  color: #fff;
}

/* ---------- Tiles ---------- */

.hank-card-tile {
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  width: 100%;
}

.hank-card-tile-image {
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hank-card-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* ---------- Blocks ---------- */

.hank-block {
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  overflow: visible;
}

/* ---------- Info boxes ---------- */

.hank-info-box {
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  overflow: visible;
  border: 1px solid #111;
  background: #f4f7f2;
  color: #111;
}

.hank-info-box * {
  color: inherit;
}

/* ---------- Forms ---------- */

.hank-form-control,
.hank-info-box input,
.hank-info-box select,
.hank-info-box textarea {
  box-sizing: border-box;
  max-width: 100%;
  font: inherit;
}

.hank-autogrow-textarea {
  min-height: 110px;
  resize: none;
  overflow: hidden;
}

/* ---------- Canonical card tiles ---------- */

.hank-card-tile {
  box-sizing: border-box;
  width: 230px;
  min-height: 250px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,.13);
  border: 2px solid rgba(255,255,255,.24);
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 10px;
}

.hank-card-tile-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 2px;
}

.hank-card-tile-image {
  width: 100%;
  height: 105px;
  margin: 0 0 2px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.16);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hank-card-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.hank-card-tile-meta,
.hank-card-tile-summary {
  font-size: 14px;
  opacity: .85;
}


/* ---------- Universal flip cards ---------- */

.hank-flip-card {
  width: 260px;
  min-height: 360px;
  perspective: 1200px;
  cursor: pointer;
  box-sizing: border-box;
}

.hank-flip-card-inner {
  position: relative;
  width: 100%;
  min-height: 360px;
  transition: transform .55s ease;
  transform-style: preserve-3d;
}

.hank-flip-card.is-flipped .hank-flip-card-inner {
  transform: rotateY(180deg);
}

.hank-flip-card-face {
  position: absolute;
  inset: 0;
  min-height: 360px;
  box-sizing: border-box;
  padding: 18px;
  border: 2px solid rgba(255,255,255,.24);
  border-radius: 18px;
  background: rgba(255,255,255,.13);
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: auto;
}

.hank-flip-card-front {
  transform: rotateY(0deg);
}

.hank-flip-card-back {
  transform: rotateY(180deg);
}

.hank-flip-card-image {
  width: 100%;
  height: 145px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px;
  background: rgba(0,0,0,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hank-flip-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hank-flip-card-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
}

.hank-flip-card-summary {
  display: grid;
  gap: 8px;
}

.hank-flip-card-detail {
  margin-top: 10px;
  line-height: 1.45;
}

.hank-flip-card:focus-visible {
  outline: 3px solid rgba(255,255,255,.75);
  outline-offset: 4px;
}
