/* ═══════════════════════════════════════════
   OkayMSO Ghost Theme — screen.css
   ═══════════════════════════════════════════ */

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

:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #161616;
  --text-primary: #f0ede6;
  --text-secondary: #8a8578;
  --text-muted: #5a564d;
  --accent-warm: #c8a96e;
  --accent-warm-dim: #9e8455;
  --accent-warm-glow: rgba(200, 169, 110, 0.08);
  --border: #222018;
  --border-hover: #3a3528;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --max-width: 1200px;
  --content-width: 720px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.6;
}

::selection {
  background: var(--accent-warm);
  color: var(--bg);
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

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

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

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

/* ─── Navigation ─── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 10, 0.8);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.site-logo .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent-warm-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.site-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  list-style: none;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.nav-cta {
  background: var(--accent-warm);
  color: var(--bg) !important;
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.3s;
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(200, 169, 110, 0.25);
  color: var(--bg) !important;
}

@media (max-width: 768px) {
  .site-header { padding: 1rem 1.5rem; }
  .site-nav { display: none; }
}

/* ─── Main Content ─── */
.site-main {
  padding-top: 5rem;
  min-height: 80vh;
}

/* ─── Index / Post List ─── */
.index-hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
  text-align: center;
  position: relative;
}

.index-hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, var(--accent-warm-glow), transparent 70%);
  pointer-events: none;
}

.index-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 400;
  position: relative;
  margin-bottom: 0.75rem;
}

.index-hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Post Grid */
.post-feed {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .post-feed { grid-template-columns: repeat(2, 1fr); }
}

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

/* Post Card */
.post-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.4s, transform 0.3s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  border-color: var(--accent-warm-dim);
  transform: translateY(-4px);
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.post-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-warm);
  margin-bottom: 0.6rem;
}

.post-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-card-title a {
  color: var(--text-primary);
}

.post-card-title a:hover {
  color: var(--accent-warm);
}

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.post-card-meta .author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* ─── Single Post ─── */
.post-hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 5rem 2rem 2rem;
  position: relative;
}

.post-hero::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, var(--accent-warm-glow), transparent 70%);
  pointer-events: none;
}

.post-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-warm);
  margin-bottom: 1rem;
  display: inline-block;
  position: relative;
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  position: relative;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  position: relative;
  margin-bottom: 2rem;
}

.post-meta .author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.post-meta .sep {
  color: var(--text-muted);
}

.post-feature-image {
  max-width: 900px;
  margin: 0 auto 3rem;
  padding: 0 2rem;
}

.post-feature-image img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* Post Content / Ghost Editor Output */
.post-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
  position: relative;
}

.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 2.5rem 0 1rem;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 2rem 0 0.75rem;
}

.post-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

.post-content a {
  color: var(--accent-warm);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content blockquote {
  border-left: 3px solid var(--accent-warm);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.post-content ul,
.post-content ol {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content img {
  border-radius: var(--radius);
  margin: 2rem 0;
}

.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
}

.post-content p code {
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.post-content figure {
  margin: 2rem 0;
}

.post-content figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Ghost-specific card overrides */
.kg-card {
  margin: 2rem 0;
}

.kg-image-card img {
  border-radius: var(--radius);
}

.kg-width-wide {
  max-width: 900px;
  margin-left: calc((var(--content-width) - 900px) / 2);
  margin-right: calc((var(--content-width) - 900px) / 2);
}

.kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s;
}

.kg-bookmark-card:hover {
  border-color: var(--border-hover);
}

.kg-bookmark-container {
  display: flex;
  text-decoration: none !important;
  color: var(--text-primary);
}

.kg-bookmark-content {
  padding: 1.25rem;
  flex: 1;
}

.kg-bookmark-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.kg-bookmark-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kg-bookmark-thumbnail img {
  width: 200px;
  height: 100%;
  object-fit: cover;
}

/* ─── Author Section ─── */
.post-author-section {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.post-author-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  background: var(--bg-card);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.post-author-box .author-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-author-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.post-author-box p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Pagination ─── */
.pagination {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.pagination a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-warm);
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: background 0.25s, border-color 0.25s;
}

.pagination a:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
}

.pagination .page-number {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Tag Archive ─── */
.tag-hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem 2rem;
  text-align: center;
}

.tag-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.tag-hero p {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ─── Footer ─── */
.site-footer {
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.footer-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text-secondary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-legal a {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-legal a:hover {
  color: var(--text-secondary);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Error Pages ─── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-family: var(--font-display);
  font-size: 6rem;
  color: var(--accent-warm);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.error-page a {
  color: var(--accent-warm);
  font-weight: 600;
}

/* ─── Utilities ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
