/* ------------------------------------------------------------
   section-cv.css — Advanced CV Styles (responsive padding & safe-area)
   ------------------------------------------------------------ */

/* fallbacks للمتغيرات لو مش موجودة في مكان آخر */
:root{
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --accent: #cfA84f;
  --accent-2: #00C8FF;
  --ink: #0b0b0b;
  --muted: #777b80;
  --t: 420ms;
  --ease: cubic-bezier(.22,.9,.32,1);
  --container-max: 1200px;
}

/* scope box-sizing to section to avoid global override */
#cv, #cv * { box-sizing: border-box; }

/* Section root: responsive padding (top/right/bottom/left) + safe area */
#cv {
  position: relative;
  padding-top: calc(env(safe-area-inset-top, 0px) + clamp(24px, 6vw, 64px));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(24px, 6vw, 64px));
  padding-left: clamp(12px, 4vw, 48px);
  padding-right: clamp(12px, 4vw, 48px);

  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.98));
  overflow: visible; /* allow shadows/animations to show */
  text-align: center;
  width: 100%;
}

/* Inner container to limit width and add inner gutters (prevents touching slide edges) */
#cv .cv__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: clamp(8px, 3.5vw, 36px);
}

/* Section header */
.cv__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}
.cv__title-section {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.4px;
}
.cv__underline {
  display: block;
  width: 90px;
  height: 6px;
  margin: 0.6rem auto 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px rgba(207,168,79,0.2);
}

/* Grid layout */
.cv__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(12px, 2.4vw, 28px);
  align-items: stretch;
  margin-bottom: var(--space-lg);
}

/* CV blocks */
.cv__block {
  position: relative; /* required for ::before pseudo */
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: clamp(14px, 3.2vw, 28px);
  box-shadow: 0 12px 28px rgba(11,11,11,0.05);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  text-align: left;
  overflow: visible;
}
.cv__block h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}
.cv__time {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.cv__desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Hover accent (pseudo effect) */
.cv__block::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -40%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(207,168,79,0.08), transparent 60%);
  transform: rotate(25deg);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.cv__block:hover::before { opacity: 1; }
.cv__block:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 18px 40px rgba(11,11,11,0.12);
}

/* Scope button styles to #cv to avoid overriding site-wide .btn--primary */
#cv .btn--primary {
  background: #fff; /* white button */
  color: #000;
  font-size: 1.05rem;
  padding: 0.9rem 2.2rem;
  border-radius: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.3s ease;
  margin-top: var(--space-md);
  display: inline-block;
}
#cv .btn--primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 28px rgba(11,11,11,0.15);
}

/* Animations for fade-up & general slide-animate compatibility */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-animate="fade-up"].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* general anim helpers used by slide-mode JS and section scripts */
[data-animate], .slide-animate {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.48s var(--ease), transform 0.48s var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-animate].is-visible, .slide-animate.visible, .slide-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive tweaks */
@media (max-width: 1100px) {
  .cv__grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 900px) {
  #cv { padding-left: clamp(12px, 5vw, 28px); padding-right: clamp(12px, 5vw, 28px); }
  .cv__grid { gap: 18px; }
  .cv__title-section { font-size: clamp(1.4rem, 4.4vw, 1.95rem); }
  .cv__block { padding: clamp(12px, 4vw, 18px); }
}
@media (max-width: 600px) {
  #cv {
    padding-top: calc(env(safe-area-inset-top, 0px) + clamp(18px, 7vw, 36px));
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(18px, 7vw, 36px));
    padding-left: env(safe-area-inset-left, 12px);
    padding-right: env(safe-area-inset-right, 12px);
  }
  .cv__grid { grid-template-columns: 1fr; gap: 12px; }
  .cv__title-section { font-size: 1.6rem; }
  #cv .btn--primary { width: 100%; padding: 0.9rem 1rem; }
}

/* If this section is used inside a full-page .slide, ensure inner spacing from slide edges */
.slide > #cv,
#cv.slide-section,
.slide .cv {
  padding-top: calc(env(safe-area-inset-top, 0px) + clamp(20px, 5vw, 56px));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(20px, 5vw, 56px));
  padding-left: clamp(12px, 4vw, 48px);
  padding-right: clamp(12px, 4vw, 48px);
}

/* print adjustments */
@media print {
  #cv { background: transparent; box-shadow: none; padding: 12px; }
  .cv__block { box-shadow: none; background: transparent; border: none; }
}
