/* === COLOR VARIABLES === */
:root {
  --bg-color: #f7fafc;
  --text-color: #1a202c;
  --link-color: #3182ce;
  --link-hover: #2b6cb0;
  --code-bg: #e2e8f0;
  --blockquote-bg: #edf2f7;
  --table-border: #cbd5e0;
  --button-bg: #3182ce;
  --button-text: #ffffff;
}

[data-theme="dark"] {
  --bg-color: #1a202c;
  --text-color: #f7fafc;
  --link-color: #63b3ed;
  --link-hover: #4299e1;
  --code-bg: #2d3748;
  --blockquote-bg: #2d3748;
  --table-border: #4a5568;
  --button-bg: #63b3ed;
  --button-text: #1a202c;
}

/* System dark preference only if no data-theme set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-color: #1a202c;
    --text-color: #f7fafc;
    --link-color: #63b3ed;
    --link-hover: #4299e1;
    --code-bg: #2d3748;
    --blockquote-bg: #2d3748;
    --table-border: #4a5568;
    --button-bg: #63b3ed;
    --button-text: #1a202c;
  }
}

/* === BASE STYLES === */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Inter", sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 2rem;
  transition: background 0.3s, color 0.3s;
}

h1,h2,h3,h4,h5,h6 { margin: 1.5rem 0 1rem; font-weight:700; }
p { margin-bottom: 1rem; }
a { color: var(--link-color); text-decoration: underline; transition: color 0.3s; }
a:hover { color: var(--link-hover); }

/* INLINE CODE */
p code {
  background-color: var(--code-bg);
  color: var(--text-color);
  font-family: "Fira Code", monospace;
  font-size: 0.875rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  transition: background 0.3s, color 0.3s;
}

/* CODE BLOCKS */
pre {
  background-color: var(--code-bg);
  color: var(--text-color);
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: background 0.3s, color 0.3s;
}
pre code { display:block; background:none; padding:0; color:inherit; }

/* BLOCKQUOTES */
blockquote {
  background-color: var(--blockquote-bg);
  border-left: 4px solid var(--link-color);
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 0.25rem;
}

/* LISTS */
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }

/* TABLES */
table { width:100%; border-collapse: collapse; margin-bottom:1rem; }
th, td { border:1px solid var(--table-border); padding:0.75rem; text-align:left; }
th { background-color: var(--blockquote-bg); }

/* BUTTONS */
button {
  background-color: var(--button-bg);
  color: var(--button-text);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}
button:hover { opacity:0.85; }

/* PROSE */
.prose { max-width:65ch; margin:0 auto; }

/* === iOS-style Toggle Switch === */
.theme-switch {
/*  position: fixed;
  top: 20px;
  right: 20px;
  display: inline-block; */
  width: 60px;
  height: 34px;
}
.theme-switch input { display: none; }
.theme-switch .slider {
  position: absolute;
  cursor: pointer;
  top:0; left:0; right:0; bottom:0;
  background: linear-gradient(135deg,#f0f0f0,#dcdcdc); /* light default */
  border-radius:34px;
  transition: 0.4s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.theme-switch .slider:before {
  content:"";
  position:absolute;
  height:26px; width:26px;
  left:4px; bottom:4px;
  background:white;
  border-radius:50%;
  transition:0.4s;
  box-shadow:0 2px 4px rgba(0,0,0,0.3);
}
.theme-switch input:checked + .slider {
  background: linear-gradient(135deg,#4c6ef5,#1c3faa); /* dark gradient */
}
.theme-switch input:checked + .slider:before {
  transform: translateX(26px);
}

/* Card wrapper */
.card {
  background-color: var(--code-bg);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  overflow-x: auto;
}
