/* Value of Risk - Custom Styles */

/* Custom properties for the design system */
:root {
  /* Primary colors - Wine/Burgundy */
  --color-primary: #722F37;
  --color-primary-dark: #4A1C23;
  --color-primary-light: #A65D66;

  /* Text colors */
  --color-text-primary: #1F2937;
  --color-text-secondary: #4B5563;
  --color-text-muted: #6B7280;

  /* Background colors */
  --color-bg: #FAFAF9;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F5F4;

  /* Accent colors */
  --color-accent: #F7E7CE;
  --color-accent-dark: #E8D4B8;
  --color-amber: #FFBF00;
  --color-amber-light: #FFD54F;

  /* Category colors */
  --color-cornerstones: #722F37;
  --color-case-studies: #FFBF00;
  --color-shtf: #374151;
  --color-know-your-partners: #0D9488;

  /* Typography */
  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Spacing */
  --content-max-width: 1200px;
  --article-max-width: 720px;
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: 1.7;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-primary);
}

/* Texture backgrounds - deprecated brick, new geometric patterns */
.texture-brick {
  position: relative;
}

.texture-brick::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/assets/images/white_brick_wall.webp');
  background-position: center;
  background-repeat: repeat;
  opacity: 0.06;
  pointer-events: none;
}

.texture-brick-light::before {
  opacity: 0.04;
}

.texture-brick-medium::before {
  opacity: 0.1;
}

/* Modern diagonal accent stripe */
.accent-stripe {
  position: relative;
  overflow: hidden;
}

.accent-stripe::before {
  content: '';
  position: absolute;
  top: 0;
  right: -50px;
  width: 200px;
  height: 100%;
  background: linear-gradient(
    135deg,
    transparent 0%,
    transparent 40%,
    var(--color-primary) 40%,
    var(--color-primary) 42%,
    transparent 42%,
    transparent 48%,
    var(--color-accent) 48%,
    var(--color-accent) 50%,
    transparent 50%
  );
  opacity: 0.08;
  pointer-events: none;
}

/* Subtle topographic contour pattern */
.texture-contour {
  position: relative;
}

.texture-contour::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-radial-gradient(
      ellipse at 50% 50%,
      transparent 0px,
      transparent 8px,
      rgba(114, 47, 55, 0.03) 8px,
      rgba(114, 47, 55, 0.03) 9px
    );
  background-size: 80px 80px;
  pointer-events: none;
}

/* Geometric dot pattern accent for sections */
.geometric-dots {
  position: relative;
  overflow: hidden;
}

.geometric-dots::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 300px;
  background-image: radial-gradient(circle, rgba(114, 47, 55, 0.12) 2px, transparent 2px);
  background-size: 24px 24px;
  pointer-events: none;
}

.geometric-dots::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200px;
  height: 200px;
  background-image: radial-gradient(circle, var(--color-amber) 2px, transparent 2px);
  opacity: 0.1;
  background-size: 20px 20px;
  pointer-events: none;
}

/* Cross-hatch pattern */
.cross-hatch {
  position: relative;
  overflow: hidden;
}

.cross-hatch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(114, 47, 55, 0.03) 40px,
      rgba(114, 47, 55, 0.03) 41px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(114, 47, 55, 0.03) 40px,
      rgba(114, 47, 55, 0.03) 41px
    );
  pointer-events: none;
}

/* Corner bracket accent */
.corner-brackets {
  position: relative;
}

.corner-brackets::before,
.corner-brackets::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border: 3px solid rgba(114, 47, 55, 0.15);
  pointer-events: none;
}

.corner-brackets::before {
  top: 20px;
  left: 20px;
  border-right: none;
  border-bottom: none;
}

.corner-brackets::after {
  bottom: 20px;
  right: 20px;
  border-left: none;
  border-top: none;
}

/* Corner accent decoration */
.corner-accent {
  position: relative;
  overflow: hidden;
}

.corner-accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary) 50%,
    transparent 50%
  );
  opacity: 0.05;
  pointer-events: none;
}

.corner-accent::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: linear-gradient(
    -45deg,
    var(--color-accent) 0%,
    var(--color-accent) 50%,
    transparent 50%
  );
  opacity: 0.06;
  pointer-events: none;
}

/* Hero section with texture */
.hero-textured {
  position: relative;
  background-color: var(--color-primary);
  overflow: hidden;
}

/* Full-width diagonal amber stripes */
.hero-textured::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(255, 191, 0, 0.06) 20px,
    rgba(255, 191, 0, 0.06) 22px
  );
  pointer-events: none;
}

.hero-textured h1,
.hero-textured h2 {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-textured p {
  color: rgba(255, 255, 255, 0.9);
}

.hero-textured > * {
  position: relative;
  z-index: 1;
}

/* Author hero - slate variant */
.hero-author {
  position: relative;
  background-color: #374151;
  overflow: hidden;
}

.hero-author::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.04) 20px,
    rgba(255, 255, 255, 0.04) 22px
  );
  pointer-events: none;
}

.hero-author h1,
.hero-author h2 {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-author p {
  color: rgba(255, 255, 255, 0.9);
}

.hero-author > * {
  position: relative;
  z-index: 1;
}

/* Decorative elements */
.decorative-rule {
  height: 3px;
  background: linear-gradient(to right, var(--color-primary), var(--color-primary-light), transparent);
  border: none;
  margin: 2rem 0;
}

.decorative-rule-center {
  height: 2px;
  background: linear-gradient(to right, transparent, var(--color-primary-light), transparent);
  border: none;
  margin: 3rem auto;
  max-width: 200px;
}

/* Refined card styles */
.card-elevated {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-elevated:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

/* Bespoke section divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #d6d3d1, transparent);
}

.section-divider-icon {
  color: var(--color-primary-light);
  font-size: 0.875rem;
}

/* Article content styling */
.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary-light);
}

.article-content h3 {
  font-size: 1.375rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--color-text-secondary);
  font-family: var(--font-heading);
  font-size: 1.125rem;
}

.article-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: var(--color-primary-dark);
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-surface-alt);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.article-content pre {
  background-color: var(--color-text-primary);
  color: #F9FAFB;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Category badge colors */
.category-cornerstones {
  background-color: var(--color-cornerstones);
}

.category-case-studies {
  background-color: var(--color-case-studies);
}

.category-shtf {
  background-color: var(--color-shtf);
}

.category-know-your-partners {
  background-color: var(--color-know-your-partners);
}

/* Refined button styles */
.btn-primary {
  background-color: var(--color-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid var(--color-primary);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn-outline {
  background-color: transparent;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid white;
}

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

/* Hero-specific button variants for better contrast on dark backgrounds */
.btn-hero-primary {
  background-color: var(--color-accent);
  color: var(--color-primary-dark);
  padding: 0.875rem 1.75rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-hero-primary:hover {
  background-color: #FFFFFF;
  border-color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.btn-hero-secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.875rem 1.75rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
}

.btn-hero-secondary:hover {
  background-color: white;
  color: var(--color-primary-dark);
  border-color: white;
}

/* Transitions */
a, button {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Focus styles for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Newsletter form */
.newsletter-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

/* Textured newsletter section */
.newsletter-section {
  position: relative;
  background-color: #f5f5f4;
  border-top: 1px solid #e7e5e4;
  border-bottom: 1px solid #e7e5e4;
  overflow: hidden;
}

/* Diagonal stripes top corner */
.newsletter-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  height: 150px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(114, 47, 55, 0.06) 8px,
    rgba(114, 47, 55, 0.06) 10px
  );
  pointer-events: none;
}

/* Amber accent bar */
.newsletter-section::after {
  content: '';
  position: absolute;
  top: 0;
  right: 40px;
  width: 80px;
  height: 4px;
  background-color: var(--color-amber);
}

.newsletter-section > * {
  position: relative;
  z-index: 1;
}

/* Mobile menu - hidden by default with slide animation */
#mobile-menu {
  display: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out;
}

#mobile-menu.is-open {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

/* Loading state for posts */
.loading-skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-bg) 50%, var(--color-surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Refined category cards */
.category-card {
  position: relative;
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.25s ease;
  overflow: hidden;
}

.category-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.category-card:hover::after {
  transform: scaleX(1);
}

.category-card:hover {
  border-color: currentColor;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Pull quote style */
.pull-quote {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--color-primary);
  text-align: center;
  padding: 2rem;
  margin: 2rem 0;
  position: relative;
}

.pull-quote::before,
.pull-quote::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--color-primary-light);
}

.pull-quote::before {
  top: 0;
}

.pull-quote::after {
  bottom: 0;
}

/* Print styles */
@media print {
  nav-header, site-footer, newsletter-form {
    display: none;
  }

  .article-content {
    font-size: 12pt;
  }

  .texture-brick::before,
  .hero-textured::before,
  .newsletter-section::before {
    display: none;
  }
}
