/* Base Reset */
body, h1, h2, p, button {
  margin: 0;
  padding: 0;
  font-family: Palatino, Georgia, serif;
  line-height: 1.6;
  transition: all 0.3s ease;
}

/* Layout */
body {
  max-width: 800px;
  margin: 5vh auto;
  padding: 0 5vw;
}

/* Responsive Typography */
h1 {
  font-size: clamp(2em, 5vw, 2.5em);
}
h2 {
  font-size: clamp(1.5em, 4vw, 1.8em);
}
p, .section p {
  font-size: clamp(1em, 3.5vw, 1.05em);
}

/* Theme: Dark Mode */
body.dark {
  background-color: #121212;
  background-image: linear-gradient(to bottom, #121212, #1e1e1e);
  color: #e0e0e0;
}

body.dark header h1,
body.dark .section h2,
body.dark .section p,
body.dark .footer {
  color: #e0e0e0;
}

body.dark .section h2 {
  border-bottom: 2px dashed #555;
}

body.dark .section p:hover {
  background-color: #1a1a1a;
}

body.dark .footer {
  border-top: 1px solid #444;
}

body.dark .footer::after {
  content: "🛠️ Handlebar-tested. Corona-approved.";
  display: block;
  margin-top: 10px;
  font-size: 0.8em;
  color: #666;
}

/* Theme: Light Mode */
body.light {
  background-color: #f4f1e9;
  background-image: linear-gradient(to bottom, #f4f1e9, #e8e5dc);
  color: #3a3a3a;
}

body.light header h1,
body.light .section h2,
body.light .section p,
body.light .footer {
  color: #3a3a3a;
}

body.light .section h2 {
  border-bottom: 2px dashed #999;
}

body.light .section p:hover {
  background-color: #f0ede4;
}

body.light .footer {
  border-top: 1px solid #bbb;
}

body.light .footer::after {
  content: "☀️ Powered by Daylight Delusion.";
  display: block;
  margin-top: 10px;
  font-size: 0.8em;
  color: #666;
}

/* Link Styling */
a {
  text-decoration: none;
  transition: color 0.3s ease, border-bottom 0.3s ease, transform 0.2s ease;
  border-bottom: 1px dotted;
  position: relative;
}

a:hover {
  transform: translateY(-1px);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

a:hover::after {
  transform: scaleX(1);
}

body.dark a {
  color: #66ccff;
  border-bottom-color: #66ccff;
}
body.dark a:hover {
  color: #ffffff;
  text-shadow: 0 0 4px #66ccff;
  border-bottom: 1px solid #ffffff;
}
body.dark a:visited {
  color: #99ccff;
  border-bottom-color: #99ccff;
}

body.light a {
  color: #0066cc;
  border-bottom-color: #0066cc;
}
body.light a:hover {
  color: #000000;
  border-bottom: 1px solid #000000;
}
body.light a:visited {
  color: #663399;
  border-bottom-color: #663399;
}

/* Header */
header h1 {
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 1px 1px #333;
  border-bottom: 2px solid;
  padding-bottom: 10px;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid;
  animation: typewriter 3s steps(30) 1s forwards;
}

/* Sections */
.section h2 {
  margin-bottom: 10px;
  padding-bottom: 5px;
}
.section p {
  margin-bottom: 20px;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.9em;
  margin-top: 40px;
  padding-top: 20px;
}

/* Toggle Button */
#theme-toggle {
  display: block;
  margin: 0 auto 20px auto;
  padding: 12px 24px;
  font-size: 1em;
  background-color: #444;
  color: #eee;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-family: Georgia, serif;
  touch-action: manipulation;
}

body.light #theme-toggle {
  background-color: #ccc;
  color: #222;
}

/* Monospaced Elements */
.code,
.thesis,
.meta,
.cli {
  font-family: 'Courier New', Courier, monospace;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95em;
  display: inline-block;
}

body.light .code,
body.light .thesis,
body.light .meta,
body.light .cli {
  background-color: #eae7dd;
  color: #3a3a3a;
}

/* Code Blocks */
pre.code-block {
  font-family: 'Courier New', Courier, monospace;
  background-color: #1a1a1a;
  color: #e0e0e0;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.5em;
}

body.light pre.code-block {
  background-color: #f0ede4;
  color: #3a3a3a;
}

pre, code {
  font-family: Consolas, Monaco, 'Courier New', monospace;
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-left: 4px solid #6c6c6c;
  padding: 0.75em 1em;
  margin: 1em 0;
  overflow-x: auto;
  border-radius: 4px;
  color: #333;
}

/* Link Icons */
.link-icons {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.1em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.link-icons a {
  padding: 8px 12px;
  border-radius: 4px;
}

body.dark .link-icons a:hover {
  background-color: #1a1a1a;
}
body.light .link-icons a:hover {
  background-color: #e0e0e0;
}

/* External Link Icon */
a.external::after {
  content: " 🔗";
  font-size: 0.9em;
}

/* Typewriter Animation */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

/* Media Queries */
@media (max-width: 600px) {
  body {
    padding: 0 4vw;
  }
  header h1 {
    font-size: 2em;
    border-right: none;
    animation: none;
  }
  .section h2 {
    font-size: 1.4em;
  }
  #theme-toggle {
    width: 100%;
    font-size: 1em;
  }
}
