/* ==========================================================================
   Bill Langer Research Geologist LLC
   Modernized rebuild of researchgeologist.com
   ========================================================================== */

/* --------------------------------------------------------------- theming
   Colours are declared once as tokens here and overridden wholesale in the
   [data-theme="dark"] block below. Nothing outside these two blocks should
   hard-code a colour, so a new theme only ever touches this section.

   The inline script in each page's <head> sets data-theme before first
   paint (stored choice -> system preference -> light), which is what keeps
   a dark-mode visitor from getting a white flash on load.
   -------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --blue:        #156287;   /* links, card accents          */
  --blue-dark:   #0f4a67;   /* link hover                   */
  --blue-light:  #e7f1f6;   /* tinted hover background      */
  --orange:      #e59728;   /* brand accent from the banner */

  --btn-bg:      #156287;
  --btn-fg:      #ffffff;

  --heading:     #3d3d3d;
  --ink:         #1b1b1b;
  --ink-soft:    #4a4a4a;
  --muted:       #6d6d6d;

  --bg:          #ececeb;   /* page                         */
  --surface:     #ffffff;   /* cards, panels, masthead      */
  --feature:     #4c4c4c;   /* the "Connect with me" card   */
  --feature-ink: #e5e5e5;
  --feature-dim: #a5a5a5;
  --feature-line: rgba(255, 255, 255, .15);
  --feature-edge: transparent;

  --bar:         #3d3d3d;   /* nav + footer                 */
  --bar-ink:     #e8e8e6;
  --rule:        #dcdcd8;
  --card-edge:   transparent;

  --banner-filter: none;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .07);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .07), 0 8px 24px rgba(0, 0, 0, .08);

  --radius:    10px;
  --radius-lg: 14px;

  --measure: 1160px;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Lightened so they clear WCAG AA against the dark surfaces; the original
     #156287 is far too dark to read on a dark background. */
  --blue:        #74b8dc;
  --blue-dark:   #9bcde8;
  --blue-light:  #232c33;
  --orange:      #efa93c;

  /* Light button fill needs dark text on it, the inverse of light mode. */
  --btn-bg:      #74b8dc;
  --btn-fg:      #10171c;

  --heading:     #edeff0;
  --ink:         #e4e6e8;
  --ink-soft:    #b7bbbf;
  --muted:       #8d9399;

  --bg:          #15171a;
  --surface:     #1e2126;
  --feature:     #272c31;   /* lifted off --surface so the card still reads */
  --feature-ink: #edeff0;
  --feature-dim: #9aa1a7;
  --feature-line: rgba(255, 255, 255, .13);
  --feature-edge: rgba(239, 169, 60, .28);

  --bar:         #101216;
  --bar-ink:     #dfe2e4;
  --rule:        #32373d;
  --card-edge:   #2a2f35;   /* borders do the work shadows can't on dark */

  /* The banner is a light gravel photo; at full brightness it glares against
     a dark page. Dimmed just enough to settle down, not so far that the
     black wordmark inside it stops reading. */
  --banner-filter: brightness(.88) contrast(1.02);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

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

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

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--heading); }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.wrap { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- masthead */

.masthead { background: var(--surface); padding: 1rem 0 .35rem; }
.masthead .wrap { max-width: 976px; }
.masthead__banner {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  filter: var(--banner-filter);
}
.masthead h1 { margin: 0; }

/* -------------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, var(--shadow-sm);
}
.nav .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}
.nav a {
  display: block;
  padding: .85rem 1.15rem;
  color: var(--bar-ink);
  font-size: .84rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.nav a:hover,
.nav a:focus-visible { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--orange); }
.nav__spacer { margin-left: auto; }
.nav__cta { color: var(--orange) !important; }

/* ------------------------------------------------------------ theme toggle */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: .5rem;
  padding: 0;
  color: var(--bar-ink);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--orange); border-color: var(--orange); background: rgba(255, 255, 255, .12); }
.theme-toggle:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; display: block; }

/* Show the icon for the theme you would switch *to*. */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* ------------------------------------------------------------------- page */

main { padding: 2.75rem 0 3.5rem; }

.lede {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 68ch;
}

.page-head { margin-bottom: 2.25rem; }
.page-head h1 { margin-bottom: .5rem; }
.page-head::after {
  content: "";
  display: block;
  width: 68px;
  height: 4px;
  margin-top: 1.1rem;
  background: var(--orange);
  border-radius: 2px;
}

/* ------------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.75rem;
  align-items: stretch;
  margin-bottom: 3rem;
}

.hero__photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--surface);
  border: 1px solid var(--card-edge);
}
.hero__photo img { width: 100%; }
.hero__photo figcaption {
  padding: .85rem 1.15rem;
  font-size: .9rem;
  color: var(--muted);
  background: var(--surface);
}

.card-dark {
  background: var(--feature);
  color: var(--feature-ink);
  border: 1px solid var(--feature-edge);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.card-dark h2 { color: #fff; font-size: 1.5rem; margin: 0; }
.card-dark__tagline {
  margin: 0;
  color: var(--feature-dim);
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.5;
}
.card-dark dl { margin: 0; display: grid; gap: .9rem; }
.card-dark dt {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--feature-dim);
}
.card-dark dd { margin: .15rem 0 0; font-size: 1.05rem; }
.card-dark a { color: #fff; text-decoration-color: rgba(255, 255, 255, .45); }
.card-dark a:hover { color: var(--orange); }
.card-dark__note {
  margin: auto 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--feature-line);
  font-weight: 700;
  color: #fff;
}

/* ---------------------------------------------------------------- section */

.section { margin-bottom: 3rem; }
.section:last-child { margin-bottom: 0; }

.section__title {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 0 0 1.4rem;
  font-size: 1.45rem;
  color: var(--heading);
}
.section__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  box-shadow: var(--shadow-sm);
}

.two-col { columns: 2; column-gap: 2.5rem; }
.two-col p { break-inside: avoid; }

/* ------------------------------------------------------------------ cards */

.grid { display: grid; gap: 1.25rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--blue);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card h3 { color: var(--blue); margin-bottom: .75rem; }
.card p, .card ul { font-size: .97rem; }
.card > :last-child { margin-bottom: 0; }

.card--link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.more {
  align-self: flex-start;
  margin-top: 1.25rem;
  padding: .5rem 1.1rem;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: 999px;
  transition: background-color .15s ease;
}
.more:hover { background: var(--blue-dark); color: var(--btn-fg); }
.more::after { content: " →"; }

/* --------------------------------------------------- expertise index links */

.linklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.linklist a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--card-edge);
  border-left: 4px solid var(--orange);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background-color .15s ease;
}
.linklist a::after { content: "→"; margin-left: auto; color: var(--muted); }
.linklist a:hover { transform: translateX(3px); background: var(--blue-light); }

/* --------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.75rem; border-left: 2px solid var(--rule); }
.timeline > li { position: relative; margin-bottom: 1.75rem; }
.timeline > li:last-child { margin-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 7px);
  top: .5rem;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border: 3px solid var(--blue);
  border-radius: 50%;
}
.timeline .role { font-weight: 700; color: var(--heading); display: block; }
.timeline .dates {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: .3rem;
}
.timeline p { margin: .25rem 0 0; font-size: .97rem; color: var(--ink-soft); }
.timeline .sub { list-style: none; margin: 1rem 0 0; padding: 0 0 0 1.1rem; border-left: 2px dotted var(--rule); }
.timeline .sub > li { margin-bottom: 1.1rem; }
.timeline .sub > li:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ lists */

.bullets { margin: 0; padding-left: 1.15rem; }
.bullets li { margin-bottom: .5rem; }
.bullets li:last-child { margin-bottom: 0; }
.bullets li::marker { color: var(--orange); }

.creds { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.4rem; }
.creds strong { display: block; color: var(--heading); }
.creds p { margin: .25rem 0 0; font-size: .97rem; color: var(--ink-soft); }

.refs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; font-size: .93rem; }
.refs li {
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
  line-height: 1.55;
}
.refs cite { font-style: italic; }

.venues { display: grid; gap: .8rem; margin: 0; }
.venues dt {
  font-weight: 700;
  color: var(--blue);
  font-size: .82rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.venues dd { margin: .15rem 0 0; font-size: .95rem; color: var(--ink-soft); }

/* ------------------------------------------------------------ publication */

.pub {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.6rem;
  align-items: center;
}
.pub img { box-shadow: var(--shadow-md); border-radius: 4px; width: 130px; }
.pub h3 { margin-bottom: .4rem; }

/* --------------------------------------------------------------- contact */

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; align-items: start; }
.contact-card { display: grid; gap: 1.4rem; }
.contact-card .row { display: flex; align-items: baseline; gap: 1rem; }
.contact-card .label {
  min-width: 76px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--feature-dim);
}
.contact-card .value { font-size: 1.15rem; }

/* ------------------------------------------------------------------ media */

figure.inline-figure { margin: 0 0 1.25rem; }
figure.inline-figure img { border-radius: var(--radius); box-shadow: var(--shadow-sm); width: 100%; }
figure.inline-figure figcaption { margin-top: .55rem; font-size: .88rem; color: var(--muted); }

/* ----------------------------------------------------------------- footer */

.footer {
  background: var(--bar);
  color: #c8c8c6;
  padding: 2.5rem 0 2rem;
  font-size: .93rem;
}
.footer a { color: #fff; }
.footer a:hover { color: var(--orange); }
.footer__grid { display: flex; flex-wrap: wrap; gap: 2rem 3rem; justify-content: space-between; }
.footer strong { color: #fff; display: block; margin-bottom: .35rem; font-size: 1rem; }
.footer__nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer__nav a { text-decoration: none; }
.footer__nav a:hover { text-decoration: underline; }
.footer__legal {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .13);
  font-size: .84rem;
  color: #9a9a98;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .two-col { columns: 1; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav .wrap { gap: 0; }
  .nav a { padding: .7rem .8rem; font-size: .74rem; letter-spacing: .06em; }
  .nav__spacer { margin-left: auto; }
  .panel, .card-dark { padding: 1.35rem; }
  .pub { grid-template-columns: 1fr; justify-items: start; }
  .theme-toggle { width: 34px; height: 34px; margin-left: .35rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .nav, .footer, .more, .theme-toggle { display: none; }
  body { background: #fff; font-size: 11pt; }
  .panel, .card { box-shadow: none; border: 1px solid var(--rule); }
}
