/* ==========================================================================
   PyCMS Theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  --color-primary:      #3b82f6;
  --color-secondary:    #6b7280;
  --color-primary-dark: #2563eb;

  --color-white:   #ffffff;
  --color-light:   #f3f4f6;
  --color-dark:    #111827;
  --color-muted:   #6b7280;
  --color-border:  #e5e7eb;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-sm: .25rem;
  --radius:    .5rem;
  --radius-lg: 1rem;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);

  --t: 180ms ease;
  --max-width: 1200px;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-sans); color: var(--color-dark); background: var(--color-white); line-height: 1.65; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4,h5,h6 { line-height: 1.25; font-weight: 700; margin-bottom: .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
ul,ol { padding-left: 1.5rem; margin-bottom: 1rem; }

blockquote {
  border-left: 4px solid var(--color-primary);
  padding: .75rem 1.25rem;
  background: var(--color-light);
  border-radius: var(--radius);
  font-style: italic;
  margin-bottom: 1rem;
}

code { background: var(--color-light); padding: .15em .35em; border-radius: var(--radius-sm); font-size: .875em; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* --------------------------------------------------------------------------
   4. Header / nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: .9rem; gap: 1.5rem;
}

.site-nav__logo {
  font-size: 1.3rem; font-weight: 800;
  color: var(--color-dark); text-decoration: none;
  flex-shrink: 0; display: flex; align-items: center; gap: .5rem;
  transition: opacity var(--t);
}
.site-nav__logo:hover { opacity: .8; text-decoration: none; }
.site-nav__logo img { height: 2rem; width: auto; }

.site-nav__links { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.site-nav__links a {
  color: var(--color-dark); font-weight: 500; font-size: .9375rem;
  text-decoration: none; transition: color var(--t);
  position: relative; padding-bottom: 2px;
}
.site-nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 0; height: 2px; background: var(--color-primary);
  transition: width var(--t);
}
.site-nav__links a:hover { color: var(--color-primary); text-decoration: none; }
.site-nav__links a:hover::after,
.site-nav__links a.active::after { width: 100%; }

.nav-toggle { display: none; }
.nav-toggle-label { display: none; cursor: pointer; padding: .4rem; font-size: 1.4rem; line-height: 1; }

@media (max-width: 640px) {
  .nav-toggle-label { display: block; }
  .site-nav__links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--color-white); flex-direction: column; align-items: flex-start;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow); gap: .75rem;
  }
  .nav-toggle:checked ~ .site-nav__links { display: flex; }
  .site-header { position: relative; }
}

/* --------------------------------------------------------------------------
   5. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--color-dark); color: rgba(255,255,255,.75);
  padding-block: 2.5rem; margin-top: auto;
}
.site-footer a { color: rgba(255,255,255,.75); }
.site-footer a:hover { color: #fff; }
.site-footer p { margin-bottom: 0; font-size: .9rem; }

/* --------------------------------------------------------------------------
   6. Section backgrounds, padding, text-align (data-attribute driven)
   -------------------------------------------------------------------------- */
[data-bg="white"]      { background-color: var(--color-white); }
[data-bg="light"]      { background-color: var(--color-light); }
[data-bg="dark"]       { background-color: var(--color-dark); color: #f9fafb; }
[data-bg="dark"] h1,[data-bg="dark"] h2,[data-bg="dark"] h3 { color: #f9fafb; }
[data-bg="primary"]    { background-color: var(--color-primary); color: #fff; }
[data-bg="primary"] h1,[data-bg="primary"] h2,[data-bg="primary"] h3 { color: #fff; }
[data-bg="transparent"]{ background-color: transparent; }

[data-pad="none"] { padding-block: 0; }
[data-pad="sm"]   { padding-block: 2rem; }
[data-pad="md"]   { padding-block: 4rem; }
[data-pad="lg"]   { padding-block: 6rem; }
[data-pad="xl"]   { padding-block: 8rem; }

[data-align="left"]   { text-align: left; }
[data-align="center"] { text-align: center; }
[data-align="right"]  { text-align: right; }

/* --------------------------------------------------------------------------
   7. Hero section
   -------------------------------------------------------------------------- */
.section-hero {
  position: relative; min-height: 70vh;
  display: flex; align-items: center;
  padding-block: 5rem; overflow: hidden;
  background-color: var(--color-dark);
}

.section-hero__bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  z-index: 0; will-change: transform;
}

.section-hero__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45); z-index: 1;
}

.section-hero__content {
  position: relative; z-index: 2;
  max-width: 800px; width: 100%;
  will-change: opacity, transform;
}

.section-hero[data-align="center"] .section-hero__content { margin-inline: auto; }
.section-hero[data-align="right"]  .section-hero__content { margin-left: auto; }

.section-hero__heading   { color: #fff; font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1rem; }
.section-hero__subheading { color: rgba(255,255,255,.85); font-size: clamp(1rem, 2vw, 1.25rem); margin-bottom: 2rem; }

.section-hero[data-bg="white"] .section-hero__heading,
.section-hero[data-bg="light"] .section-hero__heading  { color: var(--color-dark); }
.section-hero[data-bg="white"] .section-hero__subheading,
.section-hero[data-bg="light"] .section-hero__subheading { color: var(--color-muted); }

.section-hero__ctas { display: flex; gap: 1rem; flex-wrap: wrap; }
.section-hero[data-align="center"] .section-hero__ctas { justify-content: center; }
.section-hero[data-align="right"]  .section-hero__ctas { justify-content: flex-end; }

/* --------------------------------------------------------------------------
   8. One-column
   -------------------------------------------------------------------------- */
.section-one-col { width: 100%; }

/* --------------------------------------------------------------------------
   9. Two-column
   -------------------------------------------------------------------------- */
.section-two-col { width: 100%; }
.section-two-col__grid { display: grid; gap: 3rem; align-items: start; grid-template-columns: 1fr 1fr; }

.section-two-col[data-widths="one-third"]      .section-two-col__grid { grid-template-columns: 1fr 2fr; }
.section-two-col[data-widths="two-thirds"]     .section-two-col__grid { grid-template-columns: 2fr 1fr; }
.section-two-col[data-widths="one-quarter"]    .section-two-col__grid { grid-template-columns: 1fr 3fr; }
.section-two-col[data-widths="three-quarters"] .section-two-col__grid { grid-template-columns: 3fr 1fr; }

@media (max-width: 768px) {
  .section-two-col__grid { grid-template-columns: 1fr !important; }
  .section-two-col[data-reverse-mobile="true"] .section-two-col__left  { order: 2; }
  .section-two-col[data-reverse-mobile="true"] .section-two-col__right { order: 1; }
}

/* --------------------------------------------------------------------------
   10. Three-column
   -------------------------------------------------------------------------- */
.section-three-col { width: 100%; }
.section-three-col__grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 2rem; align-items: start; }

@media (max-width: 900px) { .section-three-col__grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px) { .section-three-col__grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   11. Cards section
   -------------------------------------------------------------------------- */
.section-cards { width: 100%; }
.section-cards__heading   { text-align: center; margin-bottom: .5rem; }
.section-cards__subheading { text-align: center; color: var(--color-muted); margin-bottom: 2.5rem; }
[data-bg="dark"]    .section-cards__subheading,
[data-bg="primary"] .section-cards__subheading { color: rgba(255,255,255,.75); }
.section-cards__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 1.5rem; }

/* --------------------------------------------------------------------------
   12. Image + text
   -------------------------------------------------------------------------- */
.section-image-text { width: 100%; }
.section-image-text__grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3rem; align-items: center;
}
.section-image-text[data-image-pos="right"] .section-image-text__image   { order: 2; }
.section-image-text[data-image-pos="right"] .section-image-text__content { order: 1; }
.section-image-text__image img { border-radius: var(--radius-lg); width: 100%; object-fit: cover; }
@media (max-width: 768px) {
  .section-image-text__grid { grid-template-columns: 1fr; }
  .section-image-text__image   { order: 1 !important; }
  .section-image-text__content { order: 2 !important; }
}

/* --------------------------------------------------------------------------
   13. Banner / CTA
   -------------------------------------------------------------------------- */
.section-banner { width: 100%; }
.section-banner__content {
  text-align: center; max-width: 700px; margin-inline: auto;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.section-banner__subheading { font-size: 1.1rem; opacity: .85; }

/* --------------------------------------------------------------------------
   14. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.4rem; border-radius: var(--radius);
  font-weight: 600; font-size: .9375rem; cursor: pointer;
  border: 2px solid transparent; text-decoration: none !important;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t), transform var(--t);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn--primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); box-shadow: 0 4px 14px rgba(59,130,246,.4); }

.btn--secondary { background: var(--color-secondary); color: #fff; border-color: var(--color-secondary); }
.btn--secondary:hover { filter: brightness(1.1); }

.btn--outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--outline:hover { background: var(--color-primary); color: #fff; }

.btn--ghost { background: transparent; color: currentColor; border-color: transparent; padding-inline: .25rem; text-decoration: underline !important; }
.btn--ghost:hover { opacity: .75; }

/* --------------------------------------------------------------------------
   15. Block: image figure
   -------------------------------------------------------------------------- */
.block-image { margin-bottom: 1.5rem; }
.block-image img { width: 100%; border-radius: var(--radius); }
.block-image figcaption { font-size: .85rem; color: var(--color-muted); margin-top: .5rem; text-align: center; }

/* --------------------------------------------------------------------------
   16. Block: card
   -------------------------------------------------------------------------- */
.block-card {
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: box-shadow var(--t), transform var(--t);
}
.block-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.block-card__image { width: 100%; aspect-ratio: 3/2; object-fit: cover; }
.block-card__body  { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; flex: 1; }
.block-card__heading { font-size: 1.1rem; margin-bottom: 0; }
.block-card__text  { color: var(--color-muted); font-size: .9375rem; }
.block-card__text p:last-child { margin-bottom: 0; }
.block-card__body .btn { margin-top: auto; align-self: flex-start; }

/* --------------------------------------------------------------------------
   17. Blog
   -------------------------------------------------------------------------- */
.blog-header { padding-block: 4rem 2rem; border-bottom: 1px solid var(--color-border); margin-bottom: 3rem; }
.blog-header p { color: var(--color-muted); font-size: 1.1rem; }

.blog-categories { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.blog-categories a {
  display: inline-block; padding: .35rem .85rem; border-radius: 999px;
  background: var(--color-light); color: var(--color-dark);
  font-size: .875rem; font-weight: 500; text-decoration: none;
  transition: background var(--t), color var(--t);
}
.blog-categories a:hover, .blog-categories a.active { background: var(--color-primary); color: #fff; }

.blog-listing {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr));
  gap: 2rem; margin-bottom: 3rem;
}

.blog-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--color-white); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
  display: flex; flex-direction: column;
}
.blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.blog-card img   { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.blog-card__body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }

.blog-card h2 { font-size: 1.15rem; margin-bottom: 0; }
.blog-card h2 a { color: var(--color-dark); text-decoration: none; }
.blog-card h2 a:hover { color: var(--color-primary); }

.meta { color: var(--color-muted); font-size: .85rem; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tags a { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--color-light); color: var(--color-muted); text-decoration: none; }
.tags a:hover { background: var(--color-primary); color: #fff; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding-block: 2rem; }
.pagination a {
  padding: .5rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: .9rem; color: var(--color-dark); text-decoration: none;
  transition: background var(--t), color var(--t);
}
.pagination a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination span { color: var(--color-muted); font-size: .9rem; }

.blog-post-container { max-width: 800px; margin-inline: auto; padding-block: 3rem; }
.blog-post__hero { width: 100%; max-height: 480px; object-fit: cover; border-radius: var(--radius-lg); margin-bottom: 2rem; }
.blog-post__header { margin-bottom: 2rem; }
.blog-post__intro  { font-size: 1.15rem; color: var(--color-muted); font-style: italic; margin-bottom: 1.5rem; }

.blog-body h2 { margin-top: 2rem; }
.blog-body h3 { margin-top: 1.5rem; }
.blog-body figure { margin-block: 1.5rem; }
.blog-body figure img { border-radius: var(--radius); }
.blog-body blockquote { margin-block: 1.5rem; }

.blog-post__tags { margin-block: 2rem; }

.related-posts { border-top: 1px solid var(--color-border); padding-top: 2rem; margin-top: 2rem; }
.related-posts h3 { margin-bottom: 1rem; }
.related-posts ul { list-style: none; padding-left: 0; }
.related-posts li { padding: .5rem 0; border-bottom: 1px solid var(--color-border); }
.related-posts li:last-child { border-bottom: none; }

.back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--color-muted); font-size: .9rem; margin-top: 2rem; }
.back-link:hover { color: var(--color-primary); }

/* --------------------------------------------------------------------------
   18. Rich text
   -------------------------------------------------------------------------- */
.rich-text h2 { margin-top: 1.75rem; }
.rich-text h3 { margin-top: 1.5rem; }
.rich-text a  { color: var(--color-primary); text-decoration: underline; }
.rich-text img { border-radius: var(--radius); margin-block: 1rem; }

/* --------------------------------------------------------------------------
   19. Responsive embed
   -------------------------------------------------------------------------- */
.responsive-object { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); }
.responsive-object iframe, .responsive-object embed, .responsive-object object {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

/* --------------------------------------------------------------------------
   20. AOS card stagger via CSS (nth-child delay)
   -------------------------------------------------------------------------- */
.section-cards__grid [data-aos]:nth-child(2) { transition-delay: 100ms !important; }
.section-cards__grid [data-aos]:nth-child(3) { transition-delay: 200ms !important; }
.section-cards__grid [data-aos]:nth-child(4) { transition-delay: 300ms !important; }
.section-cards__grid [data-aos]:nth-child(5) { transition-delay: 400ms !important; }
.section-cards__grid [data-aos]:nth-child(6) { transition-delay: 500ms !important; }

.blog-listing [data-aos]:nth-child(2) { transition-delay: 100ms !important; }
.blog-listing [data-aos]:nth-child(3) { transition-delay: 200ms !important; }
.blog-listing [data-aos]:nth-child(4) { transition-delay: 300ms !important; }
.blog-listing [data-aos]:nth-child(5) { transition-delay: 400ms !important; }
.blog-listing [data-aos]:nth-child(6) { transition-delay: 500ms !important; }
