/* ==========================================================================
   1. TYPOGRAPHY & FONTS
   ========================================================================== */
@font-face {
  font-family: 'SFMono';
  src: url("../fonts/SFMonoMedium.otf");
}

@font-face {
  font-family: 'Inconsolata';
  src: url("../fonts/Inconsolata.ttf");
}

@font-face {
  font-family: 'SourceCode';
  src: url("../fonts/SourceCodePro.ttf");
}

@font-face {
  font-family: 'Terminus';
  src: url("../fonts/Terminus.ttf");
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url("../fonts/JetBrainsMono.ttf");
}

@font-face {
  font-family: 'Roboto Mono';
  src: url("../fonts/RobotoMono-SemiBold.ttf");
}

/* ==========================================================================
   2. GLOBAL & LAYOUT
   ========================================================================== */
body {
  /* Smooth theme transitions */
  transition: background 0.3s ease, color 0.3s ease;
  margin: 0;
  overflow-x: hidden;
}

/* Footer Styling */
footer {
  text-align: center;
  padding: 2rem 0;
  font-family: 'SourceCode', monospace;
  font-weight: 600;
  opacity: 0.6;
  color: var(--page-font-color);
  background: transparent;
}

footer a {
  text-decoration: none !important;
  color: inherit;
}

/* ==========================================================================
   3. NAVBAR
   ========================================================================== */
.nav-content {
  transition: transform 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: inset 0 -10px 10px -10px rgba(10, 10, 10, 0.5);
}

.icon-nav.collapsed {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.icon-link {
  font-size: 1.3rem;
  color: var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
  text-decoration: none;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.icon-link:hover {
  color: var(--page-link-color, var(--theme-link-color, var(--default-link-color)));
}

.dropdown-button {
  background: transparent;
  border: 2px solid var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
  color: var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  z-index: 1001; /* Above Navbar */
  position: absolute;
  top: 8px;
  right: 10px;
}

.dropdown-button.rotate {
  transform: rotate(180deg);
}

/* ==========================================================================
   4. PROFILE CARD
   ========================================================================== */
/* Blinking caret next to username (Targeting ID #name) */
#name2::after {
  content: '_';
  font-size: 19px;
  margin-left: 5px;
  animation: blink 1s step-end infinite;
  color: var(--page-link-color, inherit);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ==========================================================================
   5. BOOKMARKS SECTION
   ========================================================================== */
/* Base Grid */
.bookmarks-grid { 
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 3rem auto;
  box-sizing: border-box;
  justify-content: center;
}

/* Individual Card */
.bookmark-card {
  display: flex;
  align-items: center;
  width: 320px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  margin: 10px auto;
}

.bookmark-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--page-link-color, var(--theme-link-color, var(--default-link-color)));
}

.bookmark-card:hover .bookmark-title a {
  color: var(--page-link-color, var(--theme-link-color, var(--default-link-color)));
}

.bookmark-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  margin-right: 15px;
  flex-shrink: 0;
}

.bookmark-title {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bookmark-title a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease;
}

/* Front-Page "Pinned" Override (Pill View) */
.bookmarks-grid.show {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 600px;
  margin: 2rem auto;
}

.bookmarks-grid.show .bookmark-card {
  min-width: 280px;
  border-radius: 50px;
  padding: 12px 15px;
  background: var(--custom-bookmark-bg, var(--theme-bookmark-bg, var(--default-bookmark-bg)));
  border: 1px solid rgba(250, 250, 250, 0.2);
}

.bookmarks-grid.show .bookmark-card:hover {
  background: var(--page-link-color, var(--theme-link-color, var(--default-link-color)));
}

.bookmarks-grid.show .bookmark-card .bookmark-title a {
  color: var(--page-font-color, var(--theme-font-color, var(--default-font-color))) !important;
  font-weight: 600;
}

/* ==========================================================================
   6. PHOTO GRID LAYOUT
   ========================================================================== */
.photo-grid-layout {
  display: grid;
  /*grid-template-columns: repeat(3, 1fr);*/
  grid-auto-rows: 250px;
  gap: 10px;
  padding: 10px;
  max-width: 1200px;
  margin: 60px auto;
  width: 100%;
  box-sizing: border-box;
}

.photo-grid-layout .feed-card.photo-card {
  margin: 0;
  height: 100%;
  background: transparent;
  border: none;
}

.photo-grid-layout .photo-content {
  padding: 0;
  height: 100%;
}

.photo-grid-layout .feed-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
  border-radius: 4px;
}

.photo-grid-layout .feed-image:hover {
  transform: scale(1.02);
  z-index: 2;
  position: relative;
  border: 1px solid var(--page-link-color, var(--theme-link-color, var(--default-link-color)));
}

/* Desktop Mosaic Layout */
@media (min-width: 768px) {
  .photo-grid-layout {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 250px;
  }
  /* Mosaic Spans */
  .photo-grid-layout .feed-card.photo-card:nth-child(2),
  .photo-grid-layout .feed-card.photo-card:nth-child(5),
  .photo-grid-layout .feed-card.photo-card:nth-child(12),
  .photo-grid-layout .feed-card.photo-card:nth-child(14) {
    grid-row: span 2;
  }
  .photo-grid-layout .feed-card.photo-card:nth-child(11) {
    grid-column: span 2;
  }
}

/* ==========================================================================
   7. YOUTUBE SECTION
   ========================================================================== */
#youtube-section {
  margin-top: 60px;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 0.7rem;
  box-sizing: border-box;
}

.video-item-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 700px;
  margin-bottom: 5px;
  background-color: var(--custom-yt-bg, var(--theme-yt-bg, var(--default-yt-bg)));
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px;
  box-sizing: border-box;
}

.video-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  width: 100%;
  background-color: black;
  border-radius: 4px;
}

.video-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-embed-title {
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--page-font-color, #333);
  text-align: left;
  padding: 0 10px;
  word-break: break-word;
  width: 100%;
}

/* ==========================================================================
   8. JOURNAL / FEED SECTION (Theme-Synced & Expandable)
   ========================================================================== */
#journal-section {
    padding: 0 1rem;
    display: block;
    margin-top: 65px;
} 

.journal-entries {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
}

/* Base Card using YOUR Theme Variables */
.journal-card {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px;
    background: var(--custom-journal-bg, var(--theme-journal-bg, var(--default-journal-bg)));
    color: var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
    font-family: var(--page-font), monospace;
    border-radius: 8px;
    box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.journal-card a {
    color: var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
}

/* Hover & Expand States */
.journal-card:hover {
    transform: scale(1.02);
}

.journal-card.expanded {
    cursor: default;
    transform: none; /* Disables the hover scale when reading a full post */
}

/* Header Flexbox: Title/Tags on Left, Date on Right */
.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.85rem;
    opacity: 0.9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.journal-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 8px 0;
}

.journal-date {
    white-space: nowrap;
    opacity: 0.8;
}

/* Tags Styling (Using your theme colors) */
.journal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.journal-tag {
    color: #000;
    padding: 2px 8px;
    background: var(--page-link-color, #fff);
    border-radius: 4px;
    border: 1px solid var(--page-link-color, #000);
    font-size: 0.85em;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Content Layout (Excerpt vs Full) */
.journal-excerpt {
    line-height: 1.5;
    word-break: break-word;
    display: block; /* Visible by default */
    opacity: 0.85;
}

.journal-full-content {
    display: none; /* Hidden by default */
    line-height: 1.5;
    word-break: break-word;
    margin-top: 15px;
    border-top: 0px solid rgba(255, 255, 255, 0.1);
 
}

.journal-full-content img {
    width: 100%;
    border-radius: 6px;
    margin: 10px 0;
}

/* Toggle Logic */
.journal-card.expanded .journal-excerpt {
    display: none; 
}

.journal-card.expanded .journal-full-content {
    display: block; 
}

/* Internal Markdown Styling */
.journal-full-content pre {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

.journal-full-content code {
    font-family: monospace;
}

.journal-full-content blockquote {
    border-left: 3px solid var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
    margin: 10px 0;
    padding-left: 15px;
    opacity: 0.7;
}

/* Legacy Footer/Action links just in case you use them later */
.journal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    font-size: 0.8rem;
    margin-top: 15px;
}
.action-link, .action-link-btn {
    color: var(--page-font-color, var(--theme-font-color, var(--default-font-color)));
    text-decoration: none;
    margin-right: 15px;
    opacity: 0.6;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.action-link:hover, .action-link-btn:hover { opacity: 1; }
/* ==========================================================================
   9. LIGHTBOX
   ========================================================================== */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.2s ease;
}

#lightbox.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

#lightbox img,
#lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  object-fit: contain;
}

#lightbox::after {
  content: "×";
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 3rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#lightbox::after:hover {
  opacity: 1;
}

/* ==========================================================================
   10. THEMES
   ========================================================================== */

/* --- Minimal --- */
body.theme-minimal { 
  --theme-card-bg: transparent;
  --theme-bg-color: #f0f0f0;
  --theme-font-color: #333;
  --theme-link-color: #007bff; 
  --theme-card-shadow: 0px 4px 15px rgba(0, 0, 0, 0.5);
  --theme-nav-bg: rgba(255, 255, 255, 0.08);
  --social-bg: transparent;
  --theme-bookmark-bg: #fff; 
  --theme-card-border: 1px solid rgba(0, 0, 0, 0.1);
}


/* --- Dark --- */
body.theme-dark {
  --theme-card-bg: linear-gradient(3deg, rgba(0, 0, 0, 1) 0%, rgba(13, 13, 13, 1) 38%, rgba(20, 20, 20, 1) 100%);
  --theme-bg-color: #000;
  --theme-font-color: #A0A0A0;
  --theme-link-color: #3f3f3f;
  --theme-card-border: rgba(38, 38, 38, 0.8);
  --theme-card-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
  --social-bg: #1e1e1e;
  --theme-journal-bg: linear-gradient(3deg, rgba(0, 0, 0, 1) 0%, rgba(13, 13, 13, 1) 38%, rgba(20, 20, 20, 1) 100%);
}

/* --- Zen --- */
body.theme-zen { 
  --theme-card-bg: #ffffff;
  --theme-bg-color: #ffffff;
  --theme-font-color: #333;
  --theme-link-color: #a0a0a0;
  --theme-card-bg: #ffffff;
  --theme-card-border: rgba(150, 150, 150, 0.5);
  --theme-card-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
  --social-bg: transparent;
  --theme-bookmark-bg: #fff;
  --theme-journal-bg:rgba(250, 250, 250, 0.8);
}

/* --- BSOD --- */
body.theme-bsod { 
  --theme-card-bg: #faf2fb;
  --theme-bg-color: #1e3df4;
  --theme-font-color: #faf2fb;
  --theme-link-color: #db00f6;
  --theme-card-bg: #1e3df4;
  --theme-card-border: rgba(250, 250, 250, 0.5);
  --theme-card-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
  --social-bg: transparent;
  --theme-bookmark-bg: #1e3df4;
  --theme-journal-bg: #1e3df4;
}

/* --- Borderless --- */
body.theme-borderless {
  --theme-bg-color: #000;
  --theme-font-color: #fff;
  --theme-link-color: #007bff;
  --theme-card-bg: transparent;
  --theme-card-border: rgba(0, 0, 0, 0);
  --theme-card-shadow: 0px 4px 15px rgba(0, 0, 0, 0);
  --theme-nav-bg: rgba(255, 255, 255, 0.08);
  --social-bg: transparent;
  --theme-yt-bg: transparent;
  --theme-bookmark-bg: #000;
  --theme-journal-bg: rgba(150, 150, 150, 0.1);
}

/* --- Gray --- */
body.theme-gray { 
  --theme-bg-color: #e9e9e9;
  --theme-font-color: #4a4a4a;
  --theme-link-color: #45ff0d;
  --theme-card-bg: linear-gradient(180deg, #aeaeae 0%, #888 100%);
  --theme-card-border: transparent;
  --theme-card-shadow: 0 0 5px rgba(255, 255, 255, 0.2), 0 10px 30px rgba(0, 0, 0, 0.5);
  --social-bg: #848484;
  --selection-bg: #45ff0d;
  --theme-nav-bg: #aeaeae;
  --theme-journal-bg: linear-gradient(180deg, #aeaeae 0%, #888 100%);
}

body.theme-gray #social-icons {
  text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5), -1px -1px 1px rgba(0, 0, 0, 0.3);
  border-radius: 50px;
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.4), inset -1px -1px 3px rgba(255, 255, 255, 0.6);
}

/* --- Retro --- */
body.theme-retro {
  --theme-font: Terminus;
  --theme-bg-color: #000;
  --theme-font-color: #7CCF00;
  --theme-link-color: #7CCF00;
  --theme-card-bg: #000;
  --theme-card-border: #7CCF00;
  --theme-card-shadow: 0 0 10px #7CCF00;
  --social-bg: #000;
  --selection-bg: #7CCF00;
  --selection-text: #000;
  --theme-journal-bg: rgba(0, 0, 0, 0.3);
}

/* Retro Scanlines */
body.theme-retro .profile-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
      0deg,
      rgba(51, 255, 51, 0.05),
      rgba(51, 255, 51, 0.05) 2px,
      transparent 2px,
      transparent 4px
  );
  pointer-events: none;
  border-radius: 16px;
  animation: scanline 1s infinite linear;
}
@keyframes scanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 4px; }
}

/* --- Pink --- */
body.theme-pink {
  --theme-bg-color: #959595;
  --theme-font-color: #b3b0ac;
  --theme-link-color: #fff;
  --theme-card-bg: #ea57ad;
  --theme-card-border: #f7b2e1;
  --theme-card-shadow: 0 0 15px #1a1a1a;
  --social-bg: #ea57ad;
  --selection-bg: #fff;
  --selection-text: #000;
  --theme-journal-bg: #ea57ad;
}
body.theme-pink .profile-card { border: 0; }

/* --- Clear --- */
body.theme-clear {
  --theme-bg-color: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
  --theme-font-color: #fff;
  --theme-link-color: #000;
  --theme-card-border: rgba(255, 255, 255, 0.8);
  --theme-card-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
  --social-bg: transparent;
  --selection-bg: #000;
  --selection-text: #fff;
  --theme-bookmark-bg: transparent;
  --theme-journal-bg: rgba(255, 255, 255, 0.15);
}

body.theme-clear .nav-content {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-radius: 3rem;
  margin: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px) saturate(180%);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2), inset 0 4px 20px rgba(255, 255, 255, 0.3);
}

body.theme-clear .profile-card {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2), inset 0 4px 20px rgba(255, 255, 255, 0.3);
}

body.theme-clear .profile-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  backdrop-filter: blur(1px);
  box-shadow: inset -10px -8px 0px -11px rgba(255, 255, 255, 1), inset 0px -9px 0px -8px rgba(255, 255, 255, 1);
  opacity: 0.6;
  z-index: -1;
  filter: blur(1px) drop-shadow(10px 4px 6px black) brightness(115%);
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}