/* ============================================================
   Tyler Moore — Site-Wide Modern Stylesheet v3
   Covers: index.html, pub.html, teaching.html, news.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=DM+Serif+Display&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --bg:          #f7f6f3;
  --surface:     #ffffff;
  --border:      #e4e2db;
  --text:        #1a1917;
  --muted:       #6b6860;
  --accent:      #185fa5;
  --accent-light:#e6f1fb;
  --link:        #185fa5;
  --link-hover:  #0c447c;
  --radius-sm:   6px;
  --radius-md:   10px;
  --max-w:       860px;
  --font-serif:  'DM Serif Display', Georgia, serif;
  --font-sans:   'Inter', system-ui, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }

/* ============================================================
   OUTER CONTENT WRAPPER
   ============================================================ */
#content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   HEADER — #header contains a layout <table> with photo + nav
   We leave the table itself as-is but style its contents.
   ============================================================ */
#header {
  padding: 1.25rem 0 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
  overflow: hidden; /* contain the floated photo */
}

/* The header layout table — let it be a normal table, not grid */
#header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.25rem 0;
}
.hdr-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.hdr-top {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.hdr-photo {
  width: 120px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.hdr-identity { flex: 1; min-width: 0; }
#name {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.namedesc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.namedesc a { color: var(--muted); }
.namedesc a:hover { color: var(--link); text-decoration: underline; }
.hdr-nav {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}
a.menu {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}
a.menu:hover { background: var(--accent-light); color: var(--link-hover); }

@media (max-width: 600px) {
  .hdr-photo { width: 60px; }
  #name { font-size: 1.35rem; }
}




/* Photo cell */
#header table td[rowspan] {
  padding-right: 1.5rem;
  vertical-align: top;
}
#header table td[rowspan] img {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: 160px !important;
  height: auto;
}

/* Name */
#name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
  padding-bottom: 0.25rem;
}

/* Title / affiliations */
.namedesc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.namedesc a { color: var(--muted); }
.namedesc a:hover { color: var(--link); text-decoration: underline; }

/* Nav links row */
a.menu {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  text-decoration: none;
}
a.menu:hover {
  background: var(--accent-light);
  color: var(--link-hover);
  text-decoration: none;
}
/* Row containing nav links — add top border and padding */
#header table tr:last-child td {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main {
  padding-bottom: 4rem;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin: 3rem 0 1.25rem;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.5rem;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 1.5rem 0 0.4rem;
}

p {
  font-size: 16px;
  margin-bottom: 1rem;
  color: var(--text);
}

blockquote {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px;
  color: var(--muted);
}
blockquote p { margin-bottom: 0; color: var(--muted); font-size: 15px; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { font-size: 15px; margin-bottom: 0.4rem; line-height: 1.65; }

/* ============================================================
   PUBLICATION TABLES — scoped to #main to avoid touching #header
   ============================================================ */
#main table {
  width: 100%;
  border-collapse: collapse;
}

#main table tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
#main table tr:first-child { border-top: 1px solid var(--border); }
#main table tr:hover { background: var(--surface); }

#main table td {
  padding: 0.9rem 0.75rem 0.9rem 0 !important;
  font-size: 15px;
  line-height: 1.65;
  border: none;
  vertical-align: top;
}

/* Number cell — fixed narrow width, LEFT aligned, overrides align="right" */
#main table td.bibtexnumber {
  width: 2.5rem !important;
  text-align: left !important;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-right: 0 !important;
}
#main table td.bibtexnumber a {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 600;
}
#main table td.bibtexnumber a:hover {
  background: none !important;
  border: none !important;
  color: var(--muted) !important;
  text-decoration: none !important;
}

#main table td.bibtexitem { font-size: 15px; }
#main table td em { font-style: italic; color: var(--muted); }

/* Resource pills — all other links inside bibtexitem */
#main table td.bibtexitem a {
  display: inline-block;
  margin: 0.4rem 0.3rem 0 0;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
}
#main table td.bibtexitem a:hover {
  background: #cde0f5;
  border-color: var(--accent);
  text-decoration: none;
}

/* ============================================================
   TEACHING — research group photo
   ============================================================ */
img[src*="secon"], img[src*="group"] {
  max-width: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 1rem 0;
}

/* ============================================================
   SEARCH INPUT
   ============================================================ */
input[type="text"], input[type="search"] {
  display: block;
  width: 100%;
  max-width: 480px;
  padding: 0.6rem 1rem;
  font-family: var(--font-sans);
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  outline: none;
  margin: 0.5rem 0 2rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.12);
}

hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }

/* ============================================================
   MOBILE — ≤ 600px
   ============================================================ */
@media (max-width: 600px) {
  body { font-size: 19px; }
  #content { padding: 0 1rem; }

  /* Stack header: photo above name/nav */
  #header table,
  #header table tr,
  #header table td {
    display: block !important;
    width: 100% !important;
  }

  /* Photo */
  #header table td[rowspan] {
    padding-right: 0;
    padding-bottom: 0.75rem;
  }
  #header table td[rowspan] img {
    width: 90px !important;
    border-radius: var(--radius-md);
  }

  /* Hide the redundant colspan cells on mobile that show up as blank rows */
  #header table td[colspan] { padding: 0 0 0.1rem; }

  #name { font-size: 1.6rem; }
  .namedesc { font-size: 13px; }
  a.menu { font-size: 14px; padding: 0.3rem 0.55rem; }

  #main { padding-bottom: 3rem; }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 14px; }
  h3 { font-size: 16px; }
  p { font-size: 18px; }
  li { font-size: 17px; }

  /* Pub table: larger text, number stays left */
  #main table td { font-size: 17px !important; padding: 0.75rem 0.5rem 0.75rem 0 !important; }
  #main table td.bibtexnumber { font-size: 12px !important; width: 2rem !important; }
  #main table td.bibtexitem a { font-size: 12px; padding: 4px 10px; }
}

/* ============================================================
   DARK MODE
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #18171a;
    --surface:     #222129;
    --border:      #36343e;
    --text:        #eeecea;
    --muted:       #9b9898;
    --accent:      #85b7eb;
    --accent-light:#0c2a42;
    --link:        #85b7eb;
    --link-hover:  #b5d4f4;
  }

  #main table td.bibtexitem a { background: var(--accent-light); border-color: #1e3f5a; }
  #main table td.bibtexitem a:hover { background: #122d44; border-color: var(--accent); }
  blockquote { background: #0c2a42; }
  input { background: var(--surface); color: var(--text); }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, a { transition: none !important; }
  html { scroll-behavior: auto; }
}
