/* ==========================================================
   Hi BodyMate — Layout & Grid
   Breakpoints: 320 · 640 · 768 · 1024 · 1280 · 1600 · 2560
   ========================================================== */

/* ----------------------------------------------------------
   Container boxed
   ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding-inline: var(--space-4);
  }
}

/* ----------------------------------------------------------
   Grid 12 colunas
   ---------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-6);
}

/* Column spans */
.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* ----------------------------------------------------------
   Responsive: tablet (≤ 1024px) — 6/12 → 12/12
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .col-5 { grid-column: span 12; }
  .col-6 { grid-column: span 12; }
  .col-8 { grid-column: span 12; }
  .col-4 { grid-column: span 12; }
  .col-2 { grid-column: span 12; }
}

/* ----------------------------------------------------------
   Responsive: mobile (≤ 640px) — tudo full width
   ---------------------------------------------------------- */
@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  [class^="col-"],
  [class*=" col-"] {
    grid-column: span 1;
  }
}

/* ----------------------------------------------------------
   Section spacing
   ---------------------------------------------------------- */
.section {
  padding-block: var(--space-16);
}

.section--sm {
  padding-block: var(--space-10);
}

.section--lg {
  padding-block: var(--space-24);
}

/* ----------------------------------------------------------
   Page wrapper (empurra conteúdo abaixo do header fixo)
   ---------------------------------------------------------- */
.page-wrapper {
  padding-top: var(--header-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
}

/* ----------------------------------------------------------
   Flex utilities
   ---------------------------------------------------------- */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* ----------------------------------------------------------
   Background alternation
   ---------------------------------------------------------- */
.bg-1 { background-color: var(--color-bg1); }
.bg-2 { background-color: var(--color-bg2); }
.bg-box { background-color: var(--color-bg-box); }

/* ----------------------------------------------------------
   Recent Posts sidebar (col-2 na home)
   ---------------------------------------------------------- */
.recent-posts-inner {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.recent-posts-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-brand-teal);
  margin-bottom: var(--space-1);
}

.recent-post-card {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.recent-post-card:last-of-type {
  border-bottom: none;
}

.recent-post-thumb {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-md);
  aspect-ratio: 16 / 7;
  margin-bottom: var(--space-2);
}

.recent-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.recent-post-card:hover .recent-post-thumb img {
  transform: scale(1.04);
}

.recent-post-thumb-placeholder {
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-box);
}

.recent-post-date {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-h4);
  margin-bottom: var(--space-1);
}

.recent-post-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-2);
}

.recent-post-heading a {
  color: var(--color-h2);
  transition: color var(--transition-fast);
}

.recent-post-heading a:hover {
  color: var(--color-brand-teal);
}

.recent-post-excerpt {
  font-size: var(--text-xs);
  color: var(--color-h4);
  line-height: 1.5;
}

.recent-posts-all {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-brand-teal);
  transition: color var(--transition-fast);
}

.recent-posts-all:hover {
  color: var(--color-h2);
}

@media (max-width: 1024px) {
  /* Move recent posts below calculators as a full-width horizontal strip */
  .recent-posts-col {
    grid-column: span 12;
    order: 10;
  }

  .recent-posts-inner {
    position: static;
  }

  .recent-posts-col .recent-posts-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  /* Horizontal scroll row of cards on tablet */
  .recent-posts-col .recent-post-card {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-2) var(--space-3);
    align-items: start;
  }

  .recent-posts-col .recent-post-thumb {
    grid-row: 1 / 4;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
  }

  .recent-posts-col .recent-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ----------------------------------------------------------
   CTA Card: How to Measure
   ---------------------------------------------------------- */
.cta-measure-card {
  background-color: #FFE4E6;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.cta-measure-content {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.cta-measure-text {
  flex: 1;
}

.cta-measure-text h3 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: #9f1239;
  margin-bottom: var(--space-3);
}

.cta-measure-text p {
  font-size: var(--text-base);
  color: #9f1239;
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

.cta-measure-link {
  display: inline-block;
  font-size: var(--text-base);
  font-weight: 600;
  color: #9f1239;
  text-decoration: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  border: 2px solid #9f1239;
  transition: all var(--transition-normal);
}

.cta-measure-link:hover {
  background-color: #9f1239;
  color: #FFE4E6;
}

.cta-measure-image {
  flex: 0 0 240px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: #FDE3E0;
}

.cta-measure-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* CTA link as button reset */
button.cta-measure-link {
  cursor: pointer;
  background: none;
}

@media (max-width: 768px) {
  .cta-measure-content {
    flex-direction: column;
    gap: var(--space-6);
  }

  .cta-measure-image {
    flex: 1;
    width: 100%;
    max-width: none;
  }

  .cta-measure-text h3 {
    font-size: var(--text-xl);
  }
}

/* ----------------------------------------------------------
   Modal: How to Measure
   ---------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: var(--space-8) var(--space-4);
}

.modal-overlay.is-open {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  animation: modalFadeIn 0.25s ease;
}

.modal-container {
  background-color: var(--color-bg2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  margin-top: var(--space-8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-h2);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-h4);
  background: none;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-body figure {
  margin: var(--space-4) 0;
}

.modal-body img {
  width: 100%;
  border-radius: var(--radius-lg);
}

.modal-body h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--color-h2);
}

.modal-body section:first-child h3 {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.modal-body p {
  color: var(--color-h3);
  margin-bottom: var(--space-3);
}

.modal-body ul {
  padding-left: var(--space-5);
  margin-bottom: var(--space-4);
}

.modal-body li {
  color: var(--color-h3);
  margin-bottom: var(--space-2);
  list-style: disc;
}

.modal-body li strong {
  color: var(--color-h2);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (max-width: 640px) {
  .modal-overlay { padding: var(--space-4) var(--space-3); }
  .modal-container { max-height: 90vh; margin-top: var(--space-4); }
  .modal-body { padding: var(--space-4); }
}

/* ----------------------------------------------------------
   Modal: Export PNG
   ---------------------------------------------------------- */
.export-modal-container {
  max-width: 480px;
}

.export-modal-body {
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

/* Card preview */
.export-card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(145deg, #f0fdf4 0%, #ccfbf1 100%);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.export-card-mate-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  opacity: 0.12;
  pointer-events: none;
}

.export-card-mate-bg svg {
  width: 70%;
  height: auto;
}

.export-card-content {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.export-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-card-logo {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-brand-teal);
}

.export-card-date {
  font-size: var(--text-xs);
  color: var(--color-h4);
  font-weight: 500;
}

.export-card-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-h4);
  margin: 0;
}

.export-card-slots {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.export-slot-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.export-slot-name {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-h4);
  width: 56px;
  flex-shrink: 0;
}

.export-slot-value {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--color-h2);
}

.export-slot-cat {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.export-card-message {
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-h3);
  line-height: 1.5;
  margin: 0;
}

.export-card-url {
  font-size: var(--text-xs);
  color: var(--color-brand-teal);
  font-weight: 600;
  margin-top: auto;
}

/* Download + share row */
.export-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.export-download-btn {
  width: 100%;
  background-color: var(--color-brand-teal);
  color: #fff;
  font-size: var(--text-base);
  font-weight: 700;
  padding: var(--space-4);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.export-download-btn:hover {
  opacity: 0.88;
}

.export-share {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.export-share-label {
  font-size: var(--text-sm);
  color: var(--color-h4);
}

.export-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  color: #fff;
}

.export-share-btn:hover {
  opacity: 0.85;
  transform: scale(1.08);
}

.export-share-btn svg {
  width: 22px;
  height: 22px;
}

#share-whatsapp {
  background-color: #25D366;
}

#share-messenger {
  background: linear-gradient(135deg, #0084ff 0%, #a033ff 100%);
}
