/* ==========================================================================
   Kotler Post — single.php (single blog post)
   - Reading progress bar
   - Breadcrumb
   - Hero (kategoria pill + H1 + meta + featured image)
   - 2-col layout (sticky sidebar TOC+share + content)
   - Content typography (drop cap, headings, blockquote, lists, code)
   - Author box
   - Related posts (reuses .kotler-blog__grid + card)
   ========================================================================== */

/* === READING PROGRESS BAR === */

.kotler-post__progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 90;
  pointer-events: none;
}

.kotler-post__progress-fill {
  height: 100%;
  background: var(--kotler-blue);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 80ms linear;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .kotler-post__progress-fill {
    transition: none;
  }
}

/* === LAYOUT WRAPPER === */

.kotler-post {
  background: var(--kotler-bg);
}

/* === BREADCRUMB === */

.kotler-post__breadcrumb {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) var(--container-padding) 0;
}

.kotler-post__breadcrumb-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--kotler-text-mute);
}

.kotler-post__breadcrumb-inner a,
.kotler-post__breadcrumb-inner a:link,
.kotler-post__breadcrumb-inner a:visited {
  color: var(--kotler-text-mute);
  text-decoration: none;
  transition: color 200ms ease;
}

.kotler-post__breadcrumb-inner a:hover,
.kotler-post__breadcrumb-inner a:focus-visible {
  color: var(--kotler-blue);
}

/* === HERO === */

.kotler-post__hero {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) var(--container-padding) clamp(2.5rem, 5vw, 4rem);
}

.kotler-post__hero-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.kotler-post__hero-category,
.kotler-post__hero-category:link,
.kotler-post__hero-category:visited {
  display: inline-block;
  margin-bottom: var(--space-6);
  padding: 0.3rem 0.8rem;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--kotler-blue);
  background: var(--kotler-blue-50);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease;
}

.kotler-post__hero-category:hover,
.kotler-post__hero-category:focus-visible {
  color: #fff;
  background: var(--kotler-blue);
}

.kotler-post__hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 4.5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--kotler-ink);
  margin: 0 0 var(--space-8);
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (min-width: 768px) {
  .kotler-post__hero-title {
    letter-spacing: var(--tracking-tightest);
    line-height: 1.08;
  }
}

.kotler-post__hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--kotler-text-mute);
}

.kotler-post__hero-author {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.kotler-post__hero-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.kotler-post__hero-author-name {
  color: var(--kotler-text-soft);
  font-weight: 500;
}

.kotler-post__hero-media {
  max-width: 1200px;
  margin: clamp(2rem, 4vw, 3rem) auto 0;
}

.kotler-post__hero-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* === BODY (2-col) === */

.kotler-post__body {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) var(--container-padding);
}

.kotler-post__body-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 720px;
  margin: 0 auto;
}

.kotler-post--has-sidebar .kotler-post__body-inner {
  max-width: 1080px;
}

@media (min-width: 1024px) {
  .kotler-post--has-sidebar .kotler-post__body-inner {
    grid-template-columns: 260px minmax(0, 720px);
    gap: clamp(2rem, 4vw, 4rem);
  }
}

.kotler-post__sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .kotler-post--has-sidebar .kotler-post__sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height, 88px) + 1rem);
    align-self: start;
    max-height: calc(100vh - var(--header-height, 88px) - 2rem);
    overflow-y: auto;
  }
}

.kotler-post__article {
  min-width: 0;
}

/* === TOC === */

.kotler-post__toc {
  padding: var(--space-5);
  background: var(--kotler-paper);
  border: 1px solid var(--kotler-border);
  border-radius: var(--radius-md);
}

.kotler-post__toc-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--kotler-text-mute);
  margin: 0 0 var(--space-3);
}

.kotler-post__toc-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kotler-post__toc-list li {
  margin: 0;
}

.kotler-post__toc-list a,
.kotler-post__toc-list a:link,
.kotler-post__toc-list a:visited {
  display: block;
  padding: 0.4em 0 0.4em 0.8em;
  margin-left: -0.8em;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--kotler-text-soft);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: color 200ms ease, border-color 200ms ease;
}

.kotler-post__toc-list a:hover,
.kotler-post__toc-list a:focus-visible {
  color: var(--kotler-blue);
}

.kotler-post__toc-list a.is-active {
  color: var(--kotler-blue);
  border-left-color: var(--kotler-blue);
  font-weight: 600;
}

.kotler-post__toc-item--h3 a {
  padding-left: 1.6em !important;
  font-size: var(--text-xs);
  color: var(--kotler-text-mute);
}

/* === SHARE === */

.kotler-post__share {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--kotler-border);
  position: relative;
}

.kotler-post__share-bottom {
  margin-top: var(--space-12);
}

.kotler-post__share-label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--kotler-text-mute);
  margin-bottom: var(--space-3);
}

.kotler-post__share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.kotler-post__share-btn,
.kotler-post__share-btn:link,
.kotler-post__share-btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--kotler-ink);
  background: var(--kotler-paper);
  border: 1px solid var(--kotler-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.kotler-post__share-btn:hover,
.kotler-post__share-btn:focus-visible {
  color: var(--kotler-blue);
  background: var(--kotler-blue-50);
  border-color: var(--kotler-blue-200);
  transform: translateY(-2px);
}

.kotler-post__share-toast {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: var(--space-2);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: #fff;
  background: var(--kotler-ink);
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.kotler-post__share-toast:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}

/* === CONTENT TYPOGRAPHY === */

.kotler-post__content {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--kotler-text);
}

@media (min-width: 768px) {
  .kotler-post__content {
    font-size: 1.1875rem;
  }
}

.kotler-post__content > * + * {
  margin-top: 1.5em;
}

.kotler-post__content p {
  margin: 0 0 1.5em;
  font-size: inherit;
  line-height: 1.7;
  color: var(--kotler-text);
}

.kotler-post__content p:last-child {
  margin-bottom: 0;
}

/* Drop cap (first paragraph only) */
.kotler-post__content > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 4em;
  line-height: 0.9;
  font-weight: 800;
  margin: 0.08em 0.12em 0 -0.04em;
  color: var(--kotler-blue);
}

@media (prefers-reduced-motion: reduce) {
  .kotler-post__content > p:first-of-type::first-letter {
    /* keep dropcap, just no animation needed */
  }
}

/* Headings within content */
.kotler-post__content h2,
.kotler-post__content h3,
.kotler-post__content h4 {
  font-family: var(--font-display);
  color: var(--kotler-ink);
  letter-spacing: var(--tracking-tighter);
  scroll-margin-top: calc(var(--header-height, 88px) + 1rem);
}

.kotler-post__content h2 {
  font-size: clamp(1.75rem, 2.8vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 2.5em 0 0.8em;
}

.kotler-post__content h2:first-child {
  margin-top: 0;
}

.kotler-post__content h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 2em 0 0.6em;
}

.kotler-post__content h4 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 1.6em 0 0.5em;
}

/* Blockquote */
.kotler-post__content blockquote {
  margin: 2em 0;
  padding: 1.25em 1.75em;
  border-left: 4px solid var(--kotler-blue);
  background: var(--kotler-bg-warm);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.1em;
  font-style: italic;
  color: var(--kotler-ink);
}

.kotler-post__content blockquote p {
  margin: 0 0 0.6em;
  color: inherit;
}

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

.kotler-post__content blockquote cite {
  display: block;
  margin-top: 0.8em;
  font-family: var(--font-display);
  font-size: 0.85em;
  font-style: normal;
  color: var(--kotler-text-mute);
}

/* Lists */
.kotler-post__content ul,
.kotler-post__content ol {
  margin: 1.5em 0;
  padding-left: 1.5em;
}

.kotler-post__content ul li,
.kotler-post__content ol li {
  margin: 0 0 0.5em;
  line-height: 1.65;
  color: var(--kotler-text);
}

.kotler-post__content ul li::marker {
  color: var(--kotler-blue);
}

.kotler-post__content ol li::marker {
  color: var(--kotler-blue);
  font-weight: 700;
}

.kotler-post__content li > ul,
.kotler-post__content li > ol {
  margin: 0.5em 0;
}

/* Links */
.kotler-post__content a,
.kotler-post__content a:link,
.kotler-post__content a:visited {
  color: var(--kotler-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 200ms ease, text-decoration-thickness 200ms ease;
}

.kotler-post__content a:hover,
.kotler-post__content a:focus-visible {
  color: var(--kotler-blue-600);
  text-decoration-thickness: 2px;
}

/* Strong + em */
.kotler-post__content strong {
  font-weight: 700;
  color: var(--kotler-ink);
}

.kotler-post__content em {
  font-style: italic;
}

/* Inline code */
.kotler-post__content code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--kotler-bg-warm);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--kotler-ink);
}

/* Pre code block */
.kotler-post__content pre {
  margin: 2em 0;
  padding: 1.5em;
  background: var(--kotler-ink);
  color: var(--kotler-bg);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.kotler-post__content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* Images + figure */
.kotler-post__content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 2em auto;
  display: block;
}

.kotler-post__content figure {
  margin: 2em 0;
}

.kotler-post__content figure img {
  margin: 0 auto;
}

.kotler-post__content figcaption {
  text-align: center;
  margin-top: 0.7em;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--kotler-text-mute);
  font-style: italic;
}

/* HR */
.kotler-post__content hr {
  margin: 3em auto;
  width: 100px;
  border: 0;
  border-top: 2px solid var(--kotler-blue);
  opacity: 0.35;
}

/* Tables */
.kotler-post__content table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.95em;
}

.kotler-post__content th,
.kotler-post__content td {
  padding: 0.7em 1em;
  text-align: left;
  border-bottom: 1px solid var(--kotler-border);
}

.kotler-post__content th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--kotler-ink);
  background: var(--kotler-bg-warm);
}

/* === AUTHOR BOX === */

.kotler-post__author {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-16);
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--kotler-bg-warm);
  border-radius: var(--radius-lg);
}

@media (min-width: 600px) {
  .kotler-post__author {
    flex-direction: row;
    align-items: flex-start;
  }
}

.kotler-post__author-avatar {
  flex-shrink: 0;
}

.kotler-post__author-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
}

.kotler-post__author-info {
  flex: 1;
}

.kotler-post__author-kicker {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--kotler-text-mute);
}

.kotler-post__author-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--kotler-ink);
  margin: 0 0 var(--space-2);
}

.kotler-post__author-name a,
.kotler-post__author-name a:link,
.kotler-post__author-name a:visited {
  color: inherit;
  text-decoration: none;
}

.kotler-post__author-name a:hover,
.kotler-post__author-name a:focus-visible {
  color: var(--kotler-blue);
}

.kotler-post__author-bio {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--kotler-text-soft);
  margin: 0;
}

.kotler-post__author-bio--placeholder {
  color: var(--kotler-text-mute);
  font-style: italic;
}

/* === RELATED === */

.kotler-post__related {
  background: var(--kotler-bg);
  padding: clamp(3rem, 6vw, 5rem) var(--container-padding);
  border-top: 1px solid var(--kotler-border);
}

.kotler-post__related-inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.kotler-post__related-header {
  max-width: 880px;
  margin-bottom: var(--space-8);
}

.kotler-post__related-kicker {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--kotler-blue);
  margin: 0 0 var(--space-3);
}

.kotler-post__related-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tighter);
  line-height: 1.15;
  color: var(--kotler-ink);
  margin: 0;
}

/* === REDUCED MOTION === */

@media (prefers-reduced-motion: reduce) {
  .kotler-post__share-btn,
  .kotler-post__share-toast,
  .kotler-post__content a,
  .kotler-post__hero-category {
    transition: none !important;
  }

  .kotler-post__share-btn:hover {
    transform: none;
  }
}
