/*
 * @bhp/design-system — component layer
 *
 * STATUS: AUTHORED 2026-07-26. Not recovered.
 *
 * The original component layer was lost and could not be reconstructed. The live
 * site (bhpbitumen.com) is an Elementor build with no reusable components to
 * reverse-engineer — no buttons, no card system, no shared motifs in the chrome.
 *
 * So this is a first pass authored against what IS verified:
 *   - brand primitives confirmed from the logo artwork and the live site
 *   - real type metrics measured on the site: body 14px / 1.66, nav 15px,
 *     h1 40px/700, links #222 with no underline
 *   - the red-rule device taken from the logo, where it brackets the wordmark
 *   - the runtime contract: logical properties, RTL, visible focus, ARIA,
 *     prefers-reduced-motion
 *
 * It needs a designer's review before it is treated as canonical. Every value is a
 * semantic token — no raw brand hex — so retheming is a token change, not a rewrite.
 *
 * Load order: tokens/bhp-tokens.css first, then this file.
 */

/* ========================================================== foundations == */

.bhp-root {
  background: var(--bhp-bg);
  color: var(--bhp-text);
  font-family: "IRANSans", "Vazirmatn", Inter, system-ui, sans-serif;
  font-size: var(--bhp-text-sm, 0.875rem);
  line-height: var(--bhp-leading-normal, 1.66);
}

/* The signature device from the logo: a red rule bracketing content.
   Use sparingly — it carries the mark's authority. */
.bhp-rule {
  border: 0;
  block-size: 3px;
  inline-size: 100%;
  background: var(--bhp-brand-red);
  margin-block: var(--bhp-space-3, 12px);
}
.bhp-rule--short { inline-size: 64px; }

.bhp-bracket {
  padding-block: var(--bhp-space-3, 12px);
  border-block: 3px solid var(--bhp-brand-red);
}

/* ============================================================== button == */

.bhp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--bhp-space-2, 8px);
  padding-block: var(--bhp-space-3, 12px);
  padding-inline: var(--bhp-space-5, 20px);
  border: 1px solid transparent;
  border-radius: var(--bhp-radius-md, 6px);
  font: inherit;
  font-weight: var(--bhp-font-semibold, 600);
  line-height: var(--bhp-leading-tight, 1.15);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--bhp-duration-fast, 150ms) var(--bhp-ease-out, ease-out),
              border-color var(--bhp-duration-fast, 150ms) var(--bhp-ease-out, ease-out),
              color var(--bhp-duration-fast, 150ms) var(--bhp-ease-out, ease-out);
}

.bhp-button:focus-visible {
  outline: 2px solid var(--bhp-focus, #7ccca4);
  outline-offset: 2px;
}

.bhp-button[disabled],
.bhp-button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* variants */
.bhp-button--primary {
  background: var(--bhp-color-primary);
  color: var(--bhp-text-inverse, #fff);
}
.bhp-button--primary:hover { background: var(--bhp-color-primary-hover); }
.bhp-button--primary:active { background: var(--bhp-color-primary-active); }

.bhp-button--secondary {
  background: transparent;
  color: var(--bhp-text-brand, var(--bhp-color-primary));
  border-color: var(--bhp-border-brand, var(--bhp-color-primary));
}
.bhp-button--secondary:hover { background: var(--bhp-bg-brand-subtle); }

.bhp-button--ghost {
  background: transparent;
  color: var(--bhp-text);
}
.bhp-button--ghost:hover { background: var(--bhp-bg-muted); }

/* Red is the mark and the danger state. Never use it for a routine action. */
.bhp-button--danger {
  background: var(--bhp-color-danger);
  color: var(--bhp-text-inverse, #fff);
}

/* sizes */
.bhp-button--sm {
  padding-block: var(--bhp-space-2, 8px);
  padding-inline: var(--bhp-space-3, 12px);
  font-size: var(--bhp-text-xs, 0.75rem);
}
.bhp-button--lg {
  padding-block: var(--bhp-space-4, 16px);
  padding-inline: var(--bhp-space-6, 24px);
  font-size: var(--bhp-text-base, 1rem);
}

/* ================================================================ card == */

.bhp-card {
  background: var(--bhp-surface);
  border: 1px solid var(--bhp-border);
  border-radius: var(--bhp-radius-lg, 8px);
  padding: var(--bhp-space-5, 20px);
}
.bhp-card--raised {
  background: var(--bhp-surface-raised, var(--bhp-surface));
  box-shadow: var(--bhp-shadow-md);
  border-color: transparent;
}
/* Brand-marked card: the logo's red rule, applied to the inline start edge so it
   flips correctly in RTL. */
.bhp-card--marked { border-inline-start: 3px solid var(--bhp-brand-red); }

.bhp-card__title {
  margin: 0 0 var(--bhp-space-2, 8px);
  font-size: var(--bhp-text-lg, 1.125rem);
  font-weight: var(--bhp-font-semibold, 600);
  color: var(--bhp-text);
}
.bhp-card__body { margin: 0; color: var(--bhp-text-muted); }

/* =============================================================== badge == */

.bhp-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--bhp-space-1, 4px);
  padding-block: 2px;
  padding-inline: var(--bhp-space-2, 8px);
  border-radius: var(--bhp-radius-full, 999px);
  font-size: var(--bhp-text-xs, 0.75rem);
  font-weight: var(--bhp-font-medium, 500);
  background: var(--bhp-bg-muted);
  color: var(--bhp-text);
}
.bhp-badge--brand   { background: var(--bhp-bg-brand-subtle); color: var(--bhp-text-brand); }
.bhp-badge--success { background: var(--bhp-bg-brand-subtle); color: var(--bhp-color-success); }
.bhp-badge--warning { background: var(--bhp-bg-muted); color: var(--bhp-color-warning); }
.bhp-badge--danger  { background: var(--bhp-bg-muted); color: var(--bhp-color-danger); }

/* ============================================================== fields == */

.bhp-field { display: flex; flex-direction: column; gap: var(--bhp-space-2, 8px); }

.bhp-label {
  font-size: var(--bhp-text-sm, 0.875rem);
  font-weight: var(--bhp-font-medium, 500);
  color: var(--bhp-text);
}
.bhp-label[data-required]::after {
  content: "*";
  color: var(--bhp-color-danger);
  margin-inline-start: 2px;
}

.bhp-input,
.bhp-select,
.bhp-textarea {
  inline-size: 100%;
  padding-block: var(--bhp-space-3, 12px);
  padding-inline: var(--bhp-space-3, 12px);
  border: 1px solid var(--bhp-border-strong, var(--bhp-border));
  border-radius: var(--bhp-radius-md, 6px);
  background: var(--bhp-surface);
  color: var(--bhp-text);
  font: inherit;
}
.bhp-input::placeholder,
.bhp-textarea::placeholder { color: var(--bhp-text-muted); }

.bhp-input:focus-visible,
.bhp-select:focus-visible,
.bhp-textarea:focus-visible {
  outline: none;
  border-color: var(--bhp-color-primary);
  box-shadow: var(--bhp-focus-ring, 0 0 0 3px rgba(99, 191, 166, 0.42));
}
.bhp-input[aria-invalid="true"] { border-color: var(--bhp-color-danger); }

.bhp-hint  { font-size: var(--bhp-text-xs, 0.75rem); color: var(--bhp-text-muted); }
.bhp-error { font-size: var(--bhp-text-xs, 0.75rem); color: var(--bhp-color-danger); }

/* ============================================================ spec table ==
   Bitumen grades are published as specification tables — penetration, viscosity,
   performance, AC. This is the component that carries the product data. */

.bhp-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--bhp-text-sm, 0.875rem);
}
.bhp-table caption {
  text-align: start;
  padding-block-end: var(--bhp-space-2, 8px);
  font-weight: var(--bhp-font-semibold, 600);
  color: var(--bhp-text);
}
.bhp-table th,
.bhp-table td {
  text-align: start;
  padding-block: var(--bhp-space-3, 12px);
  padding-inline: var(--bhp-space-3, 12px);
  border-block-end: 1px solid var(--bhp-border);
}
.bhp-table thead th {
  background: var(--bhp-bg-subtle);
  font-weight: var(--bhp-font-semibold, 600);
  color: var(--bhp-text);
  border-block-end: 2px solid var(--bhp-border-strong, var(--bhp-border));
}
.bhp-table tbody tr:hover { background: var(--bhp-bg-subtle); }
/* numeric columns read better aligned to the end, in both directions */
.bhp-table [data-numeric] { text-align: end; font-variant-numeric: tabular-nums; }

/* =============================================================== alert == */

.bhp-alert {
  display: flex;
  gap: var(--bhp-space-3, 12px);
  padding: var(--bhp-space-4, 16px);
  border-radius: var(--bhp-radius-md, 6px);
  border-inline-start: 3px solid var(--bhp-color-info);
  background: var(--bhp-bg-subtle);
  color: var(--bhp-text);
  font-size: var(--bhp-text-sm, 0.875rem);
}
.bhp-alert--success { border-inline-start-color: var(--bhp-color-success); }
.bhp-alert--warning { border-inline-start-color: var(--bhp-color-warning); }
.bhp-alert--danger  { border-inline-start-color: var(--bhp-color-danger); }

/* ================================================================= nav == */

.bhp-nav { display: flex; gap: var(--bhp-space-1, 4px); align-items: center; }

.bhp-nav__link {
  padding-block: var(--bhp-space-2, 8px);
  padding-inline: var(--bhp-space-3, 12px);
  border-radius: var(--bhp-radius-sm, 4px);
  color: var(--bhp-text);
  text-decoration: none;             /* matches the live site */
  font-size: var(--bhp-text-sm, 0.875rem);
}
.bhp-nav__link:hover { background: var(--bhp-bg-muted); }
.bhp-nav__link[aria-current="page"] {
  color: var(--bhp-text-brand, var(--bhp-color-primary));
  font-weight: var(--bhp-font-semibold, 600);
  box-shadow: inset 0 -2px 0 var(--bhp-brand-red);
}
.bhp-nav__link:focus-visible {
  outline: 2px solid var(--bhp-focus, #7ccca4);
  outline-offset: 2px;
}

/* ============================================================== scrim ==
   White text over photography needs a scrim — a brand rule, not a preference. */

.bhp-scrim { position: relative; isolation: isolate; }
.bhp-scrim > * { position: relative; z-index: 1; }
.bhp-scrim::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 0.68), rgb(0 0 0 / 0.15));
}

/* ====================================================== accessibility == */

@media (prefers-reduced-motion: reduce) {
  .bhp-button,
  .bhp-nav__link { transition: none; }
}

.bhp-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
