/* =========================
   Passage Clock - Page Styles
   ========================= */

/* Banner */
.pc-banner {
  display: none;
  margin: 16px;
}
.pc-banner.show {
  display: block;
}

/* Setup panel */
.pc-setup {
  margin: 0 16px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.pc-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.pc-field {
  display: grid;
  gap: 6px;
}

.pc-subtle {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.pc-inline-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.pc-inline-actions-tight {
  margin-top: 8px;
}

#shipOffsetWrap {
  margin-top: 4px;
}

.pc-fold {
  margin-top: 6px;
  border-radius: 12px;
}
.pc-fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  font-weight: 800;
  padding: 4px 0;
  list-style: none;
}
.pc-fold summary::marker {
  content: "";
}
.pc-fold summary::-webkit-details-marker {
  display: none;
}
.pc-fold summary::after {
  content: "\25BC";
  font-size: 12px;
  color: var(--muted-2);
  transition: transform 150ms ease;
}
.pc-fold[open] summary::after {
  transform: rotate(180deg);
}
.pc-fold-body {
  padding-top: 6px;
  display: grid;
  gap: 6px;
}
.pc-fold-label {
  display: block;
  color: var(--muted-2);
}
.pc-fold-foot {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .pc-fold {
    border: 1px solid var(--border);
    padding: 0 12px 10px;
    background: rgba(255, 255, 255, 0.8);
  }
  .pc-fold summary {
    margin: 0 -12px;
    padding: 10px 12px;
  }
  .pc-fold-body {
    padding-top: 10px;
  }
}
@media (min-width: 721px) {
  .pc-fold summary {
    cursor: default;
  }
  .pc-fold summary::after {
    display: none;
  }
}

/* Actions */
.pc-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.pc-actions button {
  width: 100%;
}

.pc-primary {
  border-color: rgba(91, 42, 166, 0.35);
  background: rgba(91, 42, 166, 0.12);
  font-weight: 900;
}

/* Sticky Dashboard bar */
.pc-togglebar {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  position: relative;
  top: 10px;
  z-index: 50;
}

.pc-togglebar .pc-title {
  display: grid;
  gap: 2px;
}

.pc-togglebar .pc-actions-right {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pc-edit-hint {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.pc-summary {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 68ch;
}

/* Hide setup panel when toggled */
body.pc-hide-controls .pc-setup,
body.pc-hide-controls #setupPanel {
  display: none !important;
}

/* Clocks / pills */
.pc-clockgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pc-clock .t {
  font-variant-numeric: tabular-nums;
}

.pc-pills {
  padding: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}

.pc-diagnostics {
  margin: 0 16px 16px;
  padding: 12px 16px 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.pc-diagnostics-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}

.pc-pill-info {
  width: auto;
  padding: 4px 6px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pc-pill-info:hover {
  background: transparent;
  text-decoration-thickness: 2px;
}
.pc-pill-info:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.pc-pill-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}
.pc-pill-note[hidden] {
  display: none;
}

/* Help */
details.pc-help summary {
  cursor: pointer;
  font-weight: 900;
}

.pc-helpbox {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.pc-helpbox ul {
  margin: 8px 0 0 18px;
}

.pc-helpbox li {
  margin: 6px 0;
}

/* =========================================================
   UTC emphasis
   - Ship OFF: UTC is the hero among the 3 clocks
   - Ship ON : UTC/Home/Dest are equal (ship is the hero)
   ========================================================= */

body:not(.pc-ship-active) .pc-utc .t {
  font-size: 48px;
  font-weight: 900;
}

/* =========================================================
   Ship-Time Active: HERO layout + prominence
   ========================================================= */

/* Hero row wrapper (Ship card + right-hand +/- rail) */
.pc-ship-hero-row {
  display: none;               /* only shown when ship mode active */
  grid-column: 1 / -1;         /* span full clock grid width */
  width: 100%;
  gap: 12px;
  align-items: stretch;
}

/* Show hero row whenever ship mode is on */
body.pc-ship-active .pc-ship-hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: stretch;
}

/* Ship card prominence + centered content */
body.pc-ship-active #shipCard.pc-ship-card {
  border: 2px solid rgba(91, 42, 166, 0.35);
  background:
    radial-gradient(900px 520px at 18% 10%, rgba(91,42,166,0.12), transparent 60%),
    linear-gradient(to bottom, rgba(255,255,255,0.98), rgba(255,255,255,0.72));
  box-shadow:
    0 8px 22px rgba(91,42,166,0.20),
    0 18px 45px rgba(17,24,39,0.12);

  /* Center the entire ship tile content */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Bigger ship time */
body.pc-ship-active #shipCard.pc-ship-card .t {
  font-size: 64px;
  font-weight: 950;
  letter-spacing: 0.5px;
}

/* Ensure the SHIP / UTC+... row is centered (default was space-between) */
body.pc-ship-active #shipCard.pc-ship-card .pc-ship-tz-row {
  justify-content: center;
}

/* Make time + date occupy full width so centering is visually perfect */
body.pc-ship-active #shipCard.pc-ship-card .t,
body.pc-ship-active #shipCard.pc-ship-card .hint {
  width: 100%;
  text-align: center;
}

/* Slightly de-emphasise other clocks while ship is hero */
body.pc-ship-active .pc-clock:not(.pc-ship-card) {
  opacity: 0.85;
}

/* SHIP tz row base layout (used when ship is NOT active too) */
.pc-ship-tz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Right-side quick-adjust rail (ONLY when controls hidden) */
.pc-ship-mini-rail {
  display: none;
  align-self: center;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* Show rail only in ship-active + hide-controls */
body.pc-ship-active.pc-hide-controls .pc-ship-mini-rail {
  display: flex;
}

/* Square-ish buttons */
.pc-ship-mini-rail button {
  width: 56px;
  height: 56px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  border-radius: 12px;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
  .pc-setup-grid {
    grid-template-columns: 1fr;
  }
  .pc-actions {
    grid-template-columns: 1fr 1fr;
  }
  .pc-clockgrid {
    grid-template-columns: 1fr;
  }
  .pc-togglebar {
    flex-direction: column;
    align-items: stretch;
  }
  .pc-togglebar button {
    width: 100%;
  }
  .pc-edit-hint,
  .pc-summary {
    white-space: normal;
  }
  .pc-togglebar .pc-actions-right {
    justify-content: stretch;
    width: 100%;
  }
  .pc-summary {
    max-width: none;
  }

  /* Ship hero stacks */
  body.pc-ship-active .pc-ship-hero-row {
    grid-template-columns: 1fr;
  }

  body.pc-ship-active.pc-hide-controls .pc-ship-mini-rail {
    flex-direction: row;
    justify-content: flex-start;
  }

  .pc-ship-mini-rail button {
    width: 64px;
    height: 44px;
    border-radius: 12px;
  }
}

.pc-elapsed-note {
  margin-top: 4px;
}
/* =========================================================
   FINAL OVERRIDES - Ship hero centering (wins every time)
   Put this at the very bottom of passage-clock.css
   ========================================================= */

body.pc-ship-active #shipCard.pc-ship-card {
  text-align: center !important;
}

/* Make the label row span full width and actually center its content */
body.pc-ship-active #shipCard.pc-ship-card .pc-ship-tz-row {
  width: 100% !important;
  justify-content: center !important;
}

/* Force the time + date to span the card width so centering is visible */
body.pc-ship-active #shipCard.pc-ship-card .t,
body.pc-ship-active #shipCard.pc-ship-card .hint {
  width: 100% !important;
  text-align: center !important;
}
/* =========================================================
   FINAL OVERRIDES - UTC emphasis toggles by ship mode
   ========================================================= */

/* Default in ship-active: UTC should look like Home/Dest */
body.pc-ship-active .pc-utc .t {
  font-size: 22px !important;   /* match shared .nowcard .t baseline */
  font-weight: 700 !important;  /* normal-ish */
}

/* When ship mode is OFF: UTC becomes the hero among the 3 clocks */
body:not(.pc-ship-active) .pc-utc .t {
  font-size: 48px !important;
  font-weight: 900 !important;
}

/* Base card styling for clock tiles (scoped)
   (Previously inherited via shared CSS; keep it local to avoid cross-page bleed.) */
:where(body.tk[data-tool="passage-clock"]) .pc-clock,
:where(body.tk[data-tool="passage-clock"]) .pc-banner{
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(17,24,39,0.04),
    0 10px 30px rgba(17,24,39,0.08);
  transition:
    transform 180ms ease-out,
    box-shadow 180ms ease-out,
    background-color 180ms ease-out,
    border-color 180ms ease-out,
    color 180ms ease-out;
}
:where(body.tk[data-tool="passage-clock"]) .pc-clock:hover{
  transform: translateY(-2px);
  box-shadow:
    0 4px 10px rgba(17,24,39,0.06),
    0 16px 40px rgba(17,24,39,0.10);
}
