/* FindCryptoJobs — light, compact, table-first */

:root {
    --ink: #111827;
    --muted: #6b7280;
    --faint: #9ca3af;
    --line: #e5e7eb;
    --bg: #ffffff;
    --bg-soft: #f9fafb;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --orange: #f7931a;
    --featured-bg: #fffbeb;
    --featured-line: #fde68a;
}

* { box-sizing: border-box; }

/* Shoelace loads async from its CDN — until each custom element is actually
   registered, the browser treats <sl-dropdown> etc. as unknown elements and
   just renders their raw light-DOM content inline, unstyled and unhidden.
   That's the "nav flashes open, everything's all over the place" flash on
   load. Hiding anything not-yet-defined (space still reserved, so no layout
   jump) makes it pop in already-styled instead. */
:not(:defined) { visibility: hidden; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 16px 48px;
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 0 16px;
    flex-wrap: wrap;
}

.logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
    flex-shrink: 0;
}
.logo span { color: var(--orange); }

.btn-post {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.btn-post:hover { background: #1d4ed8; }

/* Header's "Post a job" is now an <sl-button> (Shoelace styles its own
   appearance) — .btn-post itself must stay untouched, it's still used
   as-is on Apply buttons across every generated job page. */
.site-header sl-button { margin-left: auto; flex-shrink: 0; }

/* Nav */
.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 13px;
    flex: 1;
}
.site-nav > a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.site-nav > a:hover { background: var(--bg-soft); color: var(--ink); }

/* Nav dropdowns are Shoelace <sl-dropdown> + <sl-button variant="text"> triggers
   (converted from hand-rolled <details>) — Shoelace positions/shows the panel
   itself, so rules here are just trigger sizing and panel content styling,
   same as the .controls note above. Hover-open is wired in app.js. */
.nav-drop sl-button[slot="trigger"]::part(base) {
    font-size: 13px;
    color: var(--muted);
    padding: 0 4px;
}

.nav-panel {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.1);
    padding: 6px;
    display: flex;
    flex-direction: column;
    min-width: 180px;
}
.nav-panel a {
    color: var(--ink);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
}
.nav-panel a:hover { background: var(--bg-soft); }
.nav-panel a.nav-panel-all { border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; margin-bottom: 4px; padding-bottom: 8px; }

.top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 18px;
    flex-wrap: wrap;
}
.tagline {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
    max-width: 520px;
}
.updated { color: var(--faint); white-space: nowrap; }

.top-stats { display: flex; gap: 20px; flex-shrink: 0; }
.top-stat { text-align: right; }
.top-stat .n {
    display: block;
    font-size: 17px;
    font-weight: 800;
    color: var(--muted);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.top-stat .l {
    display: block;
    font-size: 10.5px;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 1px;
    white-space: nowrap;
}

.sponsor-slot { margin: 0 0 16px; }

/* Layout: sidebar (category + refine + perks, all Shoelace components) + main
   (search + table). Sidebar controls are exposed directly — no popover — per
   the "show them all, let people scroll" call on the filters redesign. */
sl-dropdown { display: inline-block; vertical-align: middle; }

.layout { display: flex; gap: 32px; align-items: flex-start; }
.sidebar {
    width: 216px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.side-block { margin-bottom: 22px; }
.side-block + .side-block { border-top: 1px solid var(--line); padding-top: 18px; }
.side-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--faint); font-weight: 700; margin-bottom: 10px;
}

.cat-nav { display: flex; flex-direction: column; gap: 1px; }
.cat-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 8px; border-radius: 6px; border: none; background: none;
    color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer; text-align: left;
}
.cat-item:hover:not(.active) { background: var(--bg-soft); }
.cat-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat-item .c { color: var(--faint); font-size: 11.5px; }
.cat-item.active .c { color: var(--accent); opacity: .7; }

.sidebar sl-checkbox { display: block; margin-bottom: 8px; }
.posted-row { display: block; width: 100%; margin-top: 4px; }

.perks-scroll { padding-bottom: 4px; }
.perks-scroll sl-checkbox { display: block; margin-bottom: 9px; }
.perks-scroll sl-checkbox:last-child { margin-bottom: 0; }
.perks-scroll sl-checkbox::part(label) { font-size: 12.5px; }

.main { flex: 1; min-width: 0; order: 1; }
.sidebar { order: 2; }

/* Job alert email capture block */
.alert-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--accent-soft);
    border-radius: 10px;
    padding: 14px;
}
.alert-block sl-select, .alert-block sl-input, .alert-block sl-button { width: 100%; }
.alert-block + .side-block { border-top: none; padding-top: 0; }
.alert-msg { font-size: 12.5px; font-weight: 600; color: var(--accent); margin: 0; }
.alert-msg.alert-msg-error { color: #dc2626; }

/* Sticky search gets its own padded, opaque band so it reads as a distinct
   floating bar — content scrolling underneath stays hidden behind it instead
   of peeking through around a bare sticky input. */
.search-sticky {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 16px 0;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.search-sticky { display: flex; gap: 10px; }
sl-input#search { flex: 2; min-width: 0; }
sl-input#locationFilter { flex: 1; min-width: 0; }

.count {
    margin: 0 0 8px;
    font-size: 12.5px;
    color: var(--faint);
}

/* Table */
.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    table-layout: fixed;
}

th.col-title, td.col-title { width: 38%; }
th.col-company, td.col-company { width: 14%; }
th.col-location, td.col-location { width: 20%; }
th.col-salary, td.col-salary { width: 18%; }
th.col-posted, td.col-posted { width: 10%; }

thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    padding: 0 10px 8px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg-soft); }

tr.featured { background: var(--featured-bg); }
tr.featured:hover { background: #fef3c7; }
tr.featured td { border-bottom-color: var(--featured-line); }

.job-title {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.job-title:hover { color: var(--accent); }

.tag {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: 1px;
    white-space: nowrap;
}
.tag.featured-tag {
    color: #92400e;
    background: #fef3c7;
    border-color: var(--featured-line);
}

/* Chip row: pay tier + perks, capped with a "+N more". Only "Top 10% Paid"
   gets color — everything else, including "Top 30% Paid", is plain grey so
   the one thing worth a glance actually stands out. */
/* min-height keeps every row the same height whether or not that job has
   any chips — an empty chip-row still reserves the space one would take.
   max-height + overflow:hidden clamps it to exactly that one line even when
   flex-wrap would otherwise push extra chips onto a second line — rows with
   more chips than fit just have the overflow quietly clipped instead of
   growing taller than every other row. */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; min-height: 19px; max-height: 19px; overflow: hidden; }
.chip {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}
.chip-top10 { background: #dc2626; color: #fff; border-color: #dc2626; }
.chip-more { color: var(--faint); background: transparent; border-color: transparent; padding-left: 2px; }

td.col-company {
    white-space: nowrap;
}
.company-link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
    text-decoration: none;
}
.company-link:hover { text-decoration: underline; }
.company-count { margin-top: 4px; font-size: 11.5px; color: var(--faint); }
td.col-location, td.col-salary { color: var(--muted); }
td.col-posted { color: var(--faint); white-space: nowrap; font-size: 12.5px; }
td.col-salary { white-space: nowrap; }

/* Some jobs list several locations separated by semicolons (multi-office
   postings) — long enough to wrap to 4+ lines and blow out the row height.
   Clamp to 2 lines max with a trailing ellipsis, same reasoning as the
   chip-row clamp above. Applied to an inner span, not the <td> itself —
   -webkit-box display on the <td> overrides its table-cell display and
   collapses the column width. */
.location-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination button {
    min-width: 32px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--faint); color: var(--ink); }
.pagination button.current {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.pagination button:disabled { opacity: 0.4; cursor: default; }

.empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
}

/* Footer */
.site-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    max-width: 560px;
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.fine { color: var(--faint); font-size: 12px; }

/* Job detail page: salary badge + share row */
.salary-badge {
    display: inline-block;
    margin: 4px 0 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-soft);
    border: 1px solid var(--line);
}
.salary-badge-above { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.salary-badge-below { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.salary-badge-same { color: var(--muted); }

.share-row { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.share-link { color: var(--accent); text-decoration: none; }
.share-link:hover { text-decoration: underline; }

/* Post-a-job page */
.post-page { max-width: 720px; }
.post-page h1 { font-size: 26px; letter-spacing: -0.02em; margin: 8px 0 4px; }
.post-page .lede { color: var(--muted); margin: 0 0 24px; }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.plan {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
}
.plan.highlight { border-color: var(--orange); background: var(--featured-bg); }
.plan h2 { font-size: 15px; margin: 0; }
.plan .price { font-size: 26px; font-weight: 800; margin: 6px 0 10px; }
.plan .price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.plan ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.plan li { margin-bottom: 4px; }

.post-form { border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.post-form label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 4px; }
.post-form label:first-child { margin-top: 0; }
.post-form input, .post-form select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    color: var(--ink);
}
.post-form button {
    margin-top: 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
}
.post-form button:hover { background: #1d4ed8; }
.post-form .hint { font-size: 12.5px; color: var(--faint); margin-top: 10px; }

.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }

/* Mobile */
@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: static; max-height: none; overflow-y: visible; }
    .top-row { flex-direction: column; }
}

@media (max-width: 640px) {
    .search-sticky { flex-direction: column; }
    table { table-layout: auto; }
    .col-company, .col-location, .col-salary,
    td.col-company, td.col-location, td.col-salary { display: none; }
    th.col-title, td.col-title, th.col-posted, td.col-posted { width: auto; }
    .plans { grid-template-columns: 1fr; }
    thead th, tbody td { padding: 8px 10px; }

    .site-header { flex-direction: column; align-items: stretch; }
    .btn-post { margin-left: 0; text-align: center; }
    .site-header sl-button { margin-left: 0; display: block; width: 100%; }
    .site-header sl-button::part(base) { width: 100%; }
    .site-nav { order: 2; }
}
