/* Brake Calculator — presentation only (Phase 14A).
   Calculation logic lives in brake-calculator.html; do not encode formulas here. */

:root {
  --bk-bg: #070a10;
  --bk-surface: #12151c;
  --bk-surface-2: #161a22;
  --bk-text: #e8eef4;
  --bk-muted: #8a9aab;
  --bk-border: #2a3140;
  --bk-border-soft: rgba(255, 255, 255, 0.08);
  --bk-blue: #6ea8c4;
  --bk-blue-strong: #81d4fa;
  --bk-blue-deep: #4fc3f7;
  --bk-yellow: #ffeb3b;
  --bk-error: #ff8a80;
  --bk-error-bg: rgba(255, 80, 80, 0.1);
  --bk-radius: 14px;
  --bk-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  --bk-workspace-max: 920px;
}

html {
  background-color: var(--bk-bg);
}

body.bk-site {
  margin: 0;
  min-height: 100%;
  color: var(--bk-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Solid base + non-repeating ambient glows (fixed sizes → no vertical banding). */
  background-color: var(--bk-bg);
  background-image:
    radial-gradient(
      ellipse 920px 520px at 50% -80px,
      rgba(79, 140, 200, 0.2),
      transparent 70%
    ),
    radial-gradient(
      ellipse 640px 420px at 92% 18%,
      rgba(40, 80, 130, 0.1),
      transparent 72%
    );
  background-repeat: no-repeat, no-repeat;
  background-position: 50% 0, 100% 0;
  background-size: 100% 640px, 70% 520px;
}

.bk-page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
  box-sizing: border-box;
}

.bk-main {
  width: min(var(--bk-workspace-max), 100%);
  margin: 0.35rem auto 0;
  padding: 0 0 0.25rem;
  box-sizing: border-box;
}

/* —— Tool introduction —— */
.bk-intro {
  margin: 0.35rem 0 0.85rem;
  text-align: left;
}

.bk-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bk-blue-strong);
}

.bk-title {
  margin: 0;
  color: #fff;
  font-weight: 780;
  letter-spacing: 0.01em;
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  line-height: 1.15;
}

.bk-lead {
  margin: 0.45rem 0 0;
  max-width: 38rem;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--bk-muted);
}

/* —— Workspace card —— */
.bk-workspace {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, transparent 42%),
    linear-gradient(180deg, #171b24 0%, var(--bk-surface) 55%, #10131a 100%);
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius);
  padding: 1.15rem 1.2rem 1.05rem;
  box-shadow: var(--bk-shadow);
}

.bk-form {
  margin: 0;
}

.bk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.75rem;
  align-items: flex-end;
}

.bk-input {
  flex: 1 1 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  color: var(--bk-text);
}

.bk-input-label {
  font-size: 0.9rem;
  font-weight: 650;
  color: #cfd8dc;
}

.bk-help {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--bk-muted);
}

.bk-input input {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  color: var(--bk-text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 1.05rem;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.bk-input input:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.24);
}

.bk-input input:focus,
.bk-input input:focus-visible {
  border-color: rgba(129, 212, 250, 0.75);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.bk-input input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.bk-input input.is-invalid,
.bk-input input[aria-invalid="true"] {
  border-color: rgba(255, 138, 128, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 80, 80, 0.18);
  background: var(--bk-error-bg);
}

.bk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}

.bk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.65rem 1.15rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.bk-btn:focus-visible {
  outline: 2px solid var(--bk-blue-strong);
  outline-offset: 2px;
}

.bk-btn:active {
  transform: translateY(1px);
}

.bk-btn-primary {
  background: rgba(110, 168, 196, 0.94);
  border: 1.5px solid rgba(160, 200, 220, 0.55);
  color: #061018;
  box-shadow: 0 8px 20px rgba(60, 120, 160, 0.18);
}

.bk-btn-primary:hover,
.bk-btn-primary:focus-visible {
  background: rgba(130, 185, 210, 0.98);
  border-color: rgba(180, 215, 235, 0.7);
}

.bk-btn-secondary {
  background: rgba(12, 18, 26, 0.5);
  border: 1.5px solid rgba(160, 200, 220, 0.38);
  color: #d7e3ec;
}

.bk-btn-secondary:hover,
.bk-btn-secondary:focus-visible {
  background: rgba(20, 30, 40, 0.72);
  border-color: rgba(160, 200, 220, 0.55);
  color: #fff;
}

.bk-error {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 138, 128, 0.45);
  background: var(--bk-error-bg);
  color: #ffcdd2;
  font-size: 0.92rem;
  line-height: 1.4;
}

.bk-error[hidden] {
  display: none !important;
}

.bk-error::before {
  content: "";
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--bk-error);
  box-shadow: 0 0 0 3px rgba(255, 80, 80, 0.2);
}

.bk-mode {
  display: inline-flex;
  margin: 0.75rem 0 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 59, 0.28);
  background: rgba(255, 235, 59, 0.07);
  color: #fff59d;
  font-size: 0.82rem;
  font-weight: 650;
}

.bk-mode[hidden] {
  display: none !important;
}

/* —— Results —— */
.bk-results {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--bk-border-soft);
}

.bk-results[hidden] {
  display: none !important;
}

.bk-section {
  margin: 0.15rem 0 0.5rem;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.bk-section-muted {
  color: var(--bk-muted);
  font-weight: 650;
  font-size: 0.9rem;
}

.bk-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--bk-border-soft);
  margin: 0 0 0.85rem;
  background: rgba(7, 13, 20, 0.45);
}

.bk-table {
  min-width: 600px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--bk-text);
}

.bk-table th,
.bk-table td {
  padding: 0.65rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.bk-table th:last-child,
.bk-table td:last-child {
  border-right: none;
}

.bk-table thead th {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.03)
  );
  font-weight: 750;
  color: #e3eef5;
  font-size: 0.86rem;
}

.bk-table tbody td {
  font-size: 0.95rem;
}

.bk-table tbody td b {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}

.bk-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.bk-divider {
  position: relative;
  text-align: center;
  margin: 0.45rem 0 0.65rem;
}

.bk-divider::before,
.bk-divider::after {
  content: "";
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  z-index: 0;
}

.bk-pill {
  position: relative;
  z-index: 1;
  min-height: 2.1rem;
  min-width: 2.6rem;
  border: 1px solid rgba(255, 235, 59, 0.55);
  background: rgba(255, 235, 59, 0.92);
  color: #0b1120;
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.bk-pill:hover,
.bk-pill:focus-visible {
  background: #fff59d;
  border-color: #fff59d;
}

.bk-pill:focus-visible {
  outline: 2px solid var(--bk-blue-strong);
  outline-offset: 2px;
}

.bk-coll {
  overflow: hidden;
  transition: max-height 0.28s ease;
  max-height: 0;
}

.bk-coll .bk-table {
  min-width: 600px;
}

/* —— About —— */
.bk-about {
  margin: 1rem 0 1.35rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(42, 49, 64, 0.9);
  background: rgba(16, 19, 26, 0.72);
}

.bk-about-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #cfd8dc;
}

.bk-about-copy {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--bk-muted);
}

/* —— Orientation overlay —— */
.bk-orient {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: saturate(120%) blur(2px);
  z-index: 9999;
  color: #c0c0c0;
  text-align: center;
  padding: 24px;
}

.bk-orient.show {
  display: flex;
}

.bk-orient .phone {
  width: 72px;
  height: 120px;
  border: 2px solid #c0c0c0;
  border-radius: 12px;
  margin: 0 auto 12px;
  position: relative;
}

.bk-orient .phone::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 6px;
  border: 2px solid #c0c0c0;
  border-bottom: none;
  border-radius: 8px;
}

.bk-orient .arrow {
  font-size: 28px;
  line-height: 1;
  margin: 10px 0 0;
  display: block;
  transform-origin: center;
  animation: bk-spin 2.2s linear infinite;
}

@keyframes bk-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bk-orient .arrow {
    animation: none;
  }
  .bk-coll {
    transition: none;
  }
}

.bk-orient-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin-top: 0.9rem;
}

/* —— Responsive —— */
@media (min-width: 741px) {
  .bk-workspace {
    padding: 1.35rem 1.45rem 1.25rem;
  }

  .bk-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "input actions"
      "help help";
    column-gap: 0.85rem;
    row-gap: 0.55rem;
    align-items: end;
  }

  .bk-input {
    grid-area: input;
  }

  .bk-actions {
    grid-area: actions;
    flex-wrap: nowrap;
  }

  .bk-help {
    grid-area: help;
  }
}

@media (max-width: 740px) {
  .bk-page {
    padding: 0.65rem 0.85rem 0;
  }

  .bk-intro {
    text-align: left;
  }

  .bk-workspace {
    padding: 1rem 0.9rem 0.95rem;
  }

  .bk-row {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-actions {
    flex-direction: column;
    width: 100%;
  }

  .bk-btn {
    width: 100%;
  }

  .bk-input input[type="number"] {
    -webkit-appearance: none;
    appearance: textfield;
  }

  .bk-input input[type="number"]::-webkit-outer-spin-button,
  .bk-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}

@media (max-width: 390px) {
  .bk-title {
    font-size: 1.4rem;
  }

  .bk-lead {
    font-size: 0.92rem;
  }
}
