/* =============================================
   Blog Common Styles | kepakisan.co.nz
   Shared across all blog pages (index + posts)
   ============================================= */

/* Variables */
:root {
  --cream: #FAF7F2;
  --sand: #EDE0CC;
  --sand-d: #D9C8AD;
  --terra: #C4714A;
  --rust: #A8522E;
  --sage: #6B7F5E;
  --sage-l: #D4E0D0;
  --bali: #E8A838;
  --bali-l: #FDF3DC;
  --bark: #3D2E1E;
  --bark-l: #6B5440;
  --white: #fff;
  --sh: rgba(61, 46, 30, .10);
  --code-bg: #1E1612;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--cream);
  color: var(--bark);
  font-family: 'Nunito', sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Navigation */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 4rem;
  background: rgba(250, 247, 242, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sand);
  transition: box-shadow .3s;
}

nav.sc {
  box-shadow: 0 2px 24px var(--sh);
}

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.logo span {
  color: var(--terra);
}

.logo-sub {
  font-size: .7rem;
  color: var(--bark-l);
  letter-spacing: .06em;
  margin-top: -3px;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--bark-l);
  background: var(--sand);
  padding: .4rem 1rem;
  border-radius: 100px;
  transition: all .2s;
}

.nav-back:hover {
  background: var(--terra);
  color: #fff;
}

/* Post Hero */
.post-hero {
  padding: 8rem 4rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}

.cat-badge {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 100px;
}

.cat-tech {
  background: var(--bark);
  color: var(--cream);
}

.cat-data {
  background: var(--sage);
  color: #fff;
}

.cat-finance {
  background: var(--bali-l);
  color: #8A6200;
  border: 1px solid rgba(232, 168, 56, .3);
}

.post-date {
  font-size: .8rem;
  color: var(--bark-l);
  font-weight: 600;
}

.read-time {
  font-size: .8rem;
  color: var(--bark-l);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem;
}

.dot {
  width: 3px;
  height: 3px;
  background: var(--sand-d);
  border-radius: 50%;
  display: inline-block;
}

.post-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 300;
  line-height: 1.1;
  color: var(--bark);
  margin-bottom: 1.4rem;
}

.post-title em {
  font-style: italic;
  color: var(--terra);
}

.post-subtitle {
  font-size: 1.15rem;
  color: var(--bark-l);
  line-height: 1.65;
  max-width: 680px;
  margin-bottom: 2rem;
}

.author-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--sand);
  max-width: 480px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sand), var(--terra));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-weight: 700;
  font-size: .9rem;
  color: var(--bark);
}

.author-title {
  font-size: .75rem;
  color: var(--bark-l);
}

/* Hero Visual */
.hero-visual {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4rem 3.5rem;
  position: relative;
}

/* Article Layout */
.article-wrap {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4rem 6rem;
}

.article-body {
  min-width: 0;
}

.article-body p {
  font-size: 1.05rem;
  color: var(--bark-l);
  margin-bottom: 1.4rem;
  line-height: 1.8;
}

.article-body p:first-child {
  font-size: 1.12rem;
  color: var(--bark);
  font-weight: 500;
}

.article-body h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--bark);
  margin: 2.8rem 0 1rem;
  padding-top: .5rem;
  border-top: 2px solid var(--sand);
}

.article-body h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--bark);
  margin: 2rem 0 .7rem;
}

.article-body strong {
  color: var(--bark);
  font-weight: 700;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.4rem;
}

.article-body li {
  font-size: 1rem;
  color: var(--bark-l);
  margin-bottom: .4rem;
  line-height: 1.7;
}

.article-body em {
  color: var(--terra);
}

/* Numbered sections */
.numbered-section {
  background: var(--white);
  border-radius: 18px;
  padding: 1.6rem 2rem;
  margin: 2rem 0;
  border-left: 4px solid var(--terra);
  box-shadow: 0 4px 20px var(--sh);
}

.numbered-section .num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--terra);
  line-height: 1;
  margin-bottom: .3rem;
}

.numbered-section h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--bark);
  margin-bottom: .5rem;
}

.numbered-section p {
  font-size: .92rem;
  color: var(--bark-l);
  margin: 0;
  line-height: 1.65;
}

/* Pull quote */
.pull-quote {
  margin: 2.5rem 0;
  padding: 2rem 2.5rem;
  background: linear-gradient(135deg, var(--sand) 0%, #F0E6D0 100%);
  border-radius: 20px;
  position: relative;
}

.pull-quote::before {
  content: '\201C';
  font-family: 'Cormorant Garamond', serif;
  font-size: 6rem;
  line-height: .5;
  color: var(--terra);
  opacity: .25;
  position: absolute;
  top: 1.2rem;
  left: 1.5rem;
}

.pull-quote p {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 300;
  color: var(--bark);
  line-height: 1.45;
  position: relative;
  z-index: 1;
}

.pull-quote cite {
  font-size: .78rem;
  color: var(--bark-l);
  font-style: normal;
  display: block;
  margin-top: .8rem;
  font-weight: 600;
}

/* Callout boxes */
.callout {
  margin: 2rem 0;
  padding: 1.4rem 1.6rem;
  border-radius: 14px;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.callout .ci {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.callout p {
  font-size: .9rem;
  color: var(--bark-l);
  margin: 0;
  line-height: 1.65;
}

.callout.insight {
  background: rgba(107, 127, 94, .1);
  border: 1px solid rgba(107, 127, 94, .25);
}

.callout.insight strong {
  color: var(--sage);
}

.callout.warn {
  background: rgba(232, 168, 56, .1);
  border: 1px solid rgba(232, 168, 56, .3);
}

.callout.warn strong {
  color: #8A6200;
}

.callout.tip {
  background: rgba(196, 113, 74, .08);
  border: 1px solid rgba(196, 113, 74, .2);
}

.callout.tip strong {
  color: var(--terra);
}

.callout.draft {
  background: rgba(61, 46, 30, .06);
  border: 1px solid rgba(61, 46, 30, .15);
}

.callout.draft strong {
  color: var(--bark);
}

/* Section divider */
.sec-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
}

.sec-divider span {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--terra);
  white-space: nowrap;
}

.sec-divider::before,
.sec-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sand);
}

/* Code blocks */
.code-block {
  margin: 2rem 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: 0 8px 30px rgba(30, 22, 18, .25);
}

.code-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1.2rem;
  background: rgba(255, 255, 255, .05);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
}

.code-label {
  font-size: .72rem;
  color: rgba(250, 247, 242, .4);
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
}

.code-body {
  padding: 1.4rem 1.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  line-height: 1.8;
  color: rgba(250, 247, 242, .85);
  overflow-x: auto;
}

.code-body .kw { color: #E8A838; }
.code-body .fn { color: #C4714A; }
.code-body .str { color: #6B7F5E; }
.code-body .cm { color: rgba(250, 247, 242, .35); }
.cm { color: rgba(250, 247, 242, .35); }
.kw { color: #E8A838; }
.fn { color: #C4714A; }
.str { color: #6B7F5E; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
}

.sidebar-card {
  background: var(--white);
  border-radius: 18px;
  padding: 1.4rem;
  border: 1px solid var(--sand);
  margin-bottom: 1.2rem;
}

.sidebar-card h4 {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: .9rem;
}

.toc-item {
  font-size: .82rem;
  color: var(--bark-l);
  padding: .3rem 0;
  border-bottom: 1px solid var(--sand);
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  cursor: pointer;
  transition: color .2s;
}

.toc-item:last-child {
  border: none;
}

.toc-item:hover {
  color: var(--terra);
}

.toc-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: .9rem;
  font-weight: 600;
  color: var(--terra);
  flex-shrink: 0;
}

.tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.stag {
  font-size: .72rem;
  font-weight: 700;
  padding: .22rem .6rem;
  border-radius: 6px;
  background: var(--cream);
  color: var(--bark-l);
  border: 1px solid var(--sand);
}

/* Author bio */
.author-bio {
  background: var(--white);
  border-radius: 24px;
  padding: 2.5rem 4rem;
  max-width: 1200px;
  margin: 3rem auto;
  border: 1px solid var(--sand);
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.author-bio-inner {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  max-width: calc(1200px - 240px - 3rem);
  width: 100%;
}

.bio-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sand), var(--terra));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bio-right h3 {
  font-size: 1.1rem;
  margin-bottom: .2rem;
}

.bio-right .bio-role {
  font-size: .82rem;
  color: var(--terra);
  font-weight: 600;
  margin-bottom: .7rem;
}

.bio-right p {
  font-size: .88rem;
  color: var(--bark-l);
  line-height: 1.65;
}

.bio-links {
  display: flex;
  gap: .7rem;
  margin-top: 1rem;
}

.bio-link {
  font-size: .78rem;
  font-weight: 700;
  color: var(--bark-l);
  background: var(--cream);
  padding: .3rem .85rem;
  border-radius: 100px;
  border: 1px solid var(--sand);
  transition: all .2s;
}

.bio-link:hover {
  border-color: var(--terra);
  color: var(--terra);
}

/* Related posts */
.related-section {
  padding: 0 4rem 5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.related-section h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  margin-bottom: 1.8rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}

.rel-card {
  background: var(--white);
  border-radius: 18px;
  padding: 1.6rem;
  border: 1px solid var(--sand);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  display: block;
}

.rel-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px var(--sh);
}

.rel-cat {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .2rem .6rem;
  border-radius: 100px;
  display: inline-block;
  margin-bottom: .5rem;
}

.rel-card h4 {
  font-size: 1rem;
  margin-bottom: .4rem;
  color: var(--bark);
}

.rel-card p {
  font-size: .82rem;
  color: var(--bark-l);
}

/* Progress bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(to right, var(--terra), #E8A838);
  z-index: 300;
  transition: width .1s linear;
  width: 0;
}

/* Draft banner */
.draft-banner {
  background: linear-gradient(90deg, var(--bark) 0%, #2a1f0f 100%);
  color: rgba(250, 247, 242, .8);
  text-align: center;
  padding: .6rem 1.5rem;
  font-size: .82rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 250;
}

.draft-banner span {
  background: var(--terra);
  color: #fff;
  padding: .15rem .6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: .72rem;
  margin-right: .5rem;
}

/* ELI5 boxes */
.eli5 {
  margin: 2rem 0;
  background: var(--white);
  border-radius: 16px;
  padding: 1.5rem 1.8rem;
  border: 1px solid var(--sand);
  box-shadow: 0 4px 16px var(--sh);
}

.eli5-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--terra);
  margin-bottom: .7rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.eli5-icon {
  font-size: 1rem;
}

.eli5 p {
  font-size: .9rem;
  color: var(--bark-l);
  line-height: 1.65;
  margin: 0;
}

.eli5 p + p {
  margin-top: .8rem;
}

/* Responsive */
@media (max-width: 900px) {
  nav {
    padding: 1rem 1.5rem;
  }

  .post-hero,
  .hero-visual {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .article-wrap {
    grid-template-columns: 1fr;
    padding: 0 1.5rem 4rem;
  }

  .sidebar {
    display: none;
  }

  .author-bio {
    padding: 1.5rem;
    flex-direction: column;
  }

  .author-bio-inner {
    flex-direction: column;
    max-width: 100%;
  }

  .related-section {
    padding: 0 1.5rem 4rem;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .post-hero {
    padding-top: 6rem;
  }
}
