/* ========================================
   1. ROOT VARIABLES (Light & Dark)
   ======================================== */
:root {
  --pageBackground: #f2f5fd;
  --emphColor: #8b1e2b;
  --linkColor: #003c71;
  --codeColor: #9b2d4b;
  --noteColor: #5a6270;
  --hboxColor: #003c71;
  --brdrColor: #d0d5df;
  --bttnColor: #ffffff;
  --textColor: #1e1e1e;
}

.dark-mode {
  --pageBackground: oklch(0.17 0 45);
  --emphColor: #e87a7a;
  --linkColor: #79b8f7;
  --codeColor: #f48fb1;
  --noteColor: #b5aaa0;
  --hboxColor: #79b8f7;
  --brdrColor: oklch(0.7 0.015 45 / 0.2);
  --bttnColor: oklch(0.25 0.015 45);
  --textColor: oklch(0.95 0.01 45);
}

/* ========================================
   2. RESET & BASE
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background-color: var(--pageBackground);
  min-height: 100%;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Noise overlay (subtle grain) */
html::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}

.dark-mode html::before {
  opacity: 0.06;
}

body {
  font-family: "URWClassico", sans-serif;
  line-height: 1.7;
  margin: 0.5em auto 2em auto;
  max-width: 85%;
  background-color: transparent;
}

* {
  color: var(--textColor);
}

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

a:hover {
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--linkColor);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   3. TYPOGRAPHY
   ======================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "URWClassico", sans-serif;
  font-weight: 400;
  color: var(--emphColor);
  margin: 1.2em 0 0.4em 0;
}

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.6rem;
  font-weight: 600;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

h4 {
  font-size: 1.1rem;
  font-weight: 500;
}

p {
  font-weight: lighter;
  margin-bottom: 0.75em;
}

code {
  color: var(--codeColor);
  font-size: 120%;
}

/* Gradient underline for section headings */
h2,
h3 {
  position: relative;
  display: inline-block;
}

h2::after,
h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 40px;
  height: 3px;
  background: linear-gradient(to right, var(--emphColor), var(--linkColor));
  border-radius: 4px;
  transition: width 0.3s ease;
}

h2:hover::after,
h3:hover::after {
  width: 80px;
}

/* Gradient title in header */
h1 a {
  background: linear-gradient(to right, var(--emphColor), var(--linkColor));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

h1 a:hover {
  text-decoration: none;
}

/* Headings links inherit color */
h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a,
h1 a:visited,
h2 a:visited,
h3 a:visited,
h4 a:visited,
h5 a:visited,
h6 a:visited {
  color: inherit;
}

h1 a:hover,
h2 a:hover,
h3 a:hover,
h4 a:hover,
h5 a:hover,
h6 a:hover {
  text-decoration: none;
}

ul,
ol {
  padding-left: 1em;
  margin-bottom: 0.75em;
}

ol li {
  padding-left: 0.5em;
}

ol li ol li {
  list-style-type: lower-alpha;
}

/* ========================================
   4. LAYOUT (Header, Intro, Footer)
   ======================================== */
header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2em;
  padding: 0.5em 0 0.2em 0;
}

header h1 {
  margin: 0;
  text-align: center;
}

header a,
header a:visited {
  color: var(--textColor);
}

header a.active {
  color: var(--emphColor);
}

header a:hover {
  color: var(--emphColor);
  text-decoration: none;
}

nav ul {
  padding-left: 0;
  margin: 0.5em 0;
}

nav li {
  display: inline;
  list-style-type: none;
}

nav li:not(:first-child) {
  padding-left: 0.5em;
}

nav li:not(:last-child) {
  padding-right: 0.5em;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

footer {
  border-top: 0.1em dotted var(--brdrColor);
  margin-top: 9em;
  padding-top: 0.3em;
  text-align: right;
}

/* ========================================
   5. COMPONENTS
   ======================================== */

/* --- Profile Picture --- */
#pfp {
  width: 20em;
  border-radius: 50%;
  background-color: var(--pageBackground);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s ease, background-color 0.3s ease;
}

#pfp:hover {
  transform: scale(1.03) rotate(-2deg);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.12);
}

.dark-mode #pfp {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* --- Glassy Notes Cards --- */
.notes {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;

  /* 🪟 Glassmorphism Core */
  background: rgba(255, 255, 255, 0.55);
  /* Semi-transparent white */
  backdrop-filter: blur(8px);
  /* Frosts the noise behind */
  -webkit-backdrop-filter: blur(8px);
  /* Safari support */
  border: 1px solid rgba(255, 255, 255, 0.5);
  /* Glass edge highlight */
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  /* Softer, wider shadow */

  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.3s ease, background 0.3s ease;
}

.notes:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  /* Glowing edge on hover */
}

.notes .content {
  flex: 1;
}

.notes .title {
  font-weight: 900;
  line-height: 125%;
}

.notes .links {
  margin-top: 0.5em;
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
}

/* --- Dark Mode Glassy Notes --- */
.dark-mode .notes {
  background: rgba(255, 255, 255, 0.06);
  /* Very faint white */
  border: 1px solid rgba(255, 255, 255, 0.1);
  /* Subtle edge */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dark-mode .notes:hover {
  /* border-color: var(--linkColor); */
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* --- Badges & Tags --- */
.interest-group {
  margin: 1.2em 0;
}

.interest-line {
  margin-bottom: 0.5em;
}

.label {
  font-weight: 600;
  color: var(--textColor);
  margin-right: 0.5em;
  font-size: 0.95rem;
}

.tag {
  display: inline-block;
  background: var(--linkColor);
  color: var(--pageBackground);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2em 0.8em;
  border-radius: 20px;
  margin: 0.2em 0.3em 0.2em 0;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, background 0.15s ease;
}

.tag.current {
  background: var(--emphColor);
}

.tag:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.15em 0.6em;
  border-radius: 20px;
  letter-spacing: 0.03em;
  display: inline-block;
}

.badge.complete {
  background: var(--linkColor);
  color: var(--pageBackground);
}

/* --- Bio --- */
.bio {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 600px;
  color: var(--textColor);
  opacity: 0.9;
  font-style: italic;
}

/* --- Section Divider --- */
.section-divider {
  border: none;
  border-top: 2px solid var(--brdrColor);
  margin: 2em 0 1.5em 0;
  opacity: 0.5;
}

/* --- School / Education --- */
.school {
  color: var(--emphColor);
  font-weight: bold;
}

/* --- Buttons (Glassmorphism) --- */
.shadcn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.shadcn-btn--icon {
  height: 2.5rem;
  width: 2.5rem;
  padding: 0;
  border-radius: 0.625rem;
}

.shadcn-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--linkColor);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.dark-mode .shadcn-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.dark-mode .shadcn-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0);
}

.dark-mode .icon {
  filter: brightness(0) invert(1);
}

/* --- Fixed Social & Mode Toggle Buttons --- */
#mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

#github,
#instagram,
#discord {
  position: static;
  /* will be overridden by media query below */
}

#github,
#instagram,
#discord,
#mode-toggle {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  /* Just enough to soften the noise behind */
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.dark-mode #github,
.dark-mode #instagram,
.dark-mode #discord,
.dark-mode #mode-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Hover: They "solidify" nicely */
#github:hover,
#instagram:hover,
#discord:hover,
#mode-toggle:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--linkColor);
}

.dark-mode #github:hover,
.dark-mode #instagram:hover,
.dark-mode #discord:hover,
.dark-mode #mode-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Toast --- */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 300px;
  width: 100%;
  pointer-events: none;
}

.toast {
  background-color: var(--bttnColor);
  border: 1px solid var(--brdrColor);
  color: var(--textColor);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 0.625rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  /* Soft, but solid */
  opacity: 0;
  font-weight: 500;
  font-size: 14px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(20px);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.dark-mode .toast {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* --- Utilities --- */
.clearfix {
  clear: both;
}

newcommand {
  display: none;
}

mjx-container * {
  color: #000000c2;
}

/* ========================================
   CUSTOM SCROLLBAR (Modern & Minimal)
   ======================================== */

/* WebKit Browsers (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
  width: 8px;
  /* Vertical scrollbar width */
  height: 8px;
  /* Horizontal scrollbar height */
}

/* The track (background behind the thumb) */
::-webkit-scrollbar-track {
  background: var(--brdrColor);
  border-radius: 10px;
  margin: 4px 0;
  /* Slight spacing from top/bottom */
}

/* The draggable thumb */
::-webkit-scrollbar-thumb {
  background: var(--linkColor);
  border-radius: 10px;
  border: 2px solid var(--pageBackground);
  /* Creates a "floating" gap effect */
  transition: background 0.2s ease;
}

/* Thumb hover state */
::-webkit-scrollbar-thumb:hover {
  background: var(--emphColor);
}

/* The corner (when both scrollbars meet) */
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox (uses different properties) */
* {
  scrollbar-width: thin;
  /* "auto" or "thin" */
  scrollbar-color: var(--linkColor) var(--brdrColor);
  /*                                 ↑ thumb       ↑ track   */
}

/* Dark mode specific adjustments (Firefox) */
.dark-mode * {
  scrollbar-color: var(--linkColor) var(--brdrColor);
  /* Track is already semi-transparent in dark mode via variable */
}

/* ========================================
   6. RESPONSIVE MEDIA QUERIES
   ======================================== */

/* Small screens (≤480px) */
@media screen and (max-width: 480px) {
  body {
    max-width: 95%;
    font-size: 100%;
  }

  #pfp {
    width: 19em;
    margin-left: 0;
  }
}

/* Medium screens (≥480px) */
@media screen and (min-width: 480px) {
  body {
    max-width: 85%;
  }
}

/* Large screens (≥700px) – fixed social buttons */
@media screen and (min-width: 700px) {
  .intro {
    flex-direction: row-reverse;
  }

  #github,
  #instagram,
  #discord {
    position: fixed;
    bottom: 20px;
    z-index: 100;
  }

  #github {
    left: 20px;
  }

  #instagram {
    left: 70px;
  }

  #discord {
    left: 120px;
  }
}

/* Extra large screens (≥1000px) – wider body + row layout */
@media screen and (min-width: 1000px) {
  body {
    max-width: 740px;
  }

  header {
    flex-direction: row;
  }

  .notes {
    flex-direction: row;
    align-items: center;
  }

  .notes .content {
    flex-basis: 75%;
    margin: 0.8em 0 0.7em 0;
  }

  .notes .links {
    margin-top: 0.55em;
    flex-shrink: 0;
  }
}

/* Between 480px and 1000px – notes adjustments */
@media screen and (max-width: 1000px) {
  .notes .content {
    flex-basis: 80%;
    padding-top: 0.5em;
  }

  .notes .links {
    margin-top: 0;
  }
}

/* ========================================
   7. PRINT STYLES
   ======================================== */
@media print {

  footer,
  nav,
  #mode-toggle,
  #github,
  #instagram,
  #discord,
  #toast-container {
    display: none !important;
  }

  a::after {
    content: " (" attr(href) ")";
  }

  * {
    color: #000 !important;
    background: #fff !important;
  }

  body {
    max-width: 100%;
    background-color: #fff;
  }

  code,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  h1 a,
  h2 a,
  h3 a,
  h4 a,
  h5 a,
  h6 a {
    color: #000 !important;
  }

  h1 a {
    -webkit-text-fill-color: #000 !important;
    background: none !important;
  }

  .notes {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    transform: none !important;
  }

  .notes .links a {
    background: #eee !important;
    color: #000 !important;
  }

  .tag,
  .badge {
    background: #eee !important;
    color: #000 !important;
  }

  header a,
  header a:visited {
    color: #000 !important;
  }

  header a.active {
    color: #000 !important;
  }
}