/* ================================================================
   Lucas W. Davis — personal website
   Stylesheet aligned with the UC Berkeley Haas brand
   (https://haas.berkeley.edu/brand-hub/visual-identity/)

   Accessibility: WCAG 2.1 AA. All color pairings used below clear
   the 4.5:1 contrast ratio on body text and 3:1 on large text.
   ================================================================ */

/* ---- Brand tokens ------------------------------------------------ */
:root {
  --haas-blue:    #003057;   /* Primary - WCAG AA on white  */
  --haas-gold:    #FDB515;   /* Primary accent             */
  --dark-gray:    #434545;   /* Body text - WCAG AA on white */
  --medium-gray:  #808080;
  --light-gray:   #F2F2F2;
  --white:        #FFFFFF;

  /* Type scale */
  --font-display: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --content-max:  880px;
  --content-pad:  clamp(20px, 4vw, 40px);
}

/* ---- Reset & base ------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 17px;       /* base for em/rem; 17px reads cleanly */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--dark-gray);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Skip link (a11y) ------------------------------------------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--haas-blue);
  color: var(--white);
  padding: 10px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  z-index: 100;
}
.skip-link:focus { top: 0; }

/* ---- Header & nav ----------------------------------------------- */
.site-header {
  background: var(--haas-blue);
}

.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px var(--content-pad) 20px;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--white);
  line-height: 1.1;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}
.site-title a:hover,
.site-title a:focus-visible { color: var(--haas-gold); }

.site-subtitle {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--white);
  opacity: 0.85;
  margin: 4px 0 0;
  letter-spacing: 0.02em;
}

.site-nav {
  background: var(--haas-blue);
  border-bottom: 3px solid var(--haas-gold);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
}

.nav-list a {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white);
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nav-list a:hover,
.nav-list a:focus-visible {
  border-bottom-color: var(--haas-gold);
  color: var(--haas-gold);
  outline: none;
}
.nav-list a[aria-current="page"] {
  border-bottom-color: var(--haas-gold);
  color: var(--haas-gold);
}

/* ---- Main content ----------------------------------------------- */
main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 56px var(--content-pad) 80px;
}

/* ---- Typography ------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--haas-blue);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  margin-bottom: 0.4em;
}
h2 {
  font-size: 1.45rem;
  margin-top: 2.2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--light-gray);
}
h3 {
  font-size: 1.1rem;
  margin-top: 1.4em;
}

p { margin: 0 0 1em; }

em, cite { font-style: italic; }

/* Links in body copy */
main a {
  color: var(--haas-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-thickness 0.15s ease, text-decoration-color 0.15s ease;
}
main a:hover {
  text-decoration-thickness: 3px;
  text-decoration-color: var(--haas-gold);
}
main a:focus-visible {
  outline: 2px solid var(--haas-gold);
  outline-offset: 2px;
  text-decoration: none;
}

/* ---- Homepage hero ---------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  gap: 48px;
  align-items: start;
}

.hero h1 { margin-top: 0; }

.hero-affil {
  margin-top: 1.4em;
  padding-top: 1.2em;
  border-top: 1px solid var(--light-gray);
  font-size: 0.95rem;
}
.hero-affil p {
  margin: 0 0 0.6em;
}

.hero-affil .role {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--haas-blue);
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-portrait {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.contact-block {
  margin-top: 2.5em;
  padding: 24px;
  background: var(--light-gray);
  border-left: 4px solid var(--haas-gold);
  font-size: 0.95rem;
}
.contact-block h2 {
  margin-top: 0;
  border: none;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--haas-blue);
  padding-bottom: 0;
}
.contact-block p { margin: 0.3em 0; }

/* ---- Publication list -------------------------------------------- */
.pubs {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pubs li {
  padding: 18px 0;
  border-bottom: 1px solid var(--light-gray);
}
.pubs li:last-child { border-bottom: none; }

.pub-title {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}
.pub-title a { text-decoration: none; }
.pub-title a:hover { text-decoration: underline; }

.pub-meta {
  font-size: 0.93rem;
  color: var(--dark-gray);
  display: block;
}

.pub-links {
  margin-top: 6px;
  font-size: 0.8rem;
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pub-links a {
  color: var(--haas-blue);
  text-decoration: none;
  margin-right: 16px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--haas-blue);
  transition: border-bottom-width 0.15s ease, border-bottom-color 0.15s ease;
}
.pub-links a:hover {
  border-bottom-width: 3px;
  border-bottom-color: var(--haas-gold);
}

/* Abstract disclosure (<details>/<summary>) styled to match pub-links */
.pub-abstract {
  display: inline;
  margin-right: 16px;
}
/* Auto-hide the Abstract button on papers whose abstract has not yet
   been added. Supported in all browsers since 2023. */
.pub-abstract:has(.abstract-body:empty) {
  display: none;
}
.pub-abstract summary {
  display: inline;
  cursor: pointer;
  color: var(--haas-blue);
  border-bottom: 1px solid var(--haas-blue);
  padding-bottom: 1px;
  list-style: none;
  transition: border-bottom-width 0.15s ease, border-bottom-color 0.15s ease;
}
.pub-abstract summary::-webkit-details-marker { display: none; }
.pub-abstract summary::marker { content: ""; }
.pub-abstract summary:hover {
  border-bottom-width: 3px;
  border-bottom-color: var(--haas-gold);
}
.pub-abstract summary:focus-visible {
  outline: 2px solid var(--haas-gold);
  outline-offset: 2px;
}
.pub-abstract[open] summary {
  border-bottom-color: var(--haas-gold);
  border-bottom-width: 3px;
}
.pub-abstract .abstract-body {
  display: block;
  margin: 10px 0 4px;
  padding: 12px 16px;
  background: var(--light-gray);
  border-left: 3px solid var(--haas-blue);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--dark-gray);
  line-height: 1.55;
}

/* ---- Teaching page-specific ------------------------------------- */
.lead {
  font-size: 1.15rem;
  color: var(--dark-gray);
  margin-bottom: 1.5em;
}

.course-list {
  padding-left: 1.4em;
}
.course-list li { margin-bottom: 0.4em; }

.testimonials {
  margin-top: 1.5em;
}
.testimonial {
  margin: 0 0 1em;
  padding: 18px 22px;
  background: var(--light-gray);
  border-left: 3px solid var(--haas-blue);
  font-style: italic;
  color: var(--dark-gray);
  font-size: 0.97rem;
}
.testimonial p { margin: 0; }

figure {
  margin: 2em 0;
}
figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--dark-gray);
  font-style: italic;
}

/* ---- Compact mode (research & teaching pages) -------------------- */
/* Slightly smaller type and tighter vertical rhythm so longer content
   pages stay scannable without feeling like a brochure. */
body.compact main {
  padding: 40px var(--content-pad) 60px;
  font-size: 0.94rem;
}
body.compact h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.1rem);
  margin-bottom: 0.3em;
}
body.compact h2 {
  font-size: 1.25rem;
  margin-top: 1.6em;
}
body.compact h3 {
  font-size: 1.02rem;
  margin-top: 1.1em;
}
body.compact .pubs li {
  padding: 11px 0;
}
body.compact .pub-title {
  font-size: 0.97rem;
  margin-bottom: 2px;
}
body.compact .pub-meta {
  font-size: 0.88rem;
}
body.compact .pub-links {
  margin-top: 4px;
  font-size: 0.75rem;
}
body.compact .lead {
  font-size: 1.02rem;
  margin-bottom: 1em;
}
body.compact .testimonial {
  padding: 12px 18px;
  margin-bottom: 0.7em;
  font-size: 0.9rem;
}
body.compact figure {
  margin: 1.4em 0;
}

/* ---- Footer ----------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--light-gray);
  padding: 28px var(--content-pad);
  text-align: center;
  font-size: 0.85rem;
  color: var(--dark-gray);
}
.site-footer a {
  color: var(--dark-gray);
  text-decoration: underline;
}
.site-footer a:hover {
  color: var(--haas-blue);
  text-decoration-thickness: 2px;
}

/* ---- Responsive -------------------------------------------------- */
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-portrait {
    max-width: 280px;
    margin: 0 auto;
  }
  .nav-list {
    gap: 0 20px;
  }
  .nav-list a {
    font-size: 0.88rem;
    padding: 12px 0;
  }
}

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