/* ============================================================
   HISR — Holdway Institute for Systems Research
   Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=JetBrains+Mono:wght@300;400&display=swap');

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── TOKENS ── */
:root {
  --black:     #080808;
  --deep:      #0d0d0f;
  --surface:   #111114;
  --border:    #1e1e24;
  --muted:     #2a2a32;
  --dim:       #7a7a92;   /* readable against near-black */
  --mid:       #a8a8bc;   /* readable against near-black */
  --light:     #c8c8d8;
  --white:     #eeeef4;
  --gold:      #c9a84c;
  --gold-dim:  #7a6430;
  --mono:      'JetBrains Mono', monospace;
  --serif:     'Cormorant Garamond', Georgia, serif;
}

/* ── BASE ── */
html { scroll-behavior: auto; }  /* JS handles smooth scroll manually */

body {
  background: var(--black);
  color: var(--light);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.4;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 3rem;
  background: rgba(8,8,8,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);        /* readable default */
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--gold); }

/* ── EYEBROW ── */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before {
  content: '';
  display: block;
  width: 2rem;
  height: 1px;
  background: var(--gold);
}

/* ── HEADINGS ── */
h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 300;
  color: var(--white);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 300;
  color: var(--white);
  letter-spacing: -0.01em;
  margin-bottom: 2.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--white);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

/* ── LEAD ── */
.lead {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--mid);
  max-width: 560px;
  line-height: 1.8;
}

/* ── PAGE HEADER ── */
.page-header {
  padding: 10rem 3rem 4rem;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeUp 0.9s cubic-bezier(0.22,1,0.36,1) both;
}

/* Atmospheric full-width header backdrop */
.page-header-wrap {
  position: relative;
  overflow: hidden;
  background: var(--black);
}

.page-header-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 80% at 10% 60%, rgba(201,168,76,0.18) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 90% 20%, rgba(201,168,76,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 100%, rgba(201,168,76,0.06) 0%, transparent 70%);
  animation: atmosphericPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
}

.page-header-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

@keyframes atmosphericPulse {
  from {
    opacity: 0.4;
    transform: scale(1) translateX(0);
  }
  to {
    opacity: 1;
    transform: scale(1.08) translateX(2%);
  }
}

/* ── SECTION LABEL ── */
.section-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: 0 3rem 5rem;
  position: relative;
  background: var(--black);
  overflow: hidden;
}

/* Loading overlay — hides the poster image flash, fades out when video plays */
.hero-loading {
  position: absolute;
  inset: 0;
  background: var(--black);
  z-index: 1;
  transition: opacity 1.5s ease;
  pointer-events: none;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

@media (max-width: 768px) {
  .hero-video { display: none; }
  .hero { background-image: url('images/Penteract2.jpg'); background-size: cover; background-position: center; }
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(8,8,8,0.3) 0%,
    rgba(8,8,8,0.5) 40%,
    rgba(8,8,8,0.92) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 820px;
  animation: fadeUp 1.2s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5px;
  background: var(--border);
  border: 1px solid var(--border);
}

/* ── CARDS (index) ── */
.card {
  display: block;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  min-height: 420px;
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1);
}

.card:hover { transform: scale(1.01); z-index: 2; }

.image-card {
  background-size: cover;
  background-position: center;
}

.image-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8,8,8,0.97) 0%,
    rgba(8,8,8,0.7) 50%,
    rgba(8,8,8,0.2) 100%
  );
  transition: opacity 0.4s;
}

.card-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.5rem;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.card-inner p {
  font-size: 0.9rem;
  color: var(--mid);
  line-height: 1.7;
  font-family: var(--mono);
  font-weight: 300;
}

.card-arrow {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.card:hover .card-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* ── ORIENTATION (index) ── */
.orientation {
  border-top: 1px solid var(--border);
  padding: 5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  align-items: start;
}

.orientation-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 0.4rem;
}

.orientation p {
  font-size: 1rem;
  color: var(--mid);
  line-height: 1.9;
  font-weight: 300;
}

/* ── FILTER BAR (publications) ── */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  margin-right: 0.75rem;
}

.filter-btn {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  background: none;
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ── PUBLICATIONS LIST ── */
.publications-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem;
}

.count-line {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 2rem;
}

.pub-entry {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
  animation: fadeUp 0.6s cubic-bezier(0.22,1,0.36,1) both;
}

.pub-entry:hover { background: rgba(201,168,76,0.03); }
.pub-entry:last-child { border-bottom: 1px solid var(--border); }

.pub-meta {
  padding: 2rem 2rem 2rem 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pub-date {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.pub-type {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.pub-source {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-top: auto;
}

.pub-body {
  padding: 2rem 0 2rem 2rem;
}

.pub-title {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  transition: color 0.2s;
}

.pub-entry:hover .pub-title { color: var(--gold); }

.pub-desc {
  font-size: 0.92rem;
  color: var(--mid);
  line-height: 1.7;
  font-weight: 300;
  max-width: 600px;
}

.pub-arrow {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  transition: color 0.2s, transform 0.2s;
}

.pub-entry:hover .pub-arrow {
  color: var(--gold);
  transform: translateX(4px);
}

/* ── ARCHIVES ── */
.archives-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 3rem 5rem;
}

.category-section {
  border-bottom: 1px solid var(--border);
  padding: 4rem 0;
  animation: fadeUp 0.7s cubic-bezier(0.22,1,0.36,1) both;
}

.category-section:last-child { border-bottom: none; }

.category-header {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  align-items: baseline;
  margin-bottom: 2rem;
}

.category-name {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  padding-right: 2rem;
}

.category-rule {
  height: 1px;
  background: var(--border);
  align-self: center;
}

.archive-entry {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--border);
  transition: background 0.2s;
}

.archive-entry:hover { background: rgba(201,168,76,0.03); }

.archive-entry.no-link { cursor: default; pointer-events: none; }
.archive-entry.no-link .entry-title { color: var(--mid); }

.entry-meta {
  padding: 1.75rem 2rem 1.75rem 0;
  border-right: 1px solid var(--border);
}

.entry-date {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  display: block;
}

.entry-body { padding: 1.75rem 0 1.75rem 2rem; }

.entry-title {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.archive-entry:hover .entry-title { color: var(--gold); }

.entry-desc {
  font-size: 1.1rem;
  color: var(--mid);
  line-height: 1.7;
  font-weight: 300;
  max-width: 560px;
}

.entry-arrow {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  transition: color 0.2s, transform 0.2s;
}

.archive-entry:hover .entry-arrow {
  color: var(--gold);
  transform: translateX(4px);
}

/* ── ABOUT ── */
.about-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 3rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}

.about-sidebar {
  padding-right: 3rem;
  border-right: 1px solid var(--border);
}

.sidebar-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 1.5rem;
}

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.meta-item { display: flex; flex-direction: column; gap: 0.25rem; }

.meta-key {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.meta-value {
  font-size: 0.9rem;
  color: var(--mid);
  font-weight: 300;
}

.meta-value a {
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.2s;
}

.meta-value a:hover { opacity: 0.7; }

.about-copy { padding-left: 3rem; }

.about-copy p {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--light);
  line-height: 1.9;
  margin-bottom: 1.75rem;
  max-width: 620px;
}

.about-copy p:last-child { margin-bottom: 0; }

.contact-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 3rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.2s both;
}

.contact-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  padding-right: 3rem;
  border-right: 1px solid var(--border);
  padding-top: 0.3rem;
}

.contact-body { padding-left: 3rem; }

.contact-body h2 {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--white);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.contact-body p {
  font-size: 0.95rem;
  color: var(--mid);
  line-height: 1.8;
  font-weight: 300;
  margin-bottom: 1rem;
}

.contact-email {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 0.1rem;
  transition: border-color 0.2s, opacity 0.2s;
}

.contact-email:hover { opacity: 0.75; border-color: var(--gold); }

/* ── STATUS / LOADING ── */
.status {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--dim);
  padding: 4rem 0;
  letter-spacing: 0.08em;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
}

footer p {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.footer-orcid {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-orcid:hover { color: var(--gold); }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(1.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 1rem 1.5rem; }

  .hero { padding: 0 1.5rem 4rem; }

  .page-header { padding: 8rem 1.5rem 3rem; }

  .publications-section { padding: 2rem 1.5rem; }

  .pub-entry { grid-template-columns: 1fr; }
  .pub-meta {
    padding: 1.5rem 0 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .pub-source { margin-top: 0; }
  .pub-body { padding: 1.25rem 0 1.5rem; }

  .archives-container { padding: 0 1.5rem 4rem; }
  .category-header { grid-template-columns: 1fr; gap: 0.75rem; }
  .category-rule { display: none; }
  .archive-entry { grid-template-columns: 1fr; }
  .entry-meta {
    padding: 1.25rem 0 0.5rem;
    border-right: none;
  }
  .entry-body { padding: 0.5rem 0 1.25rem; }

  .orientation { grid-template-columns: 1fr; gap: 1.5rem; padding: 4rem 1.5rem; }

  .about-body { grid-template-columns: 1fr; padding: 3rem 1.5rem; }
  .about-sidebar {
    padding-right: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
  }
  .sidebar-meta { flex-direction: row; flex-wrap: wrap; gap: 1.5rem; }
  .about-copy { padding-left: 0; }

  .contact-section { grid-template-columns: 1fr; padding: 3rem 1.5rem; gap: 1.5rem; }
  .contact-label { border-right: none; padding-right: 0; }
  .contact-body { padding-left: 0; }

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

  footer {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 2rem 1.5rem;
  }
}

/* ── PRINT STYLESHEET ── */
@media print {
  /* Hide navigation and decorative elements */
  nav,
  #scroll-progress,
  .page-header-wrap::before,
  .page-header-wrap::after,
  body::before,
  .card-arrow,
  .back-link,
  .pub-action-btn,
  footer,
  .filter-bar,
  .recent-strip {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 12pt;
    line-height: 1.6;
    -webkit-print-color-adjust: exact;
  }

  .page-header-wrap,
  .page-header {
    padding: 1rem 0 !important;
    border: none !important;
    background: none !important;
    animation: none !important;
  }

  h1 {
    font-size: 22pt !important;
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
    background: none !important;
    margin-bottom: 0.5rem !important;
  }

  .eyebrow {
    color: #555 !important;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    font-size: 9pt !important;
  }

  .eyebrow::before { display: none !important; }

  .lead,
  .pub-desc,
  .entry-desc,
  .about-copy p,
  .archive-article-body p {
    color: #333 !important;
    font-size: 11pt !important;
  }

  .pub-detail-header,
  .archive-article,
  .about-body,
  .contact-section {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .archive-article-sidebar,
  .pub-detail-sidebar,
  .about-sidebar {
    border: none !important;
    padding: 0 0 1rem !important;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid #ccc !important;
  }

  .archive-article-body,
  .pub-detail-content,
  .about-copy {
    padding: 0 !important;
  }

  .meta-key { color: #555 !important; }
  .meta-value { color: #111 !important; }

  .pub-abstract {
    border-left: 2px solid #999 !important;
    background: #f8f8f8 !important;
    color: #333 !important;
  }

  .pub-abstract-label { color: #555 !important; }

  .archive-article-body blockquote {
    border-left: 2px solid #999 !important;
    background: #f8f8f8 !important;
  }

  .archive-article-body .footer-note {
    border-top: 1px solid #ccc !important;
    color: #666 !important;
  }

  a { color: #111 !important; text-decoration: none !important; }

  /* Show URL after links that matter */
  .pub-detail-doi a::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
}
