/* ============================================================================
   FILE: /public_html/css/ximera_institutions.css
   ROLE: Institutions suite layout shaping (Public + Console helpers)
   INITIATED: 2026-01-15T14:35:00+00:00
   UPDATED:   2026-01-16T00:00:00+00:00
   ----------------------------------------------------------------------------
   Goals:
   - Fix “page factor not shaped” (content pinned top-left, no width/padding)
   - Keep brand: black/gold/white
   - Zero inline style attributes needed in pages
   - Platform range support: 320px -> 4K, safe-area, touch, readable scale
   ============================================================================ */

:root{
  --tcg-gold:#d0a548;
  --tcg-bg:#070707;
  --tcg-deep:#181715;
  --tcg-line:rgba(208,165,72,.18);
  --tcg-chip:rgba(255,255,255,.06);
  --tcg-chipb:rgba(255,255,255,.12);

  /* ---------- Range system ---------- */
  --xim-pad: clamp(12px, 2vw, 22px);
  --xim-gap: clamp(10px, 2vw, 16px);
  --xim-radius: clamp(12px, 1.4vw, 16px);
  --xim-tap: 44px;                /* touch target */
  --xim-measure: 72ch;            /* readable line length */

  /* Fluid type scale */
  --xim-fs-0: clamp(12px, 1.2vw, 14px);
  --xim-fs-1: clamp(14px, 1.35vw, 16px);
  --xim-fs-2: clamp(16px, 1.8vw, 20px);
  --xim-fs-3: clamp(20px, 2.4vw, 26px);
  --xim-fs-4: clamp(26px, 3.2vw, 38px);
}

/* ---------- Base / normalisation ---------- */
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
.ximera-body{
  background: var(--tcg-bg);
  color:#fff;
  font-size: var(--xim-fs-1);
  line-height: 1.42;
}

/* Safe-area helper (notches) */
.ximera-safe-area{
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Prevent media overflow everywhere */
img, video, canvas, svg{ max-width:100%; height:auto; }

/* Inputs: prevent iOS zoom-on-focus, enforce touch targets */
button, a.ximera-btn, button.ximera-btn,
input, select, textarea{
  min-height: var(--xim-tap);
}
input, select, textarea{ font-size: 16px; }

/* ---------- Public layout ---------- */
.ximera-public-main{
  width:min(1160px, calc(100% - (var(--xim-pad) * 2)));
  margin: clamp(12px, 2vw, 18px) auto clamp(28px, 4vw, 44px) auto;
  padding-inline: var(--xim-pad);
}

/* Readable text columns when needed */
.ximera-measure{ max-width: var(--xim-measure); }

/* Larger screens: avoid “tiny UI floating in space” */
@media (min-width: 1600px){
  .ximera-public-main{ width:min(1400px, calc(100% - (var(--xim-pad) * 2))); }
}

.ximera-public-footer{
  border-top:1px solid var(--tcg-line);
  background: rgba(11,11,11,.72);
}

.ximera-public-footer-inner{
  width:min(1160px, calc(100% - (var(--xim-pad) * 2)));
  margin: 0 auto;
  padding: 14px var(--xim-pad);
}
@media (min-width: 1600px){
  .ximera-public-footer-inner{ width:min(1400px, calc(100% - (var(--xim-pad) * 2))); }
}

/* ---------- Cards / chips (fallback if ultimate.css doesn’t style these) ---------- */
.ximera-card{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--xim-radius);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.ximera-card-inner{
  padding: clamp(14px, 2vw, 18px);
}

.ximera-hr{
  border:0;
  border-top:1px solid rgba(255,255,255,.10);
  margin: 14px 0;
}

.ximera-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--tcg-chipb);
  background: var(--tcg-chip);
  font-size: var(--xim-fs-0);
  font-weight: 800;
  letter-spacing: .01em;
  color: rgba(255,255,255,.92);
}

.ximera-muted{
  color: rgba(255,255,255,.74);
}

/* ---------- Rows / grids ---------- */
.ximera-row{
  display:flex;
  align-items:center;
  gap: var(--xim-gap);
  flex-wrap:wrap;
}

.ximera-row-between{
  justify-content: space-between;
  align-items: flex-start;
}

/* Responsive grids that collapse cleanly */
.ximera-grid-2,
.ximera-grid-3{
  display:grid;
  gap: var(--xim-gap);
}

.ximera-grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ximera-grid-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 980px){
  .ximera-grid-3{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .ximera-grid-2{ grid-template-columns: 1fr; }
  .ximera-grid-3{ grid-template-columns: 1fr; }
}

/* Optional: hide on small screens */
@media (max-width: 640px){
  .ximera-hide-sm{ display:none !important; }
}

/* ---------- Media ---------- */
.ximera-media-preview{
  width:100%;
  height: clamp(148px, 20vw, 180px);
  border-radius: 12px;
  overflow:hidden;
  background: rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.10);
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom: 12px;
}

.ximera-img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.ximera-empty{
  color: rgba(255,255,255,.60);
  font-weight: 800;
  font-size: var(--xim-fs-0);
}

.ximera-hero{
  width:100%;
  border-radius: 16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  margin-bottom: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.ximera-hero-img{
  width:100%;
  height: clamp(200px, 26vw, 320px);
  object-fit: cover;
  display:block;
}

.ximera-logo-wrap{
  width: clamp(72px, 8vw, 92px);
  height: clamp(72px, 8vw, 92px);
  border-radius: 16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
}

.ximera-logo{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
}

.ximera-video{
  width:100%;
  max-height: min(60vh, 520px);
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background:#000;
}

/* ---------- Links ---------- */
.ximera-card-link{
  display:block;
  color: inherit;
  text-decoration:none;
}

.ximera-card-link:hover .ximera-h2{
  color: var(--tcg-gold);
}

.ximera-link{
  color: var(--tcg-gold);
  font-weight: 900;
  text-decoration:none;
}
.ximera-link:hover{ text-decoration: underline; }

/* ---------- Headings (fluid) ---------- */
.ximera-h1{
  margin:0;
  font-size: var(--xim-fs-4);
  line-height: 1.06;
  font-weight: 950;
  letter-spacing: -.02em;
}
.ximera-h2{
  margin:0;
  font-size: var(--xim-fs-2);
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: -.01em;
}

/* =======================
   Institutions Console: Media controls
   ======================= */
.inst-media-actions { margin-top: 10px; display: grid; gap: 10px; }

.inst-media-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;            /* mobile-safe */
}

.inst-media-file { flex: 1 1 260px; min-width: 0; }

.inst-media-upload { flex: 0 0 auto; }

.inst-media-row-secondary { justify-content: flex-start; }

.inst-media-unlink,
.inst-media-danger { flex: 0 0 auto; }

/* “Danger ghost” without breaking brand */
.inst-media-danger {
  border-color: rgba(208,165,72,0.35);
  box-shadow: none;
  opacity: 0.95;
}
.inst-media-danger:hover {
  border-color: rgba(208,165,72,0.75);
  opacity: 1;
}

/* =======================
   Ensure Ximera buttons style <button> elements (not just <a>)
   ======================= */
button.ximera-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(208,165,72,.35);
  background: rgba(0,0,0,.55);
  color: rgba(255,255,255,.92);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

button.ximera-btn:hover {
  border-color: rgba(208,165,72,.75);
  background: rgba(0,0,0,.65);
}

button.ximera-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

button.ximera-btn-primary {
  background: rgba(208,165,72,.18);
  border-color: rgba(208,165,72,.75);
}

button.ximera-btn-primary:hover {
  background: rgba(208,165,72,.26);
}

button.ximera-btn-ghost {
  background: rgba(0,0,0,.35);
  border-color: rgba(208,165,72,.25);
}

/* ---------- Motion safety ---------- */
@media (prefers-reduced-motion: reduce){
  *{
    animation-duration:0.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:0.001ms !important;
    scroll-behavior:auto !important;
  }
}
