/* ==========================================================
   careerpathatlas — Job Details Page Stylesheet
   File: assets/css/job_details.css

   Covers:
   - Breadcrumb navigation
   - Job hero and company logo
   - Main content and job information grid
   - Description, responsibilities and qualifications
   - Related jobs and mobile apply button
   - Sidebar, company information and apply widget
   - Career advice and recently closed jobs
   - Footer and responsive accessibility
   ========================================================== */

/* ==================== DESIGN TOKENS ==================== */
:root {
    --jd-primary: #1d4ed8;
    --jd-primary-hover: #2563eb;
    --jd-primary-dark: #1e3a8a;

    --jd-text: #111827;
    --jd-text-mid: #374151;
    --jd-text-muted: #6b7280;

    --jd-page-bg: #f3f4f6;
    --jd-card-bg: #ffffff;
    --jd-soft-bg: #f9fafb;

    --jd-border: #e5e7eb;
    --jd-success: #16a34a;
    --jd-success-hover: #15803d;
    --jd-danger: #dc2626;

    --jd-radius: 12px;
    --jd-radius-sm: 8px;
    --jd-container: 1200px;
    --jd-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
}

/* ==================== GLOBAL BASE ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--jd-page-bg);
    color: var(--jd-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.65;
}

a {
    color: var(--jd-primary);
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

a:hover {
    color: var(--jd-primary-hover);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    line-height: 1.3;
    overflow-wrap: break-word;
}

p {
    overflow-wrap: break-word;
}

button,
input,
select,
textarea {
    font: inherit;
}

:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

/* ==================== BREADCRUMB ==================== */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
    max-width: var(--jd-container);
    margin: 0 auto;
    padding: 0.75rem 1rem;
    color: var(--jd-text-muted);
    font-size: 0.85rem;
    line-height: 1.7;
}

.breadcrumb a {
    color: var(--jd-text-muted);
}

.breadcrumb a:hover {
    color: var(--jd-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.breadcrumb span {
    margin: 0 0.3rem;
}

.breadcrumb [aria-current="page"] {
    color: var(--jd-text-mid);
    overflow-wrap: anywhere;
}

/* ==================== JOB HERO ==================== */
.job-hero {
    padding: 2.5rem 1rem;
    background: linear-gradient(
        135deg,
        var(--jd-primary-dark) 0%,
        var(--jd-primary-hover) 100%
    );
    color: #ffffff;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    width: 100%;
    max-width: var(--jd-container);
    margin: 0 auto;
}

.hero-logo {
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    padding: 8px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--jd-radius);
}

.hero-text {
    flex: 1 1 auto;
    min-width: 0;
}

.hero-text h1 {
    margin: 0 0 0.45rem;
    color: #ffffff;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 750;
    line-height: 1.3;
}

.hero-text p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

/* ==================== MAIN PAGE LAYOUT ==================== */
.job-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 1.75rem;
    width: 100%;
    max-width: var(--jd-container);
    margin: 1.75rem auto;
    padding: 0 1rem;
}

.job-content {
    min-width: 0;
    padding: 1.75rem 2rem;
    background: var(--jd-card-bg);
    border: 1px solid var(--jd-border);
    border-radius: var(--jd-radius);
    box-shadow: var(--jd-shadow);
}

/* Two-column layout on desktop */
@media (min-width: 992px) {
    .job-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

/* ==================== JOB INFORMATION GRID ==================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 145px), 1fr)
    );
    gap: 0.85rem;
    margin-bottom: 2rem;
}

.info-cell {
    min-width: 0;
    padding: 0.85rem;
    background: var(--jd-soft-bg);
    border: 1px solid var(--jd-border);
    border-radius: var(--jd-radius-sm);
    font-size: 0.88rem;
}

.info-cell strong {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--jd-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.info-cell span {
    display: block;
    color: var(--jd-text);
    font-weight: 550;
    overflow-wrap: anywhere;
}

/* ==================== JOB CONTENT SECTIONS ==================== */
.job-content article {
    min-width: 0;
}

.job-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--jd-border);
}

.job-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.job-section h2 {
    margin: 0 0 0.9rem;
    color: var(--jd-text);
    font-size: 1.2rem;
    font-weight: 700;
}

.job-section h3 {
    margin: 0 0 0.75rem;
    color: var(--jd-text);
    font-size: 1.08rem;
    font-weight: 700;
}

.job-section p {
    margin: 0 0 0.85rem;
    color: var(--jd-text-mid);
}

.job-section p:last-child {
    margin-bottom: 0;
}

.job-section ul,
.job-section ol {
    margin: 0;
    padding-left: 1.4rem;
}

.job-section li {
    margin-bottom: 0.55rem;
    color: var(--jd-text-mid);
    line-height: 1.7;
}

.job-section li:last-child {
    margin-bottom: 0;
}

.job-section a {
    font-weight: 550;
    overflow-wrap: anywhere;
}

.job-section a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==================== JOB DESCRIPTION ==================== */
.job-description {
    color: var(--jd-text-mid);
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.job-description p {
    margin: 0 0 1rem;
    color: inherit;
}

.job-description p:last-child {
    margin-bottom: 0;
}

.job-description h2,
.job-description h3,
.job-description h4 {
    margin: 1.4rem 0 0.65rem;
    color: var(--jd-text);
}

.job-description ul,
.job-description ol {
    margin: 0.75rem 0 1rem;
    padding-left: 1.5rem;
}

.job-description li {
    margin-bottom: 0.4rem;
}

.job-description a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.job-description img {
    height: auto;
    max-width: 100%;
}

/* Tables inserted into job descriptions */
.job-description table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    overflow-x: auto;
    border-collapse: collapse;
}

.job-description th,
.job-description td {
    padding: 0.65rem;
    border: 1px solid var(--jd-border);
    text-align: left;
    vertical-align: top;
}

.job-description th {
    background: var(--jd-soft-bg);
}

/* ==================== RELATED JOBS ==================== */
.related-list {
    margin: 0;
    padding-left: 1.35rem;
    list-style: disc;
}

.related-list li {
    margin-bottom: 0.65rem;
    color: var(--jd-text-mid);
}

.related-list li:last-child {
    margin-bottom: 0;
}

.related-list a {
    color: var(--jd-primary);
    font-weight: 550;
    line-height: 1.55;
}

.related-list a:hover {
    color: var(--jd-primary-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==================== MOBILE APPLY BUTTON ==================== */
.apply-mobile {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.9rem 1rem;
    background: var(--jd-primary);
    border: 1px solid var(--jd-primary);
    border-radius: var(--jd-radius);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.apply-mobile:hover {
    background: var(--jd-primary-hover);
    border-color: var(--jd-primary-hover);
    color: #ffffff;
}

@media (min-width: 992px) {
    .apply-mobile {
        display: none;
    }
}

/* ==================== SIDEBAR ==================== */
.job-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-width: 0;
}

.sidebar-widget {
    min-width: 0;
    padding: 1.4rem;
    background: var(--jd-card-bg);
    border: 1px solid var(--jd-border);
    border-radius: var(--jd-radius);
    box-shadow: var(--jd-shadow);
}

.sidebar-widget h3 {
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--jd-border);
    color: var(--jd-text);
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-widget h4 {
    margin: 0 0 0.75rem;
    color: var(--jd-text);
    font-size: 0.98rem;
    font-weight: 700;
}

.sidebar-widget p {
    overflow-wrap: anywhere;
}

/* Sticky sidebar only on sufficiently wide screens */
@media (min-width: 1200px) {
    .job-sidebar {
        position: sticky;
        top: 1.5rem;
    }
}

/* ==================== APPLY WIDGET ==================== */
.apply-widget .deadline-row {
    margin: 0 0 1rem;
    color: var(--jd-text-mid);
    font-size: 0.9rem;
}

.apply-widget .deadline-row strong {
    color: var(--jd-text);
}

.apply-widget .expired-label {
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--jd-radius-sm);
    color: var(--jd-danger);
    font-size: 0.9rem;
    font-weight: 700;
}

.btn-apply {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--jd-success);
    border: 1px solid var(--jd-success);
    border-radius: var(--jd-radius);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.btn-apply:hover {
    background: var(--jd-success-hover);
    border-color: var(--jd-success-hover);
    color: #ffffff;
}

/* ==================== COMPANY WEBSITE BUTTON ==================== */
.btn-website {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--jd-primary);
    border: 1px solid var(--jd-primary);
    border-radius: var(--jd-radius);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.btn-website:hover {
    background: var(--jd-primary-hover);
    border-color: var(--jd-primary-hover);
    color: #ffffff;
}

/* ==================== APPLICATION UNAVAILABLE NOTICE ==================== */
.closed-notice {
    margin-top: 0.75rem;
    padding: 0.8rem;
    background: var(--jd-soft-bg);
    border: 1px solid var(--jd-border);
    border-radius: var(--jd-radius-sm);
    color: var(--jd-text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* ==================== SIDEBAR LINK LISTS ==================== */
.sidebar-link-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-link-list li {
    margin: 0;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.sidebar-link-list li:first-child {
    padding-top: 0;
}

.sidebar-link-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.sidebar-link-list a {
    display: block;
    color: var(--jd-text);
    font-size: 0.9rem;
    font-weight: 550;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sidebar-link-list a:hover {
    color: var(--jd-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sidebar-link-list small {
    display: block;
    margin-top: 0.2rem;
    color: var(--jd-text-muted);
    font-size: 0.78rem;
    font-weight: 400;
}

/* ==================== COMPANY ABOUT ==================== */
.company-about-text {
    margin: 0 0 0.75rem;
    color: var(--jd-text-mid);
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* ==================== FOOTER ==================== */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    background: #1f2937;
    color: #d1d5db;
}

.site-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem 0.7rem;
    max-width: var(--jd-container);
    margin: 0 auto 0.75rem;
    text-align: center;
}

.site-footer .footer-links a {
    color: #d1d5db;
    font-size: 0.88rem;
}

.site-footer .footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer .footer-links span {
    color: #6b7280;
}

/* Avoid forcing the layout of the included footer.php content */
.site-footer > footer,
.site-footer .footer-container {
    max-width: var(--jd-container);
    margin-right: auto;
    margin-left: auto;
}

/* ==================== TABLET ==================== */
@media (max-width: 991px) {
    .job-layout {
        gap: 1.25rem;
        margin-top: 1.25rem;
    }

    .job-content {
        padding: 1.4rem;
    }

    .job-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 1rem;
    }

    .apply-widget {
        grid-column: 1 / -1;
    }

    .sidebar-widget {
        padding: 1.15rem;
    }
}

/* ==================== MOBILE ==================== */
@media (max-width: 640px) {
    body {
        font-size: 0.96rem;
    }

    .breadcrumb {
        padding: 0.65rem 1rem;
        font-size: 0.8rem;
    }

    .job-hero {
        padding: 1.6rem 1rem;
    }

    .hero-inner {
        align-items: flex-start;
        gap: 0.9rem;
    }

    .hero-logo {
        flex-basis: 60px;
        width: 60px;
        height: 60px;
        padding: 5px;
        border-radius: var(--jd-radius-sm);
    }

    .hero-text {
        flex: 1 1 calc(100% - 75px);
    }

    .hero-text h1 {
        font-size: clamp(1.2rem, 5vw, 1.55rem);
    }

    .hero-text p {
        font-size: 0.85rem;
    }

    .job-layout {
        display: flex;
        flex-direction: column;
        gap: 1.1rem;
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    .job-content {
        width: 100%;
        padding: 1rem;
        border-radius: var(--jd-radius-sm);
    }

    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        margin-bottom: 1.5rem;
    }

    .info-cell {
        padding: 0.7rem;
        font-size: 0.84rem;
    }

    .info-cell strong {
        font-size: 0.66rem;
    }

    .job-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .job-section h2 {
        font-size: 1.1rem;
    }

    .job-section h3 {
        font-size: 1rem;
    }

    .job-sidebar {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }

    .sidebar-widget {
        width: 100%;
        padding: 1rem;
        border-radius: var(--jd-radius-sm);
    }

    .site-footer {
        margin-top: 2rem;
        padding: 1.25rem 0.85rem;
    }

    .site-footer .footer-links {
        gap: 0.5rem;
    }

    .site-footer .footer-links span {
        display: none;
    }
}

/* ==================== EXTRA-SMALL PHONES ==================== */
@media (max-width: 360px) {
    .hero-inner {
        flex-direction: column;
    }

    .hero-logo {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
    }

    .hero-text {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .job-content {
        padding: 0.85rem;
    }

    .apply-mobile,
    .btn-apply,
    .btn-website {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
