/* ==========================================================================
   QIST — Design tokens
   Primary: #5AB834 (parrot green). Neutrals carry everything else.
   Display/body: IBM Plex Sans. Labels/data/nav accents: IBM Plex Mono.
   ========================================================================== */

:root {
  /* Brand */
  --green: #5ab834;
  --green-dark: #47921f;
  --green-darker: #316615;
  --green-tint: #eaf7e2;

  /* Neutrals */
  --black: #14161a;
  --gray-900: #202329;
  --gray-800: #33383e;
  --gray-600: #5c636b;
  --gray-400: #9aa1a8;
  --gray-300: #c7cbcf;
  --gray-200: #e4e6e8;
  --gray-100: #f3f4f5;
  --white: #ffffff;

  /* Semantic */
  --bg: var(--white);
  --bg-alt: var(--gray-100);
  --text: var(--black);
  --text-muted: var(--gray-600);
  --border: var(--gray-200);

  /* Type */
  --font-display: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --max-width: 1180px;
  --nav-height: 76px;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.06), 0 1px 1px rgba(20, 22, 26, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 22, 26, 0.08);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

ul { list-style: none; margin: 0; padding: 0; }

button { font-family: inherit; cursor: pointer; }

input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--green);
}

.section {
  padding-block: 88px;
}

.section--alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 640px;
  margin-bottom: 48px;
}

.section-head h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 12px;
}

.section-head p {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.site-alert {
  background: #f7c948;
  color: #14161a;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--green);
  color: var(--black);
}
.btn--primary:hover { background: var(--green-dark); color: var(--white); }

.btn--dark {
  background: var(--black);
  color: var(--white);
}
.btn--dark:hover { background: var(--gray-900); }

.btn--outline {
  background: transparent;
  border-color: var(--gray-300);
  color: var(--text);
}
.btn--outline:hover { border-color: var(--black); }

.btn--block { width: 100%; }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-tint);
  color: var(--green-darker);
  font-weight: 600;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.grid {
  display: grid;
  gap: 24px;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--black);
  border-bottom: 1px solid var(--gray-900);
}

.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.navbar__logo {
  width: 40px;
  height: 40px;
  border: 1px dashed var(--gray-600);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--gray-400);
  text-align: center;
  flex-shrink: 0;
  /* Replace this element with <img src="/images/logo.png" alt="QIST logo"> once the PNG is ready */
}

.navbar__wordmark {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--white);
  line-height: 1.2;
}

.navbar__wordmark span {
  display: block;
  font-size: 0.62rem;
  color: var(--gray-400);
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.navbar__links {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 100%;
}

.navlink {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.navlink > a, .navlink > button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 14px;
  background: transparent;
  border: none;
  color: var(--gray-300);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s var(--ease);
}

.navlink > a:hover,
.navlink > button:hover,
.navlink.is-active > a,
.navlink.is-active > button {
  color: var(--white);
}

.navlink .caret {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.15s var(--ease);
  opacity: 0.7;
}

.navlink.is-open .caret { transform: rotate(225deg); margin-top: 3px; }

.navlink__panel {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease), visibility 0.15s;
}

.navlink.is-open .navlink__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.navlink__panel a {
  display: block;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--green-dark);
  font-weight: 500;
}

.navlink__panel a:hover {
  background: var(--green-tint);
  color: var(--green-darker);
}

.navbar__login {
  flex-shrink: 0;
  padding: 9px 18px !important;
  border-radius: var(--radius);
  background: var(--green);
  color: var(--black) !important;
  font-weight: 600;
}
.navbar__login:hover { background: var(--green-dark); color: var(--white) !important; }

.navbar__toggle {
  display: none;
  background: transparent;
  border: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0;
}
.navbar__toggle span {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--white);
  border-radius: 1px;
  margin-inline: auto;
}

@media (max-width: 768px) {
  .navbar__toggle { display: flex; }

  .navbar .container {
    gap: 12px;
  }

  .navbar__brand {
    min-width: 0;
  }

  .navbar__wordmark span {
    display: none;
  }

  .navbar__login {
    display: inline-flex;
    padding: 10px 14px !important;
    font-size: 0.9rem;
  }

  .navbar__links {
    position: fixed;
    top: calc(var(--nav-height) - 1px);
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    background: var(--black);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 12px 20px;
    gap: 0;
    overflow-y: auto;
    transform: translateY(-4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
  }

  .navbar__links.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .navlink { height: auto; flex-direction: column; align-items: stretch; }
  .navlink > a, .navlink > button {
    height: auto;
    padding: 16px 8px;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-900);
    font-size: 1rem;
  }
  .navlink__panel {
    position: static;
    box-shadow: none;
    border: none;
    margin: 0 0 0 12px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: max-height 0.2s var(--ease);
  }
  .navlink.is-open .navlink__panel { max-height: 400px; padding: 4px 0 10px; }
  .navlink__panel a {
    color: var(--green);
    padding: 14px 10px;
    font-size: 0.98rem;
  }
  .navlink__panel a:hover { background: var(--gray-900); color: var(--green-tint); }
}

body.nav-open {
  overflow: hidden;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-block: 88px 96px;
  overflow: hidden;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 28px;
  max-width: 920px;
}

.hero__intro {
  display: grid;
  gap: 18px;
}

.hero__brand-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero__brand-logo {
  width: clamp(84px, 12vw, 132px);
  height: auto;
  display: block;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  flex-shrink: 0;
}

.hero__brand-copy {
  min-width: 0;
}

.hero__title {
  font-size: clamp(2.1rem, 1.4rem + 2.8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero__animated-lines {
  display: grid;
  gap: 4px;
}

.hero__animated-line {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green-dark);
  opacity: 0;
  transform: translateY(10px);
  animation: slideFadeUp 0.7s var(--ease) forwards;
}

.hero__animated-line--two {
  animation-delay: 0.14s;
}

.hero__motto {
  font-size: 1.18rem;
  line-height: 1.45;
  color: var(--text);
}

.hero__motto em {
  font-style: italic;
}

.hero__lead {
  max-width: 46ch;
  font-size: 1.15rem;
  color: var(--text-muted);
}

.hero__actions {
  margin-top: 34px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero__stats {
  margin-top: 56px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.hero__stat dt {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--black);
}

.hero__stat dd {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

@keyframes slideFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .hero__brand-row { align-items: flex-start; }
}

@media (max-width: 640px) {
  .hero {
    padding-block: 64px 72px;
  }

  .hero__brand-row {
    gap: 14px;
  }

  .hero__title {
    font-size: clamp(1.9rem, 1.5rem + 4vw, 2.8rem);
  }

  .hero__motto {
    font-size: 1.02rem;
  }

  .hero__animated-line {
    font-size: 0.8rem;
  }

  .hero__lead {
    font-size: 1rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .hero__stats {
    gap: 20px;
    margin-top: 36px;
  }

  .hero__stat dt {
    font-size: 1.35rem;
  }

  .hero__stat dd {
    font-size: 0.76rem;
  }
}

/* ==========================================================================
   Page banner (non-home pages)
   ========================================================================== */

.page-banner {
  padding: 64px 0 56px;
  background: var(--black);
  color: var(--white);
}

.page-banner h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-banner p {
  margin-top: 14px;
  max-width: 56ch;
  color: var(--gray-400);
  font-size: 1.05rem;
}

.page-banner .eyebrow { color: var(--green); }
.page-banner .eyebrow::before { background: var(--green); }

/* ==========================================================================
   Mission / Objectives / Profile / People / Contact  (home page sections)
   ========================================================================== */

.mission {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.mission blockquote {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.mission blockquote::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  background: var(--green);
  margin-bottom: 20px;
}

.objective {
  display: flex;
  gap: 18px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.objective:last-child { border-bottom: 1px solid var(--border); }

.objective__index {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green-dark);
  flex-shrink: 0;
  padding-top: 3px;
}

.objective h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.objective p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.profile-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 40px;
}

.profile-facts__item {
  background: var(--white);
  padding: 22px 20px;
}

.profile-facts__item dt {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
}

.profile-facts__item dd {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.person {
  text-align: left;
}

.person__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--black);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.person h3 {
  font-size: 1.02rem;
  font-weight: 600;
}

.person__role {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
  color: var(--green-dark);
  font-weight: 500;
}

.person p {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
}

.contact-info dl {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

.contact-info dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-info dd {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 500;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 7px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.95rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.field textarea { resize: vertical; min-height: 120px; }

.field-hint { font-size: 0.8rem; color: var(--gray-400); margin-top: 6px; }

.form-msg {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.form-msg.is-visible { display: block; }
.form-msg--ok { background: var(--green-tint); color: var(--green-darker); }
.form-msg--error { background: #fbe9e7; color: #9a3412; }

@media (max-width: 900px) {
  .mission, .contact-grid { grid-template-columns: 1fr; gap: 40px; }
  .profile-facts { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Project / product / education / reference / news cards
   ========================================================================== */

.project-card, .product-card, .program-card, .cert-card, .blog-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-card__top, .blog-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card h3, .product-card h3, .program-card h3, .cert-card h3, .blog-card h3 {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
}

.project-card p, .product-card p, .program-card p, .cert-card p, .blog-card p {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
}

.status-dot--amber { background: #d97706; }
.status-dot--gray { background: var(--gray-400); }

.reference-list {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.reference-item {
  background: var(--white);
  padding: 20px 22px;
  display: flex;
  gap: 20px;
  align-items: baseline;
  justify-content: space-between;
}

.reference-item__title { font-weight: 600; font-size: 0.98rem; }
.reference-item__meta { margin-top: 4px; font-size: 0.85rem; color: var(--text-muted); }
.reference-item__year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

.placeholder-note {
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Technology status table ---------------------------------------------- */

.trl-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.trl-table th, .trl-table td {
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.trl-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-alt);
}

.trl-table tr:last-child td { border-bottom: none; }

.trl-bar {
  width: 120px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}
.trl-bar span { display: block; height: 100%; background: var(--green); }

@media (max-width: 700px) {
  .reference-item { flex-direction: column; gap: 4px; }
  .trl-table { display: block; overflow-x: auto; }
}