/* ==========================================================================
   MemoKee Blog Theme - Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables - Brand Colors & Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* MemoKee Brand Colors */
  --color-orange: #fdba21;
  --color-cyan: #6cc0d4;
  --color-teal: #256877;
  --color-teal-dark: #1d4f5c;

  /* Neutrals */
  --color-white: #ffffff;
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  /* Semantic Colors */
  --color-primary: var(--color-teal);
  --color-primary-dark: var(--color-teal-dark);
  --color-accent: var(--color-orange);
  --color-secondary: var(--color-cyan);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Layout */
  --max-width-content: 720px;
  --max-width-wide: 1200px;
  --max-width-full: 1400px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-slate-800);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-slate-900);
  margin: 0 0 var(--spacing-md);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin: 0 0 var(--spacing-lg);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.gh-viewport {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.gh-main {
  flex-grow: 1;
}

.gh-outer {
  padding: 0 var(--spacing-lg);
}

.gh-inner {
  max-width: var(--max-width-content);
  margin: 0 auto;
}

.gh-inner.wide {
  max-width: var(--max-width-wide);
}

.gh-inner.full {
  max-width: var(--max-width-full);
}

/* --------------------------------------------------------------------------
   5. Header
   -------------------------------------------------------------------------- */
.gh-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-slate-200);
  padding: var(--spacing-md) var(--spacing-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.gh-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  gap: var(--spacing-lg);
}

.gh-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.gh-logo img {
  height: 40px;
  width: auto;
}

/* Navigation - Fix Ghost's default ul/li structure */
.gh-nav {
  display: flex;
  align-items: center;
}

.gh-nav ul,
.gh-nav > ul {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-nav li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-nav a {
  color: var(--color-slate-600);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.gh-nav a:hover {
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.gh-btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.gh-btn-primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-white);
}

.gh-btn-accent {
  background: var(--color-orange);
  color: var(--color-slate-900);
}

.gh-btn-accent:hover {
  background: #e5a91e;
  color: var(--color-slate-900);
}

.gh-btn-large {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   7. Hero Section
   -------------------------------------------------------------------------- */
.gh-hero {
  background: linear-gradient(135deg, var(--color-teal) 0%, var(--color-teal-dark) 100%);
  color: var(--color-white);
  padding: var(--spacing-3xl) 0;
  text-align: center;
}

.gh-hero h1 {
  color: var(--color-white);
  font-size: var(--text-5xl);
  margin-bottom: var(--spacing-md);
}

.gh-hero-description {
  font-size: var(--text-xl);
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
}

.gh-hero-cta {
  font-size: var(--text-base);
  padding: var(--spacing-md) var(--spacing-xl);
}

.gh-hero-cta svg {
  transition: transform var(--transition-fast);
}

.gh-hero-cta:hover svg {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   8. Post Feed
   -------------------------------------------------------------------------- */
.gh-feed-section {
  padding: var(--spacing-3xl) 0;
}

.gh-feed-title {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
  color: var(--color-slate-900);
}

.gh-feed {
  display: grid;
  gap: var(--spacing-xl);
}

@media (min-width: 640px) {
  .gh-feed {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .gh-feed {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gh-no-posts {
  text-align: center;
  padding: var(--spacing-3xl);
  color: var(--color-slate-500);
}

/* --------------------------------------------------------------------------
   9. Post Cards
   -------------------------------------------------------------------------- */
.gh-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  border: 1px solid var(--color-slate-200);
}

.gh-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.gh-card-image {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-slate-100);
}

.gh-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gh-card:hover .gh-card-image img {
  transform: scale(1.05);
}

.gh-card-content {
  padding: var(--spacing-lg);
}

.gh-card-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-orange);
  margin-bottom: var(--spacing-sm);
}

.gh-card-tag:hover {
  color: var(--color-primary);
}

.gh-card-title {
  font-size: var(--text-xl);
  margin-bottom: var(--spacing-sm);
  line-height: 1.4;
}

.gh-card-title a {
  color: var(--color-slate-900);
}

.gh-card-title a:hover {
  color: var(--color-primary);
}

.gh-card-excerpt {
  color: var(--color-slate-600);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.gh-card-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--text-sm);
  color: var(--color-slate-500);
}

.gh-card-author-image {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   10. CTA Section
   -------------------------------------------------------------------------- */
.gh-cta-section {
  background: var(--color-slate-50);
  padding: var(--spacing-3xl) 0;
  text-align: center;
}

.gh-cta-section h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--spacing-md);
}

.gh-cta-section p {
  font-size: var(--text-lg);
  color: var(--color-slate-600);
  max-width: 500px;
  margin: 0 auto var(--spacing-xl);
}

/* --------------------------------------------------------------------------
   11. Single Post / Article
   -------------------------------------------------------------------------- */
.gh-article {
  padding: var(--spacing-2xl) 0;
}

.gh-article-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.gh-article-tag {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-orange);
  margin-bottom: var(--spacing-md);
}

.gh-article-title {
  font-size: var(--text-4xl);
  max-width: 800px;
  margin: 0 auto var(--spacing-lg);
}

.gh-article-excerpt {
  font-size: var(--text-xl);
  color: var(--color-slate-600);
  max-width: 600px;
  margin: 0 auto var(--spacing-lg);
}

.gh-article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  color: var(--color-slate-500);
}

.gh-article-image {
  margin: var(--spacing-2xl) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.gh-article-image img {
  width: 100%;
  height: auto;
}

/* Article Content Typography */
.gh-content {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1.8;
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
  font-family: var(--font-sans);
  margin-top: var(--spacing-2xl);
}

.gh-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-cyan);
  text-underline-offset: 2px;
}

.gh-content a:hover {
  text-decoration-color: var(--color-primary);
}

.gh-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-slate-100);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
}

.gh-content pre {
  background: var(--color-slate-900);
  color: var(--color-slate-100);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.gh-content pre code {
  background: transparent;
  padding: 0;
}

.gh-content blockquote {
  border-left: 4px solid var(--color-orange);
  margin: var(--spacing-xl) 0;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-slate-50);
  font-style: italic;
}

.gh-content img {
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */
.gh-footer {
  background: var(--color-slate-900);
  color: var(--color-slate-300);
  padding: var(--spacing-3xl) 0 var(--spacing-xl);
  margin-top: auto;
}

.gh-footer-inner {
  display: grid;
  gap: var(--spacing-2xl);
  margin-bottom: var(--spacing-2xl);
}

@media (min-width: 768px) {
  .gh-footer-inner {
    grid-template-columns: 2fr 2fr 1fr;
    gap: var(--spacing-3xl);
  }
}

.gh-footer-brand {
  max-width: 280px;
}

.gh-footer-logo {
  display: inline-block;
  margin-bottom: var(--spacing-md);
}

.gh-footer-logo img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.gh-footer-tagline {
  font-size: var(--text-sm);
  color: var(--color-slate-400);
  margin: 0;
  line-height: 1.6;
}

.gh-footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-xl);
}

.gh-footer-nav-section h4 {
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Footer Navigation - Fix Ghost's ul/li */
.gh-footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-footer-nav li {
  margin-bottom: var(--spacing-sm);
}

.gh-footer-nav a {
  color: var(--color-slate-400);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.gh-footer-nav a:hover {
  color: var(--color-white);
}

/* Social Icons */
.gh-footer-social h4 {
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gh-social-icons {
  display: flex;
  gap: var(--spacing-sm);
}

.gh-social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-slate-800);
  border-radius: var(--radius-full);
  color: var(--color-slate-400);
  transition: all var(--transition-fast);
}

.gh-social-icons a:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.gh-social-icons svg {
  width: 18px;
  height: 18px;
}

/* Footer Bottom */
.gh-footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-xl);
  border-top: 1px solid var(--color-slate-800);
  text-align: center;
}

@media (min-width: 768px) {
  .gh-footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

.gh-footer-copyright,
.gh-footer-powered {
  font-size: var(--text-sm);
  color: var(--color-slate-500);
  margin: 0;
}

.gh-footer-powered a {
  color: var(--color-slate-400);
}

.gh-footer-powered a:hover {
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   13. Pagination
   -------------------------------------------------------------------------- */
.gh-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-2xl);
  font-size: var(--text-sm);
  color: var(--color-slate-500);
}

.gh-pagination a {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-slate-100);
  border-radius: var(--radius-md);
  color: var(--color-slate-600);
  font-weight: 500;
}

.gh-pagination a:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   14. Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --text-4xl: 1.875rem;
    --text-5xl: 2.25rem;
  }

  .gh-header-inner {
    flex-wrap: wrap;
  }

  .gh-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: var(--spacing-md);
  }

  .gh-nav ul {
    gap: var(--spacing-lg);
  }

  .gh-hero {
    padding: var(--spacing-2xl) 0;
  }

  .gh-hero h1 {
    font-size: var(--text-3xl);
  }

  .gh-hero-description {
    font-size: var(--text-base);
  }

  .gh-footer-inner {
    grid-template-columns: 1fr;
  }

  .gh-footer-brand {
    max-width: none;
    text-align: center;
  }

  .gh-footer-links {
    justify-items: center;
    text-align: center;
  }

  .gh-footer-social {
    text-align: center;
  }

  .gh-social-icons {
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   15. Author & Tag Pages
   -------------------------------------------------------------------------- */
.gh-author-header,
.gh-tag-header {
  text-align: center;
  padding: var(--spacing-2xl) 0;
  background: var(--color-slate-50);
}

.gh-author-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  margin: 0 auto var(--spacing-md);
  object-fit: cover;
}

.gh-author-bio,
.gh-tag-description {
  max-width: 500px;
  margin: 0 auto;
  color: var(--color-slate-600);
}

/* --------------------------------------------------------------------------
   16. Error Page
   -------------------------------------------------------------------------- */
.gh-error {
  text-align: center;
  padding: var(--spacing-3xl) 0;
}

.gh-error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--color-slate-200);
  line-height: 1;
  margin-bottom: var(--spacing-md);
}

.gh-error h1 {
  margin-bottom: var(--spacing-md);
}

.gh-error p {
  color: var(--color-slate-600);
  margin-bottom: var(--spacing-xl);
}

/* --------------------------------------------------------------------------
   17. Ghost Koenig Editor Cards - Width Classes
   -------------------------------------------------------------------------- */
.kg-width-wide {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin-left: calc(50% - 42.5vw);
  margin-right: calc(50% - 42.5vw);
}

.kg-width-full {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.gh-content .kg-width-wide img,
.gh-content .kg-width-full img {
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   18. Ghost Gallery Card
   -------------------------------------------------------------------------- */
.kg-gallery-container {
  display: flex;
  flex-direction: column;
  max-width: var(--max-width-wide);
  margin: var(--spacing-xl) auto;
}

.kg-gallery-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.kg-gallery-row:not(:first-of-type) {
  margin-top: 0.75em;
}

.kg-gallery-image {
  flex: 1 1 0%;
  margin: 0;
}

.kg-gallery-image:not(:first-of-type) {
  margin-left: 0.75em;
}

.kg-gallery-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   19. Ghost Bookmark Card
   -------------------------------------------------------------------------- */
.kg-bookmark-card {
  width: 100%;
  margin: var(--spacing-xl) 0;
}

.kg-bookmark-container {
  display: flex;
  min-height: 148px;
  font-family: var(--font-sans);
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-slate-200);
  overflow: hidden;
  color: inherit;
  transition: box-shadow var(--transition-fast);
}

.kg-bookmark-container:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.kg-bookmark-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: flex-start;
  align-items: flex-start;
  padding: var(--spacing-lg);
  overflow: hidden;
}

.kg-bookmark-title {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-slate-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kg-bookmark-description {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-slate-600);
  margin-top: var(--spacing-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kg-bookmark-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--spacing-md);
  font-size: var(--text-sm);
  color: var(--color-slate-500);
}

.kg-bookmark-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.kg-bookmark-author {
  line-height: 1.5;
}

.kg-bookmark-author::after {
  content: "•";
  margin: 0 var(--spacing-xs);
}

.kg-bookmark-publisher {
  line-height: 1.5;
  color: var(--color-slate-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.kg-bookmark-thumbnail {
  flex-shrink: 0;
  position: relative;
  min-width: 160px;
  max-width: 240px;
}

.kg-bookmark-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) {
  .kg-bookmark-container {
    flex-direction: column;
  }

  .kg-bookmark-thumbnail {
    order: 1;
    min-height: 160px;
    width: 100%;
    max-width: none;
  }

  .kg-bookmark-content {
    order: 2;
  }
}
