/* JinVi.us ecosystem CSS */
/* 2025-08-19 — tidied, deduped, and fixed broken blocks */
/* 2025-08-22 — added tooltips */

/* ===== Brand tokens ===== */
:root {
  --jv-gold: #fde383;
  --jv-brand-gold: #d4af37;
  --jv-altgold: #b8860b;
  --jv-brand-impjade: #0b7d3b;
  --jv-ltjade: #59c13a;
  --jv-cinnabar: #b00e0e;
  --jv-maxred: #ff0000;
  --jv-bgfield: #000054;
  --jv-bgselect: #F0F0F0;
  --jv-accent: #49b52b;
  --jv-inactive: #888888;
  --jv-bgtable: #19196e;

  /* Heading scale */
  --h1: clamp(2rem, 3.5vw, 2.75rem);
  --h2: clamp(1.5rem, 2.5vw, 2rem);
  --h3: clamp(1.25rem, 2vw, 1.5rem);
  --h4: 1.125rem;
  --heading-lh: 1.2;
  --heading-mt: 1.5rem;
  --heading-mb: .5rem;
}

/* ===== Brand helpers ===== */
.grayed {
  color: var(--jv-inactive);
}
.jv-font {
  font-family: "NebulaSans-Black";
}
.jv-jin {
  color: var(--jv-brand-gold);
  font-family: "NebulaSans-Black";
}
.jv-vi {
  color: var(--jv-brand-impjade);
  font-family: "NebulaSans-Black";
}

/* ===== Fonts ===== */
@font-face {
  font-family: "NebulaSans-Black";
  src: url("https://www.jinvi.us/fonts/NebulaSans-Black.woff2") format("woff2");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

/* ===== Base ===== */
html {
  scroll-behavior: smooth;
}

/* ensure a reference height with full viewport on mobile */
body {
  background: var(--jv-bgfield);
  color: var(--jv-gold);
  font-family: sans-serif;
  margin-left: 2em;
  margin-right: 2em;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* content grows */
main {
  flex: 1 0 auto;
}

/* footer pushed to the bottom */
footer {
  text-align: center;
  margin: 3em 0 1em;
}

/* ===== Links ===== */
a {
  color: var(--jv-altgold);
  text-decoration: underline;
}

a:hover,
a:focus,
.portal-block:hover,
.portal-block:focus-visible,
button:hover,
button:focus,
input:hover,
input:focus,
.has-tooltip:hover .tooltip,
.has-tooltip:focus .tooltip,
.has-tooltip:focus-within .tooltip {
  text-decoration-thickness: 2px;
  color: black;
  background: var(--jv-bgselect);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  border-color: var(--jv-altgold);
  outline: 3px solid color-mix(in oklab, var(--jv-altgold), transparent 60%);
  outline-offset: 2px;
}

/* ===== Headings ===== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif, Georgia, "Times New Roman", serif);
  line-height: var(--heading-lh);
  margin-block: var(--heading-mt) var(--heading-mb);
  text-wrap: balance;
}
h1 {
  font-size: var(--h1);
  text-align: center;
  color: var(--jv-gold, #d4af37);
}
h2 {
  font-size: var(--h2);
  color: var(--jv-altgold);
}
h3 {
  font-size: var(--h3);
  color: var(--jv-ltjade);
}
h4 {
  font-size: var(--h4);
}
h1 + h2,
h2 + h3,
h3 + h4 {
  margin-top: .75rem;
}

/* ===== Paragraphs ===== */
p {
  line-height: 1.6;
}
.article p:first-of-type {
  text-indent: 2em;
}

/* ===== Superscripts/Subscripts ===== */
sup,
sub {
  font-size: calc(0.29em + 4px);
  line-height: 0;
  vertical-align: baseline;
  position: relative; 
  top: calc(-0.5 * 0.83 * 2 * (1.75em - 4px));
}
sub {
  top: calc(0.5 * 0.83 * 2 * (1.75em - 4px));
}

/* ===== Tables ===== */
table {
  border-collapse: separate;
  border-spacing: 0 0.25ex; /* vertical gap */
  margin-bottom: 1em;
}
thead tr {
  background: var(--jv-bgtable);
}
thead th {
  color: var(--jv-altgold);
}
tbody > tr:nth-of-type(even) {
  background: color-mix(in oklab, var(--jv-bgtable), white 6%);
}
tbody > tr:nth-of-type(odd) {
  background: color-mix(in oklab, var(--jv-bgtable), black 6%);
}
th,
td {
  padding: .5em .75em;
  border: 1px solid #222;
}
td.c,
th.c {
  text-align: center;
}

/* ===== Tooltips ===== */
.has-tooltip {
  position: relative;
}
.has-tooltip .tooltip {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 130%; /* show below nav item */
  padding: 0.5em 1em;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 1em;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
  pointer-events: none;
}
.has-tooltip:hover .tooltip,
.has-tooltip:focus .tooltip,
.has-tooltip:focus-within .tooltip {
  display: block;
}

/* ===== Navbar ===== */
.main-nav {
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  z-index: 100;
}
.main-nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav li {
  margin: 0 1.5em;
}
.main-nav a {
  display: block;
  font-weight: bold;
  font-size: 1em;
  padding: 1.2em .2em;
  text-decoration: none;
  transition: color .2s, background .2s;
  border-bottom: 3px solid transparent;
}

/* ===== Home layout & hero ===== */
.page {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
  display: grid;
  gap: 2rem;
}
.home-hero {
  grid-column: 1/-1;
  position: relative;
  text-align: center;
  padding: clamp(2.5rem, 8vw, 6rem) 1.25rem;
  border-radius: 1.25rem;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.00), rgba(0,0,0,.25));
}
.tag {
  margin: 0 auto 1.25rem;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  opacity: .9;
  text-indent: 0;
}
.btn {
  display: inline-block;
  padding: .8rem 1.25rem;
  border-radius: .75rem;
  font-weight: 700;
  text-decoration: none;
}
.btn-primary {
  background: var(--jv-altgold);
  color: #0b0b0b;
}
.btn-ghost {
  border: 1.5px solid var(--jv-altgold);
  color: var(--jv-gold);
}

/* ===== Value props ===== */
.vp-div {
  display: grid;
  gap: 1rem;
}
.vp {
  background: color-mix(in oklab, var(--jv-bgtable), black 8%);
  border: 1px solid color-mix(in oklab, var(--jv-altgold), transparent 85%);
  border-radius: .75rem;
  padding: .9rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}
.vp strong {
  color: var(--jv-gold);
}
.vp span {
  opacity: .9;
}

/* ===== Featured block ===== */
.featured {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: center;
}
.featured__media {
  aspect-ratio: 4/3;
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.00)),
    color-mix(in oklab, var(--jv-bgtable), black 6%);
  box-shadow: 0 8px 22px rgba(0,0,0,.28) inset, 0 4px 16px rgba(0,0,0,.18);
}

/* ===== Portals as big button divs ===== */
.portals--buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  align-items: stretch;
}
.portal-block {
  display: block;
  height: 100%;
  padding: clamp(1rem, 3vw, 1.5rem);
  cursor: pointer;
  text-decoration: none;
  border-radius: 1rem;
  border: 1.5px solid color-mix(in oklab, var(--jv-altgold), transparent 85%);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  background: color-mix(in oklab, var(--jv-bgtable), black 4%);
}
.portal-block h2,
.portal-block h3 {
  text-align: center;
}
.portal-block p {
  margin: 0;
  text-indent: 0;
  line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .featured {
    grid-template-columns: 1fr;
  }
  .vp-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Site Search ===== */
#jinvi-search-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: color-mix(in oklab, var(--jv-bgfield), black 20%);
}
#jinvi-search-modal.active { display: flex; align-items: center; justify-content: center; }
#jinvi-search-bar {
  background: color-mix(in oklab, var(--jv-bgfield), white 20%);
  border-radius: 1em;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  padding: 2em 1.5em;
  min-width: 320px; max-width: 90vw;
  display: flex; flex-direction: column; align-items: center;
}
#jinvi-search-bar input[type="text"] {
  width: 240px; padding: 0.5em; font-size: 1em; border-radius: 0.5em; border: 1px solid #ccc;
  
}
#jinvi-search-bar button, #jinvi-search-bar .close-btn {
  margin-top: 1em;
  border: none;
  border-radius: 0.5em;
  padding: 0.6em 1.2em;
  cursor: pointer;
  font-size: 1em; transition: background 0.2s;
}
#jinvi-search-bar .close-btn { background: #888; margin-left: 1em; }
#jinvi-search-trigger {
  background: var(--jv-altgold); border: none; cursor: pointer; font-size: 1em; margin-left: 1em;
  line-height: 1.5ex;
}
#jinvi-search-trigger:focus { outline: 2px solid #4b5a82; }

@media (max-width: 500px) {
  #jinvi-search-bar {
    padding: 1em 0.5em;
    min-width: 0;
    max-width: 97vw;
  }
  #jinvi-search-bar label {
    font-size: 1em !important;
    text-align: center;
    display: block;
    width: 100%;
    margin-bottom: 0.75em;
  }
  #jinvi-search-bar input[type="text"] {
    width: 100%;
    min-width: 0;
    font-size: 1em;
    margin-bottom: 1em;
    box-sizing: border-box;
  }
  #jinvi-search-bar .close-btn,
  #jinvi-search-bar button[type="submit"] {
    width: 48%;
    min-width: 80px;
    margin-top: 0.5em;
    font-size: 1em;
    padding: 0.6em 0.5em;
  }
  #jinvi-search-bar .close-btn {
    margin-left: 4%;
  }
  #jinvi-search-bar > div {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5em;
    width: 100%;
    justify-content: space-between;
    display: flex;
  }
}
