/* ==========================================================================
   Naoki Masuda — site stylesheet
   Self-contained: no frameworks, no build step, no external fonts.
   Tweak the variables in :root to change sizes/colours globally.
   ========================================================================== */

:root {
  /* ---- Type scale (this is the knob for "bigger fonts") ---- */
  --font-base: 18px;          /* body text on desktop */
  --font-base-mobile: 17px;
  --line: 1.65;

  /* ---- Layout width ---- */
  --content-max: 1180px;      /* main text column */
  --bar-max: 1400px;          /* header/nav bar */
  --gutter: 24px;

  /* ---- Colours ---- */
  --navy: #00274c;            /* U-M blue */
  --navy-light: #123a66;
  --maize: #ffcb05;
  --ink: #1f2733;
  --ink-soft: #4a5566;
  --rule: #dfe4ea;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --link: #10508f;
  --link-hover: #c1440e;

  --header-h: 64px;           /* used for anchor offsets */
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: var(--font-base);
  line-height: var(--line);
}

img { border: 0; max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: none; }
a:hover, a:focus { color: var(--link-hover); text-decoration: underline; }

/* ==========================================================================
   Sticky top header + navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .18);
}

.bar {
  max-width: var(--bar-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: var(--header-h);
}

.brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: .01em;
  padding: 10px 0;
  white-space: nowrap;
}
.brand:hover, .brand:focus { color: var(--maize); text-decoration: none; }
.brand .tag {
  display: block;
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #b8c7d9;
}

/* --- hamburger (mobile only) --- */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .45);
  color: #fff;
  font: inherit;
  font-size: .95rem;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .12); }

/* --- menu --- */
.site-nav { margin-left: auto; }

.menu, .submenu { list-style: none; margin: 0; padding: 0; }

.menu { display: flex; align-items: stretch; flex-wrap: wrap; }

.menu > li { position: relative; }

.menu > li > a {
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 14px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.menu > li > a:hover,
.menu > li:focus-within > a { background: var(--navy-light); color: #fff; text-decoration: none; }
.menu > li > a[aria-current="page"] { border-bottom-color: var(--maize); }

/* caret for items that have a submenu */
.has-sub > a::after {
  content: "";
  margin-left: 7px;
  border: 5px solid transparent;
  border-top-color: currentColor;
  transform: translateY(3px);
}

/* --- dropdown --- */
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 270px;
  background: #fff;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--maize);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
  padding: 6px 0;
  display: none;
}
.has-sub:hover > .submenu,
.has-sub:focus-within > .submenu,
.has-sub.open > .submenu { display: block; }

.submenu a {
  display: block;
  padding: 9px 18px;
  color: var(--ink);
  font-size: .97rem;
  line-height: 1.35;
}
.submenu a:hover, .submenu a:focus {
  background: var(--bg-soft);
  color: var(--link-hover);
  text-decoration: none;
}

/* sub-toggle button is only used on mobile */
.sub-toggle { display: none; }

/* language switch sits at the far right */
.menu > li.lang > a { color: var(--maize); }

/* ==========================================================================
   Page skeleton
   ========================================================================== */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px var(--gutter) 60px;
}
.page.wide { max-width: var(--bar-max); }

h1.page-title {
  font-size: 2rem;
  line-height: 1.2;
  margin: 8px 0 22px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--maize);
  color: var(--navy);
}

h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--navy);
  margin: 2.1em 0 .6em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.22rem;
  line-height: 1.35;
  color: var(--navy);
  margin: 1.8em 0 .5em;
}

h4 { font-size: 1.06rem; margin: 1.4em 0 .4em; }

/* headings are anchor targets — keep them clear of the sticky bar */
h1[id], h2[id], h3[id], h4[id], .anchor { scroll-margin-top: calc(var(--header-h) + 14px); }

p { margin: 0 0 1em; }

/* The page itself is wide (see --content-max), but a line of running text that
   spans the full width is tiring to read, so paragraphs get a reading measure.
   Lists, tables, figures and maps still use the whole width.
   Delete this rule if you prefer edge-to-edge paragraphs. */
.page p { max-width: 82ch; }
.grid-2 p, .figtable p, .hero p, .jumpbar p, .publist p { max-width: none; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.6em; }
li { margin-bottom: .45em; }

strong { color: #17324f; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }

/* the small triangle that replaces the old list_2.gif bullet images */
.bullet {
  display: inline-block;
  width: 0; height: 0;
  margin-right: .5em;
  border: 6px solid transparent;
  border-left-color: var(--maize);
  border-right-width: 0;
  transform: translateY(1px);
}
p > .bullet:first-child { margin-left: -.1em; }
/* a paragraph that starts with a bullet reads as a list item */
p.bulleted { padding-left: 1.1em; text-indent: -1.1em; }

/* ==========================================================================
   Reusable blocks
   ========================================================================== */

.lead { font-size: 1.1rem; color: var(--ink-soft); }

.card {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--maize);
  border-radius: 6px;
  padding: 18px 22px;
  margin: 0 0 1.6em;
}
.card > :last-child { margin-bottom: 0; }

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.hero img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.books {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
}
.books img { width: 190px; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }

/* two-column grid, used for the offices/maps on the Access page */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 26px;
}
.map-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
/* fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 4 / 3) { .map-frame { height: 300px; } }

/* publication lists */
.publist ol { padding-left: 2.1em; }
.publist ol > li {
  margin-bottom: 1.15em;
  padding-left: .2em;
}
.publist ol > li::marker { color: var(--ink-soft); }

/* jump-links strip shown at the top of long pages */
.jumpbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 26px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.jumpbar a {
  font-size: .93rem;
  padding: 4px 11px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.jumpbar a:hover { background: var(--navy); color: #fff; border-color: var(--navy); text-decoration: none; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 40px;
  background: var(--navy);
  color: #cfd9e5;
  font-size: .95rem;
}
.site-footer .bar {
  min-height: 0;
  padding-top: 24px;
  padding-bottom: 24px;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.site-footer a { color: #fff; text-decoration: underline; }
.site-footer a:hover { color: var(--maize); }
.site-footer .copyright { width: 100%; border-top: 1px solid rgba(255,255,255,.18); padding-top: 14px; font-size: .87rem; }
.footer-mail img { background: #fff; padding: 4px 8px; border-radius: 4px; }

/* back-to-top */
.to-top {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 900;
  display: none;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.to-top.show { display: block; }
.to-top:hover { background: var(--link-hover); }

/* ==========================================================================
   Responsive — phones and small tablets
   ========================================================================== */

@media (max-width: 900px) {
  body { font-size: var(--font-base-mobile); }

  .nav-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,.2);
  }
  .site-header.nav-open .site-nav { display: block; }
  .site-header { position: sticky; }

  .menu { display: block; padding: 6px 0 14px; }
  .menu > li { border-bottom: 1px solid rgba(255,255,255,.12); }

  .menu > li > a {
    height: auto;
    padding: 13px 22px;
    border-bottom: 0;
    font-size: 1.05rem;
  }
  .menu > li > a[aria-current="page"] { color: var(--maize); }
  .has-sub > a::after { display: none; }

  /* on touch screens the caret becomes a real button */
  .has-sub { display: flex; flex-wrap: wrap; align-items: center; }
  .has-sub > a { flex: 1; }
  .sub-toggle {
    display: block;
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    padding: 12px 20px;
    cursor: pointer;
  }
  .sub-toggle[aria-expanded="true"] { color: var(--maize); }

  .submenu {
    position: static;
    display: none;
    width: 100%;
    flex-basis: 100%;
    background: #0b3160;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 4px 0 10px;
  }
  .has-sub:hover > .submenu, .has-sub:focus-within > .submenu { display: none; }
  .has-sub.open > .submenu { display: block; }
  .submenu a { color: #dbe6f2; padding: 10px 22px 10px 38px; }
  .submenu a:hover, .submenu a:focus { background: rgba(255,255,255,.1); color: #fff; }

  .brand { font-size: 1.02rem; white-space: normal; }
  .page { padding-top: 20px; }
  h1.page-title { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.12rem; }
  .hero img { height: 190px; }
  .books img { width: 44%; min-width: 130px; }
  .publist ol { padding-left: 1.5em; }
}

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  .books img { width: 100%; }
}

@media print {
  .site-header, .site-footer, .to-top, .jumpbar { display: none; }
  body { font-size: 11pt; }
}

/* ==========================================================================
   Figure tables carried over from the older "introduction to this research"
   pages — keep them readable on a phone.
   ========================================================================== */
.figtable {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
}
.figtable td {
  padding: 10px 8px;
  vertical-align: top;
  text-align: center;
}
.figtable td[colspan] {
  text-align: left;
  font-size: .95rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
}
.figtable img { max-width: 100%; height: auto; }

@media (max-width: 700px) {
  .figtable, .figtable tbody, .figtable tr, .figtable td { display: block; width: 100%; }
  .figtable td { padding: 6px 0; }
}

/* ==========================================================================
   Japanese pages
   ========================================================================== */

/* a book with its cover, used on the Japanese home page */
.book {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  padding: 0 0 22px;
  margin: 0 0 22px;
  border-bottom: 1px dotted #b9c2cd;
  max-width: none;
}
.book img {
  order: 2;
  flex: 0 0 130px;
  width: 130px;
  border: 1px solid #b9c2cd;
  border-radius: 3px;
}
.book > h4, .book > p { max-width: none; }
.book h4 {
  order: 1;
  margin: 0 0 .6em;
  font-size: 1.06rem;
  line-height: 1.45;
}
.book p { order: 1; margin: 0; }
/* keep the heading and text in one column to the left of the cover */
.book { flex-wrap: wrap; }
.book > *:not(img) { flex: 1 1 60%; }

@media (max-width: 620px) {
  .book { display: block; }
  .book img { float: right; margin: 0 0 12px 16px; width: 104px; flex: none; }
}

/* collapsible block for archived content */
details.card > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
}
details.card[open] > summary { margin-bottom: 1em; }

/* Japanese text reads better with a little more line spacing */
html[lang="ja"] body { line-height: 1.8; }
html[lang="ja"] .jumpbar a { font-size: .95rem; }

/* ==========================================================================
   Plain data tables (member lists, course lists, …)
   ========================================================================== */
.datatable {
  border-collapse: collapse;
  margin: .3em 0 1.4em;
  max-width: 100%;
}
.datatable td {
  text-align: left;
  vertical-align: top;
  padding: 2px 18px 2px 0;
}
.datatable td:first-child { white-space: nowrap; color: var(--ink-soft); }
.datatable td:last-child { padding-right: 0; }

@media (max-width: 560px) {
  .datatable, .datatable tbody, .datatable tr, .datatable td { display: block; width: 100%; }
  .datatable td { padding: 0; }
  .datatable td:first-child { font-size: .92rem; margin-top: .7em; }
}

/* keep the top bar compact on small phones */
@media (max-width: 520px) {
  .brand .tag { display: none; }
  .brand { font-size: 1rem; }
}
