/* ===== Creto UI – bright, friendly theme (v2.1) ===== */
/* Palette */
:root{
  --bg:#f9fbff; --panel:#ffffff; --ink:#111827; --muted:#667085;
  --line:#e7ecf3; --radius:16px;
  --accent:#4f7cff;         /* primary */
  --accent-2:#2ec4b6;       /* mint */
  --accent-3:#ff9f6e;       /* peach */
  --shadow:0 10px 24px rgba(25,35,60,.06), 0 2px 6px rgba(25,35,60,.04);
  --shadow-hover:0 16px 34px rgba(25,35,60,.12), 0 3px 10px rgba(25,35,60,.06);
}

/* ========= Global base ========= */
*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background:var(--bg);
  position:relative;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}

a{ color:var(--accent) }
a:hover{ text-decoration:underline }
h1{ margin:0 0 10px; font-size:clamp(26px,3.2vw,36px); line-height:1.15; letter-spacing:.2px }

/* === Colorful stage background === */
body::before,
body::after{ content:""; position:fixed; inset:0; pointer-events:none; z-index:0; }
body::before{
  background:
    radial-gradient(800px 600px at 8% 12%,  rgba(79,124,255,.16), transparent 60%),
    radial-gradient(900px 680px at 85% 25%, rgba(46,196,182,.15), transparent 60%),
    radial-gradient(720px 520px at 20% 78%, rgba(255,159,110,.16), transparent 60%);
  filter: blur(2px) saturate(108%);
}
body::after{
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(79,124,255,.38) 1px, transparent 2px),
    radial-gradient(2px 2px at 72% 64%, rgba(46,196,182,.32) 1px, transparent 2px),
    radial-gradient(2px 2px at 42% 82%, rgba(255,159,110,.30) 1px, transparent 2px);
  background-size: 260px 260px, 300px 300px, 340px 340px;
  animation: twinkle 4s ease-in-out infinite alternate;
  opacity:.55;
}
@keyframes twinkle{
  from{ transform: translateY(0); filter: brightness(.98); }
  to  { transform: translateY(6px); filter: brightness(1.05); }
}
@media (prefers-reduced-motion: reduce){
  body::after{ animation:none; }
}

/* Content container floats above the stage */
.wrap{ position:relative; z-index:1; max-width:1200px; margin:0 auto; padding:clamp(28px,6vh,68px) 20px; }

/* ===== Badges / chips ===== */
.badge{
  display:inline-block; font-size:12px; padding:6px 10px; border-radius:999px;
  border:1px solid rgba(79,124,255,.25);
  color:#2445ff; background:linear-gradient(180deg, #eef3ff, #eaf1ff);
  box-shadow:0 1px 0 rgba(79,124,255,.12) inset;
  margin-bottom:14px;
}

/* ===== Panel (glass) ===== */
.panel{
  background:rgba(255,255,255,.84);
  border:1px solid var(--line);
  border-radius:var(--radius);
  backdrop-filter: blur(6px) saturate(105%);
  -webkit-backdrop-filter: blur(6px) saturate(105%);
  padding:18px;
  box-shadow:var(--shadow);
}
/* Fallback when backdrop-filter unsupported */
@supports not ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))){
  .panel, .nav{ background:#ffffff; }
}

/* ===== Global nav (shared) ===== */
.nav{ position:sticky; top:0; z-index:1200; backdrop-filter:saturate(120%) blur(8px); -webkit-backdrop-filter:saturate(120%) blur(8px); }
.nav-inner{ max-width:1200px; margin:0 auto; padding:12px 20px; display:flex; align-items:center; justify-content:space-between; }
.brand{ font-weight:800; letter-spacing:.5px; color:var(--ink); text-decoration:none; }
.nav .links a{ text-decoration:none; margin-left:16px; color:var(--ink); }
.nav .links a:hover{ text-decoration:underline; }

/* ===== Controls ===== */
.controls{ display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin:12px 0 8px }
.counts,.muted{ font-size:13px; color:var(--muted) }

input[type="search"], select{
  padding:12px 14px; border-radius:12px; border:1px solid var(--line);
  background:#f5f8ff; color:var(--ink); outline:none;
  transition:border-color .15s, box-shadow .15s, background .15s, transform .05s;
}
input[type="search"]::placeholder{ color:#99a6b5 }
input[type="search"]:focus, select:focus{
  border-color:#cbd9ff; background:#fff; box-shadow:0 0 0 3px rgba(79,124,255,.15);
  transform: translateY(-1px);
}

/* ===== Sections ===== */
.section{ margin-top:20px }
.section h2{ font-size:18px; color:#243042; margin:0 0 10px }
.empty{ color:var(--muted); padding:16px }

/* ===== Grid & Cards ===== */
.grid{
  display:grid; gap:18px;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
  margin-top:12px;
}

/* support both old (.card/.thumb/.body) and new (.person-*) class names */
.person-card,.card{
  position:relative;
  background:rgba(255,255,255,.9);
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden; display:flex; flex-direction:column;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  box-shadow:var(--shadow);
}
.person-card::before,.card::before{
  content:""; position:absolute; inset:0; pointer-events:none; border-radius:18px;
  background: linear-gradient(140deg, rgba(79,124,255,.25), rgba(46,196,182,.22) 40%, rgba(255,159,110,.25) 100%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude; -webkit-mask-composite: xor;
  padding:1px; opacity:0; transition:opacity .15s ease;
}
.person-card:hover,.card:hover{
  transform:translateY(-4px);
  border-color:rgba(79,124,255,.28);
  box-shadow:var(--shadow-hover);
}
.person-card:hover::before,.card:hover::before{ opacity:1; }

.person-thumb,.thumb{
  width:100%; aspect-ratio: 9/11; object-fit:cover; display:block;
  background:linear-gradient(180deg,#f3f7ff,#eff5ff);
  border-bottom:1px solid var(--line);
}

.person-body,.body{ padding:12px }
.person-name,.name{ font-weight:800; margin:2px 0 6px; letter-spacing:.1px }
.muted{ color:var(--muted); font-size:13px; }          /* safer generic */
.person-meta{ color:var(--muted); font-size:13px; margin:2px 0; }
.person-links,.links{ margin-top:10px; font-size:13px }
.person-links a,.links a{ text-decoration:none; color:var(--accent) }
.person-links a:hover,.links a:hover{ text-decoration:underline }

/* ===== Buttons & Pills ===== */
.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--line);
  background:#fff; color:var(--ink); text-decoration:none; cursor:pointer;
  box-shadow:var(--shadow); transition:transform .12s, box-shadow .12s, border-color .12s;
}
.btn:hover{ transform:translateY(-2px); box-shadow:var(--shadow-hover); border-color:#cbd9ff; }
.btn:focus-visible{ outline:3px solid rgba(79,124,255,.25); outline-offset:2px; }

.pill{
  display:inline-block; font-size:12px; padding:6px 12px; border-radius:999px;
  border:1px solid var(--line); color:var(--muted); cursor:pointer; background:#fff;
  transition: border-color .12s, box-shadow .12s, transform .05s;
}
.pill:hover{ transform: translateY(-1px); }
.pill.active{ border-color:#cbd9ff; color:#2b4eff; background:#eef3ff; box-shadow:0 0 0 3px rgba(79,124,255,.12) }

/* ===== Table ===== */
table{ width:100%; border-collapse:collapse; margin-top:12px }
th,td{ border-top:1px solid var(--line); padding:10px 8px; text-align:left; vertical-align:top }
tr:hover{ background:linear-gradient(90deg, rgba(79,124,255,.08), rgba(46,196,182,.08)) }

/* ===== Drawer (votes/detail) ===== */
.drawer{
  position:fixed; top:0; right:0; bottom:0; width:min(560px,100%);
  transform:translateX(100%); transition:transform .25s ease;
  background:#ffffff; border-left:1px solid var(--line);
  box-shadow:0 0 40px rgba(25,35,60,.18); z-index:900; /* below sticky nav */
  display:flex; flex-direction:column;
}
.drawer.open{ transform:translateX(0) }
.drawer header{ padding:16px; border-bottom:1px solid var(--line) }
.drawer .content{ padding:16px; overflow:auto }
.member{ display:grid; grid-template-columns:1fr auto; gap:8px; padding:8px 0; border-top:1px solid var(--line) }
.score{ font-weight:800 }

/* ===== Accessibility helpers ===== */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ===== Motion reduction for interactive bits ===== */
@media (prefers-reduced-motion: reduce){
  .btn,.pill,.person-card,.card{ transition:none !important; transform:none !important; }
}

/* ===== Small screens ===== */
@media (max-width:560px){
  .wrap{ padding:16px 12px }
}
/* === Fix home page scroll + hex map visibility === */
.page-home .wrap { padding-bottom: 120px; }        /* room for long content */
.hexmap-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hexmap { margin: 0 auto; }                         /* keep centered when it fits */

/* Make the hex grid size down on narrower screens so fewer tiles get clipped */
@media (max-width: 1200px){ .hexmap{ --size:44px } }
@media (max-width: 980px){  .hexmap{ --size:40px } }
@media (max-width: 820px){  .hexmap{ --size:36px } }
@media (max-width: 700px){  .hexmap{ --size:32px } }
@media (max-width: 600px){  .hexmap{ --size:30px } }
@media (max-width: 520px){  .hexmap{ --size:28px } }
@media (max-width: 460px){  .hexmap{ --size:26px } }

/* === Directory: compact, linear (two people per row), no heavy “cards” === */
.page-directory .grid{
  /* Exactly two columns when there’s room; one on small screens */
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 14px;
}
@media (max-width: 720px){
  .page-directory .grid{ grid-template-columns: 1fr; }
}

.page-directory .card{
  /* turn the card into a skinny row */
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;

  /* “no card look”: let the colorful page BG through */
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 12px;
  padding: 8px;
  transition: background .12s ease;
}
.page-directory .card:hover{
  background: rgba(255,255,255,.35);                /* a little hover affordance */
  backdrop-filter: blur(4px);
}

.page-directory .thumb{
  width: 92px; aspect-ratio: 1/1; border: 1px solid var(--line);
  border-radius: 10px; background: linear-gradient(180deg,#f3f7ff,#eff5ff);
}
.page-directory .body{ padding: 0; }
.page-directory .name{ margin: 0 0 4px; }
.page-directory .muted{ margin: 0; }
.page-directory .links{ margin-top: 6px; }

/* Keep nav on top of everything */
.nav{ z-index: 1200; }

/* Safety: avoid global horizontal clipping that can hide the right side of the hex map */
body{ overflow-x: visible; }
