/** Design tokens **/
:root {
  --teal-800: #0c2430;
  --teal-700: #143d4d;
  --teal-600: #245a6b;
  --teal-500: #3d7a8a;
  --teal-100: #1e4550;
  --teal-50: #16333b;
  --page-bg: #0c1b24;
  --card-bg: #183034;
  --text: #d9e8ea;
  --muted: #a3c0c4;
  --border: #2a4a50;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  --font-body: "Inter", "Segoe UI", Verdana, sans-serif;
  --font-head: "Lora", Georgia, "Times New Roman", serif;
}

html {
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(5, 14, 18, 0.42) 0%, rgba(5, 14, 18, 0.62) 100%),
    url("media/images/background.jpeg") center / cover no-repeat fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

a {
  color: #5fd3e6;
  text-decoration: underline;
  transition: color 0.2s ease;
}

a:hover {
  color: #9be8f4;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #5fd3e6;
  outline-offset: 2px;
}

img {
  border: 0;
}

/* Legacy clearfix hook kept in the HTML; layout is flexbox now. */
.break {
  display: none;
}

/** Skip-to-content link (visible on keyboard focus) **/
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--teal-700);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: #ffffff;
}

/** Scroll reveal (JS adds .reveal, observer adds .reveal-visible) **/
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/** BEGIN header (sticky nav) **/
#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, var(--teal-700), var(--teal-600));
  box-shadow: 0 2px 8px rgba(5, 12, 16, 0.45);
}

#header ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 12px;
}

#header ul li a {
  display: block;
  padding: 15px 18px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

#header ul li a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

#header ul li.active a {
  box-shadow: inset 0 -3px 0 #ffffff;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  padding: 12px 18px;
  cursor: pointer;
}

/** END header **/

/** BEGIN body layout **/
#body {
  flex: 1 0 auto;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px;
}

#profilePanel {
  flex: 1 0 100%;
  border-radius: var(--radius);
}

#content1 {
  flex: 1 1 0;
  min-width: 0;
  order: 1;
}

#sidebar {
  flex: 0 0 320px;
  order: 2;
  align-self: flex-start;
  position: sticky;
  top: 70px;
}

#profilePanel,
#content1 {
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

#profilePanel.is-loading,
#content1.is-loading {
  opacity: 0;
  transform: translateY(10px);
}

/** END body layout **/

/** BEGIN profilePanel : hero (home) **/
#profilePanel.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: center;
  background: linear-gradient(120deg, var(--teal-700) 0%, var(--teal-500) 100%);
  color: #ffffff;
  padding: 44px 40px;
  box-shadow: var(--shadow);
}

.hero-text h1 {
  font-family: var(--font-head);
  font-size: 2.3rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero-roles {
  color: #dff5f7;
  font-size: 1.02rem;
  margin-bottom: 24px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-cta .button {
  background: #5fd3e6;
  color: #0c2430;
}

.hero-cta .button:hover {
  background: #9be8f4;
  color: #0c2430;
}

.hero-cta .button-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  color: #ffffff;
}

.hero-cta .button-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.hero-photo img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

/** END hero **/

/** BEGIN profilePanel : banner (inner pages) **/
#profilePanel.banner {
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(90deg, var(--teal-700), var(--teal-500));
  color: #ffffff;
  padding: 22px 28px;
  box-shadow: var(--shadow);
}

#profilePanel.banner .avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.75);
  flex: none;
}

#profilePanel.banner h1 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

#profilePanel.banner p {
  color: #dff5f7;
  font-size: 0.95rem;
  line-height: 1.5;
}

/** END banner **/

/** BEGIN content card **/
#content1 .post {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 34px;
}

#content1 .post h2 {
  font-family: var(--font-head);
  color: #5fd3e6;
  font-size: 1.45rem;
  line-height: 1.3;
  margin: 1.4em 0 0.7em;
  padding-left: 14px;
  border-left: 4px solid #5fd3e6;
}

#content1 .post h2:first-child {
  margin-top: 0;
}

#content1 .post h3 {
  color: #5fd3e6;
  font-size: 1.1rem;
  margin: 1.1em 0 0.5em;
}

#content1 .post p {
  margin-bottom: 1em;
  text-align: justify;
}

#content1 .post ul {
  list-style: none;
  margin-bottom: 1em;
}

#content1 .post ul li {
  position: relative;
  padding: 2px 0 2px 24px;
  margin-bottom: 8px;
  text-align: justify;
}

#content1 .post ul li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.72em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--teal-500);
}

#content1 .post ul li p {
  margin-bottom: 0;
}

/** END content card **/

/** BEGIN timeline (home - experience) **/
.timeline {
  margin: 0 0 1em 6px;
  border-left: 2px solid var(--teal-100);
}

.timeline-item {
  position: relative;
  padding: 0 0 20px 26px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}

.timeline-date {
  display: block;
  font-weight: 700;
  color: #5fd3e6;
}

.timeline-item p {
  margin: 2px 0 0;
}

/** END timeline **/

/** BEGIN tables **/
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  margin-bottom: 1em;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--teal-700);
  color: #ffffff;
  font-weight: 600;
}

td {
  border-bottom: 1px solid var(--border);
}

/** END tables **/

/** BEGIN sidebar **/
#sidebar h2 {
  font-family: var(--font-head);
  color: #5fd3e6;
  font-size: 1.2rem;
  margin: 4px 4px 10px;
}

#sidebar ul {
  list-style: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
}

#sidebar ul li a {
  display: block;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

#sidebar ul li a:hover {
  background: var(--teal-50);
  color: #5fd3e6;
}

#sidebar ul li.active a {
  background: var(--teal-600);
  color: #ffffff;
}

/** Sticky contact card (follows scroll) **/
.sidebar-contact {
  position: sticky;
  top: 70px;
  margin-top: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.sidebar-contact h2 {
  font-family: var(--font-head);
  color: #5fd3e6;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.sidebar-contact p {
  margin-bottom: 10px;
  word-break: break-word;
}

/** END sidebar **/

.social a {
  margin: 4px 8px 4px 0;
}

.social .fa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  text-decoration: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.fa:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.fa-facebook {
  background: #3b5998;
  color: #ffffff;
}

.fa-twitter {
  background: #55acee;
  color: #ffffff;
}

.fa-google {
  background: #dd4b39;
  color: #ffffff;
}

.fa-linkedin {
  background: #007bb5;
  color: #ffffff;
}

.fa-youtube {
  background: #bb0000;
  color: #ffffff;
}

/** END footer **/

/** Buttons **/
.button {
  display: inline-block;
  background: var(--teal-600);
  border-radius: 999px;
  color: #ffffff;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 4px 2px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.button:hover {
  background: var(--teal-700);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

/** Back-to-top button **/
#myBtn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: var(--teal-600);
  color: #ffffff;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

#myBtn:hover {
  background: var(--teal-700);
}

/** YouTube lazy-embed **/
.youtube-player {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #000;
  margin: 5px;
  border-radius: 8px;
}

.youtube-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: transparent;
}

.youtube-player img {
  object-fit: cover;
  display: block;
  left: 0;
  bottom: 0;
  margin: auto;
  max-width: 100%;
  width: 100%;
  position: absolute;
  right: 0;
  top: 0;
  border: none;
  height: auto;
  cursor: pointer;
  -webkit-transition: 0.4s all;
  -moz-transition: 0.4s all;
  transition: 0.4s all;
}

.youtube-player img:hover {
  -webkit-filter: brightness(75%);
}

.youtube-player .play {
  height: 72px;
  width: 72px;
  left: 50%;
  top: 50%;
  margin-left: -36px;
  margin-top: -36px;
  position: absolute;
  background: url("media/images/youtube.png") no-repeat;
  background-size: contain;
  cursor: pointer;
}

/** Responsive **/
@media screen and (max-width: 900px) {
  #sidebar {
    flex: 1 0 100%;
    position: static;
    align-self: stretch;
  }
}

@media screen and (max-width: 820px) {
  .nav-toggle {
    display: block;
  }

  #header ul {
    display: none;
    flex-direction: column;
    padding: 0;
  }

  #header ul.open {
    display: flex;
  }

  #header ul li a {
    padding: 12px 20px;
  }

  #header ul li.active a {
    box-shadow: inset 3px 0 0 #ffffff;
  }
}

@media screen and (max-width: 700px) {
  #body {
    padding: 20px 14px;
    gap: 20px;
  }

  #profilePanel.hero {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }

  #profilePanel.banner {
    flex-direction: column;
    text-align: center;
  }

  #content1 .post {
    padding: 22px 20px;
  }
}

/** 404 page **/
.error-page {
  text-align: center;
}

.error-code {
  font-family: var(--font-head);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--teal-500);
  line-height: 1;
  margin-bottom: 8px;
}

#content1 .error-page h2 {
  border-left: none;
  padding-left: 0;
}

#content1 .error-page p {
  text-align: center;
}

/** Publications filter **/
.pub-filter {
  margin-bottom: 18px;
}

.pub-filter-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 18px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 999px;
}

.pub-filter-input:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}

.pub-filter-count {
  display: block;
  margin: 6px 4px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/** Vanilla JS carousel gallery **/
.gallery-carousel {
  margin-top: 18px;
}

.gallery-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.gallery-main-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-main .gallery-prev,
.gallery-main .gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}

.gallery-main .gallery-prev:hover,
.gallery-main .gallery-next:hover {
  background: rgba(0, 0, 0, 0.65);
}

.gallery-main .gallery-prev {
  left: 12px;
}

.gallery-main .gallery-next {
  right: 12px;
}

.gallery-main .gallery-fullscreen {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}

.gallery-main .gallery-fullscreen:hover {
  background: rgba(0, 0, 0, 0.65);
}

.gallery-main.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  border-radius: 0;
  aspect-ratio: auto;
  background: rgba(5, 10, 12, 0.98);
  padding: 40px 60px;
}

.gallery-main.is-fullscreen .gallery-main-img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
}

.gallery-main.is-fullscreen .gallery-prev,
.gallery-main.is-fullscreen .gallery-next {
  width: 50px;
  height: 50px;
  font-size: 1.6rem;
}

.gallery-main.is-fullscreen .gallery-fullscreen {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
}

.gallery-fullscreen-caption {
  display: none;
}

.gallery-main.is-fullscreen .gallery-fullscreen-caption {
  display: block;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.6);
  color: #d9e8ea;
  border-radius: 999px;
  font-size: 0.95rem;
  text-align: center;
  z-index: 2;
}

.gallery-caption {
  text-align: center;
  min-height: 1.6em;
  margin: 12px 0;
  color: var(--text);
  font-size: 0.95rem;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal-500) transparent;
}

.gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--teal-500);
  border-radius: 3px;
}

.gallery-thumbs .gallery-thumb {
  flex: 0 0 80px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--card-bg);
  opacity: 0.7;
  transition:
    opacity 0.2s ease,
    border-color 0.2s ease;
}

.gallery-thumbs .gallery-thumb:hover {
  opacity: 1;
}

.gallery-thumbs .gallery-thumb.active {
  opacity: 1;
  border-color: #5fd3e6;
}

.gallery-thumbs .gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media screen and (max-width: 700px) {
  .gallery-main .gallery-prev,
  .gallery-main .gallery-next {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .gallery-thumbs .gallery-thumb {
    flex: 0 0 64px;
    height: 46px;
  }
}

/** Print **/
@media print {
  #header,
  #sidebar,
  #footer,
  #myBtn,
  .hero-cta,
  .pub-filter,
  .gallery-carousel,
  .youtube-player .play {
    display: none;
  }

  body {
    display: block;
    min-height: 0;
    background: #ffffff;
    color: #000000;
    font-size: 12pt;
  }

  a {
    color: #000000;
  }

  #wrapper,
  #body {
    display: block;
    max-width: none;
    padding: 0;
  }

  #profilePanel.hero,
  #profilePanel.banner {
    display: block;
    background: none;
    color: #000000;
    box-shadow: none;
    padding: 0 0 12pt;
  }

  #profilePanel .hero-roles,
  #profilePanel.banner p {
    color: #000000;
  }

  .hero-photo img {
    max-width: 160px;
  }

  #profilePanel.banner .avatar {
    width: 80px;
    height: 80px;
  }

  #content1 .post {
    box-shadow: none;
    padding: 0;
  }

  #content1 .post h2,
  #content1 .post h3 {
    color: #000000;
    border-left-color: #000000;
  }

  .button {
    background: none;
    color: #000000;
    padding: 0;
    border-radius: 0;
    text-decoration: underline;
  }

  #content1 a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 90%;
    color: #555555;
  }

  #content1 .post ul li,
  .timeline-item {
    page-break-inside: avoid;
  }

  .timeline {
    border-left-color: #999999;
  }
}
