/* --- Theme Variables --- */
:root {
  --font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
  --sidebar-width: 320px;
  --gap: 40px;
  --border-color: #a2a9b1;
  --border-radius: 4px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --background: #FCFCFC;
    --surface: #DFDFDF; /* infobox / headshot box */
    --text: #202122;
    --text-muted: #54595d;
    --link: #000000;
    --divider: #eaecf0;
    --title-shadow: none;
    --title-color: #000000;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #0F0F0F;
    --surface: #222222; /* infobox / headshot box */
    --text: #fcfcfc;
    --text-muted: #a2a9b1;
    --link: #fcfcfc;
    --divider: #444444;
    --title-shadow: -1px 0 #000, 0 1px #000, 1px 0 #000, 0 -1px #000;
    --title-color: #fcfcfc;
  }
}

[data-theme="dark"] {
  --background: #0F0F0F;
  --surface: #222222;
  --text: #fcfcfc;
  --text-muted: #a2a9b1;
  --link: #fcfcfc;
  --divider: #444444;
  --title-shadow: -1px 0 #000, 0 1px #000, 1px 0 #000, 0 -1px #000;
  --title-color: #fcfcfc;
  background-color: var(--background) !important;
  color: var(--text) !important;
}

[data-theme="light"] {
  --background: #FCFCFC;
  --surface: #DFDFDF;
  --text: #202122;
  --text-muted: #54595d;
  --link: #000000;
  --divider: #eaecf0;
  --title-shadow: none;
  --title-color: #000000;
  background-color: var(--background) !important;
  color: var(--text) !important;
}

/* --- Resets & Typography --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  padding: 40px 20px;
}

/* --- Background Effects --- */
.bg-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 20vh;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.star {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle ease-in-out infinite;
}

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

.cloud {
  position: absolute;
  left: -15%;
  opacity: 0.08;
  color: #999;
  animation: drift linear infinite;
  user-select: none;
}

@keyframes drift {
  0% { transform: translateX(-10vw); }
  100% { transform: translateX(110vw); }
}

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
  color: var(--text);
}

h2 {
  font-size: 1.5em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: bold;
}

h3 {
  font-size: 1.1em;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-weight: bold;
  color: var(--text-muted);
  border-bottom: 1px solid var(--divider);
  padding-bottom: 5px;
}

p, ul, ol {
  margin-bottom: 1em;
}

ul {
  padding-left: 20px;
}

.content-section ul {
  list-style: none;
  padding-left: 0;
}

li {
  margin-bottom: 0.5em;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.05s ease, text-decoration-thickness 0.05s ease, background-color 0.05s ease;
  padding: 2px 0;
  border-radius: 2px;
}

a:hover {
  text-decoration: underline;
}

time {
  color: var(--text-muted);
  font-size: 0.85em;
}

.content-section {
  margin-bottom: 50px;
}



/* --- Page Layout --- */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  column-gap: var(--gap);
  align-items: start;
  position: relative;
}

.page-header,
.content-section {
  grid-column: 1;
}

.infobox {
  grid-column: 2;
  grid-row: 1 / span 99;
}

/* --- Infobox --- */
.infobox {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  padding: 15px;
  font-size: 1em;
  text-align: left;
  margin-top: 140px;
}

/* --- Page Header (Title Area) --- */
.page-header {
  margin-bottom: 30px;
}

.main-title {
  font-size: 3rem;
  background-image: url("assets/images/joshtilebgdark-1732x1154.jpg");
  background-size: cover;
  background-position: center;
  color: var(--title-color);
  text-shadow: var(--title-shadow);
  padding: 15px 15px 15px 0;
  border-radius: var(--border-radius);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: bold;
}

.main-title a {
  color: inherit;
  text-decoration: none;
}

/* note: light mode title gets highlight only, no underline */
@media (prefers-color-scheme: light) {
  .main-title a { text-decoration: none !important; }
}
[data-theme="light"] .main-title a { text-decoration: none !important; }

.main-subtitle {
  font-style: italic;
  font-size: 1.1em;
  margin-top: 10px;
  color: var(--text-muted);
}

.infobox-image-container {
  margin-bottom: 25px;
}

.headshot {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

.headshot-caption {
  text-align: center;
  font-size: 0.85em;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 5px;
}

.infobox-data {
  width: 100%;
  font-size: 0.9em;
  margin-bottom: 15px;
  border-collapse: collapse;
}

.infobox-data th {
  text-align: left;
  font-weight: bold;
  padding: 4px 10px 4px 0;
  vertical-align: top;
  white-space: nowrap;
  color: var(--text-muted);
}

.infobox-data td {
  padding: 4px 0;
  vertical-align: top;
}

.infobox-links {
  margin-bottom: 30px;
}

.blog-link {
  font-size: 1em;
  font-weight: bold;
  display: inline-block;
  text-decoration-thickness: 1px;
}

.wiki-edit {
  font-size: 0.5em;
  font-weight: normal;
  font-family: var(--font-family);
  color: var(--text-muted);
  text-decoration: none;
  vertical-align: middle;
}

.wiki-edit:hover {
  color: var(--link);
}

.infobox-contact {
  margin-bottom: 30px;
}

.infobox-contact h3 {
  margin-top: 0;
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 5px;
}

.infobox-contact p {
  font-size: 1.0em;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
}

.infobox-contact p a {
  font-weight: bold;
}

/* --- Sidebar Awards --- */
.infobox-awards {
  margin-bottom: 30px;
}

.infobox-awards h3 {
  margin-top: 0;
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 10px;
}

.sidebar-list {
  list-style: none;
  padding-left: 0;
}

.sidebar-list li {
  font-size: 0.9em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.sidebar-list a {
  font-weight: normal;
  display: block;
  margin-bottom: 2px;
}

/* --- Text Selection --- */
::selection {
  background-color: rgba(168, 228, 160, 0.7);
  color: #202122;
}
@media (prefers-color-scheme: dark) {
  ::selection {
    background-color: #FF10F0;
    color: #fff;
  }
}
[data-theme="dark"] ::selection {
  background-color: #FF10F0;
  color: #fff;
}
[data-theme="light"] ::selection {
  background-color: rgba(168, 228, 160, 0.7);
  color: #202122;
}

/* --- Microblog Feed --- */
.infobox-rss {
  margin-top: 20px;
  margin-bottom: 15px;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  padding: 15px;
}

.rss-title {
  font-size: 0.85em;
  margin: 0 0 10px 0;
  color: var(--text);
  font-weight: normal;
}

.rss-container {
  padding-right: 0;
  max-height: 220px;
  overflow-y: auto;
}

.rss-item {
  margin-bottom: 8px;
  font-size: 0.9em;
  line-height: 1.3;
}

.rss-item:last-child {
  margin-bottom: 0;
}

.rss-link {
  font-weight: normal;
  display: block;
  text-decoration: none;
}

.rss-date {
  font-size: 0.85em;
  color: var(--text-muted);
}

#themeToggle {
  position: absolute;
  top: 25px;
  right: 28%;
  z-index: 1000;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 6em;
  line-height: 1;
  padding: 0;
  opacity: 0.9;
}

#themeToggle:hover {
  opacity: 1;
}


@media (max-width: 850px) {
  #themeToggle {
    top: 144px;
    right: 25%;
    font-size: 4em;
  }
}


@media (max-width: 450px) {
  #themeToggle {
    top: 8px;
    right: 5px;
    font-size: 2.5em;
  }
}

.content-area {
  min-width: 0;
}

/* --- Bandcamp Embeds --- */
.media-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}


[data-theme="dark"] .light-theme-embed { display: none; }
[data-theme="dark"] .dark-theme-embed { display: block; }

[data-theme="light"] .dark-theme-embed { display: none; }
[data-theme="light"] .light-theme-embed { display: block; }

.bandcamp-wrapper {
  width: 100%;
}

.bandcamp-embed {
  display: block;
  border: 0;
  width: 100%;
  height: 274px;
  max-width: 700px;
  min-width: 320px;
  box-sizing: border-box;
  border: 1px solid var(--border-color) !important;
}



/* --- Works Section --- */
.work-title {
  text-transform: uppercase;
}

/* --- Footer --- */
footer {
  max-width: var(--max-width);
  margin: 60px auto 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.9em;
}

/* --- Responsive Layout --- */
@media (max-width: 850px) {
  .page-container {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .content-section {
    margin-bottom: 25px;
  }

  .page-header { order: 1; margin-bottom: 15px; }
  #bio { order: 2; }
  
  .infobox {
    order: 3;
    position: static;
    max-width: 400px;
    margin: 10px auto 30px auto;
  }
  
  #examples { 
    order: 4;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
  }
  
  .bandcamp-embed {
    max-width: 100%;
    min-width: 0;
  }

  #works { 
    order: 5; 
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
  }
  #links { order: 6; }
}