/*** Vars ***/

:root {
  --primary-color: #630436;
  --secondary-color: #bf616a;
  --tertary-color: #5e81ac;
  --fg-color: #121519;
  --bg-color: #e7eef9;

  --font-xss: clamp(0.5628rem, 0.8547rem + -0.2433vw, 0.8rem);
  --font-xs: clamp(0.7502rem, 1.0576rem + -0.2562vw, 1rem);
  --font-base: clamp(1rem, 1.3077rem + -0.2564vw, 1.25rem);
  --font-s: clamp(1.333rem, 1.6155rem + -0.2354vw, 1.5625rem);
  --font-m: clamp(1.7769rem, 1.9938rem + -0.1808vw, 1.9531rem);
  --font-l: clamp(2.3686rem, 2.4582rem + -0.0747vw, 2.4414rem);
  --font-xl: clamp(3.0518rem, 3.0274rem + 0.1083vw, 3.1573rem);
  --font-xxl: clamp(3.8147rem, 3.7238rem + 0.4041vw, 4.2087rem);

  --space-3xs: clamp(0.25rem, 0.3269rem + -0.0641vw, 0.3125rem);
  --space-2xs: clamp(0.5rem, 0.6538rem + -0.1282vw, 0.625rem);
  --space-xs: clamp(0.75rem, 0.9808rem + -0.1923vw, 0.9375rem);
  --space-s: clamp(1rem, 1.3077rem + -0.2564vw, 1.25rem);
  --space-m: clamp(1.5rem, 1.9615rem + -0.3846vw, 1.875rem);
  --space-l: clamp(2rem, 2.6154rem + -0.5128vw, 2.5rem);
  --space-xl: clamp(3rem, 3.9231rem + -0.7692vw, 3.75rem);
  --space-2xl: clamp(4rem, 5.2308rem + -1.0256vw, 5rem);
  --space-3xl: clamp(6rem, 7.8462rem + -1.5385vw, 7.5rem);
}

[data-theme="dark"] {
  --primary-color: #5e81ac;
  --secondary-color: #81a1c1;
  --tertary-color: #bf616a;
  --fg-color: #eceff4;
  --bg-color: #121519;
}

/*** Theming ***/

#theme-toggle {
  border: none;
  background-color: var(--bg-color);
  cursor: pointer;
}

[data-theme="light"] #theme-sun,
[data-theme="dark"] #theme-moon {
  display: block !important;
  color: var(--primary-color);
}

[data-theme="dark"] #theme-sun,
[data-theme="light"] #theme-moon {
  display: none !important;
}

/*** Generic settings ***/

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

body {
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-color);
  color: var(--fg-color);
  font-family: "Nebula Sans", sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: var(--font-base);
  line-height: 1.5;

  /* Force to take all the page by default */
  display: flex;
  flex-direction: column;
  align-items: center;
}

* {
  margin: 0;
}

*::selection {
  color: var(--bg-color);
  background-color: var(--primary-color);
}

h1,
h2,
h3,
h4,
h5,
p {
  overflow: break-word;
}

h1 {
  font-weight: 900; /* Nebula Sans Black */
  margin-bottom: var(--space-xs);
  font-size: var(--font-xl);
  line-height: 3.2rem;
}

h2 {
  font-weight: 700; /* Nebula Sans Black */
  font-size: var(--font-l);
  margin-bottom: var(--space-m);
  border-bottom: 2px solid var(--primary-color);
}

h3 {
  font-weight: 700;
  font-size: var(--font-m);
}

h4 {
  font-size: var(--font-m);
}

h5 {
  font-size: var(--font-s);
}

p {
  font-size: var(--font-base);
  margin-bottom: --font;
}

img {
  display: block;
  max-inline-size: 100%;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
}

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

ul {
  margin: 0;
  list-style-type: square;
  list-style-position: inside;
  padding: 0;
}

li > ul {
  padding-left: 16px;
}

hr {
  margin: var(--space-l) 0;
  border: 0px solid transparent;
  border-bottom: 1px dashed rgb(from var(--fg-color) r g b / 0.8);
  width: 100%;
}

kbd {
  background-color: var(--primary-color);
  color: var(--bg-color);
  padding: 1px 3px 1px 3px;
}

blockquote {
  padding: 4px 12px 4px 12px;
  color: rgb(from var(--fg-color) r g b / 0.5);
  border-left: 8px solid var(--primary-color);
  width: 100%;
  box-sizing: border-box;
}

blockquote p {
  margin: 0;
}

/*** Header ***/

header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1024px;
  border-bottom: 1px dashed rgb(from var(--fg-color) r g b / 0.8);
  padding: var(--space-s) 0;
  margin-bottom: var(--space-xl);
}

header nav {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header nav ul {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  font-family: "Nebula Sans", sans-serif;
  font-weight: 600;
  font-size: var(--font-s);
  gap: 16px;
  padding: 0px;
}

header nav h2 {
  font-family: "Knewave", "Nebula Sans", sans-serif;
  font-weight: bold;
  font-size: var(--font-xxl);
  color: var(--primary-color);
  border-bottom: none;
  text-decoration: none;
  padding: 0 12px;
  margin: 0;
}

header nav h2 a:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

header a {
  color: inherit;
}

/*** Main body ***/

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  flex: 1;
}

/*** Articles ***/

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

article h2 {
  margin-top: var(--space-l);
  margin-bottom: var(--space-s);
}

article h3 {
  margin-top: var(--space-s);
  margin-bottom: var(--space-s);
}

article p,
article ul {
  margin-bottom: var(--space-s);
}

article p img {
  margin: 0 auto;
}

article blockquote p {
  margin: 0;
}

article blockquote {
  margin-bottom: var(--space-m);
}

article pre {
  margin-top: var(--space-xs);
  margin-bottom: var(--space-m);
}

.title-section {
  margin-bottom: var(--space-l);
  margin-top: var(--space-l);
}

/* Handle the section for footnotes */
section[role="doc-endnotes"] {
  margin-top: var(--space-xl);
  counter-reset: endnotes;
  & ol {
    list-style-position: inside;
    padding-left: 0;
    & li {
      & p {
        margin-bottom: var(--space-3xs);
        display: inline;
      }
    }
  }
}

/** Footer **/

footer {
  margin: var(--space-l) 0;
  padding-top: var(--space-m);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 1024px;
  width: 100%;
  flex: 0;
  border-top: 1px dashed rgb(from var(--fg-color) r g b / 0.8);
}

footer p {
  font-size: var(--font-xs);
  font-style: italic;
  margin: 0px;
  text-align: center;
}

/*** Classes ***/

.container {
  max-width: 1024px;
  width: 100%;
}

.is-draft {
  width: 100%;
  color: black;
  background-color: orange;
  padding: 5px;
}

/*** Metadata ***/

.metadata {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-style: italic;
}

.metadata p {
  background-color: rgb(from var(--primary-color) r g b / 0.5);
  padding: 2px 6px 2px 6px;
  width: fit-content;
}

.push-top-l {
  margin-top: var(--space-xl);
}

/*** Index & projects ***/

.index,
.project-list {
  display: flex;
  flex-direction: column;
  padding: 0px;
}

.index h3,
.project h2 {
  margin-bottom: var(--space-3xs);
  border-bottom: none;
}

.index ul {
  list-style-type: none;
  padding: 0;
}

.index li {
  margin-bottom: var(--space-m);
}

.index a {
  color: var(--fg-color);
  text-decoration: none;
}

.index a:hover {
  text-decoration: underline;
}

.project-list {
  gap: var(--space-xl);
}

.project .metadata {
  margin-bottom: 16px;
}

.project > p {
  margin-top: 8px;
  margin-bottom: 0rem;
}

/*** Profile page ***/

.profile {
  padding-top: 5px;
  padding-bottom: 5px;
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: center;
}

.profile img {
  width: 260px;
  height: 260px;
  border-radius: 100%;
  margin-bottom: var(--space-m);
}

/*** Specific media queries ***/

@media (max-width: 1080px) {
  .container {
    padding-right: 5%;
    padding-left: 5%;
    width: 90%;
  }

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

  header nav {
    flex-direction: column;
    width: 90%;
  }

  header nav ul {
    padding-top: 16px;
    justify-content: center;
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  .title-section {
    border-left: none;
    margin-top: var(--space-s);
    padding-left: 0;
  }

  .title-section h1 {
    font-size: var(--font-l);
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 8px;
  }

  .container {
    padding-right: 5%;
    padding-left: 5%;
    width: 90%;
  }

  .profile {
    flex-direction: column;
    flex-wrap: wrap;
  }
}
