@import url('https://fonts.googleapis.com/css?family=Roboto');

/* ================================
   LIGHT THEME (default)
   ================================ */
:root {
  --bg-color: #FFFFFF;
  --txt-color: #292929;
  --title-color: #57068c;
  --link-color: #57068c;
  --hover-color: #228065;

  /* legacy variables you already use */
  --bg-pink: #fae3ea;
  --primary-purple: #57068c;
  --hover-green: #228065;
  --bg-white: #FFFFFF;
}

/* ================================
   DARK THEME
   ================================ */
html[data-theme="dark"] {
  --bg-color: #404040;
  --txt-color: #FFEECA;
  --title-color: #ab82c5;
  --link-color: #ab82c5;
  --hover-color: #009b8a;

  /* the rest of your dark palette */
  --line-color: #433F37;
  --fn-color: #534F47;
  --ft-txt-color: #FFEECA;
  --bq-color: #75271E;
  --tb1-color: #47443B;
  --inline-cd-color: #37342E;
}

/* ================================
   BASE
   ================================ */

code { font-family:"Lucida Console", Monaco, monospace; font-size:85%; }

body {
  background-color: var(--bg-color) !important;
  font-family: Optima, Candara, Calibri, Arial, sans-serif;
}

html { background-color: var(--bg-color) !important; }
main { margin: 0; background-color: var(--bg-color) !important; }

p, ul, li {
  color: var(--txt-color);
  font-size:20px;
  font-family:'Roboto', sans-serif;
}

a {
  color: var(--link-color);
  font-family:'Roboto', sans-serif;
  text-decoration:none;
  transition: color 0.2s;
}
a:hover { color: var(--hover-color); }

h1, h2, h3 {
  font-family:'Roboto', sans-serif;
  font-size: 30px;
}

/* ================================
   TITLE SIZES
   ================================ */
header h1#title,
header h1#titleonly,
header h2#title,
header h2#titleonly {
  font-size: 30px !important;
  line-height: 1.1;
  margin: 0;
  font-weight: 700;
  color: var(--title-color);
}

/* Anchor inherits title */
header h1#title a,
header h1#titleonly a,
header h2#title a,
header h2#titleonly a {
  font-size: inherit !important;
  line-height: inherit;
  color: inherit;
  text-decoration: none;
  transition: color 0.2s !important;
}
header h1 a:hover,
header h2 a:hover {
  color: var(--hover-color) !important;
}

/* smaller content <h1> */
h1 {
  color: var(--title-color);
  text-align: left;
  font-size: 20px;
  margin: 1px 0 0 0;
}

h2, h3 {
  color: var(--txt-color);
  text-align:left;
  font-size:20px;
}

h5 { font-size:1px; }

.lw, p img, li img, h1 img, h2 img, h3 img, h4 img, dt img, td img {
  max-height:1em;
  max-width:1em;
  vertical-align:middle;
}
img { max-width:100%; }

/* ================================
   HEADER LAYOUT
   ================================ */

/* overall header container */
header {
  display:flex;
  flex-direction: column;
  align-items: flex-start;   /* left align */
  width: 100%;
  gap: 0;
  padding: 0;
  margin: 0;
}

/* the row that contains avatar + right column */
.top-header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;             /* FIX: was negative; caused overlap */
  width: 100%;
  justify-content: flex-start;
}

/* right column stacks title, subtitle, icons */
.right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* title block: keep compact; no extra padding */
#titletext { margin: 0; padding: 0; }
#titletext h1#title,
#titletext h1#titleonly,
#titletext h2#title,
#titletext h2#titleonly {
  margin: 0 0 -1rem 0;     /* FIX: small bottom gap so icons don't touch title */
  line-height: 1.15;
}

/* subtitle */
#subtitle {
  margin: .15rem 0 0 0;
  line-height: 1.2;
  color: var(--txt-color);
}

/* avatar: square, no distortion */
#avatar img {
  width: 56px;               /* tweak size here */
  height: 56px;
  object-fit: cover;         /* avoids stretching */
  border-radius: 50%;
}

/* ================================
   SOCIAL ICON ROW
   ================================ */
#title-social { margin: 0; padding: 0; }
#social      { margin: 0; padding: 0; color: var(--title-color); }

#social nav {
  float: none;
  width: auto;
  position: static;
  font-weight: 600;
  color: var(--title-color);
}

#social nav ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start; /* left under title */
  gap: .5rem;
  margin: 0;                   /* FIX: remove big outer margin */
  padding: 0;                  /* FIX: remove 1rem padding */
  list-style: none;
  font-weight: 600;            /* FIX: 'font-size: bold' was invalid */
}

#social nav li {
  display: inline-flex !important;
  font-weight: 600;
}

/* icons follow theme colors */
#social .icons,
#social .faicon,
#social .ai {
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
  font-size: 1.75rem;         /* slightly smaller to avoid crowding */
  color: var(--title-color);
  transition: color 0.2s;
}
#social .icons:hover,
#social .faicon:hover,
#social .ai:hover { color: var(--hover-color); }

/* Academicons */
.ai {
  font-family:"Academicons" !important;
  font-style: normal;
  font-weight: 400;
}

/* ================================
   OPTIONAL CLASSES
   ================================ */
.social-icons {
  display:flex;
  gap:1rem;
  align-items:center;
}
.social-icons a { text-decoration:none; }

.header-nav {
  display:flex;
  gap:0.3rem;
  align-items:center;
  font-weight:bold;
}
.header-nav a {
  text-decoration:none;
  color: var(--txt-color);
  font-weight:bold;
  padding:0.3rem 0.6rem;
  border-radius:4px;
  transition: background-color 0.2s, color 0.2s;
  font-size:1.5rem;
}
.header-nav a:hover {
  background-color: var(--hover-color);
  color: var(--bg-color);
}

/* main menu: its own row, left aligned */
#mainmenu {
  width: 100%;
  margin: 0 0 2rem 0;
  font-weight: 700 !important;
}
#mainmenu nav ul {
  display: flex;
  justify-content: flex-start;
  gap: 1.2rem;
  font-weight: 700 !important;
}

/* Top row: avatar | right-col */
.top-header-row{
  display:flex;
  align-items:center;
  gap:.75rem;             /* no negative gaps */
}

/* Right-hand stack: title -> (subtitle) -> icons */
.right-col{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
}

/* --- Force correct order on the top header row --- */
/* Works whether you used .right-col or not. */

.top-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* If you wrapped the right side: stack it vertically */
.top-header-row > .right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0; /* we'll control spacing below */
}

/* Enforce visual order regardless of HTML emission order */
.top-header-row > #avatar { order: 0; }
.top-header-row > #titletext,
.right-col > #titletext { order: 1; }

.top-header-row > #title-description,
.right-col > #title-description { order: 2; }

.top-header-row > #title-social,
.right-col > #title-social { order: 3; }

/* Tight, reliable spacing so icons never sit above/into the title */
#titletext { margin: 0; padding: 0; }
#titletext h1#title,
#titletext h1#titleonly,
#titletext h2#title,
#titletext h2#titleonly {
  margin: 0 0 1rem 0;   /* ensures a gap above the icons */
  line-height: 1.15;
}

/* Social row: single line, left-aligned, no outer spacing to drift upward */
#title-social { margin: 0; padding: 0; }
#social { margin: 0; padding: 0; }
#social nav { float: none; width: auto; position: static; font-weight: 600; }
#social nav ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  margin: 3rem;
  padding: 0;
  list-style: none;
}

/* Avatar: keep it from stretching title line height */
#avatar img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
}
