/* ===========================
   Root variables & reset
=========================== */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f5f5;
  --color-text: #212121;
  --color-text-muted: #5f5f5f;
  --color-border: #e6e6e6;
  --color-accent: #b12b32;
  --color-accent-dark: #8f2228;
  --color-header-bg: #f0f0f0;
  --color-header-text: #212121;
  --color-footer-bg: #f0f0f0;
  --color-footer-text: #212121;
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --max-width: 960px;
  --header-height: 64px;
  --radius: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  font-size: 16px;
  padding-top: var(--header-height);
}

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

a {
  color: var(--color-accent);
  text-decoration: underline;
}
a:hover { color: var(--color-accent-dark); }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5em;
  color: var(--color-text);
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }

ul { margin: 0 0 1em; padding-left: 1.25em; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}
hr.space-sm { margin: 12px 0; }
hr.space-lg { margin: 32px 0; }

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

/* ===========================
   Site header / navigation
=========================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--color-header-bg);
  color: var(--color-header-text);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-header-text);
  text-decoration: none;
  white-space: nowrap;
}
.site-brand:hover { color: var(--color-header-text); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
}

.main-nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  display: inline-block;
  padding: 6px 12px;
  color: var(--color-header-text);
  font-size: 0.96rem;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: none;
}

/* ===========================
   Banner
=========================== */
.banner {
  height: 240px;
  background: var(--color-bg-alt);
  overflow: hidden;
  position: relative;
}
.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 90px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.65));
  pointer-events: none;
}
@media (min-width: 768px) {
  .banner { height: 320px; }
}

/* ===========================
   Layout: sidebar + content
=========================== */
.page-body {
  padding-top: 48px;
  padding-bottom: 64px;
}

.layout {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}

.sidebar {
  flex: 0 0 240px;
  width: 240px;
}

.content {
  flex: 1;
  min-width: 0;
}

.avatar-frame {
  position: relative;
  z-index: 2;
  width: 180px;
  margin: -132px auto 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 5px #fff;
  background: #ccc;
  aspect-ratio: 1 / 1;
}
.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.sidebar .name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.sidebar .role {
  margin-bottom: 0;
  color: var(--color-text);
}
.sidebar p { margin-bottom: 6px; }

.social-list {
  list-style: none;
  margin: 0 0 1em;
  padding: 0;
}
.social-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.94rem;
}
.social-list .icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  color: var(--color-text-muted);
}
.social-list .icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.social-list a,
.email-link {
  color: var(--color-accent);
  text-decoration: underline;
}
.social-list a:hover,
.email-link:hover { color: var(--color-accent-dark); }

.btn-contact {
  display: inline-block;
  padding: 10px 22px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.94rem;
  text-decoration: none;
}
.btn-contact:hover { background: var(--color-accent-dark); color: #fff; }

/* ===========================
   Main content typography
=========================== */
.content-title .lead {
  font-size: 1.2rem;
  color: var(--color-text);
  max-width: 640px;
}

.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  margin: 24px 0;
}
.callout .emoji { flex: 0 0 auto; font-size: 1.3rem; }

.share-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
}
.share-row .label {
  font-size: 0.86rem;
  color: var(--color-text-muted);
}
.share-row a {
  color: var(--color-text);
  width: 18px;
  height: 18px;
  display: inline-flex;
}
.share-row a svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.share-row a:hover { color: var(--color-accent); }

/* ===========================
   Profile tabs
=========================== */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 28px;
}

.tab-btn {
  padding: 10px 16px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===========================
   Cards (publications / projects / teaching)
=========================== */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: #fff;
}

.card h3 { margin-bottom: 0.3em; }

.card .meta {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5em;
}

.card .tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.accordion-item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 20px;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-bg-alt);
  position: relative;
}

.accordion-item summary::-webkit-details-marker { display: none; }

.accordion-item summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent);
  font-weight: 700;
}

.accordion-item[open] summary::after { content: "\2212"; }

.accordion-body {
  padding: 16px 20px;
}

.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-list .bullet {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
}

.course-list .course-name {
  font-weight: 600;
}

.course-list .course-body p {
  margin: 4px 0 0;
  color: var(--color-text-muted);
}

/* ===========================
   CV page
=========================== */
.cv-block { margin-bottom: 30px; }

.cv-entry {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}

.cv-entry .cv-date {
  flex: 0 0 120px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.cv-entry .cv-body { flex: 1; }

.btn-download {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.92rem;
  text-decoration: none;
}
.btn-download:hover { background: var(--color-accent-dark); color: #fff; }

/* ===========================
   Contact form
=========================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.96rem;
  background: #fff;
  color: var(--color-text);
}

.form-group textarea { resize: vertical; min-height: 130px; }

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.btn-submit {
  padding: 11px 24px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.96rem;
  cursor: pointer;
}
.btn-submit:hover { background: var(--color-accent-dark); }

.contact-info .item { margin-bottom: 16px; }
.contact-info .item .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

/* ===========================
   Footer
=========================== */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 32px 0;
  font-size: 0.9rem;
  text-align: center;
}

.site-footer a { color: var(--color-footer-text); }

/* ===========================
   Responsive
=========================== */
@media (max-width: 767px) {
  .nav-toggle { display: inline-block; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .main-nav a { display: block; padding: 10px 6px; }

  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; text-align: center; }
  .avatar-frame { margin: -100px auto 16px; width: 140px; }
  .social-list li { justify-content: center; }

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

  .cv-entry { flex-direction: column; gap: 4px; }
  .cv-entry .cv-date { flex: none; }

  .tab-btn { padding: 8px 10px; font-size: 0.85rem; }
}
