/* raymondduenas.com: colors and type carried over from the Astra/Elementor site */
:root {
  --accent: #2fc1ff;
  --accent-dark: #08acf2;
  --ink: #101218;
  --text: #4c5253;
  --bg: #f3f6f6;
  --white: #ffffff;
  --rule: #dfe4e5;
  --serif: "Vollkorn", Georgia, "Times New Roman", serif;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.75 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); }
a:hover { color: var(--ink); }
h1, h2, h3, .h3 { font-family: var(--serif); font-weight: 700; color: var(--ink); line-height: 1.2; margin: 0 0 0.6em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.125rem); }
h3, .h3 { font-size: clamp(1.35rem, 2.2vw, 1.6rem); }
p { margin: 0 0 1.1em; }
ul { padding-left: 1.2em; }

.container { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 720px; }
.section { padding: 64px 0; }
.divider { display: block; width: 60px; height: 3px; background: var(--accent); margin: 0 0 24px; }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--white); padding: 8px 14px; }
.skip-link:focus { left: 8px; top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header: sits on top of each page's hero image */
.site-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
}
.logo img { width: 56px; height: 56px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 32px; }
.site-nav a {
  font: 700 1.05rem var(--serif); color: var(--white); text-decoration: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.nav-toggle { display: none; }

/* Hero */
.hero {
  position: relative; display: grid; place-items: center; text-align: center;
  color: var(--white); padding: 120px 20px 64px;
  background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.45)), var(--hero-image, none) center / cover no-repeat, var(--ink);
}
.hero-home { min-height: 100vh; min-height: 100svh; }
.hero-page { min-height: 400px; }
.hero-plain { background: linear-gradient(135deg, #101218, #2a3036); }
@media (min-width: 1024px) and (hover: hover) {
  /* Fixed backgrounds jitter or zoom on phones, so desktop only. */
  .hero-home, .hero-page { background-attachment: fixed; }
}
.hero h1 { color: var(--white); font-size: clamp(2.6rem, 6vw, 4rem); margin-bottom: 0.3em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.hero .divider { margin: 0 auto 18px; width: 80px; }
.hero-subtitle, .hero-contact { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85); margin: 0 0 8px; }
.hero-subtitle { font: 700 1.2rem var(--serif); }
.hero-contact { font-weight: 600; }
.hero-contact a { color: var(--white); }
.hero-contact a:hover { color: var(--accent); }

/* Two-column sections */
.two-col { display: grid; gap: 48px; align-items: start; }
.about-grid { grid-template-columns: 260px 1fr; }
.lab-grid { grid-template-columns: 1fr 1fr; align-items: center; }
.carpentry-intro { grid-template-columns: 420px 1fr; }
.about-photos { display: grid; gap: 20px; }
.framed { border: 3px solid #3d4246; box-shadow: 0 8px 24px rgba(16, 18, 24, 0.15); }
.about-text p { text-align: justify; hyphens: auto; }
.glance li { margin-bottom: 0.5em; }

.lab { background: var(--white); }
.lab-name { font: 700 1.15rem var(--serif); color: var(--ink); margin: 0 0 2px; }
.lab-link { margin: 0 0 18px; font-weight: 600; }

/* Project cards */
.project { display: grid; gap: 32px 48px; margin: 56px 0; }
.project.has-media { grid-template-columns: 1fr 1fr; align-items: start; }
.project-media img { width: 100%; margin-bottom: 16px; background: var(--white); }
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.media-grid img { margin: 0; }
.media-grid .span-2 { grid-column: span 2; }
.button {
  grid-column: 1 / -1; justify-self: center;
  display: inline-block; padding: 12px 40px; border-radius: 999px;
  background: var(--accent); color: var(--ink); text-decoration: none;
  font: 700 0.85rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
}
.button:hover { background: var(--accent-dark); color: var(--white); }

/* Research page */
.research-layout { display: grid; grid-template-columns: 240px 1fr; gap: 56px; padding-top: 56px; padding-bottom: 64px; }
.toc { position: sticky; top: 24px; align-self: start; font-size: 0.95rem; }
.toc-title { font: 700 1.6rem var(--serif); color: var(--ink); margin-bottom: 8px; }
.toc ul { margin: 0; padding-left: 1.1em; }
.toc a { text-decoration: none; }
.research-content .lead { font-size: 1.05rem; }
.research-project { padding-top: 40px; margin-top: 40px; border-top: 1px solid var(--rule); scroll-margin-top: 16px; }
.research-project h3 { margin-top: 1.4em; scroll-margin-top: 16px; }
.research-project p { text-align: justify; hyphens: auto; }
.advisers { display: flex; flex-wrap: wrap; gap: 24px 40px; }
.adviser { display: flex; gap: 18px; align-items: center; }
.adviser-photo { width: 110px; height: 140px; object-fit: cover; border-radius: 4px; }
.adviser-name { font: 700 1.1rem var(--serif); color: var(--ink); margin: 0 0 2px; }
.adviser-name a { color: inherit; text-decoration: none; }
.adviser-name a:hover { color: var(--accent-dark); }
.adviser-line { margin: 0; font-size: 0.92rem; line-height: 1.45; }

/* Figure grids (open full size in the lightbox) */
.figure-grid { display: grid; gap: 14px; margin: 0 0 8px; }
.figure-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.figure-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.figure-grid.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 12px; }
.figure-grid figure { margin: 0; }
.figure-grid a { display: block; height: 100%; background: var(--white); border: 1px solid var(--rule); overflow: hidden; }
.figure-grid img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: contain; transition: transform 0.35s ease; }
.gallery-section .figure-grid img { object-fit: cover; }
.figure-grid a:hover img { transform: scale(1.04); }
.gallery-section h2 { margin-top: 1.2em; }

.paper { display: inline-block; width: min(300px, 70vw); text-decoration: none; font-weight: 600; }
.paper img { border: 1px solid var(--rule); box-shadow: 0 6px 18px rgba(16, 18, 24, 0.12); margin-bottom: 8px; }

/* Footer */
.site-footer { background: var(--ink); color: #c4cacc; text-align: center; padding: 28px 20px; font-size: 0.92rem; }
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--accent); }
.copyright { color: #8a9295; }

/* Lightbox */
.lightbox { border: 0; padding: 0; max-width: none; max-height: none; width: 100vw; height: 100vh; background: transparent; }
.lightbox::backdrop { background: rgba(8, 9, 12, 0.92); }
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 12px; }
.lightbox img { max-width: calc(100vw - 160px); max-height: 82vh; width: auto; height: auto; background: var(--white); }
.lightbox figcaption { color: #e6e9ea; max-width: 70ch; text-align: center; font-size: 0.95rem; }
.lightbox button { background: none; border: 0; color: var(--white); font-size: 3rem; cursor: pointer; line-height: 1; }
.lightbox-close { position: fixed; top: 12px; right: 20px; }

@media (max-width: 900px) {
  .about-grid, .lab-grid, .carpentry-intro, .project.has-media, .research-layout { grid-template-columns: 1fr; }
  .about-photos { grid-template-columns: 1fr 1fr; }
  .toc { position: static; }
  .figure-grid.cols-3, .figure-grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .site-header { padding: 14px 18px; }
  .nav-toggle {
    display: block; background: none; border: 0; padding: 10px; cursor: pointer; z-index: 11;
  }
  .nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
    display: block; width: 26px; height: 2px; background: var(--white); position: relative;
  }
  .nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-bar::before { top: -8px; }
  .nav-toggle-bar::after { top: 8px; }
  .site-nav { display: none; position: absolute; top: 100%; right: 12px; background: rgba(16, 18, 24, 0.96); border-radius: 6px; padding: 14px 22px; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 12px; }
  .about-text p, .research-project p { text-align: left; }
  .figure-grid.cols-3, .figure-grid.cols-4 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .lightbox[open] { grid-template-columns: 40px 1fr 40px; }
  .lightbox img { max-width: calc(100vw - 90px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .figure-grid img { transition: none; }
}
