/* ==========================================================================
   Components — Post cards, headers, tags, TOC, buttons, author, CTA
   Ported from Ghost theme SCSS
   ========================================================================== */

/* --- Buttons --- */

.c-btn {
  display: inline-block;
  padding: var(--space-16) var(--space-32);
  color: var(--color-text-button);
  background-color: var(--color-background-button);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: var(--global-letter-spacing);
  text-align: center;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  border-radius: var(--global-border-radius);
  transition: all var(--global-faster-transition) ease-in-out;
}

.c-btn:hover { opacity: .9; text-decoration: none; }
.c-btn--full { width: 100%; }

.c-btn--outline {
  color: var(--ghost-accent-color);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 1px var(--ghost-accent-color);
}

.c-btn--outline:hover {
  color: var(--color-text-white);
  background-color: var(--ghost-accent-color);
}


/* --- Post Card --- */

.c-post-cards {
  display: flex;
  flex-direction: column;
}

.c-post-cards--related {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-32);
}

@media (min-width: 640px) {
  .c-post-cards--related {
    grid-template-columns: repeat(2, 1fr);
  }
}

.c-post-card {
  position: relative;
  display: flex;
  width: 100%;
  overflow: hidden;
  flex-direction: column;
  margin-bottom: var(--space-32);
  border-radius: var(--global-border-radius);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
}

.c-post-card__media {
  overflow: hidden;
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
}

.c-post-card__image-wrap {
  display: block;
  position: relative;
  padding-top: 56.25%;
}

.c-post-card__image {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.c-post-card__content {
  flex-grow: 1;
  padding: var(--space-24);
}

@media (min-width: 1024px) {
  .c-post-card__content { padding: var(--space-32); }
}

.c-post-card__tag {
  display: inline-block;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ghost-accent-color);
  letter-spacing: var(--global-letter-spacing);
  margin-bottom: var(--space-8);
}

.c-post-card__title {
  font-weight: 900;
  font-size: 20px;
  line-height: 24px;
  margin-bottom: var(--space-8);
}

@media (min-width: 640px) {
  .c-post-card__title { font-size: 24px; line-height: 32px; }
}

@media (min-width: 1024px) {
  .c-post-card__title { font-size: 32px; line-height: 40px; }
}

.c-post-card__url::after {
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 1;
}

.c-post-card__excerpt {
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 22px;
  margin-bottom: var(--space-16);
}

.c-post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-12);
  font-size: 12px;
  line-height: 18px;
  color: var(--color-text-secondary);
}

.c-post-card__authors {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.c-post-card__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.c-post-card__date {
  color: var(--color-text-secondary);
}

.c-post-card__visibility {
  display: inline-block;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  color: var(--color-text-success);
}


/* --- Post Header / Hero --- */

.c-post > * + * {
  margin-top: var(--space-32);
}

.c-post-media {
  margin-bottom: var(--space-32);
}

.c-post-media--no-caption {
  box-shadow: -8px 16px 24px -8px rgba(0, 0, 0, .08);
}

.c-post-media__wrap {
  position: relative;
  background-color: var(--color-background-secondary);
  border-radius: var(--global-border-radius);
}

.c-post-media__wrap::after {
  content: '';
  display: block;
  height: 0;
  width: 100%;
  padding-bottom: 56.25%;
}

.c-post-media__image {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--global-border-radius);
}

.c-post-media--with-caption .c-post-media__image {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.c-post-media__caption {
  width: 100%;
  text-align: center;
  padding: var(--space-16);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  border-bottom-left-radius: var(--global-border-radius);
  border-bottom-right-radius: var(--global-border-radius);
  letter-spacing: var(--global-letter-spacing);
  background-color: var(--color-background-secondary);
}

.c-post-media__caption a {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.c-post-media__caption a:hover {
  color: var(--ghost-accent-color);
}

.c-post-header {
  margin-bottom: var(--space-32);
}

.c-post-header__title {
  margin-bottom: var(--space-16);
  font-size: 32px;
  line-height: 40px;
}

@media (min-width: 640px) {
  .c-post-header__title { font-size: 40px; line-height: 48px; }
}

@media (min-width: 1024px) {
  .c-post-header__title { font-size: 48px; line-height: 56px; }
}

.c-post-header__excerpt {
  font-size: 18px;
  line-height: 28px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-24);
}

.c-post-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-16);
  font-size: 14px;
  line-height: 22px;
  color: var(--color-text-secondary);
}

.c-post-header__authors {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.c-post-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.c-post-header__author-name {
  font-weight: 500;
  transition: color var(--global-faster-transition);
}

.c-post-header__author-name:hover {
  color: var(--ghost-accent-color);
}

.c-post-header__reading-time {
  color: var(--color-text-secondary);
}


/* --- Tags --- */

.c-tags {
  overflow: hidden;
  margin-bottom: calc(var(--space-8) * -1);
}

@media (min-width: 640px) {
  .c-tags { margin-bottom: calc(var(--space-16) * -1); }
}

.c-tags a, .c-tag {
  float: left;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  letter-spacing: var(--global-letter-spacing);
  padding: var(--space-8) var(--space-16);
  margin-right: var(--space-8);
  margin-bottom: var(--space-8);
  border-radius: var(--global-border-radius);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
  transition: color var(--global-faster-transition);
}

@media (min-width: 640px) {
  .c-tags a, .c-tag {
    padding: var(--space-8) var(--space-24);
    margin-right: var(--space-16);
    margin-bottom: var(--space-16);
    line-height: 24px;
  }
}

.c-tags a:hover, .c-tag:hover {
  color: var(--ghost-accent-color);
}


/* --- Author Card --- */

.c-card-author {
  width: 100%;
  display: flex;
  padding: var(--space-24);
  border-radius: var(--global-border-radius);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
}

.c-card-author__media {
  width: var(--space-80);
  height: var(--space-80);
  border-radius: 100%;
  margin-right: var(--space-24);
  background-color: var(--color-background-primary);
  flex-shrink: 0;
}

.c-card-author__image {
  object-fit: cover;
  width: var(--space-80);
  height: var(--space-80);
  min-width: var(--space-80);
  border-radius: 100%;
}

.c-card-author__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.c-card-author__name {
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
}

.c-card-author__name a {
  transition: color var(--global-faster-transition);
}

.c-card-author__name a:hover {
  color: var(--ghost-accent-color);
}


/* --- Table of Contents --- */

.c-table-of-contents {
  padding: var(--space-32);
  border-radius: var(--global-border-radius);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
  border-left: var(--space-2) solid var(--ghost-accent-color);
}

.c-table-of-contents__heading {
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-24);
  font-variant: petite-caps;
  font-weight: 500;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 .5px 0 0 var(--color-border-primary);
}

.c-table-of-contents__content > * {
  font-size: 16px;
  line-height: 24px;
}

.c-table-of-contents__list {
  padding-left: var(--space-4);
}

.c-table-of-contents__list:first-child > .c-table-of-contents__list-item:first-child {
  margin-top: 0;
}

.c-table-of-contents__list-item {
  margin-top: var(--space-8);
}

.c-table-of-contents__list-item::marker {
  color: var(--color-text-secondary);
}

.c-table-of-contents__list-link {
  text-decoration: underline;
  transition: color var(--global-faster-transition);
}

.c-table-of-contents__list-link:hover {
  color: var(--ghost-accent-color);
}


/* --- Upgrade CTA --- */

.c-post-upgrade-cta {
  position: relative;
  text-align: center;
  padding: var(--space-24);
  border-radius: var(--global-border-radius);
  background-color: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
}

@media (min-width: 640px) {
  .c-post-upgrade-cta { padding: var(--space-40); }
}

@media (min-width: 1024px) {
  .c-post-upgrade-cta { padding: var(--space-56); }
}

.c-post-upgrade-cta__title {
  font-size: 24px;
  line-height: 32px;
  margin-bottom: var(--space-24);
}


/* --- Related Posts --- */

.c-related-posts {
  margin-top: var(--space-48);
  padding-top: var(--space-48);
  border-top: 1px solid var(--color-border-primary);
}

.c-related-posts__title {
  font-size: 24px;
  line-height: 32px;
  margin-bottom: var(--space-32);
}


/* --- Archive --- */

.c-archive__header {
  margin-bottom: var(--space-32);
}

.c-archive__title {
  font-size: 32px;
  line-height: 40px;
}


/* --- Pagination --- */

.c-pagination {
  margin-top: var(--space-16);
  margin-bottom: var(--space-32);
  text-align: center;
}


/* --- Page --- */

.c-page {
  padding-bottom: var(--space-48);
}


/* --- Flash Messages --- */

.c-flash {
  max-width: 40rem;
  margin: 1rem auto;
  padding: 0.75rem 1.25rem;
  border-radius: var(--global-border-radius);
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  animation: flashIn 0.3s ease-out;
}
.c-flash--notice {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.c-flash--alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}
.c-flash--leaving {
  animation: flashOut 0.3s ease-in forwards;
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes flashOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-0.5rem); }
}
.c-flash p { margin: 0; }


/* --- Account Page --- */

.c-account-page {
  max-width: 32rem;
  margin: var(--space-48) auto;
  padding: 0 var(--space-16);
}
.c-account-page__title {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  margin: 0 0 var(--space-24);
}
.c-account-page__card {
  background: var(--color-background-secondary);
  border-radius: var(--global-border-radius);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
  padding: var(--space-24);
  margin-bottom: var(--space-24);
}
.c-account-page__field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}
.c-account-page__field + .c-account-page__field {
  border-top: 1px solid var(--color-border-primary);
}
.c-account-page__label {
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.c-account-page__value {
  font-size: 14px;
  line-height: 22px;
  color: var(--color-text-primary);
}
.c-account-page__status-badge {
  display: inline-block;
  padding: var(--space-4) var(--space-12);
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
}
.c-account-page__status-badge--paid,
.c-account-page__status-badge--comped {
  background: #dbeafe;
  color: #1e40af;
}
.c-account-page__status-badge--free {
  background: var(--color-background-secondary);
  box-shadow: inset 0 0 0 .5px var(--color-border-primary);
  color: var(--color-text-secondary);
}
.c-account-page__actions {
  text-align: center;
}
.c-account-page__logout-btn {
  display: inline-block;
  padding: var(--space-12) var(--space-24);
  background: none;
  border: 1px solid var(--color-border-primary);
  border-radius: var(--global-border-radius);
  font-size: 14px;
  line-height: 22px;
  font-family: inherit;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--global-faster-transition) ease-in-out;
}
.c-account-page__logout-btn:hover {
  border-color: #dc2626;
  color: #dc2626;
}


/* --- Header Account Links --- */

.c-nav__link--accent {
  color: var(--ghost-accent-color);
}

@media (max-width: 640px) {
  .c-account-page {
    margin-top: var(--space-32);
  }
  .c-account-page__field {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
}
