/* ============================================================
   GAMBIT — projectgambit.org
   One stylesheet for the whole site. No build step.
   ============================================================ */

/* ---- Fonts (self-hosted) ----
   Public Sans is the only typeface on the site (variable weight 100-900). */
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/PublicSans-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/PublicSans-var-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --bg: #060a13;
  --bg-raise: #0a1120;
  --surface: #0e1728;
  --line: rgba(126, 154, 220, 0.16);
  --line-strong: rgba(126, 154, 220, 0.34);
  --text: #e8edf8;
  --text-2: #9fadc9;
  --cyan: #45e0e0;
  --blue: #3e6dff;
  --blue-bright: #6f92ff;
  --violet: #8a5cff;
  --violet-bright: #a685ff;
  --blue-white: #cfdcff;
  --pole-n: #e08585;
  --pole-s: #7d9be8;
  --grad: linear-gradient(120deg, var(--cyan), var(--blue) 45%, var(--violet));
  --display: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --frame-inset: 22px;
}

/* ---- Reset / base ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--blue-bright); text-decoration: none; }
a:hover { color: var(--cyan); }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(62, 109, 255, 0.4); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Hero — the magnet card, full viewport
   ============================================================ */
.hero {
  position: relative;
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
/* Soft aura spilling past the card so the hero fades into the page */
.hero::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -170px;
  transform: translateX(-50%);
  width: min(980px, 85vw);
  height: 340px;
  background: radial-gradient(
    ellipse closest-side,
    rgba(62, 109, 255, 0.13),
    rgba(138, 92, 255, 0.06) 55%,
    transparent 75%
  );
  pointer-events: none;
}

/* Radiating field lines behind everything */
.hero-rays {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
.hero-rays svg {
  width: max(160vw, 160vh);
  height: max(160vw, 160vh);
  flex-shrink: 0;
  animation: rays-turn 240s linear infinite;
}
@keyframes rays-turn {
  to { transform: rotate(360deg); }
}
/* Soft glow at the heart of the field */
.hero-rays::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 60% 52% at 50% 46%,
      rgba(62, 109, 255, 0.28),
      rgba(138, 92, 255, 0.12) 48%,
      transparent 72%
    ),
    radial-gradient(ellipse 42% 36% at 10% 4%, rgba(224, 133, 133, 0.12), transparent 70%),
    radial-gradient(ellipse 46% 40% at 90% 96%, rgba(125, 155, 232, 0.16), transparent 70%);
}

/* 1px gradient frame — the card's edge */
.hero-frame {
  position: absolute;
  inset: var(--frame-inset);
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(
    160deg,
    rgba(69, 224, 224, 0.8),
    rgba(62, 109, 255, 0.45) 40%,
    rgba(138, 92, 255, 0.7)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  pointer-events: none;
}

/* Label sitting on the card's top edge */
.hero-program {
  position: absolute;
  top: var(--frame-inset);
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0.15rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.09em;
  color: var(--text-2);
  white-space: nowrap;
}
.hero-program a { color: inherit; }
.hero-program a:hover { color: var(--cyan); }

/* Pole marks in opposite corners, as on the logo card */
.hero-pole {
  position: absolute;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}
.hero-pole.n { top: calc(var(--frame-inset) + 10px); left: calc(var(--frame-inset) + 16px); color: var(--pole-n); }
.hero-pole.s { bottom: calc(var(--frame-inset) + 10px); right: calc(var(--frame-inset) + 16px); color: var(--pole-s); transform: rotate(180deg); }

/* ---- Nav (inside the card) ---- */
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(var(--frame-inset) + 2.7rem) calc(var(--frame-inset) + 2.2rem) 0;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.28em;
  color: var(--text);
}
.nav-links-only { justify-content: flex-end; }
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}
.nav-links a {
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.nav-links a:hover { color: var(--cyan); }

/* ---- Hero center ---- */
.hero-center {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem 3.5rem;
  animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise {
  from { transform: translateY(16px); }
  to   { transform: translateY(0); }
}

.hero-knight { width: clamp(64px, 9vw, 96px); margin-bottom: 1.6rem; }

.hero-logo { margin: 0; }
.hero-logo img {
  /* As large as the viewport allows: scale with width, capped by height so
     the mission line and actions stay inside the first viewport */
  width: min(max(340px, 56vw), 62svh);
  height: auto;
  filter: brightness(1.55);
}

.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.4rem, 9vw, 6rem);
  line-height: 1;
  letter-spacing: 0.16em;
  margin-right: -0.16em; /* optically recenter tracked caps */
  color: var(--text);
}

.hero-expansion {
  margin-top: 1.1rem;
  font-size: clamp(0.72rem, 1.4vw, 0.85rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-2);
  max-width: 64ch;
  text-wrap: balance;
}

.hero-mission {
  margin-top: -1.25rem;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  max-width: 44ch;
}
.hero-mission em {
  font-style: italic;
  color: var(--cyan);
}

.hero-actions {
  margin-top: 2.6rem;
  display: flex;
  align-items: center;
  gap: 2.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  position: relative;
  display: inline-block;
  padding: 0.85rem 1.9rem;
  border-radius: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--text);
  background:
    linear-gradient(var(--bg-raise), var(--bg-raise)) padding-box,
    var(--grad) border-box;
  border: 1px solid transparent;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.btn:hover {
  color: var(--text);
  box-shadow: 0 6px 28px -6px rgba(62, 109, 255, 0.55);
  transform: translateY(-1px);
}

.link-arrow {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.link-arrow::after {
  content: " \2192";
  color: var(--cyan);
}
.link-arrow:hover { color: var(--text); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 7.5rem 0 2.5rem; }
.section:last-of-type { padding-bottom: 6rem; }

/* Raised band for visual contrast between sections */
.section-raised {
  background: var(--bg-raise);
  border-top: 1px solid var(--line);
  padding: 5.5rem 0 5rem;
}
.section-raised.section:last-of-type { padding-bottom: 5rem; }

.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.5vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
  text-wrap: balance;
}

.section-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-2);
  max-width: none;
  margin-bottom: 3rem;
}
.section-lead strong { color: var(--text); font-weight: 550; }

/* ---- Approach ---- */
.loop-figure {
  margin: 3.5rem 0 4rem;
}
.loop-figure svg { display: block; width: 100%; height: auto; }
.loop-figure text {
  font-family: var(--display);
  font-weight: 600;
}

.stages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 4rem;
  border-top: 1px solid var(--line);
}
.stage {
  padding: 2.2rem 0 2.4rem;
  border-bottom: 1px solid var(--line);
}
.stage h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.stage h3 svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  overflow: visible;
}
.stage p { color: var(--text-2); font-size: 1rem; max-width: 52ch; }
.stage p strong { color: var(--text); font-weight: 550; }

/* ---- Team ---- */
.roster {
  list-style: none;
  border-top: 1px solid var(--line);
}
.roster li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 0.85fr);
  gap: 1rem 2rem;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.avatar {
  display: block;
  width: 104px;
  height: 104px;
  border-radius: 10px;
  overflow: hidden;
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.roster .name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}
.roster .name a { color: inherit; }
.roster .name a:hover { color: var(--cyan); }
.roster .focus { color: var(--text-2); font-size: 0.98rem; }
.roster .inst {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-2);
  text-align: right;
}

.inst-strip {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3.5rem;
  align-items: center;
  justify-content: center;
}
.inst-strip img {
  height: 30px;
  width: auto;
  filter: grayscale(1) brightness(0) invert(1);
  opacity: 0.45;
  transition: opacity 0.2s ease;
}
.inst-strip a:hover img { opacity: 0.8; }

/* ---- Market ---- */
.market-figure { margin: 3rem 0 3.5rem; max-width: 860px; margin-inline: auto; }
.market-cta {
  margin-top: 2.8rem;
  font-size: 1.15rem;
  color: var(--text);
  max-width: 52ch;
}
.market-actions {
  margin-top: 1.6rem;
  justify-content: flex-start;
}

/* ---- News ---- */
.news-item {
  border-top: 1px solid var(--line);
  padding: 2.4rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1rem 4rem;
  align-items: start;
}
.news-item:last-of-type { border-bottom: 1px solid var(--line); }
.news-date {
  font-size: 0.88rem;
  font-weight: 550;
  letter-spacing: 0.06em;
  color: var(--cyan);
}
.news-item h3 {
  margin-top: 0.8rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: 0;
  max-width: 26ch;
  text-wrap: balance;
}
.news-item h3 a { color: var(--blue-white); }
.news-item h3 a:hover { color: var(--cyan); }
.news-item p {
  margin-top: 0.4rem;
  color: var(--text-2);
  max-width: 66ch;
}
.news-item .link-arrow { display: inline-block; margin-top: 1.2rem; }

.news-all { margin-top: 2.2rem; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 2.4rem 0 1.6rem;
  position: relative;
}
.footer-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 2rem 3.5rem;
  align-items: center;
}
.footer-brand img {
  width: 130px;
  height: auto;
  filter: brightness(1.5);
}
.footer-ack {
  margin-top: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 64ch;
}
.footer-contact h4 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}
.footer-contact p { font-size: 0.95rem; color: var(--text-2); }
.footer-meta {
  margin-top: 1.8rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-2);
}

/* ============================================================
   Inner pages (news archive + posts)
   ============================================================ */
.page {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
/* The magnet card's edge, carried onto inner pages as a top rule */
.page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad);
  opacity: 0.8;
}
.page .hero-pole.n { top: 10px; left: 18px; }
.page .hero-pole.s { bottom: 10px; right: 18px; }
.page .nav { padding-top: 1.9rem; }
.page-main { flex: 1; padding-top: 4.5rem; }
.page .footer { margin-top: 2rem; padding: 2.2rem 0; }

.page-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.article { max-width: 720px; }
.article .news-date { display: block; margin-bottom: 1.1rem; }
.article-body { margin-top: 2.2rem; }
.article-body p { margin-bottom: 1.4rem; color: var(--text); }
.article-body p.aside { color: var(--text-2); font-size: 0.95rem; }
.article-nav {
  display: flex;
  gap: 2.2rem;
  margin-top: 2.5rem;
}
.article-back { display: inline-block; }
.article-back::before { content: "\2190  "; color: var(--cyan); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  :root { --frame-inset: 12px; }

  .nav {
    flex-direction: column;
    gap: 1.1rem;
    padding-left: calc(var(--frame-inset) + 1.2rem);
    padding-right: calc(var(--frame-inset) + 1.2rem);
  }
  .nav-links { gap: 1.3rem; }

  .hero-pole.n { top: calc(var(--frame-inset) + 10px); left: calc(var(--frame-inset) + 14px); }
  .hero-pole.s { bottom: calc(var(--frame-inset) + 10px); right: calc(var(--frame-inset) + 14px); }
  .hero-program { font-size: 0.6rem; letter-spacing: 0.17em; padding: 0.15rem 0.7rem; }

  .section { padding: 4.5rem 0 1.5rem; }

  .stages { grid-template-columns: 1fr; gap: 0; }

  .roster li {
    grid-template-columns: 88px 1fr;
    gap: 0.4rem 1.1rem;
    padding: 1.2rem 0;
    align-items: center;
  }
  .avatar { width: 88px; height: 88px; }
  .roster .focus, .roster .inst { grid-column: 2; }
  .roster .inst { text-align: left; }

  .news-item { grid-template-columns: 1fr; gap: 0; }
  .news-item p { margin-top: 1rem; }

  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- Motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-rays svg { animation: none; }
  .hero-center { animation: none; }
  .btn { transition: none; }
}
