/*
Theme Name: 7PetDays V2
Theme URI: https://7petdays.com
Author: Annah
Description: Modern premium pet editorial theme.
Version: 2.0.0
Text Domain: petdays-v2
*/

:root {
  --bg: #fffaf5;
  --surface: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #ece3d8;
  --brand: #d97706;
  --brand-soft: #f9eddc;
  --radius: 14px;
  --max: 1240px;
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.site-wrap { width: min(100% - 2rem, var(--max)); margin-inline: auto; }

.pet-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.pet-header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.pet-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: #111827;
}
.pet-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 20px;
}
.pet-brand-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.35rem; letter-spacing: .02em; }

.pet-nav-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 42px;
  height: 42px;
}
.pet-nav { display: none; }
.pet-nav.open { display: block; }
.pet-menu {
  list-style: none;
  margin: 0;
  padding: .8rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.pet-menu a {
  display: block;
  text-decoration: none;
  color: #374151;
  padding: .48rem .7rem;
  border-radius: 10px;
}
.pet-menu a:hover { background: var(--brand-soft); color: #111827; }

.pet-hero {
  margin-top: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}
.pet-hero-media img { width: 100%; height: 100%; min-height: 320px; object-fit: cover; }
.pet-hero-body { padding: 1.7rem; }
.pet-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--brand-soft);
  color: #9a5a00;
  border-radius: 999px;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 700;
  padding: .3rem .65rem;
}
.pet-hero h1 { margin: .8rem 0 .7rem; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(1.9rem,3vw,2.8rem); line-height: 1.15; }
.pet-hero p { margin: 0; color: var(--muted); }

.pet-cat-row {
  display: flex;
  gap: .55rem;
  overflow-x: auto;
  padding: 1rem 0 .8rem;
}
.pet-cat-row a {
  white-space: nowrap;
  text-decoration: none;
  color: #374151;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: .42rem .75rem;
  font-size: .86rem;
}
.pet-cat-row a:hover { border-color: #e2c9a6; background: var(--brand-soft); }

.pet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}
.pet-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pet-card-media { height: 220px; overflow: hidden; }
.pet-card-media img { width: 100%; height: 220px; object-fit: cover; display: block; }
.pet-card-body { padding: .95rem; }
.pet-card h3 { margin: .5rem 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem; line-height: 1.25; }
.pet-card p { margin: 0; color: var(--muted); font-size: .94rem; }

.pet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.6rem;
  align-items: start;
  margin: 1.2rem 0 2.2rem;
}
.pet-article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.pet-article-hero img { width: 100%; max-height: 500px; object-fit: cover; display:block; }
.pet-article-inner { padding: 1.4rem; }
.pet-article h1 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(2rem,4vw,3rem); line-height: 1.12; margin: .6rem 0 1rem; }
.pet-meta { color: #6b7280; font-size: .9rem; margin-bottom: 1rem; }

.pet-toc {
  position: sticky;
  top: 90px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem;
}
.pet-toc h3 { margin: .2rem 0 .6rem; font-size: .95rem; text-transform: uppercase; letter-spacing:.05em; color:#6b7280; }
.pet-toc ul { list-style: none; margin: 0; padding: 0; }
.pet-toc li { margin: .45rem 0; }
.pet-toc a { text-decoration: none; color: #4b5563; font-size: .92rem; }
.pet-toc a:hover { color: #111827; }

.pet-footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2rem;
  color: #6b7280;
  font-size: .9rem;
}

@media (max-width: 1000px) {
  .pet-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pet-layout { grid-template-columns: 1fr; }
  .pet-toc { position: static; }
}
@media (max-width: 860px) {
  .pet-hero { grid-template-columns: 1fr; }
  .pet-hero-media img { min-height: 260px; }
}
@media (max-width: 760px) {
  .pet-grid { grid-template-columns: 1fr; }
  .pet-card-media, .pet-card-media img { height: 210px; }
}
@media (min-width: 980px) {
  .pet-nav-toggle { display: none; }
  .pet-nav { display: block !important; }
  .pet-menu { flex-direction: row; align-items: center; padding: 0; gap: .2rem; }
}

/* Keep header menu clean: top-level only */
.pet-menu > li { position: relative; }
.pet-menu > li > ul,
.pet-menu .sub-menu,
.pet-menu .children {
  display: none !important;
}

/* REVIEW FIXES: lang switch + strict card image height */
.pet-lang-switch {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}
.pet-lang-switch a {
  text-decoration: none;
  border: 1px solid var(--line);
  color: #374151;
  background: #fff;
  border-radius: 999px;
  padding: .28rem .6rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.pet-lang-switch a.is-active,
.pet-lang-switch a:hover {
  background: var(--brand-soft);
  border-color: #e4c8a4;
  color: #1f2937;
}

.pet-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
}

/* Force exact equal card image heights */
.pet-card-media {
  height: 220px !important;
  min-height: 220px !important;
  max-height: 220px !important;
  overflow: hidden !important;
}
.pet-card-media img,
.pet-card-media .wp-post-image {
  width: 100% !important;
  height: 220px !important;
  min-height: 220px !important;
  max-height: 220px !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

@media (max-width: 980px) {
  .pet-header-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
}

/* FIX 1: mobile card title clamp */
.pet-card h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* FIX 2: explicit author display_name styling */
.pet-byline {
  margin-top: .35rem;
  font-size: .82rem;
  color: #8b8f99;
  font-weight: 500;
}


/* FIX: related articles responsive columns */
.pet-related-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 1024px) {
  .pet-related-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .pet-related-grid { grid-template-columns: 1fr; }
}

/* FIX: prevent category badge truncation in cards */
.pet-card .pet-pill {
  font-size: .64rem;
  letter-spacing: .02em;
  line-height: 1.25;
  text-transform: uppercase;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* FIX: TOC placement and inline image rendering */
.pet-toc-inline {
  display: none;
  margin: .8rem 0 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem;
}
.pet-toc-inline h3 {
  margin: .2rem 0 .5rem;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
}
.pet-toc-inline ul { list-style: none; margin: 0; padding: 0; }
.pet-toc-inline li { margin: .4rem 0; }
.pet-toc-inline a { text-decoration: none; color: #4b5563; font-size: .9rem; }
.pet-toc-inline a:hover { color: #111827; }

/* Inline content images must not be cropped */
#article-content img,
.pet-article-inner img,
.wp-block-image img {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
}

@media (max-width: 1000px) {
  .pet-toc { display: none; }
  .pet-toc-inline { display: block; }
}
@media (min-width: 1001px) {
  .pet-toc { display: block; }
  .pet-toc-inline { display: none; }
}


/* HOTFIX: inline article images should never crop or overflow */
#article-content img,
#article-content .wp-caption img,
.pet-article-inner .wp-block-image img,
.pet-article-inner img[class*="wp-image"] {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
}

#article-content figure,
#article-content .wp-caption,
.pet-article-inner .wp-block-image {
  max-width: 100% !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow: visible !important;
}
