/* assets/css/frontend.css
   Cleaned & fixed: desktop-focused max-width & overlap behaviour
*/

.elx-legal-services {
  --bg: #071014;
  --card-bg: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
  --muted: #94a3a6;
  --accent: #e6eef0;
  --line: rgba(255,255,255,0.04);
  --card-pad: 20px;
  --radius: 14px;
  --visual-right-gap: 80px;
  --panel-img-w: 300px;
  --panel-img-h: 200px;
  --title-size: 22px;
  --item-size: 17px;
  --desc-size: 15px;
  --btn-size: 14px;

  box-sizing: border-box;
  width: 100%;
  display: block;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* inherit box-sizing */
.elx-legal-services *, .elx-legal-services *::before, .elx-legal-services *::after { box-sizing: inherit; }

/* Card */
.elx-legal-services .card {
  width: 100%;
  max-width: 980px; /* overridden by widget inline style if set */
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: var(--card-pad);
  position: relative;
  box-shadow: 0 8px 30px rgba(2,6,8,0.6);
  border: 1px solid rgba(255,255,255,0.03);
  overflow: visible; /* allow image overlap */
}

/* Title */
.elx-legal-services .title {
  font-size: var(--title-size);
  font-weight: 700;
  margin-bottom: 14px;
  color: #ffffff;
}

/* inner grid */
.elx-legal-services .card-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

/* services list */
.elx-legal-services .services {
  list-style: none;
  margin-top: 4px;
  padding: 0;
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 1; /* keep list under visual overlap layer */
}

/* each service row */
.elx-legal-services .service {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.012);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background .12s ease, transform .06s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.elx-legal-services .service:active { transform: translateY(1px); }
.elx-legal-services .service:hover { background: rgba(255,255,255,0.02); }
.elx-legal-services .service:focus { outline: none; box-shadow: 0 0 0 4px rgba(230,240,242,0.04); }

.elx-legal-services .service .name {
  font-size: var(--item-size);
  font-weight: 600;
  color: var(--accent);
  line-height: 1.15;
}
.elx-legal-services .service .num {
  font-weight: 700;
  color: var(--muted);
  margin-left: 12px;
}

/* active/current row styling */
.elx-legal-services .service[aria-current="true"]{
  background: rgba(230,240,242,0.02);
}

/* Expanded panel */
.elx-legal-services .expanded {
  margin-top: 10px;
  padding: 0 6px;
  background: transparent;
  position: relative;
  display: none; /* visibility controlled by .open */
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 240ms ease, transform 240ms ease, max-height 320ms ease;
  will-change: opacity, transform;
  z-index: 2;
}
.elx-legal-services .expanded.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* description (FIXED for desktop calc) */
.elx-legal-services .expanded p {
  color: var(--muted);
  line-height: 1.55;
  font-size: var(--desc-size);
  margin: 8px 0 10px;
  /* Desktop-safe calc: subtract panel image width + extra gap so text won't run under image */
  max-width: min(64ch, calc(100% - (var(--panel-img-w)   + -14.5rem)))
  padding-left: 8px;
  padding-right: 6rem;
}

/* Read more button */
.elx-legal-services .read-more-btn {
  display: inline-block;
  padding: 8px 10px;
  font-size: var(--btn-size);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
}

/* VISUAL: absolute on wide screens so it can overlap the service rows */
.elx-legal-services .visual {
  position: absolute;
  right: calc(var(--card-pad) - 6px);
  top: 36%; /* lift higher so image overlaps tab border */
  transform: translateY(-50%);
  min-height: 220px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  overflow: visible;
  padding-right: var(--visual-right-gap);
  pointer-events: none;
  z-index: 6; /* ensure visual sits above the service list */
}

/* panel-image with overlap behavior */
.elx-legal-services .panel-image {
  width: var(--panel-img-w);
  height: var(--panel-img-h);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(2,8,10,0.72);
  /* rotate and pull up so it visually overlaps above the tab border */
  transform: rotate(8deg) translateY(-28px);
  border: 6px solid rgba(255,255,255,0.03);
  background: #fff;
  pointer-events: auto;
  z-index: 8;
}

/* image element */
.elx-legal-services .panel-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* when expanded slightly reduce lift for neatness */
.elx-legal-services .expanded .panel-image {
  transform: rotate(8deg) translateY(-18px);
  box-shadow: 0 14px 36px rgba(2,8,10,0.55);
  border-width: 4px;
}

/* responsive adjustments */

/* medium screens */
@media (max-width:1100px) {
  .elx-legal-services { --panel-img-w: 260px; --panel-img-h: 170px; --visual-right-gap: 60px; }
  .elx-legal-services .visual { top: 40%; }
  .elx-legal-services .panel-image { transform: rotate(6deg) translateY(-22px); box-shadow: 0 16px 40px rgba(2,8,10,0.6); }
  .elx-legal-services .card { padding: 18px; }
}

/* tablet */
@media (max-width:900px) {
  .elx-legal-services { --panel-img-w: 220px; --panel-img-h: 150px; --title-size: 20px; --item-size: 16px; --desc-size: 14px; --card-pad: 20px; }
  .elx-legal-services .card { width:100%; padding: 16px; }
  .elx-legal-services .service { padding: 12px; }
  .elx-legal-services .panel-image { transform: rotate(4deg) translateY(-16px); }
  .elx-legal-services .read-more-btn { padding:9px 12px; font-size:14px; }
  .elx-legal-services .expanded p { max-width: calc(100% - (var(--panel-img-w) + 3.5rem)); }
}

/* mobile: visual becomes in-flow (no overlap) for better UX and avoid header jump */
@media (max-width:700px) {
  .elx-legal-services { --panel-img-w: 100%; --panel-img-h: 150px; --title-size: 18px; --item-size: 15px; --desc-size: 15px; --card-pad: 14px; --visual-right-gap: 20px; }
  .elx-legal-services .card { padding: 12px; border-radius: 12px; }
  .elx-legal-services .card-inner { gap: 12px; }
  .elx-legal-services .visual {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    margin: 0 0 8px 0;
    padding-right: 0;
    justify-content: center;
    z-index: 1;
  }
  .elx-legal-services .panel-image {
    width: 100%;
    height: var(--panel-img-h);
    transform: none;
    border-radius: 10px;
    border-width: 3px;
    box-shadow: 0 10px 24px rgba(2,8,10,0.35);
  }
  .elx-legal-services .expanded { margin-top: 8px; padding: 0 6px; }
  .elx-legal-services .expanded p { margin: 6px 0 10px; padding-left: 6px; max-width: 100%; padding-right: 6px; }
  .elx-legal-services .read-more-btn { width: 100%; padding: 12px; border-radius: 8px; font-size: 15px; }
  .elx-legal-services .service { padding: 12px; border-radius: 10px; }
}

/* very small screens */
@media (max-width:420px) {
  .elx-legal-services { --panel-img-h: 140px; --item-size: 14px; --title-size: 16px; }
  .elx-legal-services .panel-image { height: var(--panel-img-h); border-radius: 8px; }
  .elx-legal-services .card { padding: 10px; }
  .elx-legal-services .read-more-btn { font-size: 14px; padding: 11px; }
  .elx-legal-services .expanded p { padding: 0; }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .elx-legal-services .expanded,
  .elx-legal-services .panel-image,
  .elx-legal-services .service { transition: none !important; }
}

/* Accessibility: keyboard focus */
.elx-legal-services :focus { outline: none; }

/* NOTE:
If your theme or parent Elementor column/section applies overflow:hidden
the overlapping image might get clipped. If that happens, you can override:
.elementor-column, .elementor-widget, .elx-legal-services .card {
  overflow: visible !important;
}
*/
