/* ===================================================================
   Lab website — design system
   =================================================================== */

:root {
  --ink: #1c2536;
  --ink-soft: #55617a;
  --paper: #faf9f6;
  --surface: #ffffff;
  --line: #e6e2d8;
  --accent: #3450c8;
  --accent-dark: #24378c;
  --accent-soft: #eef1fc;
  --navy: #161d33;
  --gold: #c8952e;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(22, 29, 51, .07), 0 8px 24px rgba(22, 29, 51, .06);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }

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

img { max-width: 100%; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.accent { color: var(--accent); font-weight: 500; }

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------
   Header & navigation
   ------------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 249, 246, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; font-family: var(--font-display);
  font-size: .95rem; font-weight: 700; letter-spacing: .5px;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; }
.brand-text small { color: var(--ink-soft); font-size: .72rem; }

.main-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }

.main-nav a {
  color: var(--ink-soft); font-size: .92rem; font-weight: 500;
  padding: .45rem .7rem; border-radius: 8px;
}
.main-nav a:hover { color: var(--ink); background: var(--accent-soft); text-decoration: none; }
.main-nav a.active { color: var(--accent-dark); background: var(--accent-soft); }

.main-nav .nav-cta {
  background: var(--navy); color: #fff; margin-left: .35rem;
}
.main-nav .nav-cta:hover, .main-nav .nav-cta.active { background: var(--accent-dark); color: #fff; }

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

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .6rem .7rem; }
}

/* ------------------------------------------------------------------
   Flash messages
   ------------------------------------------------------------------ */

.flash {
  margin: 1rem 0 0; padding: .7rem 1rem; border-radius: var(--radius);
  font-size: .92rem; border: 1px solid;
}
.flash-success { background: #ecf7ef; border-color: #b7dfc2; color: #205b32; }
.flash-error { background: #fdefef; border-color: #efc4c4; color: #8c2b2b; }

/* ------------------------------------------------------------------
   Hero & page heads
   ------------------------------------------------------------------ */

.hero {
  background:
    radial-gradient(1000px 400px at 85% -50%, rgba(52, 80, 200, .16), transparent),
    radial-gradient(700px 300px at 0% 120%, rgba(200, 149, 46, .12), transparent),
    var(--navy);
  color: #fff;
  padding: 4.5rem 0 4rem;
  text-align: center;
}

.hero-kicker {
  text-transform: uppercase; letter-spacing: .18em; font-size: .78rem;
  color: #aab6dd; margin-bottom: .8rem;
}

.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 1rem; }

.hero-tagline {
  max-width: 640px; margin: 0 auto 2rem; font-size: 1.12rem; color: #ccd3ea;
}

.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.page-head {
  background: linear-gradient(180deg, #f1efe9, var(--paper));
  border-bottom: 1px solid var(--line);
  padding: 2.6rem 0 2rem;
}
.page-head h1 { margin-bottom: .3rem; }

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */

.btn {
  display: inline-block; padding: .6rem 1.3rem; border-radius: 999px;
  font-size: .93rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s ease;
  font-family: var(--font-body);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost { border-color: currentColor; color: var(--accent); background: transparent; }
.hero .btn-ghost { color: #dce2f5; }

.btn-danger { background: #fdefef; color: #a03030; border-color: #efc4c4; }
.btn-danger:hover { background: #a03030; color: #fff; }

.btn-sm { padding: .3rem .8rem; font-size: .82rem; }
.btn-block { width: 100%; }

.btn.btn-sm:not(.btn-danger):not(.btn-primary) {
  background: var(--accent-soft); color: var(--accent-dark);
}

/* ------------------------------------------------------------------
   Sections & layout helpers
   ------------------------------------------------------------------ */

/* padding-block only: .container supplies the horizontal padding, and a
   shorthand here would wipe it on elements with both classes. */
.section { padding-block: 2.75rem; }

.section-tinted { background: #f2f0ea; border-block: 1px solid var(--line); }
.section-tinted .section { padding-block: 0; }

.section-title {
  font-size: 1.45rem; margin: 1.8rem 0 1.1rem; position: relative;
}
.section-title:first-child { margin-top: 0; }
.section-title::after {
  content: ""; display: block; width: 44px; height: 3px;
  background: var(--gold); margin-top: .45rem; border-radius: 2px;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.see-all { font-size: .92rem; font-weight: 600; white-space: nowrap; }

.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem; padding: 2rem 1.25rem;
}

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; text-align: center;
  box-shadow: var(--shadow); color: var(--ink);
}
.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat strong { display: block; font-size: 1.9rem; font-family: var(--font-display); color: var(--accent-dark); }
.stat span { color: var(--ink-soft); font-size: .85rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  background: var(--accent-soft); color: var(--accent-dark);
  border: 1px solid #d5dcf5; border-radius: 999px;
  padding: .3rem .85rem; font-size: .86rem; font-weight: 500;
}
.chips-sm .chip { padding: .15rem .65rem; font-size: .78rem; }

.empty-note { color: var(--ink-soft); font-style: italic; padding: 1rem 0; }

/* ------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem;
  box-shadow: var(--shadow);
}

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.2rem;
}

a.card { color: var(--ink); display: block; transition: all .15s ease; }
a.card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); }

/* ------------------------------------------------------------------
   People
   ------------------------------------------------------------------ */

.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.avatar-fallback {
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 1.1rem;
  font-family: var(--font-body); letter-spacing: .5px;
}
.avatar-lg { width: 86px; height: 86px; font-size: 1.6rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.2rem; }

.people-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.2rem;
}

.person-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem 1rem;
  text-align: center; color: var(--ink);
  box-shadow: var(--shadow); transition: all .15s ease;
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
}
.person-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); }
.person-card h3 { font-size: 1.02rem; }

.teacher-list { display: flex; flex-direction: column; gap: 1.2rem; }

.teacher-row { display: flex; gap: 1.4rem; align-items: flex-start; }
.teacher-row-body { display: flex; flex-direction: column; gap: .35rem; }
.teacher-row h2 { font-size: 1.3rem; }

.profile-head { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; }

.profile-body {
  display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem;
  align-items: start;
}
@media (max-width: 800px) { .profile-body { grid-template-columns: 1fr; } }

.profile-main p { margin-bottom: .9rem; }

.link-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .5rem; }

.pill-link {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: .25rem .8rem; font-size: .84rem;
  font-weight: 500; color: var(--accent-dark);
}
.pill-link:hover { border-color: var(--accent); text-decoration: none; }
.pill-accent { background: var(--accent-soft); border-color: #d5dcf5; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: .45rem .9rem; font-size: .92rem; }
.facts dt { color: var(--ink-soft); font-weight: 500; }
.facts dd { margin: 0; }

/* ------------------------------------------------------------------
   Tabs
   ------------------------------------------------------------------ */

.tabs { display: flex; gap: .5rem; margin-bottom: 1.8rem; border-bottom: 2px solid var(--line); }

.tab {
  padding: .55rem 1.1rem; color: var(--ink-soft); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: .95rem;
}
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab .count {
  background: var(--accent-soft); border-radius: 999px;
  font-size: .76rem; padding: .1rem .5rem; margin-left: .3rem;
}

/* ------------------------------------------------------------------
   Publications
   ------------------------------------------------------------------ */

.pub-toolbar { display: flex; gap: .8rem; margin-bottom: 2rem; flex-wrap: wrap; }
.pub-toolbar input[type="search"] {
  flex: 1; min-width: 220px; padding: .6rem .9rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: .95rem;
  background: var(--surface);
}
.pub-toolbar select {
  padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: .95rem; background: var(--surface);
}

.year-heading {
  font-size: 1.8rem; color: var(--accent-dark);
  border-bottom: 1px solid var(--line);
  margin: 2rem 0 1rem; padding-bottom: .35rem;
}
.pub-year-group:first-of-type .year-heading { margin-top: 0; }

.pub-list { display: flex; flex-direction: column; gap: 1rem; }

.pub-item {
  display: flex; gap: 1.1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; box-shadow: var(--shadow);
}

.pub-meta {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  min-width: 86px; flex-shrink: 0;
}
.pub-year { font-family: var(--font-display); color: var(--ink-soft); font-size: .95rem; }

.pub-title { font-size: 1.03rem; margin-bottom: .15rem; }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: .9rem; color: var(--ink-soft); }
.pub-venue { font-size: .88rem; color: var(--ink-soft); }
.pub-links { display: flex; gap: .8rem; font-size: .85rem; font-weight: 600; margin-top: .25rem; }

/* Badges */

.badge {
  display: inline-block; border-radius: 999px; padding: .14rem .65rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-journal { background: #e7f3ec; color: #1d6b3d; }
.badge-conference { background: var(--accent-soft); color: var(--accent-dark); }
.badge-workshop { background: #fdf1e2; color: #915a10; }
.badge-preprint { background: #f0e9fa; color: #5b3894; }
.badge-thesis { background: #fbeaf1; color: #99295e; }
.badge-book { background: #e6f4f6; color: #14646f; }

.badge-status-current { background: #e7f3ec; color: #1d6b3d; }
.badge-status-upcoming { background: var(--accent-soft); color: var(--accent-dark); }
.badge-status-past { background: #efedeb; color: var(--ink-soft); }

.badge-status-enrolled { background: #e7f3ec; color: #1d6b3d; }
.badge-status-on_leave { background: #fdf1e2; color: #915a10; }
.badge-status-graduated { background: #efedeb; color: var(--ink-soft); }

.badge-role-admin { background: #fdf1e2; color: #915a10; }
.badge-role-teacher { background: var(--accent-soft); color: var(--accent-dark); }
.badge-role-student { background: #e7f3ec; color: #1d6b3d; }

/* ------------------------------------------------------------------
   Seminars
   ------------------------------------------------------------------ */

.seminar-card { display: flex; flex-direction: column; gap: .55rem; }
.seminar-card-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.seminar-dates { font-size: .82rem; color: var(--ink-soft); }
.seminar-facts {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .86rem; color: var(--ink-soft); margin-top: .35rem;
}

.topic-list, .book-list { padding-left: 1.3rem; margin-bottom: 1rem; }
.topic-list li, .book-list li { margin-bottom: .4rem; }

/* Calendar */

.calendar-widget {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.2rem; max-width: 760px;
}

.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.cal-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.cal-nav {
  background: var(--accent-soft); border: none; color: var(--accent-dark);
  border-radius: 8px; width: 34px; height: 34px; font-size: 1rem;
  cursor: pointer; font-weight: 700;
}
.cal-nav:hover { background: var(--accent); color: #fff; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal-dow {
  text-align: center; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); padding: .3rem 0;
}

.cal-cell {
  min-height: 58px; border: 1px solid var(--line); border-radius: 8px;
  padding: .25rem .35rem; font-size: .8rem; background: var(--paper);
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.cal-cell.other-month { opacity: .35; }
.cal-cell.today { border-color: var(--gold); border-width: 2px; }
.cal-daynum { font-weight: 600; color: var(--ink-soft); }
.cal-cell.today .cal-daynum { color: var(--gold); }

.cal-event {
  display: block; border-radius: 5px; padding: 1px 5px;
  font-size: .68rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event:hover { text-decoration: none; opacity: .85; }
.cal-event.status-current { background: #2c8c53; }
.cal-event.status-upcoming { background: var(--accent); }

.calendar-legend { display: flex; gap: 1.4rem; margin-top: .9rem; font-size: .86rem; color: var(--ink-soft); }
.legend-item { display: flex; align-items: center; gap: .4rem; }
.dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dot-current { background: #2c8c53; }
.dot-upcoming { background: var(--accent); }

@media (max-width: 640px) {
  .cal-cell { min-height: 44px; }
  .cal-event { font-size: 0; padding: 0; height: 6px; }
}

/* ------------------------------------------------------------------
   Contact & misc pages
   ------------------------------------------------------------------ */

.contact-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.contact-card { text-align: center; }
.contact-icon { font-size: 1.8rem; display: block; margin-bottom: .5rem; }
.contact-card .link-row { justify-content: center; }

.prose { max-width: 720px; }
.prose p { margin-bottom: 1rem; font-size: 1.03rem; }

.auth-section { display: flex; justify-content: center; padding-top: 4rem; padding-bottom: 5rem; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 1rem; padding: 2rem; }
.auth-card h1 { font-size: 1.5rem; }

.error-page { text-align: center; padding: 6rem 0; }
.error-page h1 { font-size: 5rem; color: var(--accent-dark); }
.error-page p { margin-bottom: 1.5rem; }

/* ------------------------------------------------------------------
   Forms (shared by login + admin)
   ------------------------------------------------------------------ */

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: var(--ink-soft); }

input:not([type="checkbox"]):not([type="file"]), select, textarea {
  padding: .55rem .8rem; border: 1px solid #d8d4ca; border-radius: 8px;
  font-size: .95rem; font-family: var(--font-body); background: var(--surface);
  color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 80, 200, .15);
}
textarea { resize: vertical; }

.inline-check { display: inline-flex; flex-direction: row; align-items: center; gap: .35rem; font-weight: 400; }

/* ------------------------------------------------------------------
   Admin
   ------------------------------------------------------------------ */

.admin-bar { background: var(--navy); }
.admin-bar-inner {
  display: flex; align-items: center; gap: 1.2rem;
  min-height: 48px; flex-wrap: wrap; padding-block: .3rem;
}
.admin-label { color: var(--gold); font-weight: 700; font-size: .9rem; }
.admin-nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.admin-nav a {
  color: #b9c1da; font-size: .88rem; font-weight: 500;
  padding: .35rem .7rem; border-radius: 6px;
}
.admin-nav a:hover { color: #fff; text-decoration: none; }
.admin-nav a.active { background: rgba(255, 255, 255, .12); color: #fff; }

.admin-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}

.admin-stats .stat { text-align: center; }

.quick-actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.admin-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); font-size: .92rem;
}
.admin-table th {
  text-align: left; background: #f2f0ea; padding: .65rem .9rem;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft);
}
.admin-table td { padding: .65rem .9rem; border-top: 1px solid var(--line); vertical-align: middle; }
.admin-table .cell-wide { max-width: 380px; }

@media (max-width: 700px) {
  /* Wide admin tables scroll inside themselves instead of stretching the page. */
  .admin-table { display: block; overflow-x: auto; }
}

.row-actions { display: flex; gap: .4rem; align-items: center; white-space: nowrap; }
.row-actions form { display: inline; }

.admin-form { display: flex; flex-direction: column; gap: 1.1rem; max-width: 760px; margin-top: 1rem; }

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
}

.form-actions { display: flex; gap: .8rem; padding-top: .4rem; }

.weekday-picker {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1.1rem; display: flex; flex-wrap: wrap; gap: .9rem;
  background: var(--surface);
}
.weekday-picker legend { font-weight: 600; font-size: .92rem; padding: 0 .35rem; }

.admin-two-col {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem; margin-top: 2rem; align-items: start;
}
.admin-two-col h2 { font-size: 1.2rem; }

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

.site-footer { background: var(--navy); color: #b9c1da; margin-top: 3rem; }

.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem;
  padding: 2.8rem 1.25rem 2rem;
}
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }

.site-footer h3 { color: #fff; margin-bottom: .5rem; }
.site-footer h4 {
  color: #fff; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .1em; margin-bottom: .7rem;
}
.site-footer a { display: block; color: #b9c1da; padding: .18rem 0; font-size: .92rem; }
.site-footer a:hover { color: #fff; }
.site-footer p { font-size: .92rem; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-top: 1.2rem; padding-bottom: 1.6rem;
  font-size: .82rem; color: #8891ad;
}
