/* Public minisite styles — minimalist, hand-written, responsive.
 *
 * Every themed color comes from --primary-color, which lib/public-router.js
 * injects per site (`:root{--primary-color:<site color>}`) and app.js also
 * sets from window.__SITE__. No framework, no build step.
 */

:root {
  --primary-color: #2563eb;
  --text: #1f2933;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #ffffff;
  --page-bg: #f8fafc;
  --radius: 8px;
  --wrap: 960px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: var(--primary-color);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top: 4px solid var(--primary-color);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.site-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  flex: 0 0 auto;
}

.site-name {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.site-name a {
  text-decoration: none;
  color: inherit;
}

.site-tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---- Content ---- */

.content {
  padding-top: 24px;
  padding-bottom: 40px;
}

.page-heading {
  margin: 0 0 16px;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---- Filters ---- */

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.filter-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-field input,
.filter-field select {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.filter-field input:focus,
.filter-field select:focus,
.btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  border-color: var(--primary-color);
}

.btn.primary {
  color: #fff;
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border);
}

/* ---- Job list ---- */

.job-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.job-card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius);
}

.job-card-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.job-card-title a {
  text-decoration: none;
}

.job-card-title a:hover {
  text-decoration: underline;
}

.job-card-company {
  margin: 0;
  font-weight: 600;
}

.job-card-meta,
.job-card-salary {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.job-card-salary {
  color: var(--text);
  font-weight: 600;
}

/* The selected card. The marker itself is aria-current on the card (exposed to
   assistive tech); this rule keys the visual treatment off that same attribute
   so a card can never look selected without being announced as selected.
   The affordance is the border plus an inset ring in the primary color: no
   background tint, which would lower the contrast of the muted meta line
   (.job-card-meta) below WCAG AA. */
.job-card[aria-current="true"] {
  border-color: var(--primary-color);
  box-shadow: inset 0 0 0 1px var(--primary-color);
}

.job-card[aria-current="true"] .job-card-title a {
  text-decoration: underline;
}

.job-count {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

/* ---- Pagination ---- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.page-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.page-range {
  color: var(--muted);
}

/* ---- Job detail ---- */

.job-detail {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.job-detail-back {
  margin: 0 0 14px;
  font-size: 0.9rem;
}

.job-detail-title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  line-height: 1.25;
}

.job-detail-company {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.job-detail-location,
.job-detail-type,
.job-detail-category,
.job-detail-posted {
  display: inline-block;
  margin: 0 10px 8px 0;
  padding: 3px 10px;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.job-detail-salary {
  margin: 4px 0 12px;
  font-weight: 600;
}

.job-detail-description {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.job-detail-apply {
  margin: 20px 0 0;
}

.apply-btn {
  padding: 11px 24px;
}

/* ---- States ---- */

.state {
  padding: 32px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.state h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.state p {
  margin: 0 0 14px;
  color: var(--muted);
}

.state .btn {
  margin: 0 4px;
}

.state.loading {
  border-style: dashed;
  color: var(--muted);
}

.state.error {
  border-color: var(--primary-color);
}

/* ---- Footer ---- */

.site-footer {
  padding: 20px 0 28px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

/* ---- Split view workspace (base = narrow, list-only) ----
 *
 * The workspace container holds two columns: the job list (.results) and the
 * detail pane (.detail-col). The narrow layout is the base layer, so a width
 * below the breakpoint is list-only: the pane is not rendered beside the list
 * at all (it is either hidden, or shown on its own in mobile detail mode).
 * The two-pane grid is layered on by @media (min-width: 900px) below — the
 * same breakpoint public/app.js uses for its layoutMode helper.
 */

.workspace {
  display: block;
}

.results {
  display: block;
}

.detail-col {
  display: none;
  min-width: 0;
}

.detail-pane-inner {
  min-width: 0;
}

/* Mobile detail mode: the pane takes over the content area. The list and the
   filter bar (a sibling of the workspace inside <main>) step aside so the
   detail is not shown underneath them. */
.workspace[data-detail-open] .results {
  display: none;
}

.workspace[data-detail-open] .detail-col {
  display: block;
}

.workspace[data-detail-open] .mobile-detail-bar {
  display: block;
}

.content[data-detail-open] .filters {
  display: none;
}

/* Mobile detail mode also drops the page heading ("Open positions"). Like the
   filter bar it is chrome for the list, not the detail; left visible it pushes
   the detail title far down the content area under the back bar. Scoped to
   .content[data-detail-open], which only the listings page ever sets (the
   standalone /job.html has no workspace and never gets the attribute). */
.content[data-detail-open] .page-heading {
  display: none;
}

/* The mobile detail bar holds the "Back to results" control. Outside mobile
   detail mode it is not rendered at all. */
.mobile-detail-bar {
  display: none;
  margin: 0;
}

.back-to-results {
  width: 100%;
}

/* The .btn class sets `display: inline-block`, which would otherwise beat the
   browser's [hidden] { display: none } rule and make the [hidden] attribute
   cosmetic. This keeps the attribute authoritative for the back control, so
   "hidden by default" is true of the control itself and not only of its
   container. */
.back-to-results[hidden] {
  display: none;
}

/* Screen-reader-only text (the back control names the job it returns from). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Page-level overflow guard for the narrow layout. */
html,
body {
  overflow-x: clip;
}

/* ---- Two-pane layout (>= 900px) ----
 *
 * Horizontally adjacent columns, both visible: the list is its own scroll
 * region so it scrolls independently, while the detail pane stays in the
 * viewport (sticky).
 *
 * Everything below is SCOPED to the split view. public/styles.css is shared
 * with the standalone /job.html, which also uses class="results" (and
 * class="wrap content"), so an unscoped `.results { max-height; overflow-y }`
 * would give the fallback detail page a second scrollbar at >=900px and push
 * its Apply link below the clipped box at a short viewport.
 */
@media (min-width: 900px) {
  /* The workspace is the only split-view-specific child of <main>, so it is
     what distinguishes the listings page from /job.html. (A descendant
     selector cannot express this: .content is the workspace's parent.) */
  .content:has(> .workspace) {
    max-width: 1180px;
    margin: 0 auto;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 24px;
    align-items: start;
  }

  .workspace .results {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .detail-col {
    display: block;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }

  /* Desktop always shows both panes: the mobile detail takeover never applies
     (the attribute is mobile-only, and this keeps the stylesheet honest even
     if it were left set). */
  .workspace[data-detail-open] .results {
    display: block;
  }

  .content[data-detail-open] .filters {
    display: grid;
  }

  /* Desktop always shows the page heading, exactly as it always shows the
     filters: the mobile takeover is a mobile-only state. */
  .content[data-detail-open] .page-heading {
    display: block;
  }

  .mobile-detail-bar {
    display: none;
  }
}

/* ---- Responsive ---- */

@media (max-width: 720px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filter-search {
    grid-column: 1 / -1;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .job-detail-title {
    font-size: 1.35rem;
  }

  .mobile-detail-bar {
    margin-bottom: 14px;
  }
}

@media (max-width: 460px) {
  .wrap {
    padding: 0 14px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .header-inner {
    gap: 10px;
  }

  .site-logo {
    width: 36px;
    height: 36px;
  }

  .pagination {
    justify-content: center;
  }
}

/* ---- News (sections, articles, homepage teasers) ----
 *
 * Scoped to the news surfaces only. The class names (news-item, article-body,
 * home-news, lang-toggle, site-nav, header-actions) do not appear on the job
 * listings or the standalone /job.html, so none of these rules can leak onto
 * the split view. The language toggle and site nav, however, are shared chrome
 * present on every page; they use their own classes so the existing layout is
 * untouched.
 */

.header-actions {
  margin-left: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.site-nav a {
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover {
  text-decoration: underline;
}

.lang-toggle {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.lang-option {
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
}

.lang-option[aria-current="true"] {
  color: #fff;
  background: var(--primary-color);
}

.news-region,
.article-region {
  min-width: 0;
}

.news-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.news-item {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius);
}

.news-item-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.news-item-title a {
  text-decoration: none;
}

.news-item-title a:hover {
  text-decoration: underline;
}

.news-item-date {
  margin: 0 0 8px;
  font-size: 0.85rem;
}

.news-item-excerpt {
  margin: 0 0 10px;
}

.news-item-more {
  font-weight: 600;
  text-decoration: none;
}

.news-item-more:hover {
  text-decoration: underline;
}

.article {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.article-back {
  margin: 0 0 14px;
  font-size: 0.9rem;
}

.article-title {
  margin: 0 0 6px;
  font-size: 1.7rem;
  line-height: 1.25;
}

.article-date {
  margin: 0 0 16px;
  font-size: 0.9rem;
}

.article-body {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.article-body p {
  margin: 0 0 14px;
}

.home-news-block {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.home-news {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.home-news-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.home-news-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.home-news-title a {
  text-decoration: none;
}

.home-news-title a:hover {
  text-decoration: underline;
}

.home-news-excerpt {
  margin: 0 0 10px;
}

.home-news-more {
  font-weight: 600;
  text-decoration: none;
}

.home-news-section {
  margin: 10px 0 0;
  font-size: 0.85rem;
}

@media (min-width: 900px) {
  .home-news-block {
    grid-template-columns: 1fr 1fr;
  }
}
