/* css/certs.css — area F (Certificates). Owned by area F during the build; every class
   carries the prefix .certs-. Shared components come only from css/sas.css; the
   lead folds this file into its AREA F section in phase (c). */

/* ----- search.html: the form --------------------------------------------- */

.certs-rule { margin: 0 0 15px; }

/* One column on phones, two from 576, three from 992, all six on one row from 1280. */
.certs-fields {
  display: grid;
  gap: 15px 20px;
  grid-template-columns: minmax(0, 1fr);
}

.certs-fields .field { margin-top: 0; }

@media (min-width: 576px) {
  .certs-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .certs-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .certs-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.certs-form .form-actions { margin-top: 20px; }
.certs-form .btn .icon { margin-right: 2px; }

.certs-messages:not(:empty) { margin-top: 20px; }

/* ----- search.html: the results -------------------------------------------- */

.certs-results { margin-top: 30px; }

.certs-summary {
  margin: 0 0 10px;
  color: var(--sas-muted);
}

.certs-summary:focus { outline: 0; }
.certs-summary:focus-visible { box-shadow: var(--orc-focus); }

/* The boat: its name, the sail number under it. */
.certs-boat-name { font-weight: 700; }
.certs-boat-sail { display: block; font-size: 12px; line-height: 16px; }

.certs-cert > span:first-child { display: block; }
.certs-chips { margin-top: 3px; }

/* Each row's actions: Add / In My Boats and More on one line, the tick and
   notes under them. */
.certs-actions { min-width: 0; }

.certs-actions-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.certs-add {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.certs-add .disabled-reason { margin: 0; }

.certs-inboats {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.certs-more .icon { width: 14px; height: 14px; margin-left: 2px; }

/* Headers may wrap ("Rating / office", "VPP / year"): the table fits from
   768 px without scrolling. */
.certs-results .tbl thead th,
.certs-scratch .tbl thead th { white-space: normal; }

/* A button's label on one line: the column takes their width, the names wrap. */
.certs-actions .btn,
.certs-tick { white-space: nowrap; }

.certs-tick {
  margin-top: 8px;
  font-size: 14px;
}

.certs-note {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--sas-muted);
}

.certs-rowmsg:empty { display: none; }
.certs-rowmsg .msg { margin: 8px 0 0; padding: 6px 8px; font-size: 14px; line-height: 18px; }

/* The one-design help's steps. */
.certs-steps { margin: 10px 0 0; padding-left: 22px; }
.certs-steps li + li { margin-top: 5px; }

/* The scratch-sheet bar: at the bottom of the window while the results
   scroll, once the scratch sheet has boats. */
.certs-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-top: 20px;
  padding: 10px 15px calc(10px + env(safe-area-inset-bottom));
  background: var(--orc-navy);
  color: var(--orc-white);
}

.certs-bar[hidden] { display: none; }

/* While the bar shows, a control the keyboard moves to is scrolled clear of
   it, never under it (WCAG 2.4.11): the bar is at most about 64 px high (44 px
   buttons on coarse pointers). */
html:has(.certs-bar:not([hidden])) {
  scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.certs-bar-text {
  margin: 0;
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 16px;
  line-height: 21px;
}

.certs-bar .btn .icon { margin-right: 2px; }

/* Phones: one compact line, "Open" (its full name stays for screen readers). */
@media (max-width: 575.98px) {
  .certs-bar {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }

  .certs-bar-text { font-size: 14px; line-height: 18px; }

  .certs-bar-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media print {
  .certs-bar,
  .certs-form { display: none !important; }
}

/* ----- scratch.html ------------------------------------------------------- */

.certs-report-fields {
  display: grid;
  gap: 15px 20px;
  grid-template-columns: minmax(0, 1fr);
}

.certs-report-fields .field { margin-top: 0; }

@media (min-width: 768px) {
  .certs-report-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); max-width: 900px; }
}

.certs-report .form-actions { margin-top: 20px; }
.certs-report .btn .icon { margin-right: 2px; }

.certs-count { margin: 0 0 10px; }

/* A boat taken off the sheet stays, unticked, until the page is reloaded. */
.tbl tr.certs-removed > td { color: var(--sas-muted); }
.tbl tr.certs-removed .certs-boat-name { font-weight: 400; text-decoration: line-through; }
