/* ============================================================
   GIAN — Grisons Instrument for Soft X-ray Analysis
   projects.pmodwrc.ch/gian
   ============================================================ */

:root {
  --bg: #05070d;
  --bg-elevated: #0b0f1a;
  --bg-card: #0e1422;
  --line: rgba(120, 150, 220, 0.16);
  --text: #eef1f8;
  --text-muted: #97a0b8;
  --blue: #4a7be8;
  --blue-soft: #8fb0ff;
  --orange: #ff6a2b;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--blue); color: #fff; padding: 10px 18px; z-index: 100;
}
.skip-link:focus { left: 0; }

.container { width: min(1160px, 100%); margin: 0 auto; padding: 0 32px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  transition: background 0.3s;
  background: linear-gradient(rgba(5,7,13,0.85), rgba(5,7,13,0));
}
.site-header.scrolled {
  background: rgba(5,7,13,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { width: 44px; height: 44px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.32em;
  font-size: 1.05rem;
  padding-left: 0.32em;
}
.nav { display: flex; gap: 28px; }
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav a:hover, .nav a:focus-visible { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--text); transition: transform 0.25s, opacity 0.25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  background: #05070d;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
@media (max-width: 800px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
}

/* ---------- Type ---------- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.kicker::before { content: ""; width: 26px; height: 1px; background: var(--blue); }
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.4vw, 4.1rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-bottom: 22px;
}
h1 .sun { color: var(--orange); }
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 18px;
}
.section-lead { color: var(--text-muted); max-width: 40em; margin-bottom: 40px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("../img/solar-eruption-1492.webp");
  background-size: cover;
  background-position: 72% 30%;
}
.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(100deg, rgba(5,7,13,0.96) 30%, rgba(5,7,13,0.72) 55%, rgba(5,7,13,0.28) 100%),
    linear-gradient(rgba(5,7,13,0.2) 60%, rgba(5,7,13,1) 100%);
}
.hero-inner {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 140px 32px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}
.hero-lead {
  color: var(--text-muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  max-width: 34em;
  margin-bottom: 36px;
}
.hero-lead strong { color: var(--text); font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px; }
.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn-primary { background: #3e6ad6; color: #fff; }
.btn-primary:hover { background: #345fc2; transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue-soft); transform: translateY(-1px); }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }

.hero-visual { text-align: center; }
.hero-visual img {
  width: min(400px, 88%);
  margin: 0 auto;
  filter: drop-shadow(0 30px 60px rgba(0,0,0,0.65)) drop-shadow(0 0 42px rgba(74,123,232,0.18));
}
.hero-visual figcaption { margin-top: 10px; color: var(--text-muted); font-size: 0.78rem; letter-spacing: 0.05em; }
.hero-credit {
  position: absolute;
  bottom: 14px;
  right: 18px;
  color: rgba(230,235,250,0.6);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  z-index: 2;
}
.scroll-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
}
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 110px; gap: 20px; }
  .hero-visual { order: -1; }
  .hero-visual img { width: min(260px, 64%); }
  .hero-bg { background-position: 65% 20%; }
  .scroll-hint { display: none; }
}
@media (max-width: 700px) {
  .hero-bg { background-image: url("../img/solar-eruption-1024.webp"); }
}
@media (max-width: 1100px) {
  .contact-bg {
    background-image:
      linear-gradient(rgba(5,7,13,0.82), rgba(5,7,13,0.9)),
      url("../img/sun-hires-1280.webp");
  }
}
@media (max-width: 600px) {
  .contact-bg {
    background-image:
      linear-gradient(rgba(5,7,13,0.82), rgba(5,7,13,0.9)),
      url("../img/sun-hires-800.webp");
  }
}

/* ---------- Sections ---------- */
.section { padding: 110px 0; }
.section-alt { background: var(--bg-elevated); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Instrument */
.instrument-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  margin-top: 40px;
  align-items: start;
}
.feature { display: flex; gap: 18px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.feature:last-child { border-bottom: 0; }
.feature-icon {
  flex: 0 0 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(74,123,232,0.12);
  color: var(--blue-soft);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature h3 { font-family: var(--font-display); font-size: 1.06rem; font-weight: 600; }
.feature p { color: var(--text-muted); font-size: 0.95rem; }

.instrument-visuals { display: grid; gap: 24px; }
.render-card {
  background: linear-gradient(160deg, #e9edf2, #cfd6df);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.render-card img { width: 100%; }
.render-card figcaption {
  color: #3c4657;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px 12px;
}
@media (max-width: 900px) {
  .instrument-grid { grid-template-columns: 1fr; gap: 36px; }
}


/* Objectives */
.objectives {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 36px;
}
.objective {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 26px;
  transition: transform 0.2s, border-color 0.2s;
}
.objective:hover { transform: translateY(-3px); border-color: rgba(143,176,255,0.4); }
.objective-num {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 14px;
}
.objective h3 { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.objective p { color: var(--text-muted); font-size: 0.95rem; }

.wide-figure { margin-top: 64px; }
.wide-figure img { border-radius: 12px; border: 1px solid var(--line); }
.wide-figure figcaption { color: var(--text-muted); font-size: 0.85rem; margin-top: 12px; }
.credit { color: rgba(151,160,184,0.7); font-size: 0.78rem; }

/* Team */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 900px) { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .team-grid { grid-template-columns: 1fr; } }
.member {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 0 22px;
  text-align: center;
  overflow: hidden;
}
.member .portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  margin-bottom: 18px;
}
.member h3 { padding: 0 16px; }
.member p { padding: 0 16px; }
.avatar {
  display: grid;
  place-items: center;
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(143,176,255,0.35), rgba(74,123,232,0.12));
  border: 1px solid rgba(143,176,255,0.35);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--blue-soft);
  letter-spacing: 0.05em;
}
.member h3 { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; }
.member p { color: var(--text-muted); font-size: 0.88rem; }
.avatar-tall {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  font-size: 2rem;
  background: radial-gradient(circle at 40% 35%, rgba(143,176,255,0.22), rgba(11,15,26,0.4));
}

/* Institute */
.institute-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 56px;
  align-items: center;
}
.institute-grid p { color: var(--text-muted); margin-bottom: 18px; }
.institute-grid p strong { color: var(--text); }
.text-link {
  color: var(--blue-soft);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-display);
}
.text-link:hover { color: #b4caff; }
.institute-photo img { border-radius: 12px; border: 1px solid var(--line); width: 100%; }
.institute-photo figcaption { color: var(--text-muted); font-size: 0.82rem; margin-top: 10px; }
@media (max-width: 900px) {
  .institute-grid { grid-template-columns: 1fr; gap: 32px; }
}

.partners { margin-top: 70px; border-top: 1px solid var(--line); padding-top: 36px; }
.partners-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.partner-row { display: flex; flex-wrap: wrap; gap: 16px; }
.partner-row a {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 18px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.15s;
}
.partner-row a:hover { border-color: var(--blue-soft); transform: translateY(-2px); }
.partner-row img { height: 22px; width: auto; }
.partner-row img[src*="eth-space"] { height: 31px; }
.partner-row img.logo-epix { height: 20px; }
.partner-suffix {
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  border-left: 1px solid rgba(238,241,248,0.55);
  padding-left: 14px;
  line-height: 1.15;
}

/* Contact */
.contact { position: relative; overflow: hidden; isolation: isolate; text-align: center; padding: 150px 0; }
.contact-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(5,7,13,0.82), rgba(5,7,13,0.9)),
    url("../img/sun-hires-1920.webp");
  background-size: cover;
  background-position: center 30%;
}
.contact-inner .kicker { justify-content: center; }
.contact-inner .section-lead { margin-left: auto; margin-right: auto; }
.contact address {
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 30px;
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0; background: var(--bg); }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
}
.footer-brand { display: flex; gap: 16px; align-items: center; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }
.footer-brand strong { color: var(--text); font-family: var(--font-display); letter-spacing: 0.18em; }
.footer-credits { color: var(--text-muted); font-size: 0.82rem; max-width: 520px; }
.footer-credits p { margin-bottom: 6px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
