/* Colors origin: https://www.colourlovers.com/palette/881088/Sky_Is_Mine by munsteri */

:root {
  --main-color: #196966;
  --second-color: #45B3AF;
  --third-color: #C0E5E4;
  --fourth-color: #E0F4F6;
  --white: #f4f8f8;
  --grey: #333333;
  --black: #000000;

  /* Spacing Scale */
  --space-xs: 0.25rem;  /* 4px */
  --space-sm: 0.5rem;   /* 8px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 4rem;     /* 64px */
  --space-xxl: 8rem;    /* 128px */
}

@media (prefers-color-scheme: dark) {
  :root {
    --main-color: #45B3AF;
    --second-color: #C0E5E4;
    --third-color: #1a2e2d;
    --fourth-color: #0f2d2b;
    --white: #121212;
    --grey: #e0e0e0;
    --black: #ffffff;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* General styles */

/* Accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--black);
  color: var(--white);
  padding: 8px;
  z-index: 2000;
  text-decoration: none;
  font-weight: bold;
}

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

h1 {
  font-size: 3rem;
  font-weight: bold;
  color: var(--main-color);
  text-align: left;
  margin: 0;
  padding: var(--space-md) 0;
}

h2 {
  font-size: 2rem;
  color: var(--second-color);
  text-align: left;
  font-weight: bold;
  padding: var(--space-xs) 0;
  margin: 0;
}

h3 {
  font-size: 1.25rem;
  color: var(--black);
  text-align: left;
  font-weight: bold;
  padding: var(--space-xs) 0;
  margin: 0;
}

header > h1, header > h2 {
  text-align: left;
  padding: var(--space-xs) 0;
  margin: 0;
}

header {
  margin-bottom: var(--space-md);
}

p {
  font-size: 1rem;
  font-weight: normal;
  color: var(--grey);
  margin: 0;
  padding: var(--space-sm) 0;
}

a {
  color: var(--second-color);
  text-decoration: none;
  font-weight: bold;
  margin: 0;
  padding: var(--space-sm) 0;
}

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

ul {
  color: var(--grey);
  margin: 0;
  padding: 0 var(--space-lg);
}
/* blocks shapes */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

html, body {
  scroll-padding-top: var(--space-xxl);
  margin: 0;
  padding: 0;
  gap: 0rem;
  align-items: center;
  min-height: 100vh;
  font-size: 16px;
  font-family: "Courier New", Courier, monospace;
  background-color: var(--white);
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  margin: 0;
  padding: 6rem var(--space-xl) var(--space-xl) var(--space-xl);
  gap: 0rem;
  align-items: center;
  width: 100%;
}


nav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  width: 100%;
  background-color: var(--third-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

nav > ul {
  display: flex; 
  justify-content: flex-start;
  gap: var(--space-lg); 
  list-style: none; 
  padding: var(--space-sm) 0 var(--space-sm) var(--space-lg); 
  margin: 0;
  flex: 1;
}

.header-social-links {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  background-color: transparent;
  padding: 0;
}

.social-group {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.header-social-links a {
  font-size: 1.1rem;
  padding: 4px 10px;
  line-height: 1.2;
  background-color: var(--main-color);
  color: var(--white);
  border-radius: 4px;
  text-align: center;
  min-width: 70px;
}

.header-social-links a:hover {
  background-color: var(--second-color);
  text-decoration: underline;
  color: var(--white);
}

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1000;
  padding: var(--space-xs) 0;
  margin: 0;
  width: 100%;
  background-color: var(--third-color);
}

footer > ul {
  display: flex; 
  justify-content: space-between; 
  list-style: none; 
  padding: var(--space-xs) 0; 
  margin: 0; 
  width: 100%;
}

nav a {
  text-decoration: none; 
  color: var(--black); 
  display: block; 
  font-weight: bold;
  font-size: 2rem;
}

nav a:hover {
  color: var(--main-color);
}

nav a.active {
  color: var(--main-color);
  text-decoration: underline;
}

footer li {
  padding: 0 var(--space-lg); 
  margin: 0;
}

.email-button {
  background: none;
  border: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}

.email-button:hover {
  color: var(--main-color);
}

/* Page Specific Styles */

/* Index */
.profile-container {
  display: flex; 
  align-items: flex-start; 
  justify-content: space-between;
}

.profile-info {
  max-width: 100%; 
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-right: var(--space-lg);
}

.profile-image {
  max-width: 20%; 
  object-fit: cover;
  margin-left: auto;
  border-radius: 8px;
}

/* Teaching */
.teaching-section {
  width: 100%; 
  text-align: left;
}

.mt-2 {
  margin-top: var(--space-lg);
}

/* Research */
.research-section {
  margin-bottom: var(--space-xl);
  width: 100%;
}

.research-entry {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border: 2px solid var(--third-color);
  border-radius: 8px;
  background-color: var(--white);
}

.research-entry h3 {
  margin-top: 0;
  color: var(--main-color);
}

/* Menu Toggle (Hidden on Desktop) */
.menu-toggle {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  main {
    padding: var(--space-xxl) var(--space-md) 12rem var(--space-md);
  }

  /* Profile Layout */
  .profile-container {
    flex-direction: column-reverse;
    align-items: center;
  }

  .profile-info {
    max-width: 100%;
    text-align: left;
  }

  .profile-image {
    max-width: 60%;
    margin: 0 auto var(--space-md) auto;
  }

  header > h1, header > h2 {
    text-align: center;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  /* Navigation */
  .menu-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    color: var(--grey);
    flex: 1;
  }

  .menu-text {
    font-size: 1.2rem;
    font-weight: bold;
    margin-right: var(--space-sm);
    font-family: inherit;
  }

  .menu-icon {
    font-size: 2rem;
  }

  nav > ul {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0;
  }

  nav > ul.active {
    display: flex;
  }

  nav li {
    width: 100%;
    text-align: center;
    padding: var(--space-sm) 0;
    border-top: 1px solid rgba(0,0,0,0.1);
  }

  .social-group {
    justify-content: center;
    margin-left: 0;
  }

  nav a {
    font-size: 1rem;
  }

  /* Footer */
  footer > ul {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
  }

  footer li {
    padding: 0;
  }
}

/* =========================================
   Print Stylesheet
   Optimize for printing CV or pages
   ========================================= */
@media print {

  /* Force light theme variables so colors look right on white paper */
  :root {
    --main-color: #196966 !important;
    --second-color: #45B3AF !important;
    --third-color: #C0E5E4 !important;
    --fourth-color: #E0F4F6 !important;
    --white: #f4f8f8 !important;
    --grey: #333333 !important;
    --black: #000000 !important;
  }
  
  /* 1. Reset specific background/shadows, keep colors */
  *,
  *::before,
  *::after {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* 2. Hide navigation, interactive elements, and footer */
  nav,
  .menu-toggle,
  .skip-link,
  .email-button,
  #theme-toggle,
  button,
  footer {
    display: none !important;
  }

  /* 3. Layout adjustments for paper */
  body {
    background-color: white !important;
    color: var(--grey) !important;
    margin: 0;
    padding: 0;
    font-size: 12pt;       /* Standard print font size */
    line-height: 1.5;
  }

  main {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
  }

  /* Remove grid/flex gaps that might waste space */
  .profile-container,
  .research-section {
    display: block;
  }

  /* Ensure images fit on the page */
  img, svg {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* 4. Improve Link Handling */
  a {
    text-decoration: underline;
    /* Color inherited from variables (var(--second-color)) */
  }

  /* Display URL after the link text for external links */
  /* Only for http links to avoid cluttering internal hashes/javascript */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    word-wrap: break-word;
  }


  /* 5. Page Break Control */
  /* Avoid breaking headings from their following content */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* Prevent elements from being split awkwardly */
  img, 
  table, 
  blockquote, 
  pre, 
  ul, 
  .research-entry {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Ensure paragraphs don't leave a single line (orphan/widow) */
  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }
}
