/* =========================================================
   SHAAGIRD DOCUMENTS ARCHIVE
   Branded with Shaagird Teal (#299D8E) & Design System
   Matches Policies/Reports Page Layout with Shaagird Aesthetics
========================================================= */

:root {
  --doc-teal: #299D8E;
  --doc-teal-dark: #217F74;
  --doc-teal-soft: #E7F5F2;
  --doc-teal-light: #F0F7F5;
  --doc-ink: #173B38;
  --doc-text-muted: #5F716E;
  --doc-border: #DCE9E6;
  --doc-card-bg: #FFFFFF;
}

.m2s-documents-page {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto 70px;
  padding: 0 clamp(16px, 3.5vw, 40px);
  color: var(--doc-ink);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

.m2s-documents-page *,
.m2s-documents-page *::before,
.m2s-documents-page *::after {
  box-sizing: border-box;
}

/* Background subtle pattern */
.m2s-documents-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(41, 157, 142, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 157, 142, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 75% 20%, rgba(41, 157, 142, 0.08), transparent 32%),
    linear-gradient(180deg, #FFFFFF 0%, #F5FAF9 100%);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

/* Hero Panel */
.m2s-hero-panel {
  position: relative;
  width: 100%;
  margin: 28px auto 0;
  min-height: 220px;
  padding: clamp(28px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid var(--doc-border);
  border-top: 5px solid var(--doc-teal);
  border-radius: 12px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(231, 245, 242, 0.88)),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 60px rgba(23, 59, 56, 0.08);
  backdrop-filter: blur(20px);
}

.m2s-hero-panel::after {
  content: "";
  position: absolute;
  right: clamp(24px, 5vw, 68px);
  top: 50%;
  transform: translateY(-50%) rotate(-6deg);
  width: 90px;
  height: 90px;
  border: 1px solid rgba(41, 157, 142, 0.2);
  border-radius: 50%;
  background:
    url("https://shaagird.org/shaagird-logo.svg") center / 56px 56px no-repeat,
    var(--doc-teal-soft);
  box-shadow:
    0 16px 30px rgba(41, 157, 142, 0.18),
    inset 0 0 0 10px #FFFFFF,
    inset 0 0 0 12px rgba(41, 157, 142, 0.25);
  pointer-events: none;
}

.m2s-kicker {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--doc-teal);
}

.m2s-hero-panel h1 {
  max-width: calc(100% - 140px);
  margin: 0 0 12px;
  font-size: clamp(36px, 4.8vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--doc-ink);
}

.m2s-hero-panel p:not(.m2s-kicker) {
  max-width: min(1000px, calc(100% - 120px));
  margin: 0;
  color: #31504D;
  font-size: clamp(14px, 1.2vw, 15.5px);
  line-height: 1.7;
}

/* Document Cards Grid */
.m2s-document-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 28px !important;
  align-items: start;
  width: 100%;
  margin: 28px auto 0;
  padding: clamp(18px, 2.5vw, 28px);
  border: 1px solid var(--doc-border);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    rgba(255, 255, 255, 0.75);
  box-shadow:
    0 24px 70px rgba(23, 59, 56, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
}

/* Individual Card */
.m2s-document-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 14px;
  margin: 0 !important;
  padding: 16px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid rgba(220, 233, 230, 0.7);
  box-shadow: 0 8px 24px rgba(23, 59, 56, 0.05);
  text-align: center;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease, border-color 0.28s ease;
}

.m2s-document-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(23, 59, 56, 0.12);
  border-color: var(--doc-teal);
}

/* Document Badge */
.m2s-document-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--doc-teal-soft);
  color: var(--doc-teal-dark);
}

/* Card title */
.m2s-document-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--doc-ink);
  line-height: 1.35;
}

/* Card description */
.m2s-document-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--doc-text-muted);
  line-height: 1.6;
}

/* Cover styling with realistic document sheen */
.m2s-document-cover {
  position: relative;
  display: block !important;
  width: 100% !important;
  max-width: 280px;
  aspect-ratio: 430 / 520;
  overflow: hidden;
  margin: 4px 0 !important;
  line-height: 0;
  border-radius: 8px;
  background: #E8ECEB;
  box-shadow:
    0 16px 30px rgba(23, 59, 56, 0.14),
    0 4px 10px rgba(23, 59, 56, 0.06);
  border: 1px solid rgba(23, 59, 56, 0.08);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.m2s-document-cover a {
  display: block;
  width: 100%;
  height: 100%;
}

.m2s-document-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.24) 0%, transparent 30%, transparent 70%, rgba(255, 255, 255, 0.12) 100%),
    linear-gradient(to bottom, transparent 72%, rgba(23, 59, 56, 0.16) 100%);
}

.m2s-document-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.m2s-document-card:hover .m2s-document-cover {
  transform: perspective(900px) rotateX(2deg);
  box-shadow:
    0 24px 44px rgba(23, 59, 56, 0.22),
    0 6px 14px rgba(41, 157, 142, 0.12);
}

.m2s-document-card:hover .m2s-document-cover img {
  filter: contrast(1.03) saturate(1.05);
  transform: scale(1.04);
}

/* Button Container */
.m2s-document-card .wp-block-buttons {
  display: flex !important;
  justify-content: center !important;
  margin-top: auto !important;
  padding: 6px 0 0 !important;
  width: 100%;
}

.m2s-read-button {
  margin: 0 !important;
  padding: 0 !important;
  display: inline-block;
  width: 100%;
}

/* Button Pill with Arrow */
.m2s-read-button .wp-block-button__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 220px;
  min-height: 36px;
  overflow: hidden;
  padding: 0 16px !important;
  border: 1px solid rgba(41, 157, 142, 0.5);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--doc-teal), var(--doc-teal-dark)) !important;
  color: #FFFFFF !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  box-shadow:
    0 8px 20px rgba(41, 157, 142, 0.28),
    0 0 0 2px rgba(41, 157, 142, 0.15);
  transition: all 0.25s ease;
}

.m2s-read-button .wp-block-button__link::after {
  content: "→";
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  place-items: center;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--doc-teal-dark);
  font-size: 11px;
  font-weight: 900;
  flex: 0 0 18px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.m2s-read-button .wp-block-button__link:hover,
.m2s-document-card:hover .m2s-read-button .wp-block-button__link {
  background: #111111 !important;
  color: #FFFFFF !important;
  border-color: #111111;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.m2s-read-button .wp-block-button__link:hover::after,
.m2s-document-card:hover .m2s-read-button .wp-block-button__link::after {
  background: #FFFFFF;
  color: #111111;
  transform: translateX(3px);
}

/* Trust & Verification Banner */
.m2s-doc-trust-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 36px 0 0;
  padding: 24px 32px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(231, 245, 242, 0.95), rgba(255, 255, 255, 0.9));
  border: 1px solid var(--doc-border);
  box-shadow: 0 10px 30px rgba(23, 59, 56, 0.05);
}

.m2s-doc-trust-info h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: var(--doc-ink);
}

.m2s-doc-trust-info p {
  margin: 0;
  font-size: 14px;
  color: var(--doc-text-muted);
  line-height: 1.6;
}

.m2s-doc-trust-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.m2s-doc-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.25s ease;
}

.m2s-doc-action-primary {
  background: var(--doc-teal);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(41, 157, 142, 0.25);
}

.m2s-doc-action-primary:hover {
  background: var(--doc-teal-dark);
  transform: translateY(-2px);
}

.m2s-doc-action-secondary {
  background: #FFFFFF;
  color: var(--doc-ink);
  border: 1px solid var(--doc-border);
}

.m2s-doc-action-secondary:hover {
  border-color: var(--doc-teal);
  color: var(--doc-teal);
  transform: translateY(-2px);
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
========================================================= */
@media (max-width: 1080px) {
  .m2s-document-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px !important;
  }

  .m2s-doc-trust-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  .m2s-hero-panel::after {
    display: none;
  }

  .m2s-hero-panel h1 {
    max-width: 100%;
  }

  .m2s-hero-panel p:not(.m2s-kicker) {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .m2s-documents-page {
    padding: 0 14px;
    margin-bottom: 50px;
  }

  .m2s-hero-panel {
    padding: 24px 20px !important;
    margin-top: 18px;
  }

  .m2s-hero-panel h1 {
    font-size: 30px;
  }

  .m2s-document-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 14px;
  }

  .m2s-document-card {
    max-width: 340px;
    margin: 0 auto !important;
    width: 100%;
  }

  .m2s-doc-trust-actions {
    flex-direction: column;
    width: 100%;
  }

  .m2s-doc-action-btn {
    width: 100%;
    justify-content: center;
  }
}
