/* The Keystone Model - Global Styles */
/* Typography-focused, minimal, durable design */

:root {
  --text-dark: #1a1a1a;
  --text-medium: #4a4a4a;
  --text-light: #6a6a6a;
  --bg-white: #ffffff;
  --bg-subtle: #fafafa;
  --accent: #2563EB;
  --accent-hover: #1F4FD8;
  --accent-visited: #1E3A8A;
  --border-light: #e5e5e5;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--bg-white);
}

/* Skip to main content link - hidden until keyboard focus */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -999;
}

.skip-link:focus,
.skip-link:active {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  overflow: visible;
  background: var(--accent);
  color: var(--bg-white);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
  color: var(--text-medium);
}

a {
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.2s ease;
}

a:visited {
  color: var(--accent);
}

a:hover,
a:active {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
.pdf-download-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Navigation */
nav {
  position: sticky;
  top: 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  padding: 1.75rem 0;
}

/* Mobile: Remove sticky positioning */
@media (max-width: 768px) {
  nav {
    position: relative;
    top: auto;
  }
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-name {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: -0.01em;
  line-height: 1;
}

.site-name a {
  color: var(--text-dark);
  text-decoration: none;
}

.site-name a:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1;
  margin-left: auto; /* Push nav links to the right on desktop */
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-medium);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a:active,
.nav-links a.active {
  color: var(--accent);
  text-decoration: underline;
}

/* Hamburger Menu Button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.hamburger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.hamburger span {
  width: 100%;
  height: 2px;
  background-color: var(--text-dark);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
  position: relative;
}

/* Hamburger active state (X shape) */
.hamburger.active {
  justify-content: center;
}

.hamburger.active span:nth-child(1) {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
  width: 0;
}

.hamburger.active span:nth-child(3) {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%) rotate(-45deg);
}

/* Touch/Active states for hamburger */
.hamburger:active span {
  opacity: 0.7;
  transform: scale(0.95);
}

.hamburger.active:active span {
  opacity: 0.7;
}

/* Main Content Container */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 3rem 6rem;
}

/* Keystone Diagram */
.keystone-diagram {
  max-width: 100%;
  margin: 2rem 0;
}

.keystone-diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Smaller diagram for Model page */
.diagram-small {
  max-width: 400px;
  margin: 2rem auto 2.5rem;
}

/* PDF Download Card - Scholarly & Calm */
.pdf-download-card {
  background-color: #fafafa;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 3rem;
  margin: 4rem 0;
  text-align: center;
}

.pdf-download-card h3 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.pdf-download-card p {
  color: var(--text-medium);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.pdf-download-button {
  display: inline-block;
  padding: 1rem 2rem;
  background-color: var(--accent);
  color: var(--bg-white) !important;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.pdf-download-button:visited {
  color: var(--bg-white) !important;
}

.pdf-download-button:hover,
.pdf-download-button:focus-visible {
  background-color: var(--bg-white);
  color: var(--accent) !important;
  border: 1px solid var(--accent);
}

.pdf-download-button::before {
  content: "📄 ";
  margin-right: 0.5rem;
}

.pdf-subtext {
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
}

/* Core Mechanisms Styling */
.mechanism {
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  border-left: 4px solid;
}

.mechanism h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.mechanism p {
  margin-bottom: 1rem;
}

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

.leadership-translation {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  padding-left: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-medium);
}

.translation-label {
  font-weight: 600;
  font-style: normal;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

/* Color schemes matching diagram */
.mechanism-relational {
  background-color: #E8F2F7;
  border-left-color: #3D5A8C;
}

.mechanism-relational h3 {
  color: #3D5A8C;
}

.mechanism-condition {
  background-color: #E8F4E8;
  border-left-color: #4A8A4A;
}

.mechanism-condition h3 {
  color: #4A8A4A;
}

.mechanism-homeostasis {
  background-color: #FBF7E5;
  border-left-color: #8B8B30;
}

.mechanism-homeostasis h3 {
  color: #8B8B30;
}

.mechanism-cascade {
  background-color: #F9EDED;
  border-left-color: #A03030;
}

.mechanism-cascade h3 {
  color: #A03030;
}

/* Section Spacing */
section {
  margin-bottom: 4rem;
}

section:last-child {
  margin-bottom: 0;
}

/* Reading Experience Enhancements */
.page-subtitle {
  font-size: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: -1rem;
  margin-bottom: 2rem;
}

.lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-medium);
  margin-bottom: 2.5rem;
}

.section-break {
  height: 1px;
  background: var(--border-light);
  border: none;
  margin: 4rem 0;
}

/* Links & Buttons */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-dark);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.external-link:hover {
  background: var(--bg-white);
  border-color: var(--accent);
  color: var(--accent);
}

.pdf-icon::before {
  content: "📄";
  margin-right: 0.25rem;
}

/* Team Page Specific */
.bio-container {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.headshot {
  width: 35%;
  max-width: 280px;
  height: auto;
  flex-shrink: 0;
  border-radius: 4px;
}

.headshot-float {
  float: left;
  width: 35%;
  max-width: 280px;
  height: auto;
  margin: 0 2rem 1.5rem 0;
  border-radius: 4px;
}

.bio-content {
  flex: 1;
  width: 65%;
}

/* Research Page Specific */
.university-affiliation {
  font-size: 0.95rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 2rem;
}

.research-origin {
  margin-bottom: 2rem;
}

.research-methodology {
  margin-bottom: 2rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border-light);
}

.research-outcome {
  margin-bottom: 2rem;
}

.dissertation-link {
  font-size: 1rem;
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.15s ease;
}

.dissertation-link:hover {
  color: var(--accent-hover);
}

.dissertation-link::before {
  content: "📄 ";
  margin-right: 0.5rem;
}

/* Practice Page Specific */
.practice-function {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-light);
}

.practice-function:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 2rem;
}

.practice-function h3 {
  margin-top: 0;
}

.future-context {
  opacity: 0.85;
}

.future-context h2 {
  font-weight: 400;
  font-size: 1.5rem;
}

.future-context p {
  color: var(--text-medium);
}

/* Team Page Specific */
.team-member-name {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.team-member-role {
  font-size: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 2rem;
}

.bio-section {
  margin-bottom: 1.75rem;
}

.team-note {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.95rem;
  color: var(--text-light);
  font-style: italic;
}

.team-contact {
  margin-top: 1.5rem;
}

.linkedin-link {
  font-size: 1rem;
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.15s ease;
}

.linkedin-link:hover {
  color: var(--accent-hover);
}

/* Lists */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

li {
  margin-bottom: 1rem;
  color: var(--text-medium);
  line-height: 1.6;
}

/* Subtle Emphasis */
em {
  font-style: italic;
  color: var(--text-dark);
}

strong {
  font-weight: 600;
  color: var(--text-dark);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .nav-container {
    padding: 1.5rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .site-name {
    font-size: 1rem;
    flex: 0 1 auto;
    min-width: 0;
    margin-right: 1rem;
    line-height: 1.3;
  }

  .site-name a {
    display: block;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    line-height: 1.3;
    text-rendering: optimizeLegibility;
  }

  /* Show hamburger, hide nav links */
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    background: var(--bg-white);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    gap: 0;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: 0; /* Override desktop margin-left: auto on mobile */
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-links li {
    width: 100%;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links a {
    display: block;
    padding: 0.875rem 0;
    font-size: 1rem;
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1);
  }

  /* Touch states for mobile nav links */
  .nav-links a:active {
    background-color: var(--bg-subtle);
    color: var(--accent);
  }

  /* Overlay when menu is open */
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .nav-overlay.active {
    display: block;
    opacity: 1;
  }

  main {
    padding: 3rem 1.5rem 4rem;
  }

  .keystone-diagram {
    margin: 2rem 0;
  }

  .diagram-small {
    max-width: 100%;
    margin: 2rem 0 2rem;
  }

  .mechanism {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .leadership-translation {
    font-size: 0.9rem;
  }

  .pdf-download-card {
    padding: 2rem 1.5rem;
    margin: 3rem 0;
  }

  .pdf-download-card h3 {
    font-size: 1.25rem;
  }

  .pdf-download-button {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }

  .bio-container {
    flex-direction: column;
    gap: 2rem;
  }

  .headshot {
    width: 60%;
    max-width: 240px;
  }

  .headshot-float {
    float: none;
    width: 60%;
    max-width: 240px;
    margin: 0 auto 2rem;
    display: block;
  }

  .bio-content {
    width: 100%;
  }

  footer {
    padding: 2rem 1.5rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .nav-links {
    font-size: 0.9rem;
    gap: 1rem;
  }

  main {
    padding: 2rem 1.25rem 3rem;
  }

  footer {
    padding: 1.5rem 1.25rem;
  }
}

/* Footer */
footer {
  border-top: 1px solid var(--border-light);
  padding: 2rem 3rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 4rem;
}

/* Print Styles */
@media print {
  nav {
    display: none;
  }

  footer {
    display: none;
  }

  main {
    max-width: 100%;
    padding: 0;
  }

  a {
    color: var(--text-dark);
  }
}
