/* ============================================================================
   Onam Cloud — Ghost theme stylesheet.
   Ports the Astro site's design system (tailwind.config.mjs + global.css) into
   plain CSS so the blog visually matches the corporate site. Tokens, fonts,
   typography scale, buttons, cards, header/footer are recreated here — no Astro
   components are imported. Keep in sync with website/src/styles/global.css.
   ============================================================================ */

/* ---- Fonts: Gellix (self-hosted, copied into the theme assets) ---- */
@font-face { font-family: 'Gellix'; font-weight: 300; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-Light.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 400; font-style: italic; font-display: swap; src: url('../fonts/gellix/Gellix-RegularItalic.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Gellix'; font-weight: 800; font-style: normal; font-display: swap; src: url('../fonts/gellix/Gellix-ExtraBold.ttf') format('truetype'); }

/* JetBrains Mono for eyebrows / meta / code (self-hosted, from @fontsource) */
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/jetbrains-mono/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }

/* ---- Design tokens (mirrors global.css :root) ---- */
:root {
  --bg: #FFFFFF;
  --bg-surface: #FAFAF8;
  --bg-elevated: #F0EEE9;
  --ink: #070A2B;
  --ink-surface: #0D1140;
  --navy: #070A2B;
  --navy-deep: #050720;
  --navy-light: #141952;
  --orange: #F5900E;
  --orange-rgb: 245 144 14;
  --orange-dim: #C97209;
  --orange-light: #F9B762;
  --orange-dark: #9F5E09;
  --signal-blue: #3566F2;
  --signal-blue-light: #7FA8FF;
  --signal-green: #2FA36B;
  --text: #0B0B0C;
  --text-muted: #5B5A57;
  --text-dark: #8A8880;
  --text-on-dark: #FAFAF8;
  --text-on-dark-muted: #B9BECB;
  --hairline: rgba(11, 11, 12, 0.10);
  --hairline-dark: rgba(250, 250, 248, 0.14);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --container: 1120px;
  --content: 720px;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  /* Honor Ghost's custom-font settings when set (--gh-font-*), else Gellix. */
  font-family: var(--gh-font-body, 'Gellix', system-ui, sans-serif);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--gh-font-heading, 'Gellix', system-ui, sans-serif);
  text-wrap: balance;
  color: var(--text);
  margin: 0 0 0.5em;
}
p { text-wrap: pretty; margin: 0 0 1.25rem; }
a { color: var(--orange-dim); text-decoration: none; transition: color 200ms var(--ease-out); }
a:hover { color: var(--orange); }
img { max-width: 100%; height: auto; display: block; }
::selection { background: rgba(245, 144, 14, 0.18); color: var(--text); }

/* ---- Layout ---- */
.container-main { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
@media (min-width: 1024px) { .container-main { padding: 0 2rem; } }
.content-width { max-width: var(--content); margin-left: auto; margin-right: auto; }
main { display: block; min-height: 60vh; }

/* ---- Typography scale (mirrors tailwind fontSize tokens) ---- */
.display-lg { font-size: clamp(2rem, 3.4vw, 2.5rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
.display-md { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
.display-sm { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; }
.body-lg { font-size: 1.0625rem; line-height: 1.6; }
.body-sm { font-size: 0.865rem; line-height: 1.6; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 500;
  color: var(--signal-blue);
}
.eyebrow-on-dark { color: var(--signal-blue-light); }
.meta-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.865rem; color: var(--text-muted);
}

/* ---- Skip link + a11y focus ---- */
.skip-link {
  position: absolute; left: -9999px; top: auto;
}
.skip-link:focus {
  position: fixed; left: 0.75rem; top: 0.75rem; z-index: 200;
  background: var(--ink); color: #fff; padding: 0.5rem 1rem; border-radius: 999px;
}
a:focus-visible, button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.35), 0 0 0 1.5px var(--orange);
  border-radius: 6px;
}

/* ---- Buttons (mirrors .btn-* in global.css) ---- */
.btn-primary, .btn-secondary, .btn-on-dark, .btn-on-dark-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Gellix', sans-serif; font-size: 14.5px; font-weight: 600;
  padding: 13px 26px; border-radius: 8px; text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 160ms var(--ease-out), background 200ms var(--ease-out),
              color 200ms var(--ease-out), border-color 200ms var(--ease-out),
              box-shadow 150ms var(--ease-out);
}
.btn-primary { background: var(--orange); color: var(--navy-deep); box-shadow: 0 2px 12px rgba(var(--orange-rgb), 0.22); }
.btn-primary:hover { background: var(--orange-light); color: var(--navy-deep); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(var(--orange-rgb), 0.3); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary { border-color: var(--hairline); color: var(--text); background: transparent; }
.btn-secondary:hover { border-color: var(--text); transform: translateY(-2px); }
.btn-on-dark { background: var(--orange); color: var(--navy-deep); }
.btn-on-dark:hover { background: var(--orange-light); transform: translateY(-2px); }
.btn-on-dark-outline { color: var(--text-on-dark); border-color: var(--hairline-dark); }
.btn-on-dark-outline:hover { border-color: var(--bg); transform: translateY(-2px); }

/* ============================================================================
   HEADER (mirrors NavBar.astro — solid dark #070A2B, 84px)
   ============================================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 84px;
}
.nav-logo { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-logo-text { font-family: 'Gellix', sans-serif; font-weight: 600; font-size: 24px; letter-spacing: -0.01em; }
.nav-logo-text .brand-onam { color: #FFFFFF; }
.nav-logo-text .brand-cloud { color: var(--orange); }
.nav-links { display: none; align-items: center; gap: 28px; }
.nav-link {
  font-size: 0.865rem; font-weight: 600; color: rgba(255, 255, 255, 0.85);
  transition: color 200ms var(--ease-out);
}
.nav-link:hover { color: rgba(255, 255, 255, 0.6); }
.nav-link.is-active { color: #FFFFFF; }
.nav-cta { display: none; }
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .nav-toggle { display: none; }
}
.nav-toggle {
  background: transparent; border: 0; color: rgba(255,255,255,0.85);
  width: 44px; height: 44px; cursor: pointer; position: relative;
}
.nav-toggle .bar { position: absolute; left: 10px; right: 10px; height: 1.5px; background: currentColor; transition: transform 220ms var(--ease-out), opacity 180ms ease; }
.nav-toggle .bar-1 { top: 19px; }
.nav-toggle .bar-2 { top: 25px; }
.nav-toggle[aria-expanded="true"] .bar-1 { transform: translateY(3px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar-2 { transform: translateY(-3px) rotate(-45deg); }
.mobile-menu {
  display: none; background: var(--bg); border-top: 1px solid var(--hairline);
}
.mobile-menu.is-open { display: block; }
@media (min-width: 768px) { .mobile-menu { display: none !important; } }
.mobile-menu a {
  display: block; padding: 0.625rem 0.75rem; font-size: 0.865rem;
  color: var(--text-muted); border-radius: 8px;
}
.mobile-menu a:hover { color: var(--text); background: var(--bg-elevated); }

/* ============================================================================
   FOOTER (mirrors Footer.astro — dark, 3-col, mono headings)
   ============================================================================ */
.site-footer { background: #070A2B; color: var(--text-on-dark-muted); padding: 3.5rem 0 2rem; margin-top: 4.5rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--hairline-dark); }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 3rem; } }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 0.75rem; }
.footer-brand-text { font-family: 'Gellix', sans-serif; font-weight: 800; font-size: 15px; }
.footer-heading { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 1rem; color: var(--text-on-dark-muted); }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.625rem; }
.footer-links a { font-size: 0.865rem; color: var(--text-on-dark-muted); }
.footer-links a:hover { color: var(--orange-light); }
.footer-bottom { padding-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; justify-content: space-between; }
@media (min-width: 768px) { .footer-bottom { flex-direction: row; } }
.footer-copy { font-size: 0.865rem; color: var(--text-dark); }
.footer-legal { display: flex; flex-wrap: wrap; gap: 0.5rem; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-dark); list-style: none; margin: 0; padding: 0; }
.footer-legal a { color: var(--text-dark); }
.footer-legal a:hover { color: var(--orange-light); }

/* ============================================================================
   BLOG HERO
   ============================================================================ */
.blog-hero { background: #070A2B; }
.blog-hero .container-main { padding-top: 4rem; padding-bottom: 5rem; }
.blog-hero h1 { color: var(--text-on-dark); }
.blog-hero p { color: var(--text-on-dark-muted); max-width: 42rem; margin-bottom: 0; }

/* ============================================================================
   POST LIST (mirrors InsightCard .card)
   ============================================================================ */
.post-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; padding: 4.5rem 0; }
@media (min-width: 768px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.post-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--hairline); border-radius: 14px;
  overflow: hidden;
  transition: transform 220ms var(--ease-out), border-color 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.post-card:hover { transform: translateY(-3px); border-color: rgba(11, 11, 12, 0.18); box-shadow: 0 16px 32px rgba(11, 11, 12, 0.08); }
.post-card-image { aspect-ratio: 16 / 9; background: var(--bg-elevated); overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 28px; display: flex; flex-direction: column; flex: 1; }
.post-card-tag {
  align-self: flex-start; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.1em; padding: 4px 10px; border-radius: 999px;
  background: rgba(245, 144, 14, 0.1); color: var(--orange-dark); border: 1px solid rgba(245, 144, 14, 0.2);
  margin-bottom: 0.75rem;
}
.post-card-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; line-height: 1.3; }
.post-card:hover .post-card-title { color: var(--orange-dim); }
.post-card-excerpt { font-size: 0.865rem; color: var(--text-muted); margin-bottom: 1rem; flex: 1; }
.post-card-meta { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-dark); }
.post-card-link { position: absolute; inset: 0; z-index: 1; }

/* Featured flag */
.post-card.is-featured .post-card-tag { background: var(--navy); color: var(--text-on-dark); border-color: transparent; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 0 0 4.5rem; }
.pagination a, .pagination span { font-family: 'JetBrains Mono', monospace; font-size: 0.865rem; color: var(--text-muted); }
.pagination .page-number { color: var(--text-dark); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center; max-width: 40rem; margin: 4.5rem auto; padding: 2.5rem 1.5rem;
  background: var(--bg-surface); border: 1px solid var(--hairline); border-radius: 14px;
}
.empty-state h2 { font-size: 1.5rem; }
.empty-state p { color: var(--text-muted); }

/* ============================================================================
   ARTICLE (mirrors ArticleLayout.astro)
   ============================================================================ */
.article { padding: 3rem 0 0; }
.breadcrumb { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0; margin: 0 0 2rem; font-size: 0.865rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--orange-dim); }
.breadcrumb .sep { color: var(--text-dark); }
.breadcrumb .current { color: var(--text); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-header { max-width: var(--content); margin: 0 auto 3rem; }
.article-tag {
  display: inline-block; padding: 4px 12px; font-size: 0.865rem; font-weight: 500; border-radius: 8px;
  background: rgba(245, 144, 14, 0.1); color: var(--orange-dark); border: 1px solid rgba(245, 144, 14, 0.2);
  margin-bottom: 1rem;
}
.article-title { font-size: clamp(1.5rem, 3vw, 2.5rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; margin-bottom: 1rem; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-family: 'JetBrains Mono', monospace; font-size: 0.865rem; color: var(--text-muted); }
.article-feature-image { max-width: var(--container); margin: 0 auto 3rem; }
/* Lock the post-page header image to 16:9 so every post looks uniform
   regardless of the uploaded ratio — matches the /blog thumbnail crop. The
   ratio+crop applies to the img only; the caption sits below, uncropped. */
.article-feature-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: var(--bg-elevated);
}
.article-body { max-width: var(--content); margin: 0 auto; }

/* Prose (Ghost Koenig content) */
.post-content { font-size: 1.0625rem; line-height: 1.7; color: var(--text-muted); }
.post-content > * + * { margin-top: 1.25rem; }
.post-content p { color: var(--text-muted); }
.post-content h2 { font-size: 1.5rem; letter-spacing: -0.02em; color: var(--text); margin-top: 2.5rem; margin-bottom: 1rem; }
.post-content h3 { font-size: 1.25rem; color: var(--text); margin-top: 2rem; margin-bottom: 0.75rem; }
.post-content h4 { font-size: 1.0625rem; color: var(--text); margin-top: 1.5rem; }
.post-content a { color: var(--orange-dim); text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: var(--orange); }
.post-content strong { color: var(--text); font-weight: 600; }
.post-content ul, .post-content ol { padding-left: 1.5rem; color: var(--text-muted); }
.post-content li { margin-bottom: 0.5rem; }
.post-content img, .post-content .kg-image { border-radius: 10px; margin: 2rem auto; }
.post-content figcaption { text-align: center; font-size: 0.8rem; color: var(--text-dark); margin-top: 0.5rem; }
.post-content blockquote {
  margin: 2rem 0; padding: 0.5rem 0 0.5rem 1.5rem; border-left: 3px solid var(--orange);
  color: var(--text); font-size: 1.15rem; font-style: italic;
}
.post-content hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.5rem 0; }
.post-content table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-size: 0.95rem; }
.post-content th, .post-content td { text-align: left; padding: 0.625rem 0.875rem; border: 1px solid var(--hairline); }
.post-content th { background: var(--bg-surface); color: var(--text); font-weight: 600; }
/* Code */
.post-content code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.875em;
  background: var(--bg-elevated); color: var(--orange-dark); padding: 0.15em 0.4em; border-radius: 6px;
}
.post-content pre {
  background: var(--ink); color: var(--text-on-dark); padding: 1.25rem 1.5rem; border-radius: 12px;
  overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.875rem; line-height: 1.6;
}
.post-content pre code { background: transparent; color: inherit; padding: 0; border-radius: 0; }
.kg-embed-card, .kg-gallery-card { margin: 2rem 0; }

/* Koenig editor width classes — let images/cards break out of the content
   column. Required by Ghost (gscan checks .kg-width-wide / .kg-width-full). */
.post-content .kg-card { margin: 2rem auto; }
.post-content .kg-width-wide {
  width: 85vw; max-width: var(--container);
  margin-left: 50%; transform: translateX(-50%);
}
.post-content .kg-width-full {
  width: 100vw; max-width: 100vw;
  margin-left: 50%; transform: translateX(-50%); border-radius: 0;
}
.post-content .kg-width-full img { border-radius: 0; }

/* Article tags */
.article-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2.5rem auto 0; max-width: var(--content); list-style: none; padding: 0; }
.article-tags li a {
  display: inline-block; padding: 4px 12px; font-family: 'JetBrains Mono', monospace; font-size: 0.865rem;
  border-radius: 999px; background: rgba(245, 144, 14, 0.05); color: var(--text-muted); border: 1px solid var(--hairline);
}
.article-tags li a:hover { color: var(--orange-dim); border-color: rgba(245, 144, 14, 0.3); }

/* Author box */
.author-box { display: flex; align-items: center; gap: 1rem; max-width: var(--content); margin: 2.5rem auto 0; padding-top: 2rem; border-top: 1px solid var(--hairline); }
.author-avatar { width: 48px; height: 48px; border-radius: 999px; object-fit: cover; background: var(--bg-elevated); }
.author-name { font-weight: 600; color: var(--text); }
.author-bio { font-size: 0.865rem; color: var(--text-muted); margin: 0; }

/* Prev/next + related */
.post-nav { display: grid; grid-template-columns: 1fr; gap: 1rem; max-width: var(--content); margin: 3rem auto 0; }
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav a { padding: 1rem 1.25rem; border: 1px solid var(--hairline); border-radius: 12px; background: var(--bg-surface); }
.post-nav a:hover { border-color: rgba(11,11,12,0.18); }
.post-nav .label { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dark); }
.post-nav .title { color: var(--text); font-weight: 600; }
.post-nav .next { text-align: right; }

.related { padding: 4.5rem 0 0; }
.related h2 { max-width: var(--container); margin: 0 auto 1.5rem; padding: 0 1.5rem; }

/* ---- Bottom CTA (mirrors ArticleLayout CTA) ---- */
.article-cta {
  max-width: var(--content); margin: 4rem auto 0; padding: 2rem; border-radius: 14px; text-align: center;
  background: #070A2B;
}
.article-cta h3 { color: var(--text-on-dark); font-size: 1.5rem; margin-bottom: 0.5rem; }
.article-cta p { color: var(--text-on-dark-muted); max-width: 32rem; margin: 0 auto 1.5rem; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
