:root {
  --page-max-width: 960px;
  --page-margin: 16px;
  --page-padding-x: 40px;
  --shadow-strong: 0 0 40px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background-image: url("background.jpg");
  background-position: center top;
  background-repeat: repeat;
  color: rgb(8, 12, 13);
  font-family: "Noto Sans", system-ui, -apple-system, sans-serif;
  line-height: normal;
}

.page {
  width: min(100% - (var(--page-margin) * 2), var(--page-max-width));
  margin: var(--page-margin) auto;
  min-height: calc(100vh - (var(--page-margin) * 2));
  display: flex;
  flex-direction: column;
  background-color: rgb(244, 235, 227);
  background-image: url("noise.png");
  box-shadow: var(--shadow-strong);
}

/* --- Typography --- */
h1 { font-family: "Cormorant SC", serif; font-weight: 600; font-size: 2em; text-align: center; margin: 0 0 16px 0; }
a { color: rgb(14, 146, 69); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Article text left-aligned, headings remain centered via h1 rule above */
article { text-align: left; }

/* --- Header & Profile --- */
.site-header { padding: 20px var(--page-padding-x); }
.header-bar { display: flex; align-items: center; margin-bottom: 16px; }
.site-name { font-family: "Cormorant SC", serif; font-weight: 600; font-size: 3.2em; letter-spacing: 0.05em; line-height: 1; margin-right: auto; }
.site-name a { color: inherit; text-decoration: none; }

.social-icons { display: flex; align-items: center; gap: 20px; }
.social-icon { width: 36px; height: 36px; display: block; }
.social-icon img { width: 100%; height: 100%; }

.profile { display: flex; align-items: center; gap: 32px; }
.profile-photo-wrapper { width: 180px; height: 180px; border-radius: 50%; position: relative; overflow: hidden; flex-shrink: 0; }
.profile-photo-wrapper::after { content: ""; position: absolute; inset: 0; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5) inset; pointer-events: none; }
.profile-photo { width: 100%; height: 100%; display: block; filter: grayscale(20%); object-fit: cover; }

.profile-blurb { 
  width: 100%; 
  text-align: right; 
  font-family: "Cormorant", serif; 
  font-weight: 600; 
  font-style: italic; 
  font-size: 1.4em;
  line-height: 1.5; 
}

.main-content { flex: 1; padding: 24px var(--page-padding-x) 40px; }

/* MathJax Overrides */
mjx-container { margin: 0 !important; font-size: 1.1em !important; }

/* --- Simulation Controls (Specific to ppsampler.html) --- */
input[type="range"] { accent-color: rgb(250, 245, 242); }
.control-btn { transition: opacity 0.2s; cursor: pointer; }
.control-btn:hover { opacity: 0.9; }

/* --- Responsive Design --- */
@media (max-width: 992px) {
  :root { --page-padding-x: 4.032vw; }
  .header-bar { flex-wrap: wrap; gap: 12px 16px; }
  .profile { gap: 3.226vw; }
  .profile-photo-wrapper { width: 18.145vw; height: 18.145vw; }
  .profile-blurb { font-size: 2.258vw; }
  .site-name { font-size: 5.161vw; }
  h1 { font-size: 3.225vw; }
}

@media (max-width: 780px) {
  :root { --page-padding-x: 18px; }
  
  /* Stack Header Bar (Name + Icons) and Center */
  .header-bar { flex-direction: column; align-items: center; gap: 16px; }
  .site-name { margin-right: 0; text-align: center; } /* Remove margin-right: auto */
  
  /* Stack Profile Vertical */
  .profile { flex-direction: column; }
  
  /* Center Blurb Text */
  .profile-blurb { text-align: center; text-wrap: balance; }

  /* Sizing adjustments */
  .profile-photo-wrapper { width: 140px; height: 140px; }
  .profile-blurb { font-size: 1.1em; }
  .site-name { font-size: 2.4em; }
  h1 { font-size: 1.6em; }
}