/* Styled after a classic Google Sites academic page:
   Playfair Display (name, headings) + Open Sans (text), indigo accent, dark header bar. */
:root {
  --bg: #ffffff;
  --text: #212121;
  --muted: #616161;
  --line: #e0e0e0;
  --accent: #38428e;          /* indigo used for name & headings */
  --bar: #212121;             /* header bar when scrolled */
  --bar-text: #bdbdbd;
  --soft: #f5f5f7;
  --max: 1040px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Open Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0 0 .5em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
header.site {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: transparent; transition: background .25s, box-shadow .25s;
}
header.site.scrolled, header.site.solid { background: var(--bar); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
header.site .bar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 22px; }
.brand {
  font-family: var(--serif); font-weight: 700; font-size: 1.55rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
header.site.scrolled .brand, header.site.solid .brand { color: #fff; }

nav.main { display: flex; align-items: center; gap: 6px; }
nav.main > a, .dd > button {
  font-family: var(--sans); font-size: .92rem; color: #424242;
  text-decoration: none; background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px;
}
header.site.scrolled nav.main > a, header.site.scrolled .dd > button,
header.site.solid nav.main > a, header.site.solid .dd > button { color: var(--bar-text); }
nav.main > a:hover, .dd > button:hover { color: var(--text); }
header.site.scrolled nav.main > a:hover, header.site.scrolled .dd > button:hover,
header.site.solid nav.main > a:hover, header.site.solid .dd > button:hover { color: #fff; }
nav.main a.active, .dd.active > button { font-weight: 700; color: var(--text); }
header.site.scrolled nav.main a.active, header.site.scrolled .dd.active > button,
header.site.solid nav.main a.active, header.site.solid .dd.active > button { color: #fff; }
.chev { width: 18px; height: 18px; fill: currentColor; transition: transform .2s; }

/* Dropdown */
.dd { position: relative; }
.dd-menu {
  position: absolute; top: 100%; right: 0; min-width: 330px; padding: 8px 0;
  background: #fff; border-radius: 4px; box-shadow: 0 6px 22px rgba(0,0,0,.18);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: .15s;
}
.dd-menu a {
  display: block; padding: 9px 20px; font-size: .9rem; line-height: 1.4;
  color: var(--text); text-decoration: none;
}
.dd-menu a:hover { background: var(--soft); color: var(--accent); }
.dd-menu .all { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 11px; font-weight: 600; }
.dd:hover .dd-menu, .dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd:hover .chev, .dd.open .chev { transform: rotate(180deg); }

.menu-btn { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.menu-btn svg { width: 26px; height: 26px; fill: #424242; }
header.site.scrolled .menu-btn svg, header.site.solid .menu-btn svg { fill: #fff; }

main.wrap { padding-top: 92px; }

/* ---------- Home ---------- */
.intro { display: grid; grid-template-columns: 1fr 1.3fr; gap: 44px; align-items: start; padding: 10px 0 30px; }
.intro h1 {
  font-family: var(--serif); font-weight: 400; color: var(--accent);
  font-size: 2.45rem; line-height: 1.4; margin-bottom: .55em;
}
.intro p { font-size: 1.12rem; line-height: 1.85; }
.intro .photo { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }

.section-title {
  display: block; text-align: center; margin: 46px 0 34px;
  font-family: var(--serif); font-weight: 400; font-size: 1.7rem; color: var(--accent);
}
a.section-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.selected { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; align-items: start; }
.selected figure { margin: 0; text-align: center; }
.selected .fig { display: block; background: #fff; }
.selected .fig img { width: 100%; aspect-ratio: 30 / 17; object-fit: contain; background: #fff; }
.selected figcaption { padding: 16px 6px 0; font-size: 1rem; line-height: 1.75; }
.brackets { margin-top: 10px; font-size: 1rem; }
.brackets a { text-decoration: underline; text-underline-offset: 2px; }
.brackets a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
footer.site { margin-top: 70px; padding: 30px 0 46px; }
footer.site .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; }
.touch {
  text-align: center; font-family: var(--serif); font-size: 1.7rem; color: var(--accent); margin: 0;
}
.touch a { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.icons { display: flex; gap: 12px; }
.icons a {
  width: 38px; height: 38px; border-radius: 50%; background: #424242;
  display: grid; place-items: center; transition: background .15s;
}
.icons a:hover { background: var(--accent); }
.icons svg { width: 19px; height: 19px; fill: #fff; }

/* ---------- Page heading (Projects, CV) ---------- */
.page-title {
  font-family: var(--serif); font-weight: 400; color: var(--accent);
  font-size: 2.45rem; text-align: center; margin: 10px 0 8px;
}
.page-sub { text-align: center; color: var(--muted); margin-bottom: 36px; }

/* Projects: picture-card grid */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.cards a { text-decoration: none; text-align: center; }
.cards .fig { display: block; background: #fff; border: 1px solid #eee; transition: box-shadow .15s; }
.cards a:hover .fig { box-shadow: 0 4px 16px rgba(0,0,0,.14); }
.cards img { width: 100%; aspect-ratio: 30 / 17; object-fit: contain; background: #fff; }
.cards span { display: block; padding-top: 12px; font-size: .98rem; line-height: 1.6; }
.cards a:hover span { color: var(--accent); text-decoration: underline; }

/* Project detail */
.project { padding: 54px 0 10px; border-top: 1px solid var(--line); margin-top: 50px; scroll-margin-top: 70px; }
.project + .project { margin-top: 0; }
.project h2 {
  font-family: var(--serif); font-weight: 400; color: var(--accent);
  font-size: 1.85rem; line-height: 1.35; text-align: center; margin-bottom: 6px;
}
.project .meta { text-align: center; color: var(--muted); font-size: .95rem; margin-bottom: 26px; }
.project .body { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.project .fig { border: 1px solid #ddd; background: #fff; }
.project .fig img { width: 100%; }
.project ul { padding-left: 1.2em; margin: 0 0 1em; }
.project li { margin-bottom: .45em; }
.tags { color: var(--muted); font-size: .9rem; }
.tags b { color: var(--text); font-weight: 600; }

/* ---------- CV ---------- */
.cv h2 {
  font-family: var(--serif); font-weight: 400; color: var(--accent);
  font-size: 1.75rem; margin: 46px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.cv-item { display: grid; grid-template-columns: 170px 1fr; gap: 24px; padding: 16px 0; }
.cv-item .when { color: var(--muted); font-size: .92rem; padding-top: 3px; }
.cv-item h3 { font-size: 1.06rem; font-weight: 700; margin-bottom: 0; line-height: 1.5; }
.cv-item .where { color: var(--muted); margin-bottom: .4em; }
.cv-item ul { padding-left: 1.2em; margin: 0; }
.cv-item li { margin-bottom: .35em; }
.skills { display: grid; grid-template-columns: 210px 1fr; gap: 10px 24px; margin: 18px 0 0; }
.skills dt { font-weight: 700; }
.skills dd { margin: 0; color: #424242; }
.cv-actions { text-align: center; margin-bottom: 10px; }
.btn {
  display: inline-block; padding: 9px 22px; border-radius: 4px; text-decoration: none;
  background: var(--accent); color: #fff; font-weight: 600; font-size: .95rem;
}
.btn:hover { background: #2a3270; }

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  .wrap { padding: 0 16px; }
  header.site { background: var(--bar); }
  header.site .brand { color: #fff; font-size: 1.3rem; }
  header.site .bar { padding: 0 12px 0 16px; }
  .menu-btn { display: block; }
  .menu-btn svg { fill: #fff; }
  nav.main {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; box-shadow: 0 8px 18px rgba(0,0,0,.18); padding: 8px 0;
  }
  header.site.menu-open nav.main { display: flex; }
  nav.main > a, .dd > button,
  header.site.scrolled nav.main > a, header.site.scrolled .dd > button,
  header.site.solid nav.main > a, header.site.solid .dd > button { color: var(--text); padding: 12px 20px; width: 100%; justify-content: space-between; font-size: 1rem; }
  nav.main a.active, .dd.active > button,
  header.site.scrolled nav.main a.active, header.site.scrolled .dd.active > button { color: var(--accent); }
  .dd-menu { position: static; box-shadow: none; min-width: 0; padding: 0 0 6px 14px; display: none; opacity: 1; visibility: visible; transform: none; }
  .dd.open .dd-menu { display: block; }
  .dd:hover .dd-menu { display: none; }
  .dd.open:hover .dd-menu { display: block; }

  main.wrap { padding-top: 80px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .intro .photo { order: -1; }
  .intro h1, .page-title { font-size: 2rem; }
  .intro p { font-size: 1.04rem; }
  .selected, .cards { grid-template-columns: 1fr; gap: 36px; }
  .project .body { grid-template-columns: 1fr; gap: 20px; }
  .project h2 { font-size: 1.5rem; }
  footer.site .wrap { grid-template-columns: 1fr; justify-items: center; }
  .touch { font-size: 1.35rem; }
  .cv-item, .skills { grid-template-columns: 1fr; gap: 2px; }
}
