/*
 * H&P Employee Auction - employee page layout (Home, Sale, Item, My Bids,
 * Help). SPEC §11, docs/FRONTEND.md.
 *
 * Layout only: every color comes from the theme tokens in
 * /shared/theme.css, so light, dark and forced themes keep their contrast.
 * No hard-coded colors except translucent black/white overlays on photos.
 */

/* ============================================================ shared bits */
.lead { font-size: 1.02rem; color: var(--text-secondary); max-width: 70ch; }
.muted-inline { color: var(--text-secondary); font-weight: 500; }
.time-left { display: inline-flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.pill-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.card-title-row h2, .card-title-row h3 { margin: 0; }
.load-error { max-width: 720px; }
.text-block { max-width: 75ch; overflow-wrap: anywhere; }

/* ItemCard additions (theme.css has the base tile). */
.item-card-cover-link { display: block; width: 100%; height: 100%; }
.item-card-price .price-label { font-size: 0.8rem; font-weight: 650; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; margin-right: 4px; }
.item-card-price .price-value { font-size: 1.15rem; }
.item-card-note, .item-card-sale { margin: 0; }
.item-card-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.item-card-cover .watch { box-shadow: 0 1px 3px var(--shadow-direct); font-size: 1.15rem; line-height: 1; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }

/* ============================================================ home */
.sale-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.sale-hero-cover { position: relative; background: var(--page-bg-alt); min-height: 240px; }
.sale-hero-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.sale-hero-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.sale-hero-body h2 { font-size: 1.45rem; margin: 0; }
.sale-hero-body h2 a { color: inherit; text-decoration: none; }
.sale-hero-body h2 a:hover { text-decoration: underline; }
.sale-hero-kicker { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin: 0; }
.sale-hero-countdown { font-size: 1.05rem; font-weight: 650; }
.sale-hero-body .btn-row { margin-top: auto; }
@media (max-width: 760px) {
  .sale-hero { grid-template-columns: minmax(0, 1fr); }
  .sale-hero-cover { min-height: 0; aspect-ratio: 16 / 9; }
  .sale-hero-body { padding: var(--space-4); }
}

.sale-card .item-card-body { gap: 4px; }
.sale-card-window { color: var(--text-secondary); font-size: 0.88rem; margin: 0; }

/* ============================================================ sale page */
.sale-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); color: var(--text-secondary); margin-top: var(--space-2); }

.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { background: var(--btn-secondary-bg-hover); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--btn-primary-text); }
.chip-count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] .chip-count { background: rgba(255, 255, 255, 0.22); color: var(--btn-primary-text); }

.side-stack { display: flex; flex-direction: column; gap: var(--space-4); }

.closing-order { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.closing-order li {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr);
  gap: 2px var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--divider);
}
.closing-order li:last-child { border-bottom: 0; }
.closing-order .co-pos {
  grid-row: span 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9em; height: 1.9em;
  border-radius: 50%;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-weight: 700; font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.closing-order li.is-next .co-pos { background: var(--info-bg); color: var(--info-text); box-shadow: inset 0 0 0 1px var(--info-border); }
.closing-order li.is-done .co-title a { color: var(--text-secondary); }
.closing-order .co-title { font-weight: 650; overflow-wrap: anywhere; }
.closing-order .co-title a { color: inherit; }
.closing-order .co-when { font-size: 0.84rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 4px var(--space-2); align-items: center; }

.terms-box {
  max-height: 50vh;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--page-bg-alt);
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 0.93rem;
}
details.disclosure > summary { cursor: pointer; font-weight: 650; color: var(--link); padding: 4px 0; }
details.disclosure[open] > summary { margin-bottom: var(--space-2); }

/* ============================================================ item page */
.item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas:
    "gallery panel"
    "info    panel";
  gap: var(--space-5);
  align-items: start;
}
.item-gallery-area { grid-area: gallery; min-width: 0; }
.item-panel-area { grid-area: panel; min-width: 0; position: sticky; top: calc(var(--topbar-h) + var(--space-4)); }
.item-info-area { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }
/* Phones and tablets: the bid panel comes right after the photos. */
@media (max-width: 960px) {
  .item-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "gallery" "panel" "info";
  }
  .item-panel-area { position: static; }
}
.item-title-row { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.item-title-row h1 { overflow-wrap: anywhere; }
.watch-toggle .watch-glyph { font-size: 1.1rem; line-height: 1; }
.watch-toggle[aria-pressed="true"] { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-border); }

/* Gallery */
.gallery { display: flex; flex-direction: column; gap: var(--space-2); }
.gallery-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--page-bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gallery-main {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.gallery-main img, .gallery-empty img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-empty { width: 100%; height: 100%; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(10, 20, 32, 0.62);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.gallery-nav:hover { background: rgba(10, 20, 32, 0.82); }
.gallery-nav:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--focus-ring); }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.gallery-count {
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(10, 20, 32, 0.72);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.gallery-hint { margin: 0; font-size: 0.82rem; color: var(--text-secondary); }
.gallery-thumbs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: 4px 2px 6px;
  margin: 0;
  list-style: none;
  scroll-snap-type: x proximity;
}
.gallery-thumbs li { flex: 0 0 auto; scroll-snap-align: start; }
.gallery-thumb {
  display: block;
  width: 88px;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--page-bg-alt);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.85;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb[aria-current="true"] { border-color: var(--brand-light); opacity: 1; box-shadow: 0 0 0 2px var(--brand-light); }

dialog.gallery-dialog { width: min(1100px, calc(100vw - 24px)); }
.gallery-dialog .dialog-body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.gallery-dialog-stage { position: relative; background: var(--page-bg-alt); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; min-height: 200px; }
.gallery-dialog-stage img { max-width: 100%; max-height: calc(100vh - 220px); object-fit: contain; display: block; }
.gallery-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.gallery-dialog-head h2 { margin: 0; font-size: 1rem; }

/* Bid panel */
.bid-panel { display: flex; flex-direction: column; gap: var(--space-4); }
.bid-panel h2 { margin: 0; }
.bid-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.bid-price-label { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 2px; }
.bid-price-sub { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.9rem; }
.bid-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0; }
.bid-facts .stat dd { font-size: 1.02rem; }
.bid-time { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border-radius: var(--radius); background: var(--page-bg-alt); border: 1px solid var(--border); }
.bid-time .countdown { font-size: 1.35rem; }
.bid-time-label { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.bid-time-when { font-size: 0.88rem; color: var(--text-secondary); }
.bid-note { margin: 0; font-size: 0.86rem; color: var(--text-secondary); }
.bid-panel .notice { margin-bottom: 0; }
.bid-form { display: flex; flex-direction: column; gap: var(--space-2); }
.bid-form .input-group .btn { flex-shrink: 0; }
.bid-divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-secondary); font-size: 0.82rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.bid-divider::before, .bid-divider::after { content: ""; flex: 1; border-top: 1px solid var(--divider); }
.bid-result:empty { display: none; }
.bid-contact { border-top: 1px solid var(--divider); padding-top: var(--space-3); font-size: 0.88rem; color: var(--text-secondary); }
.bid-contact p { margin: 0; }
@media (max-width: 400px) {
  .bid-form .input-group { flex-direction: column; }
}

/* Details, documents, history */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.doc-list a { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; overflow-wrap: anywhere; }
.doc-list .doc-size { color: var(--text-secondary); font-weight: 500; font-size: 0.86rem; }
.history-auto { margin-left: 6px; }
.history-me { font-weight: 750; }

/* ============================================================ my bids */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); overflow-x: auto; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--brand-light); }
.tab .chip-count { font-size: 0.75rem; }

.won-list { display: flex; flex-direction: column; gap: var(--space-4); }
.won-card { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.won-thumb { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--page-bg-alt); border: 1px solid var(--border); }
.won-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.won-body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.won-body h3 { margin: 0; overflow-wrap: anywhere; }
.won-body h3 a { color: inherit; }
.won-body .kv { margin-top: var(--space-2); }
.won-amount { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .won-card { grid-template-columns: minmax(0, 1fr); }
  .won-thumb { max-width: 320px; }
  .won-body .kv { grid-template-columns: minmax(0, 1fr); }
  .won-body .kv dd { margin-bottom: var(--space-2); }
}

/* ============================================================ help */
.faq-toc { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.faq-toc a { display: inline-flex; min-height: 36px; align-items: center; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--card-bg); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.faq-toc a:hover { background: var(--btn-secondary-bg-hover); }
.faq-section { margin-bottom: var(--space-5); scroll-margin-top: calc(var(--topbar-h) + var(--space-3)); }
.faq-section > h2 { margin-bottom: var(--space-3); }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); margin-bottom: var(--space-2); scroll-margin-top: calc(var(--topbar-h) + var(--space-3)); }
.faq-item > summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-3) var(--space-4);
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--text-secondary); flex-shrink: 0; }
.faq-item[open] > summary::after { content: "\2212"; }
.faq-item > summary:focus-visible { outline-offset: -3px; }
.faq-answer { padding: 0 var(--space-4) var(--space-4); max-width: 80ch; }
.faq-answer > :last-child { margin-bottom: 0; }
.faq-answer ul, .faq-answer ol { padding-left: 1.3em; margin: 0 0 var(--space-3); }
.faq-answer li { margin-bottom: 4px; }
.rule-quote {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--brand-light);
  background: var(--page-bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: normal;
}
.example-table { margin-bottom: var(--space-3); }
/* Keep the step column on one line only where the table is a real table;
   under 700px .table-stack turns rows into cards and nowrap would push the
   page wider than a 360px phone. */
@media (min-width: 701px) {
  .example-table td:first-child { white-space: nowrap; }
}
