:root {
  /* light mode colours */
  --aqua: aqua;
  --lime: #c2e235;
  --red: #d6513c;
  --purple: #a556e8;
  --bg-white: #f3f2f0;
  --hover-grey: #3C3A3D;
  --navy: #0095ff;
  --green: #78dc24;
  --orange: #d18232;
  --text-color: #222;
  --secondary-text: #555555;
}

/* dark mode colours */
body.dark-mode {
  --aqua: #016D6D;
  --lime: #254400;
  --red: #FD7963;
  --purple: #C172FF;
  --bg-white: #111111;
  --hover-grey: #C6C4C7;
  --navy: #009AFF;
  --green: #036801;
  --orange: #B66716;
  --text-color: #DDDDDD;
  --secondary-text: #AAAAAA;
}

body.dark-mode .sectionContent .tag-light-blue {
  background-color: #345D75;
}

body.dark-mode .sectionContent .tag-yellow {
  background-color: #654000;
}

body.dark-mode .sectionContent .tag-blue {
  background-color: #316D6F;
}

html {
  color: var(--text-color);
  font-size: 1em;
  line-height: 1.4;
}

body {
  color: var(--text-color);
  font-family: monospace;
  font-size: 24px;
  background: var(--bg-white);

  h3 {
    font-weight: bold;
    text-align: center;
    margin-bottom: 0;
    margin-top: 16px;
    font-size: 24px;

    @media (max-width: 600px){
      margin-top: 80px;
    }

    a{
      text-decoration: none;
      color: inherit;
    }
  }

  /* ===== recommend form ===== */
  .recommend-form {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;   /* horizontally center every child */
    flex-direction: column;
    gap: 8px;
    justify-content: center;
  }

  .recommend-form label {
    text-transform: lowercase;
    font-size: 18px;
    justify-content: left;
    width: 80%;
    text-align: left;
  }

  .recommend-form input,
  .recommend-form textarea {
    font-family: inherit;
    font-size: 16px;
    padding: 4px;
    border: 1px solid var(--text-color);
    width: 80%;
    justify-content: center;
    background-color: var(--bg-white);
    color: var(--text-color);
  }

  .recommend-form textarea {
    min-height: 120px;
    resize: vertical;
  }

  /* button wrapper inside form */
  .recommend-form .button-aqua {
    display: inline-block;
  }

  .recommend-form .button-aqua button {
    background-color: var(--lime);
    border: none;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 20px;
    cursor: pointer;
  }

  .recommend-form .button-aqua button:hover {
    background-color: var(--hover-grey);
    color: white;
  }

  /* message span */
  #formResult {
    font-size: 18px;
  }

  .header{

    text-align: center;
    font-size: 20px;
    margin: 0 auto;
    max-width: 720px;

    a {
      text-decoration: none;
      color: inherit;
      padding: 2.5px;

      &:hover{
        background-color: var(--hover-grey) !important;
        color: white !important;
      }
    }


  }

  .navigation {
    text-align: center;
    font-size: 20px;
    margin: 0 auto;
    max-width: 720px;

    a {
      text-decoration: none;
      color: inherit;
      padding: 2.5px;

      &:hover{
        background-color: var(--hover-grey) !important;
        color: white !important;
      }
    }

    ul {
      display: flex;
      list-style: none;
      justify-content: space-evenly;
      padding: 0;
      max-width: 640px;
    }

    .button-aqua {
      a {
        background-color: var(--aqua);
      }
    }

    .button-lime {
      a {
        background-color: var(--lime);

      }
    }

    .button-red {
      a {
        background-color: var(--red);
      }
    }

    .button-purple {
      a {
        background-color: var(--purple);
      }
    }

    .button-navy {
      a {
        background-color: var(--navy);
      }
    }

    .button-green{
      a {
        background-color: var(--green);
      }
    }

    .button-orange{
      a {
        background-color: var(--orange);
      }
    }

  }

  .aboutContent{
    text-align: left;

    h4 {

      font-weight: bold;
      font-size: 20px;
      margin: 0;
    }

    p {
      margin-bottom: 16px;
      margin-top: 8px;
      color: var(--text-color) !important;
    }

    a {
      &:hover{
        background-color: var(--hover-grey) !important;
        color: white !important;
      }
    }

  }

  .sectionContent {

    font-size: 18px;
    max-width: 720px;
    margin: 0 auto;
    padding-top: 0;


    a {
      color: inherit;
      padding: 2px;

      &:hover{
        background-color: var(--hover-grey) !important;
        color: white !important;
      }
    }


    .tag-red {
      background-color: #e86c6c;
      font-size: 12px;
      padding: 1px;
    }

    .tag-light-blue {
      background-color: #88b0c8;
      font-size: 12px;
      padding: 1px;
    }

    .tag-yellow {
      background-color: #e1bb6a;
      font-size: 12px;
      padding: 1px;
    }

    .tag-grey {
      background-color: #838383;
      font-size: 12px;
      padding: 1px;
    }

    .tag-blue {
      background-color: #67a7a8;
      font-size: 12px;
      padding: 1px;
    }

    p {
      margin: 0;
      color: var(--secondary-text);
      font-size: 16px;
      margin-bottom: 8px;

    }

    .text {
      text-align: left;
    }
  }

  /* ===== grad student homepage ===== */
  .navigation.home-nav {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    gap: 10px 24px; /* row gap makes room for the 4px keycap edge */
    margin: 16px auto 0 auto;
  }

  .profile {
    max-width: 720px;
    margin: 24px auto 40px auto;
    padding: 0 16px;
    display: flex;
    gap: 24px;
    align-items: flex-start;

    img {
      width: 170px;
      height: 196px;
      object-fit: cover;
      object-position: top center;
      flex-shrink: 0;
      border: 1px solid var(--secondary-text);
    }

    .bio p {
      margin: 0 0 12px 0;
      font-size: 16px;
      text-align: left;
      color: var(--text-color);
    }

    .bio a {
      color: inherit;
      padding: 2px;

      &:hover {
        background-color: var(--hover-grey) !important;
        color: white !important;
      }
    }

    @media (max-width: 600px) {
      flex-direction: column;
      align-items: center;
    }
  }

  .publist,
  .newslist {
    font-size: 16px;
    text-align: left;
    padding-left: 20px;
    margin-top: 8px;

    li {
      margin-bottom: 12px;
    }

    .pub-title {
      font-weight: bold;
    }

    .pub-venue {
      color: var(--secondary-text);
      font-size: 14px;
    }

    a[class^="tag-"] {
      font-size: 12px;
      padding: 1px 3px;
      text-decoration: none;
      color: var(--text-color);
    }
  }

  .newslist {
    list-style: none;
    padding-left: 0;

    li {
      margin-bottom: 6px;
    }
  }

  .blogContent{

    font-size: 18px;
    max-width: 720px;
    margin: 0 auto;
    padding-top: 0;

    .date {
      margin: 0;
      color: var(--secondary-text);
      font-size: 16px;
      margin-bottom: 8px;

    }

    .title {
      text-align: left;
      font-weight: bold;
      margin-bottom: 0;
      margin-top: 16px;
      font-size: 24px;

      @media (max-width: 600px) {
        margin-top: 80px;
      }

      a {
        text-decoration: none;
        color: inherit;
      }

    }

    p {
      font-size: 16px;
      text-align: left;
      padding-bottom: 8px;
    }


  }
}






/* ===== shooting stars (js/shooting-stars.js) ===== */
body .shooting-star {
  position: fixed;
  width: 90px;
  height: 2px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--secondary-text));
  animation: shoot 0.9s ease-out forwards;
  opacity: 0;
}

@keyframes shoot {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0);
  }
  15% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--dist));
  }
}

/* ===== neo-brutalist hard shadow for nav buttons ===== */
body .navigation [class*="button-"] a {
  display: inline-block;
  padding: 2.5px 8px;
  border: 2px solid var(--text-color);
  box-shadow: 4px 4px 0 var(--text-color);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  user-select: none;
}

/* press: slide into the shadow */
body .navigation [class*="button-"] a:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--text-color);
}

/* ===== hard shadow on content images ===== */
body .sectionContent img,
body .blogContent img,
body .aboutContent img,
body .profile img {
  border: 2px solid var(--text-color);
  box-shadow: 4px 4px 0 var(--text-color);
}

/* ===== mini hard shadow on content hyperlinks ===== */
body .sectionContent p a:not([class*="tag-"]),
body .sectionContent li > a:not([class*="tag-"]),
body .blogContent p a:not([class*="tag-"]),
body .blogContent li a:not([class*="tag-"]),
body .aboutContent p a:not([class*="tag-"]),
body .profile .bio p a {
  border: 1px solid var(--text-color);
  box-shadow: 2px 2px 0 var(--text-color);
  padding: 0 3px;
  text-decoration: none;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

body .sectionContent p a:not([class*="tag-"]):active,
body .sectionContent li > a:not([class*="tag-"]):active,
body .blogContent p a:not([class*="tag-"]):active,
body .blogContent li a:not([class*="tag-"]):active,
body .aboutContent p a:not([class*="tag-"]):active,
body .profile .bio p a:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--text-color);
}

/* ===== masthead: typographic name treatment ===== */
body .masthead {
  font-size: clamp(44px, 9vw, 76px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 40px auto 8px auto;
  padding: 0 16px;
  color: var(--text-color);
  text-shadow: 5px 5px 0 var(--red);
}

/* profile photo: green offset shadow (projects green) */
body .profile img {
  box-shadow: 4px 4px 0 var(--lime);
}

/* subheadings: same misprint treatment as the masthead, scaled down */
body .aboutContent h4.subhead {
  font-size: 24px;
  text-shadow:
    1px 1px 0 var(--red),
    -1px -1px 0 var(--lime);
}

/* hover orbit with momentum lives in js/subhead-spin.js */

/* pub link chips (pdf, doi): true circles, bordered, hard shadow like the navbar */
body .publist a[class^="tag-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--text-color);
  box-shadow: 2px 2px 0 var(--text-color);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  user-select: none;
  vertical-align: middle;
}

body .publist a[class^="tag-"]:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--text-color);
}

/* ===== sub-page headers: masthead red shadow + go-back affordance ===== */
body .header h3 a,
body .navigation h3 a {
  position: relative;
  text-shadow: 3px 3px 0 var(--red);
  /* cursor becomes a "*" */
  cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext x='4' y='19' font-family='monospace' font-size='22' font-weight='bold' fill='%23222222'%3E*%3C/text%3E%3C/svg%3E") 8 12, pointer;
}

body.dark-mode .header h3 a,
body.dark-mode .navigation h3 a {
  cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext x='4' y='19' font-family='monospace' font-size='22' font-weight='bold' fill='%23dddddd'%3E*%3C/text%3E%3C/svg%3E") 8 12, pointer;
}

/* the "go back" button: appears to the right of the header text; it is part
   of the link itself, so pressing it navigates back */
body .header h3 a::after,
body .navigation h3 a::after {
  content: var(--pill-text, "go back?");
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  margin-left: 8px;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.4;
  padding: 2px 12px;
  border: 2px solid var(--text-color);
  border-radius: 999px;
  background-color: var(--bg-white);
  color: var(--text-color);
  box-shadow: 3px 3px 0 var(--text-color);
  text-shadow: none;
  white-space: nowrap;
  opacity: 0;
  /* slow fade-out when the cursor leaves */
  transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.06s ease;
  z-index: 10;
}

body .header h3 a:hover::after,
body .navigation h3 a:hover::after,
body .header h3 a.pill-peek::after,
body .navigation h3 a.pill-peek::after {
  opacity: 1;
  transform: translateY(-50%) translateX(8px);
  /* quick fade-in */
  transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.06s ease;
}

/* cursor actually over the pill (class set by js/go-back-pill.js) */
body .header h3 a.pill-hover::after,
body .navigation h3 a.pill-hover::after {
  background-color: var(--hover-grey);
  color: white;
}

/* while over the pill, don't highlight the header text itself */
body .header h3 a.pill-hover:hover,
body .navigation h3 a.pill-hover:hover {
  background-color: transparent !important;
  color: inherit !important;
}

/* pressing the pill (or the header) pushes it into its shadow */
body .header h3 a:active::after,
body .navigation h3 a:active::after {
  transform: translateY(-50%) translateX(8px) translate(3px, 3px);
  box-shadow: 0 0 0 var(--text-color);
}

/* ===== night sky (js/night-sky.js), dark mode only ===== */
body .night-sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

body.dark-mode .night-sky {
  display: block;
}

body .night-sky .star {
  position: absolute;
  background: #ddd;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  body .night-sky .star { animation: none; }
}
