/* --- style.css --- */
/* Updated: 2025-04-24 (Based on script run date & features) */
/* Includes mobile description truncation */

/* --- Base Styles & Variables --- */
:root {
  --bg-color: #f9fafb;
  --card-bg-color: #ffffff;
  --border-color: #e5e7eb;
  --text-color: #1f2937;
  --text-muted-color: #6b7280;
  --primary-color: #3b82f6;
  --primary-hover-color: #2563eb;
  --secondary-color: #6b7280; /* Gray for secondary button */
  --secondary-hover-color: #4b5563; /* Darker gray */
  --link-color: var(--primary-color);
  --body-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --heading-font: var(--body-font);
  --base-font-size: 16px;
  --line-height: 1.6;
  --radius: 0.375rem;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 12px -3px rgba(0, 0, 0, 0.1), 0 2px 8px -2px rgba(0, 0, 0, 0.06);
  --transition: all 0.2s ease-in-out;
  --container-max-width: 1100px;
  --container-padding: 1rem;
  --header-height-desktop: 65px;
  --header-height-mobile: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: clamp(15px, 1.8vw, 16.5px);
  scroll-padding-top: var(--header-height-mobile);
}
@media (min-width: 768px) { html { scroll-padding-top: var(--header-height-desktop); } }

body {
  font-family: var(--body-font);
  line-height: var(--line-height);
  color: var(--text-color);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography & Links --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--heading-font); font-weight: 600; line-height: 1.3;
  margin-bottom: 0.75em; color: #111827;
}
h1 { font-size: clamp(1.5rem, 5vw, 1.875rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin-bottom: 1em; }
a { color: var(--link-color); text-decoration: none; transition: var(--transition); }
a:hover { text-decoration: underline; color: var(--primary-hover-color); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }

/* --- Layout: Container --- */
.container { max-width: var(--container-max-width); margin: 0 auto; padding: 0 var(--container-padding); }

/* --- Header --- */
.site-header {
  background-color: var(--card-bg-color); border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow); padding: 0; height: var(--header-height-mobile);
  position: sticky; top: 0; z-index: 10; transition: height 0.2s ease-in-out;
}
@media (min-width: 768px) { .site-header { height: var(--header-height-desktop); } }
.nav-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; gap: 1.5rem; height: 100%; padding: 0 var(--container-padding); }
.logo { font-weight: 700; font-size: 1.3rem; color: var(--text-color); text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.logo:hover { color: var(--primary-color); text-decoration: none; }
.search-form { display: flex; align-items: center; min-width: 0; }
.search-form input[type="search"] {
  padding: 0.5rem 0.85rem; border: 1px solid var(--border-color); border-radius: var(--radius);
  min-width: 150px; width: 100%; max-width: 350px; transition: all var(--transition);
  height: 38px; font-size: 0.95rem; background-color: #fff;
}
.search-form input[type="search"]:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); background-color: #fff; }
.search-form input[type="search"]::placeholder { color: #9ca3af; opacity: 1; }

/* --- Main Content Layout (Grid) --- */
.job-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin: 2rem auto; }
@media (min-width: 768px) { .job-layout { grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr); gap: 2rem; } }

/* --- Job Card (Main Content Area) --- */
.job-card-main { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
@media (min-width: 768px) { .job-card-main { padding: 2rem; } }
.job-card-main h1 { margin-bottom: 1rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.875rem; color: var(--text-muted-color); margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.meta-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.meta-item svg { width: 1.1em; height: 1.1em; fill: currentColor; flex-shrink: 0; }
.meta-item time { white-space: nowrap; }

/* --- Job Description Body & Mobile Truncation --- */
.job-body-container {
  margin-top: 1.5rem;
  position: relative; /* Needed for shadow wrapper positioning */
}

/* Styles common to full body and snippet */
.job-body-full,
.job-body-snippet {
  word-wrap: break-word;
  font-size: 1rem;
  color: #374151;
}
.job-body-full h2, .job-body-full h3 { margin-top: 1.75em; margin-bottom: 0.6em; font-weight: 600; line-height: 1.4; color: var(--text-color); }
.job-body-full ul, .job-body-full ol { margin-left: 1.5em; margin-bottom: 1em; padding-left: 0.5em; }
.job-body-full li { margin-bottom: 0.6em; }
.job-body-full strong, .job-body-full b { font-weight: 600; color: var(--text-color); }
.job-body-full a { text-decoration: underline; font-weight: 500; }
.job-body-full a:hover { text-decoration-thickness: 2px; }
.job-body-full br { display: block; content: ""; margin-top: 0.5em; }
.job-body-full p:last-child { margin-bottom: 0; }

.job-body-snippet p:last-child {
    margin-bottom: 0; /* No margin on last p of snippet */
}
.job-body-snippet br:last-child {
    display: none; /* Hide trailing br if snippet ends with one */
}


/* Default (Desktop): Show full, hide snippet/wrapper */
.job-body-snippet,
.show-more-wrapper {
  display: none;
}
.job-body-full {
  display: block;
}

/* Mobile Truncation Styles */
@media (max-width: 768px) {
  .job-body-container {
    /* Add padding only if needed for the absolutely positioned wrapper */
    /* padding-bottom: 4rem; */
    min-height: 8em; /* Example initial height */
  }

  /* JS will control display of full/snippet based on initial check */

  .show-more-wrapper {
    display: block; /* Show wrapper by default on mobile screen size */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5rem;
    text-align: center;
    padding-top: 1.5rem;
    background: linear-gradient(to bottom, hsla(0, 0%, 100%, 0), var(--card-bg-color) 60%);
    pointer-events: none;
    z-index: 1;
     /* JS will hide this if snippet is empty or button clicked */
  }

  .btn-show-more {
    pointer-events: auto;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    min-height: 38px;
  }

   /* Initial State (JS will override if snippet is empty) */
   .job-body-snippet { display: block; margin-bottom: 0.5rem; }
   .job-body-full { display: none; }

} /* End mobile media query */


/* --- Sidebar --- */
@media (min-width: 768px) {
  .sidebar {
    position: sticky; top: calc(var(--header-height-desktop) + 1.5rem); align-self: start;
    max-height: calc(100vh - var(--header-height-desktop) - 3rem); overflow-y: auto;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
}
.sidebar-card { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; text-align: center; }
.company-logo {
    max-width: 100px; max-height: 100px; height: auto; object-fit: contain;
    margin: 0 auto 1rem auto; display: block; border-radius: var(--radius);
    aspect-ratio: 1 / 1; /* Help prevent layout shift */
}
.default-logo { background-color: #f8f9fa; padding: 8px; border: 1px solid var(--border-color); object-fit: contain; }
.company-name-sidebar { font-weight: 600; margin-bottom: 1rem; color: var(--text-color); font-size: 1.05rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 0.75rem 1.5rem;
  border: 1px solid transparent; border-radius: var(--radius); font-weight: 600; text-align: center;
  cursor: pointer; transition: var(--transition); font-size: 0.95rem; min-height: 44px;
}
.btn-apply {
  background-color: var(--primary-color); border-color: var(--primary-color); color: #ffffff;
  width: 100%; margin-bottom: 1.5rem; box-shadow: var(--shadow);
}
.btn-apply:hover { background-color: var(--primary-hover-color); border-color: var(--primary-hover-color); color: #ffffff; text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.btn-apply:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4); }
.btn-secondary {
  background-color: #fff; border-color: var(--border-color); color: var(--secondary-color);
  box-shadow: var(--shadow);
}
.btn-secondary:hover { background-color: #f9fafb; border-color: #d1d5db; color: var(--secondary-hover-color); text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3); }
.btn-view {
    font-size: 0.85rem; padding: 0.4rem 0.9rem; min-height: 34px;
    background-color: rgba(255, 255, 255, 0.9);
    border-color: var(--border-color); color: var(--primary-color);
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-view:hover { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); box-shadow: var(--shadow); transform: translateY(-1px); }

/* --- Share Links --- */
.share { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--text-muted-color); margin-top: 1rem; }
.share span { margin-right: 0.5rem; font-weight: 500; }
.share a { display: inline-flex; color: var(--text-muted-color); transition: transform var(--transition), color var(--transition); padding: 0.35rem; /* Increased padding */ }
.share a:hover { transform: translateY(-2px) scale(1.1); color: var(--primary-color); }
.share svg { width: 1.5em; height: 1.5em; fill: currentColor; }

/* --- "More Jobs From Company" Sidebar Section --- */
.company-jobs-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); text-align: left; }
.company-jobs-title { font-size: 1rem; font-weight: 600; color: var(--text-muted-color); margin-bottom: 1rem; }
.company-jobs-list { list-style: none; padding: 0; margin: 0; }
.company-job-item { margin-bottom: 0.75rem; background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: var(--radius); transition: var(--transition); overflow: hidden; min-height: 48px; }
.company-job-item:last-child { margin-bottom: 0; }
.company-job-item:hover { border-color: var(--primary-color); background-color: #f8faff; box-shadow: 0 2px 5px rgba(0,0,0,0.08); transform: translateY(-1px); }
.company-job-link { display: block; padding: 0.85rem 1rem; text-decoration: none; color: inherit; }
.company-job-link:hover { text-decoration: none; }
.company-job-title { display: block; font-weight: 500; font-size: 0.9rem; color: var(--text-color); line-height: 1.3; margin-bottom: 0.15rem; transition: color 0.2s ease-in-out; }
.company-job-item:hover .company-job-title { color: var(--primary-color); }
.company-job-location { display: block; font-size: 0.8rem; color: var(--text-muted-color); line-height: 1.3; }

/* --- Related Jobs Section (Bottom) --- */
.related-jobs { margin-top: 3rem; margin-bottom: 1rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }
.related-jobs h2 { font-size: 1.25rem; margin-bottom: 1.5rem; text-align: center; }
@media (min-width: 768px) { .related-jobs h2 { text-align: left; } }
.related-list { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .related-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .related-list { grid-template-columns: repeat(3, 1fr); } }
.related-item {
    position: relative; display: flex; align-items: flex-start; background-color: var(--card-bg-color);
    border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1rem;
    box-shadow: var(--shadow); transition: var(--transition); height: 100%; overflow: hidden;
}
.related-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--primary-color); }
.related-logo {
    width: 48px; height: 48px; object-fit: contain; margin-right: 1rem; flex-shrink: 0;
    border-radius: calc(var(--radius) / 2); aspect-ratio: 1 / 1; /* Help prevent layout shift */
}
.related-item .default-logo { background-color: #f8f9fa; padding: 4px; border: 1px solid #f1f1f1; }
.related-content { flex-grow: 1; padding-bottom: 3.5rem; }
a.related-title { font-weight: 600; font-size: 1rem; color: var(--text-color); margin-bottom: 0.25rem; display: inline-block; line-height: 1.3; }
a.related-title:hover { color: var(--primary-color); }
.related-meta { font-size: 0.8rem; color: var(--text-muted-color); line-height: 1.4; }
.related-meta time { white-space: nowrap; }
/* Hover View Button */
.related-view-btn {
    position: absolute; bottom: 1rem; right: 1rem; opacity: 0; visibility: hidden;
    transform: translateY(5px);
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
    z-index: 2;
}
.related-item:hover .related-view-btn { opacity: 1; visibility: visible; transform: translateY(0); }

/* --- Back To Home Button --- */
.back-to-home { text-align: center; margin-top: 2rem; margin-bottom: 2rem; }

/* --- Footer --- */
.site-footer { text-align: center; font-size: 0.875rem; color: var(--text-muted-color); margin-top: 1rem; margin-bottom: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }

/* --- Accessibility --- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
.btn-secondary:focus-visible { box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3); }
*:focus:not(:focus-visible) { outline: none; box-shadow: none; }

/* --- Mobile / Responsiveness Adjustments --- */
@media (max-width: 768px) {
    .job-layout { gap: 1.5rem; margin-top: 1.5rem; margin-bottom: 1.5rem; }
    .job-card-main, .sidebar-card { padding: 1.25rem; }
     .related-jobs { margin-top: 2rem; margin-bottom: 1rem; padding-top: 1.5rem; }
}
@media (max-width: 640px) {
  .nav-bar { gap: 0.75rem; }
  .logo { font-size: 1.15rem; }
  .search-form input[type="search"] { min-width: 100px; max-width: 250px; padding: 0.4rem 0.7rem; height: 36px; font-size: 0.9rem; }
   .related-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .meta-line { gap: 0.5rem 1rem; }
    .related-content { padding-bottom: 3.5rem; }
    .related-view-btn { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
}
@media (max-width: 400px) {
   .search-form input[type="search"] { min-width: 80px; }
   .logo { font-size: 1.1rem; }
}