* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', serif;
  background-color: #eef6f9;
  color: #2b3a42;
  line-height: 1.7;
  padding: 2rem;
  position: relative;
  overflow-x: hidden;
}

/* Background Pattern Overlay */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: radial-gradient(#23667ce2 1px, transparent 2px);
  background-size: 20px 20px;
  opacity: 0.3;
  pointer-events: none;
  transition: background-color 0.4s ease, opacity 0.4s ease;
  animation: driftBackground 15s linear infinite;;
}

body.noscroll {
  overflow: hidden;
}

body, .container, .tab-button, blockquote, ul, .dark-mode-button {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

body.preload *,
body.preload {
  transition: none !important;
}

::-webkit-scrollbar{
  display: none;
}

.name, .subtitle {
  transition: color 0.4s ease;
}

.container {
  max-width: 700px;
  margin: auto;
  background-color: #ffffff;
  border: 1px solid #c5dfea;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 42, 66, 0.1);
}

.profile {
  text-align: center;
  margin-bottom: 2rem;
}

.portrait {
  width: 280px;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 8px rgba(0, 42, 66, 0.15);
}

.name {
  font-size: 2.4rem;
  color: #3c5f72;
}

.subtitle {
  font-style: italic;
  color: #6c8a99;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.tabs {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
}

.tab-button {
  flex-grow: 1;
  padding: 0.7rem;
  border: none;
  background-color: #dceef5;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.4s;
  font-family: 'Georgia', serif;
  color: #2b3a42;
}

.tab-button:hover {
  background-color: #c7e2f0;
}

.tab-button.active {
  background-color: #a9d3e8;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

blockquote {
  margin: 1rem 0;
  font-style: italic;
  border-left: 3px solid #90bcd1;
  padding-left: 1rem;
  color: #4b6f7c;
}

ul {
  padding-left: 1.5rem;
  list-style-type: square;
  color: #2b3a42;
}

li {
  margin-bottom: 10px;
}

footer {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  padding: 20px;
  margin-bottom: -2em;
  font-size: 0.9rem;
}

footer p {
  color: #2d363d;
  text-shadow: 0 4px 8px rgba(0, 42, 66, 0.15);
}

footer a {
  text-decoration: none;
  color: #007acc;
  transition: color 0.3s ease;
}

footer a:hover {
  color: #53baff;
}

.dark-mode-button img{
  width: 3em;
  height: 3em;
}

.dark-mode-button {
  position: absolute;
  padding: 0.5rem 0.5rem;
  font-weight: bold;
  border: none;
  width: 4.3em;
  height: 4.3em;
  background-color: #a9d3e8;
  color: #2b3a42;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.dark-mode-button:hover {
  background-color: #90bcd1;
}

/* DARK THEME SUPPORT */
[data-theme="dark"] body {
  background-color: #1b1f23;
  color: #d3e0e9;
}

@keyframes driftBackground {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 100px 100px;
  }
}

[data-theme="dark"] body::before {
  background-image: radial-gradient(#e0e0e0c9 1px, transparent 2px);
  animation: driftBackground 15s linear infinite;
  opacity: 0.15;
  pointer-events: none;
}

[data-theme="dark"] .container {
  background-color: #2a2f36;
  border-color: #3f4952;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .name {
  color: #9ec9e9;
}

[data-theme="dark"] .subtitle {
  color: #8aa9bd;
}

[data-theme="dark"] .tab-button {
  background-color: #3c4857;
  color: #d3e0e9;
}

[data-theme="dark"] .tab-button:hover {
  background-color: #495a6b;
}

[data-theme="dark"] .tab-button.active {
  background-color: #607289;
}

[data-theme="dark"] blockquote {
  color: #b2cadb;
  border-left-color: #6689a6;
}

[data-theme="dark"] ul {
  color: #d3e0e9;
}

[data-theme="dark"] footer {
  color: #d3e0e9;
}

[data-theme="dark"] footer a {
  color: #607289;
}

[data-theme="dark"] footer a:hover {
  color: #839dbf;
}

[data-theme="dark"] footer p {
  color: #d3e0e9ec;
}

[data-theme="dark"] .dark-mode-button {
  background-color: #495a6b;
  color: #ffffff;
}

/* ========== Clinical Log Modal Redesign ========== */
.log-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 10, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  font-family: 'IBM Plex Mono', monospace;
}

.log-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.log-modal-content {
  display: flex;
  width: 95%;
  max-width: 1080px;
  height: 90%;
  background-color: var(--background);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  border-radius: 4px;
}

.log-sidebar {
  width: 220px;
  background-color: var(--secondary);
  border-right: 1px solid var(--accent);
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.log-sidebar h2 {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--text);
}

.species-tabs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.species-tabs li {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--text);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.species-tabs li:hover {
  background-color: var(--highlight);
}

.species-tabs li.active {
  background-color: var(--highlight);
  border-left: 3px solid var(--accent);
  font-weight: bold;
}

.log-main {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background-color: var(--background);
}

.log-main p {
  min-width: 780px;
}

.species-data {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.species-data.active {
  display: block;
}

.species-data h3 {
  font-size: 1.1rem;
  font-weight: 500;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}

section {
  margin-bottom: 1.5rem;
}

section h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

section p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  max-width: 700px;
  text-align: left;
}

.close-button {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  font-size: 1.2rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.2rem;
  transition: opacity 0.2s ease;
}

.close-button:hover {
  opacity: 0.6;
}

.wren-portrait {
  cursor: pointer;
  max-width: 280px;
  border: 1px solid #80b4e5;
  border-radius: 12px;
  display: flex;
  margin: 0.5rem auto;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 42, 66, 0.15);
}

.wren-portrait:hover {
  transform: scale(1.015);
}

/* Responsive Behavior */
@media (max-width: 768px) {

  html, body {
    margin: 0;
    padding: 0;
    width: 103%;
    overflow-x: hidden;
  }

  body {
    font-family: 'Georgia', serif;
    background-color: #eef6f9;
    color: #2b3a42;
    line-height: 1.7;
    padding: 2rem;
    position: relative;
  }

  .container {
    max-width: 710px; /* 10px wider */
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #c5dfea;
    padding: 2rem;
    margin-left: -0.83em;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 42, 66, 0.1);
    box-sizing: border-box; /* prevents padding from increasing total width */
  }

  .wren-portrait {
    display: flex;
    max-width: 300px;
    position: relative;
    margin: 0.5em;
    left: 2%;
  }

  .log-modal-content {
    flex-direction: column;
    height: 95%;
  }

  .log-sidebar {
    width: 100%;
    height: 30%;
    border-right: none;
    border-bottom: 1px solid var(--accent);
  }

  .log-main {
    padding: 1.2rem;
    height: 70%;
  }

  .dark-mode-button {
    margin-bottom: 1rem;
    position: fixed;
    top: 6%; left: 4.4%;
    padding: 0.5rem 0.5rem;
    font-weight: bold;
    border: none;
    width: 4.3em;
    height: 4.3em;
    background-color: #a9d3e8;
    color: #2b3a42;
    border-radius: 999px;
    z-index: 0.5;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }

  section p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    max-width: 700px;
    text-align: center;
  }

    .log-summary {
    font-style: italic;
    font-size: 0.95rem;
    margin: 0 0 2rem;
    color: var(--text-secondary);
    padding-right: 1rem;
    line-height: 1.6;
  }

  .log-main p {
    min-width: auto;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

:root[data-theme='light'] {
  --background: #f6faff;
  --text: #0a0a0a;
  --secondary: #dce7f2;
  --accent: #5b9bd5;
  --highlight: #eef4fa;
}

:root[data-theme='dark'] {
  --background: #0c1117;
  --text: #e6f0ff;
  --secondary: #1a1f27;
  --accent: #66b3ff;
  --highlight: #1f2733;
}

.log-summary {
  font-style: italic;
  font-size: 0.8rem;
  margin: 0 0 2rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
  line-height: 1.6;
}


/* Details and summary styling */
details {
  border-left: 2px solid var(--accent-color);
  margin-bottom: 1rem;
  margin-top: 1rem;
  transition: border-color 0.3s ease;
}

summary {
  cursor: pointer;
  padding: 0.2rem 0;
  outline: none;
  list-style: none;
  position: relative;
  transition: color 0.3s ease;
}

summary:hover {
  color: #8395a7;
}

summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
  color: var(--accent-color);
}

details[open] summary::before {
  transform: rotate(90deg);
}

/* Paragraph content inside details */
details p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--jukebox_details-bottom);
  padding-bottom: 1rem;
  width: fit-content;
}

/* Smooth fade on opening details (no delay on page load) */
details[open] p {
  animation: fadeIn 0.3s ease;
}