@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400;1,700&family=Montserrat:wght@900&display=swap');
@import "tailwindcss";

/* ============================================
   Overreacted.io-inspired Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --font-serif: 'Merriweather', Georgia, serif;
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Light mode (default) */
  --text: #222;
  --title: #222;
  --bg: #ffffff;
  --link: #d23669;
  --code-bg: #232936;
  --inline-code-bg: rgba(255, 229, 100, 0.2);
  --inline-code-text: #1a1a1a;
  --pink: #d23669;
  --purple: #4a3272;
  --meta: #555;
  --hr: hsla(0, 0%, 0%, 0.2);
  --blockquote-border: #d23669;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: rgba(255, 255, 255, 0.88);
    --title: #ffffff;
    --bg: rgb(40, 44, 53);
    --link: #ffa7c4;
    --code-bg: #191d27;
    --inline-code-bg: rgba(115, 124, 153, 0.2);
    --inline-code-text: #e6e6e6;
    --pink: #ffa7c4;
    --purple: #c4a7ff;
    --meta: rgba(255, 255, 255, 0.6);
    --hr: hsla(0, 0%, 100%, 0.2);
    --blockquote-border: #ffa7c4;
  }

  html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* --- Base Styles --- */
html {
  font-family: var(--font-serif);
  color: var(--text);
  background-color: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  transition: background-color 0.3s ease;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

a:hover {
  opacity: 0.85;
}

/* --- Layout Container --- */
.blog-container {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

/* --- Header --- */
.blog-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3.5rem;
}

.blog-title-link {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--pink);
  text-decoration: none;
  transition: transform 0.15s ease-out;
  display: inline-block;
}

.blog-title-link:hover {
  transform: scale(1.02);
  opacity: 1;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.blog-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--meta);
}

.blog-author img {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
}

/* --- Home Page Post List --- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  top: -10px;
}

.post-list-item {
  display: block;
  padding: 1rem 0;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease-out;
}

.post-list-item:hover {
  transform: scale(1.005);
  opacity: 1;
}

.post-list-item:active {
  transform: scale(1);
  opacity: 0.7;
}

.post-list-title {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.3;
  color: var(--pink);
  margin: 0 0 0.25rem 0;
}

.post-list-meta {
  font-size: 0.8125rem;
  color: var(--meta);
  margin: 0 0 0.5rem 0;
}

.post-list-excerpt {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* --- Individual Post Page --- */
.post-article-title {
  font-family: var(--font-sans);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--title);
  margin: 0 0 0.25rem 0;
}

.post-article-meta {
  font-size: 0.8125rem;
  color: var(--meta);
  margin: 0 0 0.5rem 0;
}

/* --- Markdown Content --- */
.markdown {
  margin-top: 2.5rem;
  font-size: 1.0625rem;
  line-height: 1.8;
}

.markdown h2 {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--title);
  margin: 2.5rem 0 1rem 0;
  line-height: 1.3;
}

.markdown h3 {
  font-family: var(--font-sans);
  font-size: 1.375rem;
  font-weight: 900;
  color: var(--title);
  margin: 2rem 0 0.75rem 0;
  line-height: 1.4;
}

.markdown h4 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 900;
  color: var(--title);
  margin: 1.5rem 0 0.5rem 0;
}

.markdown p {
  margin: 0 0 1.5rem 0;
}

.markdown ul,
.markdown ol {
  margin: 0 0 1.5rem 0;
  padding-left: 1.75rem;
}

.markdown li {
  margin-bottom: 0.5rem;
}

.markdown li > ul,
.markdown li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.markdown blockquote {
  margin: 1.5rem 0;
  padding: 0 1.25rem;
  border-left: 3px solid var(--blockquote-border);
  font-style: italic;
  color: var(--meta);
}

.markdown blockquote p:last-child {
  margin-bottom: 0;
}

.markdown hr {
  border: none;
  height: 1px;
  background: var(--hr);
  margin: 2.5rem 0;
}

.markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.markdown a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* Code blocks */
.markdown pre {
  background: var(--code-bg);
  color: #e6e6e6;
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.markdown pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.markdown code {
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Syntax highlighting (Rouge) */
.markdown .highlight .k,
.markdown .highlight .kd,
.markdown .highlight .kn,
.markdown .highlight .kp,
.markdown .highlight .kr,
.markdown .highlight .kt { color: #c792ea; }

.markdown .highlight .s,
.markdown .highlight .s1,
.markdown .highlight .s2,
.markdown .highlight .se { color: #c3e88d; }

.markdown .highlight .mi,
.markdown .highlight .mf,
.markdown .highlight .mh,
.markdown .highlight .mo { color: #f78c6c; }

.markdown .highlight .c,
.markdown .highlight .c1,
.markdown .highlight .cm,
.markdown .highlight .cs { color: #697098; font-style: italic; }

.markdown .highlight .na,
.markdown .highlight .nb { color: #82aaff; }

.markdown .highlight .nf,
.markdown .highlight .nx { color: #82aaff; }

.markdown .highlight .nn,
.markdown .highlight .nc { color: #ffcb6b; }

.markdown .highlight .o,
.markdown .highlight .ow { color: #89ddff; }

.markdown .highlight .p { color: #89ddff; }

.markdown .highlight .err { color: #ff5370; }

/* Tables */
.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.markdown th {
  font-family: var(--font-sans);
  font-weight: 900;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--hr);
}

.markdown td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--hr);
}

/* --- Post Footer --- */
.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hr);
}

/* --- Admin Styles --- */
.admin-container {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--hr);
}

.admin-header h1 {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--title);
  margin: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.admin-table th {
  font-family: var(--font-sans);
  font-weight: 900;
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 2px solid var(--hr);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--meta);
}

.admin-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--hr);
  vertical-align: middle;
}

.admin-table td a {
  font-size: 0.875rem;
}

/* Form styles */
.admin-form {
  max-width: 42rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--meta);
  margin-bottom: 0.375rem;
}

.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text);
  background-color: var(--bg);
  border: 1px solid var(--hr);
  border-radius: 4px;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--link);
}

.form-group textarea {
  min-height: 400px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
}

.form-errors {
  background: rgba(255, 0, 0, 0.08);
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #d23669;
}

.form-errors ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  border: none;
}

.btn:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.btn-primary {
  background: var(--link);
  color: #ffffff;
}

.btn-secondary {
  background: transparent;
  color: var(--link);
  border: 1px solid var(--link);
}

.btn-danger {
  background: transparent;
  color: #d23669;
  border: 1px solid #d23669;
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
}

.btn-small {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
}

/* --- Flash Messages --- */
.flash-notice {
  background: rgba(100, 200, 100, 0.1);
  border: 1px solid rgba(100, 200, 100, 0.3);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.flash-alert {
  background: rgba(255, 0, 0, 0.08);
  border: 1px solid rgba(255, 0, 0, 0.2);
  color: #d23669;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

/* --- Responsive --- */
@media (max-width: 672px) {
  .post-article-title {
    font-size: 2rem;
  }

  .post-list-title {
    font-size: 1.5rem;
  }

  .blog-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 550px) {
  .post-article-title {
    font-size: 1.75rem;
  }

  .post-list-title {
    font-size: 1.25rem;
  }

  .markdown pre {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    border-radius: 0;
    padding: 1rem 1.25rem;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
