/* Default variables — fallback if none selected */
:root {
  --bg: #272822;
  --text: #f8f8f2;
  --accent: #a6e22e;
  --subtext: #75715e;
  --header-bg: #1e1f1c;
  --header-text: #a6e22e;
  --card-bg: #1e1f1c;
  --border: #444;
}

/* Base styles */
html {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0 1rem;
  transition: background 0.3s, color 0.3s;
  max-width: 960px;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  overflow-x: hidden;
}

@media (max-width: 600px) {
  body { width: 96%; padding: 0 0.4rem; }
}

/* Header & Navigation */
header {
  background: var(--header-bg);
  padding-left: 1rem;
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin-right: 1rem;
  font-family: 'Archivo', 'Segoe UI', sans-serif;
}

nav h1 {
  font-size: 1.5rem;
  color: var(--header-text);
  margin-left: 0.5rem;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin-right: 1rem;
}

nav ul li a {
  text-decoration: none;
  color: var(--header-text);
  font-weight: bold;
  transition: color 0.2s ease;
}

nav ul li a:hover {
  color: var(--subtext);
}

/* Main Content */
main {
  max-width: 960px;
  margin: 0.5rem auto;
}

section {
  margin-bottom: 3rem;
  display: none;
}

#hero {
  margin-bottom: 0.5rem;
}

#hero h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

h2.section {
  text-align: left;
}

#hero p {
  font-size: 1.1rem;
  color: var(--subtext);
}

/* Projects */
.project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .project-list { grid-template-columns: 1fr; }
}

.project-list-full {
  padding-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(1, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--card-bg);
  padding-top: 0.1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 1rem;
  border: 1px solid var(--border);
  color: var(--text);
}

.project-card h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
  margin-top: 0.8rem;
}

.content-padded {
  padding-left: 2rem;
  padding-right: 2rem;
  text-align: justify;
}

/* Markdown rendered prose */
.md h1, .md h2, .md h3,
#article-content h1, #article-content h2, #article-content h3,
#literature-content h1, #literature-content h2, #literature-content h3 {
  color: var(--accent);
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}
.md p, #article-content p, #literature-content p {
  margin-bottom: 1rem;
  line-height: 1.8;
}
.md ul, .md ol, #article-content ul, #article-content ol,
#literature-content ul, #literature-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--subtext);
  line-height: 2;
}
.md blockquote, #article-content blockquote, #literature-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--subtext);
  font-style: italic;
  margin: 1.5rem 0;
}
.md code, #article-content code, #literature-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--accent);
  background: var(--card-bg);
  padding: 1px 5px;
  border: 1px solid var(--border);
}
.md pre, #article-content pre, #literature-content pre {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.md pre code, #article-content pre code, #literature-content pre code {
  background: none;
  border: none;
  padding: 0;
}
.md hr, #article-content hr, #literature-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* SeqViz sequence viewer */
.seqviz-wrapper {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  background: var(--card-bg);
  overflow: hidden;
}

seq-viz {
  display: block;
  width: 100%;
  height: 300px;
}

.seq-fallback {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--subtext);
  padding: 1rem;
  overflow-x: auto;
  margin: 0;
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.8;
}

/* Chemical structure diagrams (SmilesDrawer) */
.smiles-target, .smiles {
  margin: 1.5rem 0;
  display: flex;
  justify-content: flex-start;
}
.smiles-canvas {
  border: 1px solid var(--border);
  background: var(--card-bg);
  max-width: 100%;
}

/* Contact Links */
.contact-span {}
.contact-card {}

/* Footer */
footer {
  padding: 1.25rem 0;
  font-size: 0.9rem;
  color: var(--subtext);
  border-top: 1px solid var(--border);
}

/* --- Optional Enhancements --- */

/* Lucide blocks icon before h3 */
h3::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  background-color: var(--accent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='7' height='7' rx='1'/%3E%3Crect x='15' y='2' width='7' height='7' rx='1'/%3E%3Crect x='2' y='15' width='7' height='7' rx='1'/%3E%3Crect x='15' y='15' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='7' height='7' rx='1'/%3E%3Crect x='15' y='2' width='7' height='7' rx='1'/%3E%3Crect x='2' y='15' width='7' height='7' rx='1'/%3E%3Crect x='15' y='15' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Themes via classes */
.theme-ivory-ink {
  --bg: #faf9f6;
  --text: #111111;
  --accent: #d63a00;
  --subtext: #666666;
  --header-bg: #111111;
  --header-text: #faf9f6;
  --card-bg: #ffffff;
  --border: #dddddd;
  --selectortext: #faf9f6;
}

.theme-cinder {
  --bg: #1a1208;
  --text: #e8dcc8;
  --accent: #d63a00;
  --subtext: #9a8c78;
  --header-bg: #111111;
  --header-text: #e8dcc8;
  --card-bg: #241a0a;
  --border: #3a2810;
  --selectortext: #e8dcc8;
}

