/* ============================================================
   Drive status — the fourth view on the home page.

   Every selector is prefixed .ds- or scoped to #view-drives, so
   nothing here can reach the archive's own markup. Colours, radii
   and fonts all come from app.css tokens.
   ============================================================ */

/* The board is the point of this view, so it takes the window's width
   (up to a very wide screen), not the reading width the archive uses. */
#view-drives { --ds-max: 1880px; --ds-pad: 28px; }
.ds-inner { flex: 1; overflow-y: auto; padding: 18px 0 90px; }

.ds-top { max-width: var(--ds-max); margin: 0 auto; padding: 0 var(--ds-pad); }
.ds-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ds-title { flex: 1 1 320px; min-width: 0; }
.ds-title h1 { font: 800 20px/1.25 var(--sans); color: var(--ink); margin: 0 0 5px; }
.ds-title p  { font: 400 13.5px/1.55 var(--sans); color: var(--ink-2); margin: 0; max-width: 62ch; }
.ds-title p b { color: var(--ink); font-weight: 600; }
.ds-acts { display: flex; gap: 8px; flex: 0 0 auto; }

.ds-btn {
  appearance: none; cursor: pointer; white-space: nowrap;
  font: 600 13px/1 var(--sans);
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
}
.ds-btn:hover { background: var(--surface-2); }
.ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ds-btn.ds-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ds-btn.ds-primary:hover { filter: brightness(1.06); }
.ds-btn[disabled] { opacity: .55; cursor: default; }

.ds-years { display: inline-flex; gap: 2px; padding: 2px; margin: 4px 0 14px;
            background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.ds-years[hidden] { display: none; }
.ds-years button {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: 600 12.5px/1 var(--sans); color: var(--ink-2);
  padding: 7px 12px; border-radius: 7px;
}
.ds-years button.ds-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ------------------------------------------------------- board */

/* Columns side by side, like Jira. The board scrolls sideways when
   there are more columns than room; the page scrolls down. */
.ds-board {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 2px var(--ds-pad) 14px; margin: 0 auto; max-width: var(--ds-max);
  scroll-padding-left: var(--ds-pad);
}
.ds-col {
  flex: 0 0 224px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 9px 9px;
}
.ds-col-h {
  display: flex; align-items: center; gap: 7px;
  padding: 1px 3px 9px;
  font: 650 11.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2);
}
.ds-col-h .ds-n {
  font: 600 11px/1 var(--mono); letter-spacing: 0; text-transform: none;
  background: var(--surface-3); color: var(--ink-2);
  border-radius: 999px; padding: 3px 7px;
}
.ds-col-h .ds-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.ds-col[data-kind="live"]   .ds-dot { background: var(--accent); }
.ds-col[data-kind="round"]  .ds-dot { background: var(--accent); }
.ds-col[data-kind="offers"] .ds-dot { background: var(--good); }
/* Offers out is the last column students see — the one that ends somebody's
   wait — so it is the one that reads as final. */
.ds-col[data-kind="offers"] { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.ds-col[data-kind="offers"] .ds-col-h { color: var(--good); }

.ds-empty-col {
  font: 400 12px/1.4 var(--sans); color: var(--ink-3);
  text-align: center; padding: 14px 6px; border: 1px dashed var(--line-strong); border-radius: 8px;
}

.ds-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 11px; margin-bottom: 7px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.ds-card:last-child { margin-bottom: 0; }
.ds-card-h { display: flex; align-items: center; gap: 9px; }
.ds-mark {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; overflow: hidden;
  display: grid; place-items: center;
  background: hsl(var(--h, 210) 34% 46%); color: #fff;
  font: 700 10.5px/1 var(--sans); letter-spacing: .02em;
}
.ds-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 2px; box-sizing: border-box; }
.ds-who { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ds-name { font: 600 13.5px/1.3 var(--sans); color: var(--ink);
           overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
           overflow-wrap: break-word; hyphens: auto; }
.ds-sub2 { font: 500 11.5px/1.35 var(--sans); color: var(--ink-3); }

/* How many offers the drive made, on the rounds · year line. */
.ds-nb { white-space: nowrap; }
.ds-type { color: var(--ink-2); font-weight: 600; }
/* Stipend, CTC, base — whatever is known. */
.ds-terms { margin-top: 8px; font: 600 12px/1.45 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.ds-offers { color: var(--good); font-weight: 650; }
.ds-offers b { font-weight: 800; font-variant-numeric: tabular-nums; }
/* The admin's line about the drive, ticked once it has been checked. */
.ds-status { display: flex; align-items: flex-start; gap: 6px; margin-top: 9px;
  font: 600 12.5px/1.4 var(--sans); color: var(--ink); overflow-wrap: anywhere; }
.ds-status.ds-ticked { color: var(--good); }
.ds-tick { flex: 0 0 auto; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-top: -1px;
  border-radius: 50%; background: var(--good); color: #fff; font: 800 10.5px/1 var(--sans); }
/* Dates, one row each; the one for the stage the drive is in stands out. */
.ds-dates { margin: 9px 0 0; display: grid; gap: 3px; }
.ds-date { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; font: 400 12px/1.35 var(--sans); }
.ds-date dt { color: var(--ink-3); white-space: nowrap; }
.ds-date dd { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ds-date.ds-now dt, .ds-date.ds-now dd { color: var(--ink); font-weight: 650; }
.ds-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 9px; }
.ds-stat { display: flex; align-items: baseline; gap: 5px; }
.ds-stat b { font: 650 15px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.ds-stat span { font: 500 11.5px/1 var(--sans); color: var(--ink-3); }
.ds-stat.ds-verified b { color: var(--good); }
.ds-stat.ds-nc b { color: var(--bad); }

.ds-note {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font: 400 12.5px/1.45 var(--sans); color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ds-note time { color: var(--ink-3); font-size: 11.5px; }

/* Live now / Done — is this stage still happening? */
.ds-phase {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font: 600 11.5px/1 var(--sans); padding: 5px 8px 5px 7px; border-radius: 999px;
}
.ds-phase::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.ds-phase.ds-ongoing { background: var(--good-bg); color: var(--good); }
.ds-phase.ds-ongoing::before { background: var(--good); animation: ds-pulse 1.6s ease-in-out infinite; }
.ds-phase.ds-done { background: var(--surface-3); color: var(--ink-2); }
.ds-phase.ds-done::before { background: var(--ink-3); }
@keyframes ds-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .ds-phase.ds-ongoing::before { animation: none; } }

/* ------------------------------------------------------ feed */

.ds-feed { max-width: var(--ds-max); margin: 24px auto 0; padding: 0 var(--ds-pad); }
.ds-feed h2 { font: 650 11.5px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase;
              color: var(--ink-3); margin: 0 0 10px; }
.ds-feed-item {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: 8px; padding: 11px 13px; margin-bottom: 8px;
  font: 400 13.5px/1.55 var(--sans); color: var(--ink);
}
.ds-feed-item.ds-pinned { border-left-color: var(--accent); }
.ds-feed-item .ds-meta { margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }

.ds-blank { text-align: center; padding: 36px 16px; font: 400 14px/1.6 var(--sans); color: var(--ink-3); }

/* ----------------------------------------------------- dialogs */

dialog.ds-sheet { border: 0; padding: 0; background: none; width: calc(100% - 32px); max-width: 470px; }
dialog.ds-sheet::backdrop { background: rgba(20,16,8,.5); }
.ds-sheet-in {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 13px;
  box-shadow: var(--shadow-lg); padding: 20px;
  max-height: calc(100dvh - 48px); overflow-y: auto; box-sizing: border-box;
}
.ds-sheet-in h2 { font: 650 16px/1.3 var(--sans); margin: 0 0 4px; }
.ds-sheet-in .ds-sub { font: 400 13px/1.55 var(--sans); color: var(--ink-2); margin: 0 0 16px; }
.ds-field { margin-bottom: 13px; }
.ds-field label { display: block; font: 600 12.5px/1 var(--sans); color: var(--ink-2); margin-bottom: 6px; }
.ds-field label i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.ds-field input[type=text], .ds-field input[type=email], .ds-field select, .ds-field textarea {
  width: 100%; box-sizing: border-box;
  font: 400 14px/1.45 var(--sans); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px;
}
.ds-field textarea { resize: vertical; min-height: 84px; }
.ds-field input:focus, .ds-field select:focus, .ds-field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.ds-field input[type=file] { font: 400 13px/1.4 var(--sans); color: var(--ink-2); width: 100%; }
.ds-keep { margin-top: 7px; font: 400 11.5px/1.55 var(--sans); color: var(--ink-3); }
.ds-keep a, .ds-title a { color: var(--accent-ink); }
.ds-foot { display: flex; gap: 9px; justify-content: flex-end; align-items: center; margin-top: 18px; }
.ds-msg { margin-right: auto; font: 400 12.5px/1.45 var(--sans); color: var(--ink-2); }
.ds-none { font: 400 14px/1.6 var(--sans); color: var(--ink-2); margin: 4px 0 6px; }
/* The claim being made, spelled out for the stage the drive is in. */
.ds-claim { display: flex; gap: 9px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px;
            background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
            font: 600 13.5px/1.4 var(--sans); color: var(--ink); cursor: pointer; }
.ds-claim input { margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
/* Two answers, one of which has to be picked: cleared it, or didn't. */
.ds-outcome { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.ds-outcome .ds-claim { margin: 0; }
.ds-claim:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ds-claim-no:has(input:checked) { border-color: var(--bad); background: var(--bad-bg); }
.ds-claim-no input { accent-color: var(--bad); }
.ds-field label i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.ds-email-row { display: flex; gap: 8px; align-items: center; }
.ds-email-row input { flex: 1; min-width: 0; }
.ds-field input.ds-locked { background: var(--surface-2); color: var(--ink-2); }
.ds-link { flex: 0 0 auto; border: 0; background: none; padding: 4px 2px; cursor: pointer;
           font: 600 12.5px/1 var(--sans); color: var(--accent-ink); }
.ds-field #ds-c-code { font: 600 18px/1.3 var(--mono); letter-spacing: .3em; }
.ds-field #ds-c-code::placeholder { font: 400 14px/1.3 var(--sans); letter-spacing: 0; }

/* On a laptop the columns share the width, so the whole board is on screen
   without scrolling. Only extra rounds push it sideways. */
@media (min-width: 721px) {
  .ds-col { flex: 1 1 0; min-width: 150px; }
}

/* ------------------------------------------------------ phones */

@media (max-width: 720px) {
  #view-drives { --ds-pad: 16px; }
  .ds-inner { padding-top: 14px; }
  .ds-head { gap: 12px; }
  .ds-acts { flex: 1 1 100%; }
  .ds-acts .ds-btn { flex: 1 1 0; }
  /* One column at a time with the next one peeking, so it is obvious the
     board carries on sideways. */
  .ds-board { scroll-snap-type: x mandatory; gap: 10px; }
  .ds-col { flex: 0 0 82%; scroll-snap-align: start; }
}

/* The Drive status tab in the laptop top bar stands out from the others. */
#view-tabs .view-btn[data-view="drives"] { font-weight: 800; color: var(--ink); }

/* ------------------------------------------- phone: top-bar button */
.ds-topbtn { display: none; }
@media (max-width: 720px) {
  /* Logo | Drive status | actions. Equal side columns keep the button in the
     middle; each side is never narrower than what it holds, so on the
     narrowest phones the button gives way a little instead of overlapping. */
  .topbar:not(.topbar-admin) { grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); column-gap: 8px; }
  .topbar:not(.topbar-admin) .top-actions { grid-column: 3; flex-wrap: nowrap; gap: 6px; }
  /* No room for a text link up here; it moves into the switcher's menu. */
  .topbar:not(.topbar-admin) #to-admin { display: none; }
  .ds-topbtn {
    display: inline-flex; align-items: center; grid-column: 2; grid-row: 1; justify-self: center;
    appearance: none; cursor: pointer; white-space: nowrap;
    font: 800 12.5px/1 var(--sans); padding: 9px 12px; border-radius: 999px;
    border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  }
  .ds-topbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
}
