/* ------------------------------
   Theme Variables & Base Styles
   ------------------------------*/
/* @import moved to fonts.css */
:root {
  /* Default (Light) Fonts */
  --font-family: 'Roboto', sans-serif;
  --font-title: 'Roboto', sans-serif;

  /* Unified color system */
  --color-bg: #ffffff;            /* page background */
  --color-body: #333333;          /* default body text */
  --color-accent: #111111;        /* links / headings / accents */

  /* Background texture pattern (default none) */
  --bg-pattern: none;

  /* Derived/utility colors */
  --color-border: var(--color-accent);
  --color-selection-bg: var(--color-accent);
  --color-selection-text: var(--color-bg);
  --color-box-shadow: rgba(17, 17, 17, 0.25);
}

/* Light Theme (default) */
.theme-light {
  --color-bg: #ffffff;
  --color-body: #333333;
  --color-accent: #111111;
  --color-box-shadow: rgba(17, 17, 17, 0.25);
  --font-family: 'Karla', sans-serif;
  --font-title: 'Varela Round', sans-serif;
}

/* Dark Theme */
.theme-dark {
  --color-bg: #121212;
  --color-body: #e0e0e0;
  --color-accent: #ffffff;
  --color-box-shadow: rgb(0 117 0 / 38%);
  --font-family: 'Karla', sans-serif;
  --font-title: 'Varela Round', sans-serif;
}

/* Retro Diner Theme */
.theme-retro {
  --color-bg: #fffbe6;
  --color-body: #2d2d2d;
  --color-accent: #d80a0a;
  --color-box-shadow: rgba(216, 10, 10, 0.37);
  --font-family: 'Quicksand', sans-serif;
  --font-title: 'Lobster Two', cursive;
  --bg-pattern: none;
}

/* Fantasy Medieval RPG Theme */
.theme-medieval {
  --color-bg: #f5f0e6;
  --color-body: #1e1001;
  --color-accent: #8b5a2b;
  --color-box-shadow: rgba(139, 90, 43, 0.5);
  --font-family: 'EB Garamond', serif;
  --font-title: 'Uncial Antiqua', cursive;
}

/* Oasis Saharan Desert Theme */
.theme-desert {
  --color-bg: #f4e8d2;
  --color-body: #3c2f2c;
  --color-accent: #c06014;
  --color-box-shadow: rgba(192, 96, 20, 0.5);
  --font-family: 'Cardo', sans-serif;
  --font-title: 'Rakkas', cursive;
  --bg-pattern: none;
}

/* Tropical Pirate Alcoves Theme */
.theme-pirate {
  --color-bg: #e0f6ff;
  --color-body: #062c43;
  --color-accent: rgb(3, 169, 244);
  --color-box-shadow: rgba(3, 169, 244, 0.5);
  --font-family: 'Mali', sans-serif;
  --font-title: 'Pirata One', cursive;
}


/* ------------------------------
   Global Reset & Typography
   ------------------------------*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  font-family: var(--font-family);
  background-color: var(--color-bg);
  background-image: var(--bg-pattern);
  /* Ensure any applied background image covers viewport while preserving aspect ratio */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  color: var(--color-body);
  height: 100%;
}

/* ------------------------------
   Header Styles
   ------------------------------*/
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg);
  box-shadow: 0px 0px 7px var(--color-box-shadow);
}

/* Inset shadow when background image is present */
.has-bg-image .site-header {
  box-shadow: inset 0px 0px 7px var(--color-box-shadow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  width: 40px;
  height: auto;
  max-width: 100%; /* Ensure logo never exceeds container */
}

.site-title {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--color-accent);
  font-family: var(--font-title);
  text-decoration: none;
  cursor: pointer;
}

/* Ensure visited/hover state keeps color */
.site-title:visited,
.site-title:hover,
.site-title:focus {
  color: var(--color-accent);
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.theme-hint {
  font-size: 0.875rem;
  line-height: 16px; /* align vertically with indicator circle */
  white-space: nowrap;
  color: var(--color-accent);
}

.theme-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-left: 0.5rem;
  border: 1px solid var(--color-accent);
  background: linear-gradient(
    135deg,
    var(--color-accent) 0%,
    var(--color-accent) 66%,
    var(--color-bg) 66%,
    var(--color-bg) 100%
  );
  flex-shrink: 0;
  cursor: pointer;
}

/* ------------------------------
   Responsive Tweaks
   ------------------------------*/
@media (max-width: 480px) {
  .site-title {
    font-size: 1rem;
  }

  .theme-hint {
    font-size: 0.75rem;
    display: none; /* hide hint on narrow screens */
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background-color: var(--color-bg);
  border: 1px solid var(--color-accent);
  color: var(--color-body);
  font-family: var(--font-title);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
}

/* ------------------------------
   Page Content
   ------------------------------*/
main {
  background-color: var(--color-bg);
  max-width: 800px;
  width: 100%;
  margin: 2rem auto;
  padding: 1rem 2rem;
  box-shadow: 0px 2px 7px var(--color-box-shadow);
}

/* Inset shadow when background image is present */
.has-bg-image main {
  box-shadow: inset 0px 0px 7px var(--color-box-shadow);
}

@media (max-width: 480px) {
  main {
    padding: 1rem 0.75rem;
    max-width: calc(100dvw - 1rem);
  }
}

/* ------------------------------
   Article Headings
   ------------------------------*/
main h1,
main h2,
main h3 {
  font-family: var(--font-title);
  color: var(--color-accent);
  margin: 0.5rem 0;
}

main h1 {
  font-size: 2rem;
}

main h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

main h4 {
  margin-top: 0;
}

/* ------------------------------
   Text Selection Styling
   ------------------------------*/
::selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-text);
}

/* Firefox */
::-moz-selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-text);
}

/* WebKit (Safari/Chrome) */
::-webkit-selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-text);
}

main img.themed-image {
  width: auto;
  max-width: 100%;
  max-height: 50dvh;
  height: auto;
  display: block;
  margin: 1rem auto;
}

a {
    color: var(--color-accent);
}

a:visited {
    color: var(--color-accent);
}

.article-image {
  margin: 0 auto;
  display: block;
  padding: 1rem;
  box-shadow: inset 0px 0px 4px var(--color-box-shadow);
  max-width: calc(100dvw - 4rem);
  width: fit-content;
}

.with-caption {
 padding-bottom: .5rem;
}

.article-image img {
  width: 100%;
}

/* Caption */
.article-image div:nth-of-type(2) {
  display: flex;
  flex-wrap: wrap;
  gap: .33rem;
  align-items: center;
  justify-content: center;    
}

hr {
    margin:1rem 0;
    border: solid 1px var(--color-box-shadow);
}

li {
  list-style-type: none;
}

.list-article {
  display: grid;
  padding-bottom: 1rem;
}

.list-article a {
  text-decoration: none;
  font-weight: 700;
}

.list-article div:nth-of-type(2) {
  
}

/* ------------------------------
    Quote Styling
   ------------------------------*/
blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  font-style: italic;
  color: var(--color-body);
  background: transparent;
}
