/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: #0D0D0D;
  background-color: #F5F5F5;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
}

/* ===== CSS Variables ===== */
:root {
  --color-primary: #1A1A2E;
  --color-secondary: #6A0DAD;
  --color-accent: #FF6F00;
  --color-bg-light: #F5F5F5;
  --color-text-dark: #0D0D0D;
  --color-text-light: #E0E0E0;
  --color-border: #3D3D5C;
  --color-success: #2E7D32;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 50px;
  --content-max-width: 1280px;
  --header-height: 80px;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
body, p {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
}
small, .text-small {
  font-size: 0.875rem;
}

/* ===== Focus & Accessibility ===== */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #0D0D0D;
  font-family: var(--font-heading);
  font-weight: 700;
  z-index: 10000;
  border-radius: var(--radius-sm);
  transition: top var(--transition-base);
}
.skip-link:focus {
  top: 0.5rem;
}

/* ===== Progress Bar ===== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: var(--color-accent);
  z-index: 1001;
  transition: width 0.1s linear;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: 2px solid var(--color-secondary);
  background: var(--color-primary);
  color: var(--color-text-light);
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--color-secondary);
  color: #fff;
  transform: translateY(-4px);
}
.back-to-top::after {
  content: '↑';
}

/* ===== Container & Grid ===== */
.content-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}
.btn-primary:hover {
  background: transparent;
  color: var(--color-secondary);
}
.btn-accent {
  background: var(--color-accent);
  color: #0D0D0D;
  border-color: var(--color-accent);
}
.btn-accent:hover {
  background: transparent;
  color: var(--color-accent);
}

/* ===== Card (Research Board) ===== */
.card {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border var(--transition-base), box-shadow var(--transition-base);
}
.card:hover {
  border-color: var(--color-secondary);
  box-shadow: 0 4px 20px rgba(106, 13, 173, 0.2);
}
.card__header {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}
.card__body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--color-text-dark);
}
.card__footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: var(--color-primary);
  color: var(--color-text-light);
  z-index: 1000;
  overflow: hidden;
}
.header-diagonal {
  position: absolute;
  top: 0;
  right: 0;
  width: 30%;
  height: 100%;
  background: var(--color-accent);
  clip-path: polygon(100% 0, 100% 100%, 0 100%, 45% 0);
  opacity: 0.15;
  pointer-events: none;
}
.header-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
}
.brand-tagline {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-light);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.nav-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.main-nav {
  display: flex;
}
.nav-list {
  display: flex;
  gap: 0.25rem;
}
.nav-list a {
  display: block;
  padding: 0.5rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-light);
  border-radius: var(--radius-pill);
  transition: background var(--transition-base), color var(--transition-base);
}
.nav-list a:hover,
.nav-list a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.nav-list a[aria-current="page"] {
  background: var(--color-secondary);
  color: #fff;
}
.nav-cta {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}
.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-light);
  border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}
[data-nav-toggle][aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
[data-nav-toggle][aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}
[data-nav-toggle][aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ===== Footer ===== */
.site-footer {
  position: relative;
  background: var(--color-primary);
  color: var(--color-text-light);
  padding: 3rem 0 1.5rem;
  overflow: hidden;
}
.footer-bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.footer-inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-heading {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.footer-links ul,
.footer-contact ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.footer-links a,
.footer-contact a {
  color: var(--color-text-light);
  transition: color var(--transition-base);
}
.footer-links a:hover,
.footer-contact a:hover {
  color: var(--color-accent);
}
.footer-coords {
  margin-top: 1rem;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--color-border);
  letter-spacing: 0.05em;
}
.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-border);
}
.trust-statement {
  width: 100%;
  text-align: center;
  font-style: italic;
  margin-top: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  .brand-name {
    font-size: 1.2rem;
  }
  .nav-list {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    flex-direction: column;
    background: var(--color-primary);
    padding: 1rem;
    gap: 0.25rem;
    border-top: 1px solid var(--color-border);
  }
  [data-nav][data-open] .nav-list {
    display: flex;
  }
  .nav-cta {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-list a {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  .nav-cta {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
  }
  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}
