/* --- 1. VARIABLES & CORE --- */
:root {
  --bg-color: #fdfcf8;
  --text-color: #2c2c2c;

	
  --serif-stack: "Cambria", "Times New Roman", serif;
  --sans-stack: system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-bg: #fffaf0;
  --accent-color: #8b0000;
  --border-color: #e0ddd5;
  --site-title-color: #001f3f;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e4e4e4;
	
    --sidebar-bg: #1a1a1a;
    --accent-color: #ff6b6b;
    --border-color: #333;
    --site-title-color: #eeeeee;
}

body {
  background-color: var(--bg-color) !important; 
  color: var(--text-color)  !important;
  transition: background 0.3s, color 0.3s;

  font-family: var(--serif-stack);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- 2. HEADER & NAVIGATION --- */
header#site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title { font-family: var(--sans-stack); font-size: 1.5rem; margin: 0; }

.site-title a, .site-title a:link, .site-title a:visited, 
.site-title a:hover, .site-title a:active {
  text-decoration: none !important;
  color: var(--site-title-color) !important;
  letter-spacing: 0.1em;
  border: none !important;
  outline: none !important;
  transition: opacity 0.2s ease;
}

.site-title a:hover { opacity: 0.7; }

/* Adjust the button container to wrap and center on small screens */
.header-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;      /* Allows language buttons to stack if necessary */
    justify-content: flex-end; /* Keeps them right-aligned on desktop */
}

/* Styling for the active language button */
.header-controls button.active {
    background-color: var(--sidebar-bg); /* Use the subtle sidebar tint */
    border-color: var(--accent-color);   /* Use your main theme color */
    font-weight: bold;                   /* Makes the text slightly sharper */
}

/* Ensure the hover effect still works on active buttons */
.header-controls button.active:hover {
    transform: translateY(-1px);
}

/* --- 1. THE BASE BUTTON --- */
button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--sans-stack);
    font-size: 0.75rem;
    padding: 6px 12px;
    cursor: pointer;
    text-transform: uppercase;
    border-radius: 4px;
    /* Added: Smooths the transition back and forth */
    transition: all 0.2s ease-in-out;
}

/* --- 2. THE HOVER INTERACTION --- */
button:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Subtle gray tint */
    border-color: #999;                   /* Slightly darker border */
    transform: translateY(-1px);          /* The "lift" effect */
}

/* --- 3. DARK MODE HOVER --- */
body.dark-mode button:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Pale tint for dark mode */
    border-color: #666;
}

/* --- 4. TOP BUTTON SPECIFIC --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--sidebar-bg); /* Opaque background from your variables */
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-family: var(--sans-stack);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    display: none;
    z-index: 1000;
    transition: all 0.2s ease-in-out;
}

/* --- TOP BUTTON HOVER (Solid Colors) --- */
#back-to-top:hover {
    background-color: #e0e0e0; /* A solid light gray for Light Mode */
    border-color: #999;
    transform: translateY(-2px);
}

/* --- TOP BUTTON DARK MODE HOVER (Solid Colors) --- */
body.dark-mode #back-to-top:hover {
    background-color: #333333; /* A solid dark gray for Dark Mode */
    border-color: #666;
    color: #ffffff;            /* Ensures text stays bright against dark gray */
}

/* Temporarily hide language buttons until content is ready 
button[onclick="setLang('en')"], 
button[onclick="setLang('gk')"], 
button[onclick="setLang('sl')"] {
    display: none !important;
} */

/* --- 3. LAYOUT & SIDEBAR (Triodion Specific) --- */
#layout { display: flex; flex: 1; width: 100%; }

#sidebar { 
    width: 280px; 
    background: var(--sidebar-bg); 
    border-right: 1px solid var(--border-color); 
    padding: 1.5rem; 
    height: calc(100vh - 60px); 
    position: sticky; 
    top: 60px; 
    overflow-y: auto; 
    flex-shrink: 0; 
}

#sidebar.hidden { display: none !important; }

/* SCOPED: Navigation Sidebar Summaries Only */
#sidebar summary { 
    font-family: var(--sans-stack); 
    font-size: 0.9rem; 
    color: var(--accent-color); 
    cursor: pointer; 
    padding-bottom: 0.5rem; 
    border-bottom: 1px solid var(--border-color);
    list-style: none;
    display: flex;
    align-items: center;
}
#sidebar summary::-webkit-details-marker { display: none; }

#sidebar ul { list-style: none; padding: 0.5rem 0 0.5rem 1rem; margin: 0; }
#sidebar a { text-decoration: none !important; color: var(--text-color); font-size: 0.9rem; font-family: var(--sans-stack); border: none !important; }
#sidebar a:hover { color: var(--accent-color); text-decoration: none !important; }

/* --- 4. MAIN CONTENT --- */
main { flex: 1; padding: 1rem 2rem 3rem 2rem; width: 100%; box-sizing: border-box; }

/* SCOPED: Minimalist Body Collapsible Sections (Triodion Warm Theme) */
main details {
    margin: 0;
    padding: 0;
    background: none !important;
    border: none !important;
}

main summary {
    font-family: var(--serif-stack) !important;
    font-size: 1.3rem;
    font-weight: bold;
    color: #8b0000; /* Dark Red to match the warm theme header values */
    cursor: pointer;
    list-style: none; 
    padding: 0;
    margin: 10px 0; 
    text-align: left;
}

/* Hide default arrow in Safari/Webkit browsers for main content */
main summary::-webkit-details-marker { 
    display: none !important; 
}

body.dark-mode main summary {
    color: #faeac9; /* Warm Pale Red override for Dark Mode reading comfort */
}

h1 {
  color: var(--text-color);
  font-family: var(--serif-stack);
  font-size: 1.5rem;
  text-align: center;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

h2 { color: #006699; font-weight: normal; font-size: 1.3em; border-bottom: 1px solid lightgray; text-align: center; margin: 10px 20px; padding: 0 10px; }
h3 { color: #006060; font-weight: normal; font-size: 1.1em; font-variant: small-caps; text-align: center; margin: 0 10px; padding: 0 10px; }
h4 { color: #a0522d; font-weight: normal; font-size: 1.1em; text-align: center; padding: 5px; margin: 0 10px; }
h5 { color: #606060; font-weight: normal; font-size: 1.1em; font-style: italic; text-align: center; margin: 0 20px; padding: 0 10px; }
h6 { color: #483d8b; font-weight: normal; font-size: 1.1em; text-align: center; margin: 0 20px; padding: 0 10px; }

article p { 
    font-size: 1.2rem; 
    line-height: 1.6; 
    margin-bottom: 1.5rem; 
    text-align: justify; /* This justifies the text */
    hyphens: auto;        /* Helps justified text look better on mobile */
}


b { font-weight: bold; }
em, i { color: #8b0000; }
hr { border: 0; border-top: 1px solid #cccccc; }
blockquote p { margin: 0; padding: 0; }

footer { margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--border-color); text-align: center; font-family: var(--sans-stack); font-size: 0.8rem; }
footer a { text-decoration: none; color: var(--text-color) ;} 
footer a:hover { color: #4682b4; transition: color 0.2s ease; }

/* --- 5. DARK MODE OVERRIDES (PALE COLORS) --- */
body.dark-mode h1 { color: var(--text-color); }
body.dark-mode h2 { color: #d6eafe; border-bottom-color: #444; }
body.dark-mode h3 { color: #c3ffef; }
body.dark-mode h4 { color: #f5f5dc; }
body.dark-mode h5 { color: #b0b0b0; }
body.dark-mode h6 { color: #eee8ff; }
body.dark-mode em, body.dark-mode i { color: #ffeeea; }
/* body.dark-mode summary { color: #faeac9; border-bottom-color: #333; } */
body.dark-mode #sidebar a:hover { color: #fffacd; transition: color 0.2s ease; }
body.dark-mode footer a { color: #d6eafe; }
body.dark-mode footer a:hover { color: #fffacd; transition: color 0.2s ease; }

/* Light Mode Links */
p a:link, p a:visited, p a:active { 
    text-decoration: none; 
    color: #003366; 
}
p a:hover { 
    color: #0088cc; 
}

/* Dark Mode Link Overrides */
body.dark-mode p a:link, 
body.dark-mode p a:visited, 
body.dark-mode p a:active { 
    text-decoration: none; 
    color: #d6eafe; 
}
body.dark-mode p a:hover { 
    color: #fffacd; 
}

/* --- 6. MOBILE & PRINT --- */
@media (max-width: 800px) {
  header#site-header { padding: 1rem; }
  /*.site-title { font-size: 1.3rem; }*/
  #layout { flex-direction: column; }
  #sidebar {
  display: none; /* Hides the sidebar by default on mobile */
  width: 100%;
  height: auto;
  position: relative;
  top: 0;
  border-right: none;
  border-bottom: 1px solid var(--border-color);
  box-sizing: border-box;
  }

	/* This class will be toggled by the Menu button */
#sidebar.show-mobile {
  display: block !important;
  }
  main { padding: 1.5rem 1rem; }
}

@media screen and (max-width: 600px) {
  main { padding: 1.25rem 0.75rem; }
  article p { font-size: 1.1rem; line-height: 1.4; margin-bottom: 1rem; }
  h1 { font-size: 1.4rem; margin-bottom: 1.2rem; }
  h2 { font-size: 1.2em; margin: 10px 0; }
  h3, h4, h5, h6 { font-size: 1.1em; margin: 0 5px 5px; padding: 0 5px; }
  h2, h5, h6 { margin-left: 0; margin-right: 0; }
  blockquote p { margin: 0; padding: 0; }
}

/* --- MOBILE HEADER BUTTON WRAP (Final Fix) --- */
@media (max-width: 535px) {
    header#site-header {
        display: flex;
        flex-wrap: wrap; 
        justify-content: space-between; /* Space items to far edges */
        padding: 1rem 1.5rem;
        text-align: left; /* Explicitly reset title alignment */
    }

    .site-title {
        flex: 1 1 auto; /* Allow title to grow/shrink but not force centering */
        text-align: left !important; /* Force left alignment */
        margin-bottom: 0.5rem;
    }

    .header-controls {
        flex: 1 0 100%;       /* Force buttons to drop to a new line */
        display: flex;
        justify-content: flex-end; /* Keep buttons pinned to the right */
        margin-top: 0.5rem;
    }
}

@media print {
  header#site-header, #sidebar, .header-controls, #back-to-top { display: none !important; }
  body { background: white !important; color: black !important; display: block; }
  main { padding: 0; width: 100%; }
}

#back-to-top { position: fixed; bottom: 20px; right: 20px; background-color: var(--sidebar-bg); border: 1px solid var(--border-color); padding: 8px 12px; font-family: var(--sans-stack); font-size: 0.7rem; cursor: pointer; border-radius: 4px; display: none; z-index: 1000; 
}
