/* ===== CSS Custom Properties ===== */
:root {
  /* Light mode - starstrike.ai palette */
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1a0d1a;
  --text-muted: #6b5c6b;
  --accent: #461248;
  --accent-hover: #a93747;
  --border: rgba(70, 18, 72, 0.08);
  --code-bg: #faf5f8;

  /* Gradient colors - starstrike.ai brand */
  --star-deep: #461248;
  --star-crimson: #a93747;
  --star-peach: #f2a15f;
  --gradient-text: linear-gradient(135deg, var(--star-deep) 0%, var(--star-crimson) 50%, var(--star-peach) 100%);
  --gradient-soft-bg: linear-gradient(135deg, rgba(70, 18, 72, 0.04) 0%, rgba(169, 55, 71, 0.04) 50%, rgba(242, 161, 95, 0.04) 100%);
  --gradient-accent-line: linear-gradient(90deg, var(--star-deep) 0%, var(--star-crimson) 50%, var(--star-peach) 100%);
  --gradient-radial-glow: radial-gradient(ellipse at top center, rgba(169, 55, 71, 0.08) 0%, transparent 60%);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-size-base: 17px;
  --line-height-body: 1.7;
  --line-height-heading: 1.3;
  --max-width: 680px;
  --letter-spacing: 0.01em;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --bg: #0f0a10;
  --surface: #1a1018;
  --text: #f0eaef;
  --text-muted: #a89ca8;
  --accent: #e8a0eb;
  --accent-hover: #f2a15f;
  --border: rgba(242, 161, 95, 0.15);
  --code-bg: #1e1620;
  --gradient-text: linear-gradient(135deg, #e8a0eb 0%, var(--star-peach) 50%, #ffd699 100%);
  --gradient-soft-bg: linear-gradient(135deg, rgba(232, 160, 235, 0.08) 0%, rgba(242, 161, 95, 0.08) 50%, rgba(242, 161, 95, 0.06) 100%);
  --gradient-radial-glow: radial-gradient(ellipse at top center, rgba(169, 55, 71, 0.15) 0%, transparent 60%);
}

[data-theme="dark"] ::selection {
  background: #a93747;
  color: #f0eaef;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: #f2a15f;
  color: #461248;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.2rem;
}

h2 {
  font-size: 1.6rem;
  margin-top: 2em;
}

h3 {
  font-size: 1.3rem;
  margin-top: 1.5em;
}

h4 {
  font-size: 1.1rem;
  margin-top: 1.25em;
}

p {
  margin-bottom: 1.5em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

strong {
  font-weight: 600;
}

/* ===== Layout ===== */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  position: relative;
}

main::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  right: -50%;
  height: 300px;
  background: var(--gradient-radial-glow);
  pointer-events: none;
  z-index: -1;
}

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent-line);
}

.header-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.2s ease;
}

.site-title:hover {
  opacity: 0.8;
}

/* ===== Header Actions ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.rss-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  color: var(--text-muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.rss-link:hover {
  color: var(--text);
  background-color: var(--border);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease, background-color 0.2s ease;
  border-radius: 4px;
}

.theme-toggle:hover {
  color: var(--text);
  background-color: var(--border);
}

.theme-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 20px;
  height: 20px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent-line);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-content>p {
  margin-bottom: 0;
}

/* ===== Post List ===== */
.post-list {
  list-style: none;
}

.post-item {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.post-card {
  display: block;
  padding: 1rem;
  margin: -1rem;
  transition: background 0.3s ease, transform 0.3s ease;
}

.post-card:hover {
  background: var(--gradient-soft-bg);
  transform: translateY(-2px);
}

.post-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin-bottom: 0.25rem;
  transition: transform 0.3s ease;
}

.post-card:hover .post-image {
  transform: scale(1.02);
}

.post-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  transition: all 0.3s ease;
}

.post-card:hover .post-title {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.post-description {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ===== Single Post ===== */
.post-header {
  margin-bottom: 2rem;
}

.post-header .post-title {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.post-header .post-meta {
  margin-bottom: 1.5rem;
}

.post-featured-image {
  width: 100%;
  margin-bottom: 0.75rem;
}

.post-content {
  margin-bottom: 3rem;
}

.post-content>*:first-child {
  margin-top: 0;
}

.post-content>*:last-child {
  margin-bottom: 0;
}

/* Lists in content */
.post-content ul,
.post-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: 0.5em;
}

/* Blockquotes */
.post-content blockquote {
  border-left: none;
  padding-left: 1.25rem;
  margin: 1.5em 0;
  color: var(--text-muted);
  font-style: italic;
  position: relative;
}

.post-content blockquote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-accent-line);
  background: linear-gradient(180deg, var(--star-deep) 0%, var(--star-crimson) 50%, var(--star-peach) 100%);
  border-radius: 3px;
}

/* Images in content */
.post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
}

/* ===== Code Blocks ===== */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
}

pre {
  background: var(--code-bg);
  padding: 1.25rem;
  padding-top: calc(1.25rem + 3px);
  overflow-x: auto;
  margin: 1.5em 0;
  border: 1px solid var(--border);
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent-line);
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Syntax highlighting overrides */
.highlight {
  margin: 1.5em 0;
}

.highlight pre {
  margin: 0;
}

/* Chroma syntax highlighting - Light mode (monokailight-inspired) */
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #272822 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #272822 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */

/* Chroma syntax highlighting - Dark mode (monokai) */
[data-theme="dark"] .highlight .c { color: #8c8c8c } /* Comment */
[data-theme="dark"] .highlight .err { color: #f92672 } /* Error */
[data-theme="dark"] .highlight .k { color: #f92672 } /* Keyword */
[data-theme="dark"] .highlight .l { color: #ae81ff } /* Literal */
[data-theme="dark"] .highlight .n { color: #f8f8f2 } /* Name */
[data-theme="dark"] .highlight .o { color: #f92672 } /* Operator */
[data-theme="dark"] .highlight .p { color: #f8f8f2 } /* Punctuation */
[data-theme="dark"] .highlight .ch { color: #8c8c8c } /* Comment.Hashbang */
[data-theme="dark"] .highlight .cm { color: #8c8c8c } /* Comment.Multiline */
[data-theme="dark"] .highlight .cp { color: #8c8c8c } /* Comment.Preproc */
[data-theme="dark"] .highlight .cpf { color: #8c8c8c } /* Comment.PreprocFile */
[data-theme="dark"] .highlight .c1 { color: #8c8c8c } /* Comment.Single */
[data-theme="dark"] .highlight .cs { color: #8c8c8c } /* Comment.Special */
[data-theme="dark"] .highlight .gd { color: #f92672 } /* Generic.Deleted */
[data-theme="dark"] .highlight .ge { font-style: italic } /* Generic.Emph */
[data-theme="dark"] .highlight .gi { color: #a6e22e } /* Generic.Inserted */
[data-theme="dark"] .highlight .gs { font-weight: bold } /* Generic.Strong */
[data-theme="dark"] .highlight .gu { color: #8c8c8c } /* Generic.Subheading */
[data-theme="dark"] .highlight .kc { color: #66d9ef } /* Keyword.Constant */
[data-theme="dark"] .highlight .kd { color: #66d9ef } /* Keyword.Declaration */
[data-theme="dark"] .highlight .kn { color: #f92672 } /* Keyword.Namespace */
[data-theme="dark"] .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
[data-theme="dark"] .highlight .kr { color: #66d9ef } /* Keyword.Reserved */
[data-theme="dark"] .highlight .kt { color: #66d9ef } /* Keyword.Type */
[data-theme="dark"] .highlight .ld { color: #e6db74 } /* Literal.Date */
[data-theme="dark"] .highlight .m { color: #ae81ff } /* Literal.Number */
[data-theme="dark"] .highlight .s { color: #e6db74 } /* Literal.String */
[data-theme="dark"] .highlight .na { color: #a6e22e } /* Name.Attribute */
[data-theme="dark"] .highlight .nb { color: #f8f8f2 } /* Name.Builtin */
[data-theme="dark"] .highlight .nc { color: #a6e22e } /* Name.Class */
[data-theme="dark"] .highlight .no { color: #66d9ef } /* Name.Constant */
[data-theme="dark"] .highlight .nd { color: #a6e22e } /* Name.Decorator */
[data-theme="dark"] .highlight .ni { color: #f8f8f2 } /* Name.Entity */
[data-theme="dark"] .highlight .ne { color: #a6e22e } /* Name.Exception */
[data-theme="dark"] .highlight .nf { color: #a6e22e } /* Name.Function */
[data-theme="dark"] .highlight .nl { color: #f8f8f2 } /* Name.Label */
[data-theme="dark"] .highlight .nn { color: #f8f8f2 } /* Name.Namespace */
[data-theme="dark"] .highlight .nx { color: #a6e22e } /* Name.Other */
[data-theme="dark"] .highlight .py { color: #f8f8f2 } /* Name.Property */
[data-theme="dark"] .highlight .nt { color: #f92672 } /* Name.Tag */
[data-theme="dark"] .highlight .nv { color: #f8f8f2 } /* Name.Variable */
[data-theme="dark"] .highlight .ow { color: #f92672 } /* Operator.Word */
[data-theme="dark"] .highlight .w { color: #f8f8f2 } /* Text.Whitespace */
[data-theme="dark"] .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
[data-theme="dark"] .highlight .mf { color: #ae81ff } /* Literal.Number.Float */
[data-theme="dark"] .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
[data-theme="dark"] .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
[data-theme="dark"] .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
[data-theme="dark"] .highlight .sa { color: #e6db74 } /* Literal.String.Affix */
[data-theme="dark"] .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
[data-theme="dark"] .highlight .sc { color: #e6db74 } /* Literal.String.Char */
[data-theme="dark"] .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
[data-theme="dark"] .highlight .sd { color: #e6db74 } /* Literal.String.Doc */
[data-theme="dark"] .highlight .s2 { color: #e6db74 } /* Literal.String.Double */
[data-theme="dark"] .highlight .se { color: #ae81ff } /* Literal.String.Escape */
[data-theme="dark"] .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
[data-theme="dark"] .highlight .si { color: #e6db74 } /* Literal.String.Interpol */
[data-theme="dark"] .highlight .sx { color: #e6db74 } /* Literal.String.Other */
[data-theme="dark"] .highlight .sr { color: #e6db74 } /* Literal.String.Regex */
[data-theme="dark"] .highlight .s1 { color: #e6db74 } /* Literal.String.Single */
[data-theme="dark"] .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
[data-theme="dark"] .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
[data-theme="dark"] .highlight .fm { color: #a6e22e } /* Name.Function.Magic */
[data-theme="dark"] .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
[data-theme="dark"] .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
[data-theme="dark"] .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
[data-theme="dark"] .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
[data-theme="dark"] .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */

/* ===== Back Link ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  transition: all 0.2s ease;
}

.back-link:hover {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  html {
    font-size: 17px;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .post-header .post-title {
    font-size: 1.8rem;
  }

  .post-image {
    height: 160px;
  }
}