/* ==========================================================================
   Matthew Cashman — personal site
   Plain, dependency-free, mobile-first stylesheet.
   Edit the variables below to retheme; everything keys off them.
   ========================================================================== */

:root {
  --ink:        #2a2c28;   /* body text                     */
  --heading:    #323630;   /* headings                      */
  --muted:      #6b6f68;   /* secondary text                */
  --accent:     #e0cbaa;   /* warm tan rule (from old site) */
  --accent-2:   #b9935a;   /* deeper tan for small accents  */
  --link:       #15489b;   /* links                         */
  --link-hover: #0d2f6b;
  --bg:         #fcfbf9;   /* warm off-white page           */
  --card:       #ffffff;
  --border:     #e7e3da;
  --shadow:     0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(40,38,32,.08);
  --shadow-lg:  0 12px 40px rgba(40,38,32,.18);
  --radius:     16px;
  --maxw:       760px;     /* reading width                 */
  --maxw-wide:  1120px;    /* galleries                     */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
          "Apple Color Emoji", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:     #e7e4dc;
    --heading: #f1eee7;
    --muted:   #a6a89f;
    --accent:  #6b5a3e;
    --link:    #9cc0ff;
    --link-hover: #c7dcff;
    --bg:      #16171a;
    --card:    #1e2024;
    --border:  #2c2f34;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;            /* 17px on phones */
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 640px) { body { font-size: 1.125rem; } } /* 18px */

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px;
    text-decoration-thickness: 1px; transition: color .15s ease; }
a:hover { color: var(--link-hover); }

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

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

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--heading);
  color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.wrap--wide { max-width: var(--maxw-wide); }
main { padding: 2rem 0 3.5rem; }
.lead { font-size: 1.12em; color: var(--ink); }
.muted { color: var(--muted); }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--maxw-wide); margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .25rem 1.25rem; justify-content: space-between;
}
.brand {
  font-size: 1.2rem; font-weight: 700; letter-spacing: .01em;
  color: var(--heading); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--heading); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem .35rem; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: inline-block; padding: .35rem .7rem; border-radius: 999px;
  color: var(--heading); text-decoration: none; font-weight: 500; font-size: .98rem;
}
.nav a:hover { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--heading); }
.nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--heading);
}

/* ---------- section headings (tan underline, like the old site) ---------- */
.section-title {
  font-size: 1.35rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--heading); margin: 2.4rem 0 .2rem; font-weight: 700;
}
.section-title:first-child { margin-top: 0; }
.rule { height: 0; border: 0; border-top: 4px solid var(--accent); margin: .35rem 0 1.3rem; border-radius: 4px; }

h1.page-title { font-size: clamp(1.7rem, 5vw, 2.3rem); color: var(--heading); margin: 0 0 .4rem; line-height: 1.15; }

/* ---------- home hero ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; text-align: center; padding-top: 1rem; }
.hero__photo {
  width: 200px; height: 200px; flex: none; border-radius: 50%;
  object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--card);
}
.hero__text { font-size: 1.15em; line-height: 1.6; }
.hero__name { font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 0 0 .15rem; color: var(--heading); line-height: 1.1; }
.hero__role { color: var(--muted); margin: 0 0 1rem; font-size: 1.02rem; }

@media (min-width: 680px) {
  .hero { flex-direction: row; align-items: center; text-align: left; gap: 2.5rem; padding-top: 1.5rem; }
  .hero__photo { width: 230px; height: 230px; }
}

/* ---------- publications ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-list li {
  padding: 1rem 0 1rem 1.1rem; border-left: 3px solid var(--accent);
  margin: 0 0 .35rem; padding-left: 1.1rem;
}
.pub-list li + li { border-top: 1px solid var(--border); }
.pub-list .title { font-weight: 600; color: var(--heading); }
.pub-list .venue { font-style: italic; color: var(--muted); }
.pub-list a { text-decoration: none; }
.pub-list a:hover .title { text-decoration: underline; }

/* ---------- buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.4rem 0; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600; font-size: 1rem;
  text-decoration: none; border: 1.5px solid var(--heading); cursor: pointer;
}
.btn--primary { background: var(--heading); color: #fff; }
.btn--primary:hover { background: #000; color: #fff; }
.btn--ghost { background: transparent; color: var(--heading); }
.btn--ghost:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--heading); }

/* ---------- CV preview ---------- */
.pdf-preview { width: 100%; height: 80vh; min-height: 480px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); margin-top: 1rem; }
@media (max-width: 700px) { .pdf-preview { display: none; } } /* phones: buttons only, no janky embed */
.pdf-note { color: var(--muted); font-size: .95rem; }

/* ---------- personal cards ---------- */
.cards { display: grid; gap: 1.5rem; margin-top: 1.5rem; }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none;
  color: inherit; transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.card__img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card__body { padding: 1.1rem 1.25rem 1.3rem; }
.card__title { font-size: 1.25rem; font-weight: 700; color: var(--heading); margin: 0 0 .3rem; }
.card__desc { margin: 0; color: var(--ink); }
.card__more { display: inline-block; margin-top: .7rem; color: var(--link); font-weight: 600; font-size: .95rem; }

@media (min-width: 720px) {
  .card { flex-direction: row; align-items: stretch; }
  .card__img { width: 300px; flex: none; aspect-ratio: auto; }
  .card__body { padding: 1.4rem 1.6rem; align-self: center; }
}

/* ---------- gallery grid (masonry via CSS columns) ---------- */
.gallery-intro { color: var(--muted); margin: .2rem 0 1.5rem; }
.gallery { columns: 1; column-gap: 14px; margin-top: 1.5rem; }
@media (min-width: 560px) { .gallery { columns: 2; } }
@media (min-width: 900px) { .gallery { columns: 3; } }
.gallery figure {
  break-inside: avoid; margin: 0 0 14px; border-radius: 12px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow); position: relative;
}
.gallery button.tile {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
  border-radius: 12px; overflow: hidden;
}
.gallery img { width: 100%; transition: transform .3s ease; background: var(--border); }
.gallery button.tile:hover img { transform: scale(1.03); }
.gallery figcaption {
  font-size: .9rem; color: var(--muted); padding: .55rem .7rem .7rem; line-height: 1.45;
}

.backlink { display: inline-block; margin-bottom: 1.2rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.backlink:hover { color: var(--link); }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 80; display: none; }
.lb.open { display: grid; }
.lb__backdrop { position: absolute; inset: 0; background: rgba(10,10,12,.92); }
.lb__stage { position: relative; z-index: 1; display: grid; place-items: center; height: 100dvh; padding: 3.2rem .6rem 4.4rem; }
.lb__img { max-width: 96vw; max-height: 82dvh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lb__cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  color: #f3f1ec; background: linear-gradient(transparent, rgba(0,0,0,.6));
  padding: 1.4rem 1rem 1rem; text-align: center; font-size: .98rem;
}
.lb__count { position: absolute; top: .9rem; left: 1rem; z-index: 2; color: #cfcdc6; font-size: .9rem; }
.lb__btn {
  position: absolute; z-index: 2; background: rgba(255,255,255,.12); color: #fff;
  border: 0; cursor: pointer; border-radius: 999px; width: 48px; height: 48px;
  font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
  backdrop-filter: blur(4px); transition: background .15s ease;
}
.lb__btn:hover { background: rgba(255,255,255,.26); }
.lb__close { top: .8rem; right: .9rem; }
.lb__prev { left: .6rem; top: 50%; transform: translateY(-50%); }
.lb__next { right: .6rem; top: 50%; transform: translateY(-50%); }
@media (min-width: 700px) { .lb__prev { left: 1.5rem; } .lb__next { right: 1.5rem; } }
body.lb-open { overflow: hidden; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2rem;
  padding: 1.8rem 0; color: var(--muted); font-size: .92rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--link); }
