/* Editorial academic theme inspired by Theodor Misiakiewicz's Jemdoc site.
   It preserves the grouped navigation and blue academic vocabulary while
   improving typography, spacing, hierarchy, and responsive behavior. */

:root {
  --paper: #fbfaf7;
  --surface: #ffffff;
  --navy: #173f72;
  --navy-deep: #102d51;
  --blue: #315f96;
  --blue-soft: #eaf0f7;
  --gold: #aa8655;
  --ink: #1e2732;
  --muted: #5f6974;
  --line: #d9dde2;
  --line-strong: #b9c3cf;
  --menu-bg: #f0efe9;
  --page-width: 1240px;
  --menu-width: 232px;
  --shadow: 0 22px 60px rgba(30, 39, 50, 0.09);
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 32px;
  background:
    linear-gradient(90deg, rgba(23, 63, 114, 0.025) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16.5px;
  line-height: 1.66;
  text-rendering: optimizeLegibility;
}

::selection { background: #d7e3f1; color: var(--navy-deep); }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--navy-deep);
  border-radius: 0 0 4px 4px;
}

.skip-link:focus { top: 0; }

.site-shell {
  display: grid;
  grid-template-columns: var(--menu-width) minmax(0, 1fr);
  width: min(100%, var(--page-width));
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  overflow: clip;
  background: var(--surface);
  border: 1px solid rgba(23, 63, 114, 0.14);
  box-shadow: var(--shadow);
}

#layout-menu {
  position: relative;
  align-self: stretch;
  width: var(--menu-width);
  padding: 46px 26px 40px;
  background: var(--menu-bg);
  border-right: 1px solid var(--line);
  text-align: left;
}

#layout-menu::before {
  display: block;
  width: 44px;
  height: 4px;
  margin-bottom: 46px;
  background: var(--navy);
  content: "";
}

.menu-groups { position: sticky; top: 38px; }
.menu-group + .menu-group { margin-top: 28px; }

.menu-category {
  margin: 0 0 10px;
  padding: 0 0 8px;
  color: var(--muted);
  border-bottom: 1px solid rgba(170, 134, 85, 0.52);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.menu-item { margin: 2px 0; }

.menu-item a {
  display: block;
  margin-left: -10px;
  padding: 7px 10px;
  color: var(--blue);
  border-left: 2px solid transparent;
  font-size: 0.97rem;
  line-height: 1.25;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.menu-item a:hover,
.menu-item a:focus-visible {
  color: var(--navy-deep);
  background: rgba(255, 255, 255, 0.58);
  border-left-color: var(--gold);
}

.menu-item a.current {
  color: #ffffff;
  background: var(--navy);
  border-left-color: var(--gold);
}

#layout-content {
  width: 100%;
  min-width: 0;
  max-width: 980px;
  padding: 58px clamp(40px, 6vw, 76px) 48px;
  background: var(--surface);
  text-align: left;
}

#toptitle {
  position: relative;
  margin: 0 0 42px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line-strong);
}

#toptitle::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 92px;
  height: 3px;
  background: var(--navy);
  content: "";
}

#toptitle h1 {
  margin: 0;
  padding: 0;
  color: var(--navy-deep);
  border: 0;
  font-size: clamp(2.35rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.hero-subtitle {
  max-width: 670px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.45;
}

h1, h2, h3 { color: var(--navy-deep); font-weight: 500; }
h1 { font-size: 2.7rem; }

h2 {
  position: relative;
  margin: 48px 0 22px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 1.55rem;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h2::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--gold);
  content: "";
}

h3 {
  margin: 34px 0 14px;
  padding: 0;
  font-size: 1.13rem;
  letter-spacing: 0.01em;
}

p { margin: 0 0 1em; }

a {
  color: var(--blue);
  text-decoration-color: rgba(49, 95, 150, 0.28);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

a:hover,
a:focus-visible {
  color: var(--navy-deep);
  text-decoration-color: var(--gold);
}

a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

ul, ol, dl { margin-top: 0.25em; margin-bottom: 1em; }
ul { padding-left: 1.25em; list-style-type: square; }
li::marker { color: var(--gold); }
li p { margin-bottom: 0.42em; }

.imgtable {
  width: 100%;
  margin: 0 0 42px;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.imgtable tbody {
  display: block;
}

.imgtable tr {
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 52px);
  align-items: stretch;
}

.imgtable td {
  display: block;
  padding: 0;
  border: 0;
  text-align: left;
  vertical-align: top;
}

.profile-photo {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--line);
  box-shadow: 12px 12px 0 var(--blue-soft);
}

.contact-block {
  min-width: 0;
  padding: 30px 34px !important;
  background: linear-gradient(135deg, #f3f6fa 0%, #f8f9fa 100%);
  border-top: 3px solid var(--navy) !important;
  border-bottom: 1px solid var(--line) !important;
}

.contact-block p:first-child {
  margin-bottom: 1.4em;
  font-size: 1.02rem;
  line-height: 1.7;
}

.contact-links {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.87rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.note {
  padding: 10px 14px;
  color: var(--muted);
  background: var(--paper);
  border-left: 3px solid var(--gold);
  font-size: 0.92rem;
}

.paper-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: papers;
}

.paper-list > li {
  position: relative;
  margin: 0;
  padding: 18px 0 18px 34px;
  border-top: 1px solid var(--line);
  counter-increment: papers;
}

.paper-list > li:last-child { border-bottom: 1px solid var(--line); }

.paper-list > li::before {
  position: absolute;
  top: 20px;
  left: 0;
  color: var(--gold);
  content: counter(papers, decimal-leading-zero);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.paper-list > li p { margin: 0; }

.paper-title,
.paper-list > li > p > a:first-child {
  color: var(--navy-deep);
  font-weight: 600;
}

.venue { font-style: italic; }

.tag {
  display: inline-block;
  padding: 0 0.35em;
  color: var(--navy-deep);
  background: #e8edf4;
  border-radius: 2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82em;
  font-weight: 700;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 24px;
  margin: 0;
  padding: 19px 0 20px;
  border-top: 1px solid var(--line);
}

.timeline > li:last-child { border-bottom: 1px solid var(--line); }
.timeline > li::marker { content: ""; }

.timeline .date {
  align-self: start;
  padding: 3px 8px;
  color: var(--navy);
  background: var(--blue-soft);
  border-radius: 2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.timeline .details {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.record-list,
.course-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.record,
.course-list > li {
  margin: 0;
  padding: 24px 0 26px;
  border-top: 1px solid var(--line);
}

.record:last-child,
.course-list > li:last-child {
  border-bottom: 1px solid var(--line);
}

.record-header {
  display: grid;
  gap: 4px;
  margin-bottom: 17px;
}

.record-institution {
  color: var(--navy-deep);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.record-location {
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.45;
}

.role-list {
  display: grid;
  gap: 13px;
  margin-left: 2px;
  padding-left: 17px;
  border-left: 2px solid var(--blue-soft);
}

.role {
  min-width: 0;
}

.role + .role {
  padding-top: 13px;
  border-top: 1px solid rgba(217, 221, 226, 0.72);
}

.role-header,
.course-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 22px;
  align-items: start;
}

.role-title,
.course-header strong {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}

.role-meta,
.record-note,
.course-meta,
.course-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.52;
}

.record-note {
  margin-left: 19px;
}

.meta-label {
  margin-right: 0.4em;
  color: var(--navy);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.record-list .date,
.course-list .date,
.summary-date {
  color: var(--navy);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.45;
  white-space: nowrap;
}

.teaching-summary {
  margin: 0 0 20px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f3f6fa 0%, #fafafa 100%);
  border-left: 3px solid var(--navy);
}

.teaching-summary .eyebrow {
  margin-bottom: 6px;
}

.teaching-summary p {
  display: flex;
  gap: 18px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
}

.course-note a {
  margin-left: 0.55em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88em;
  font-weight: 650;
}

.compact-list li { margin-bottom: 0.45em; }

.footer {
  margin-top: 64px;
  padding-top: 18px;
  color: #7a838c;
  border-top: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
}

.footer p { margin: 0; }

@media (max-width: 900px) {
  body { padding: 0; background: var(--surface); }

  .site-shell {
    display: block;
    width: 100%;
    min-height: 100vh;
    border: 0;
    box-shadow: none;
  }

  #layout-menu {
    position: static;
    width: 100%;
    padding: 18px 24px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  #layout-menu::before { width: 34px; height: 3px; margin-bottom: 18px; }

  .menu-groups {
    position: static;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }

  .menu-group + .menu-group { margin-top: 0; }
  .menu-item a { margin-left: -7px; padding: 5px 7px; font-size: 0.9rem; }

  #layout-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 46px 32px 42px;
  }
}

@media (max-width: 680px) {
  body { font-size: 15.8px; }
  #layout-menu { padding: 16px 18px 13px; }

  .menu-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
  }

  #layout-content { padding: 38px 20px 36px; }
  #toptitle { margin-bottom: 30px; }
  #toptitle h1 { font-size: clamp(2.25rem, 12vw, 3rem); }
  .hero-subtitle { font-size: 0.98rem; }
  h2 { margin-top: 40px; font-size: 1.38rem; }

  .imgtable tr { grid-template-columns: 1fr; gap: 28px; }

  .profile-photo {
    width: min(100%, 320px);
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
    margin-inline: auto;
  }

  .contact-block { padding: 24px !important; }
  .timeline > li { grid-template-columns: 1fr; }
  .timeline .date { justify-self: start; }
  .timeline .details { grid-column: 1; }
  .role-header,
  .course-header { grid-template-columns: 1fr; gap: 5px; }
  .record-list .date,
  .course-list .date { white-space: normal; }
  .teaching-summary p { display: grid; gap: 4px; }
  .record-note { margin-left: 19px; }
}

@media (max-width: 420px) {
  .menu-groups { grid-template-columns: 1fr; gap: 13px; }
  .menu-category { margin-bottom: 5px; }
  .menu-item { display: inline-block; margin-right: 6px; }
  .menu-item a { display: inline-block; }
}

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

@media print {
  body { padding: 0; background: #ffffff; }
  #layout-menu, .skip-link, .footer { display: none; }
  .site-shell { display: block; border: 0; box-shadow: none; }
  #layout-content { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
