/* Aussie Job Cuts Tracker. Dark by default; the header button switches to light. */

:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #0a0a0c;
  --head: #111114;
  --border: #1f1f24;
  --border-strong: #2e2e36;
  --text: #ededf0;
  --text-2: #c3c3cb;
  --muted: #8e8e99;
  --link: #8ab4ff;
  --row-hover: #121216;
  --yes-bg: #3a1411;
  --yes-fg: #ff9d90;
  --partly-bg: #352909;
  --partly-fg: #f0c14b;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #fff;
  --head: #f2f2ee;
  --border: #e6e6e0;
  --border-strong: #cfcfc7;
  --text: #17171a;
  --text-2: #3b3b43;
  --muted: #6a6a73;
  --link: #0b57d0;
  --row-hover: #f8f8f5;
  --yes-bg: #fde3df;
  --yes-fg: #a02112;
  --partly-bg: #fbeec8;
  --partly-fg: #765300;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 40px 32px 64px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body > * {
  max-width: 1840px;
  margin-left: auto;
  margin-right: auto;
}

a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: currentColor; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Header */

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.tagline {
  max-width: 72ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.last-checked {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* Show the icon for the theme you would switch to. */
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* Table */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

th, td {
  padding: 16px 14px;
  text-align: left;
  vertical-align: top;
}

th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }

/* Column labels stay in view while the long table scrolls. */
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 11px;
  padding-bottom: 11px;
  background: var(--head);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Notes is the long column; give it the most room. */
thead th:nth-child(7) { width: 28%; }

tbody tr + tr td { border-top: 1px solid var(--border); }

tbody td { transition: background-color 120ms ease; }

@media (hover: hover) {
  tbody tr:hover td { background: var(--row-hover); }
}

/* Cells */

.sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.col-date {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.col-company { min-width: 120px; }

.col-company strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.col-workers { min-width: 130px; }

.workers-num {
  display: block;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.col-areas,
.col-notes,
.col-sources {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.col-areas { min-width: 110px; }
.col-ai { min-width: 150px; }
.col-offshore { min-width: 150px; }
.col-notes { min-width: 220px; }
.col-sources { min-width: 120px; }

/* Notes clamp to four lines when scripting is available; app.js adds the toggle. */
.js .note-text:not(.expanded) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.note-more {
  all: unset;
  margin-top: 4px;
  color: var(--link);
  font-size: 12.5px;
  cursor: pointer;
}

.note-more:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note-more[hidden] { display: none; }

.col-sources a,
.col-sources span {
  display: block;
}

.col-sources > * + * { margin-top: 5px; }

/* Yes and Partly carry colour; No stays quiet so the others stand out. */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.badge-yes { background: var(--yes-bg); color: var(--yes-fg); }
.badge-partly { background: var(--partly-bg); color: var(--partly-fg); }

.badge-no,
.badge-unclear {
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Round the table's own corners, since the wrapper no longer clips them. */
@media (min-width: 881px) {
  thead th:first-child { border-top-left-radius: 5px; }
  thead th:last-child { border-top-right-radius: 5px; }
  tbody tr:last-child td:first-child { border-bottom-left-radius: 5px; }
  tbody tr:last-child td:last-child { border-bottom-right-radius: 5px; }
}

/* Medium screens: stay a table, just tighter. */
@media (max-width: 1150px) {
  body { padding: 28px 20px 48px; }

  .table-wrap { overflow-x: auto; }

  table { font-size: 13.5px; }

  th, td { padding: 13px 9px; }

  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }

  thead th {
    font-size: 11px;
    white-space: normal;
  }

  .sub { font-size: 12px; }

  .workers-num { font-size: 18px; }

  .col-areas,
  .col-notes,
  .col-sources { font-size: 12.5px; }

  .col-company,
  .col-workers,
  .col-areas,
  .col-ai,
  .col-offshore,
  .col-notes,
  .col-sources { min-width: 0; }

  .col-notes { min-width: 150px; }
  .col-date { white-space: normal; }
}

/* Small tablets: the tightest table that still reads. */
@media (max-width: 900px) {
  table { font-size: 13px; }

  th, td { padding: 11px 6px; }

  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 10px; }

  thead th {
    font-size: 10.5px;
    letter-spacing: 0.04em;
  }

  .sub { font-size: 11.5px; }

  .col-company strong { font-size: 14px; }

  .workers-num { font-size: 17px; }

  .badge { font-size: 11.5px; padding: 0 7px; }

  .col-areas,
  .col-sources { font-size: 12px; }

  .col-notes {
    min-width: 130px;
    font-size: 12px;
  }
}

/* Narrow screens: each row becomes a stacked card. */
@media (max-width: 880px) {
  body { padding: 20px 16px 40px; }

  h1 { font-size: 22px; }

  /* The date drops to its own line under the title; the toggle stays top right. */
  .site-header {
    flex-wrap: wrap;
    margin-bottom: 18px;
  }

  .site-title { flex: 1 1 0; min-width: 0; }
  .header-meta { display: contents; }

  .last-checked {
    order: 3;
    flex-basis: 100%;
  }

  .table-wrap {
    background: none;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  table, tbody, td { display: block; }

  table { font-size: 14.5px; }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  /* Cards lead with the employer name, then the date. */
  tbody tr {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  tbody tr + tr { margin-top: 12px; }
  tbody tr + tr td { border-top: 0; }

  @media (hover: hover) {
    tbody tr:hover td { background: none; }
  }

  .col-company { order: -1; }

  td,
  td:first-child,
  td:last-child { padding: 7px 16px; }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .col-company::before { display: none; }
  .col-company strong { font-size: 17px; }

  .col-date { white-space: normal; }

  .workers-num { font-size: 20px; }

  .sub { font-size: 13px; }

  .badge { font-size: 12px; padding: 1px 8px; }

  .col-areas,
  .col-notes,
  .col-sources {
    min-width: 0;
    font-size: 13.5px;
  }
}
