/* ============================================================
   SERVICES PAGE 
   Design: Industrial Operations Manifest. 
   Instead of generic cards, services are structured as a precision 
   data-table or manifest list. Heavy typography, distinct 
   hierarchy, asymmetrical alignment.
   ============================================================ */

/* ---- Tier Section Wrapper ---- */
.service-tier-section {
  position: relative;
  margin-bottom: var(--space-20);
}

.service-tier-section:last-child {
  margin-bottom: 0;
}

/* ---- Tier Header ---- */
.tier-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--gray-200);
}

@media (min-width: 768px) {
  .tier-header {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }
}

.tier-title {
  font-family: var(--font-secondary);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--industrial-dark);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1;
}

.tier-badge {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--safety-yellow);
  letter-spacing: 0.1em;
}

/* Specific Tier Colors */
.service-tier-section[data-tier="1"] .tier-badge { color: var(--gray-500); }
.service-tier-section[data-tier="2"] .tier-badge { color: var(--primary-blue); }
.service-tier-section[data-tier="3"] .tier-badge { color: var(--industrial-dark); }

/* ---- Tier List (The Manifest) ---- */
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 0; /* Rows stack seamlessly */
}

/* ---- Component: Container Item (Holds Button + Drawer) ---- */
.service-item {
  position: relative;
  scroll-margin-top: 100px; /* Offset for sticky header/anchor jump */
  border-bottom: 1px solid var(--gray-200);
}

.service-item:last-child {
  border-bottom: none;
}

/* When navigating TO this specific service via anchor link, highlight it */
.service-item:target .service-row {
  background: var(--gray-100);
}
.service-item:target .service-row::before {
  opacity: 1;
  background: var(--safety-yellow); /* Make sure target highlight is strong */
}

/* ---- Service Row (Button) ---- */
.service-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-6);
  position: relative;
  transition: padding-left var(--transition-base), background var(--transition-base);
  appearance: none;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
  outline: none;
  align-items: start;
}

.service-row:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

@media (min-width: 900px) {
  .service-row {
    grid-template-columns: 60px 1.5fr 1fr;
    gap: var(--space-8);
    align-items: start;
    padding: var(--space-10) var(--space-6);
  }
}

/* Interactive hover state - feels like selecting a table row */
.service-row:hover {
  background: var(--gray-50);
}
@media (min-width: 900px) {
  .service-row:hover {
    padding-left: var(--space-8);
  }
}

/* Left accent bar on hover or expansion */
.service-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-blue);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.service-row:hover::before {
  opacity: 1;
}

.service-row[aria-expanded="true"] {
  background: var(--gray-50);
}
.service-row[aria-expanded="true"]::before {
  opacity: 1;
}

/* ---- Component: Row Index ---- */
.service-row-index {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--gray-400);
  font-weight: 700;
  margin-top: 6px; /* Align with title text baseline */
}

/* ---- Component: Content ---- */
.service-row-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-3);
}

.service-name {
  font-family: var(--font-secondary);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--industrial-dark);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-align: left;
}

.service-desc {
  font-size: var(--text-base);
  color: var(--gray-600);
  line-height: 1.6;
  max-width: 50ch;
  margin: 0;
  text-align: left;
}

/* ---- Component: Meta Data (Right Col) ---- */
/* Flex container with margin-left: auto so the plus button sticks to the right visually */
.service-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-2);
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .service-row-meta {
    justify-content: flex-end;
    margin-top: 0;
    grid-column: auto;
  }
}

.meta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meta-value {
  font-size: var(--text-sm);
  color: var(--industrial-dark);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.meta-value svg {
  color: var(--safety-yellow);
}

/* ---- Component: Action Toggle Button Icon (+/-) ---- */
.service-row-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--primary-blue);
  transition: all var(--transition-base);
  margin-left: auto; /* Push to right */
}

@media (min-width: 900px) {
  .service-row-action {
    margin-left: var(--space-6);
  }
}

.service-row:hover .service-row-action {
  background: var(--safety-yellow);
  color: var(--industrial-dark);
}

.action-icon {
  position: relative;
  width: 14px;
  height: 14px;
}
.action-icon::before, .action-icon::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.87, 0, 0.13, 1);
}
.action-icon::before { top: 6px; left: 0; right: 0; height: 2px; }
.action-icon::after { top: 0; bottom: 0; left: 6px; width: 2px; }

/* Open state icon */
.service-row[aria-expanded="true"] .service-row-action {
  background: var(--safety-yellow);
  color: var(--industrial-dark);
}
.service-row[aria-expanded="true"] .action-icon::after {
  transform: rotate(90deg) scale(0);
}
.service-row[aria-expanded="true"] .action-icon::before {
  transform: rotate(180deg);
}

/* ============================================================
   DRAWER / ACCORDION CONTENT
   Uses grid-template-rows animation for smooth expansion
   ============================================================ */
.service-drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 350ms cubic-bezier(0.25, 1, 0.5, 1);
  background: var(--gray-50);
}

.service-row[aria-expanded="true"] + .service-drawer {
  grid-template-rows: 1fr;
}

.service-drawer-inner {
  overflow: hidden;
}

.drawer-content-box {
  padding: var(--space-4) var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  border-left: 2px solid transparent; /* matches alignment below */
}

@media (min-width: 900px) {
  .drawer-content-box {
    /* Offset padding: indent to match the title start position (60px + space-8 gap) */
    padding: var(--space-4) var(--space-6) var(--space-10) calc(60px + var(--space-8));
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.drawer-text {
  flex: 1;
}

.drawer-text h5 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary-blue);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.drawer-text h5::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--safety-yellow);
}

.drawer-text p {
  font-size: var(--text-base);
  color: var(--gray-700);
  line-height: 1.7;
  margin: 0;
  max-width: 68ch;
}

.drawer-cta {
  flex-shrink: 0;
  margin-top: var(--space-2);
}

@media (min-width: 900px) {
  .drawer-cta {
    margin-top: 0;
    margin-left: var(--space-8);
  }
}
