/* ==========================================================================
   O&G Engineering — components.css
   Buttons, cards, fact plates, registers, walls, lightbox, prose, form.
   ========================================================================== */

/* --- 1. Buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease);
}
.btn svg { flex: none; }

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-deep); color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--blue);
  border-color: var(--border-strong);
}
.btn--ghost:hover { border-color: var(--blue); background: var(--mist); color: var(--blue-deep); }

.btn--onink {
  background: transparent;
  color: #fff;
  border-color: rgba(232,237,247,.42);
}
.btn--onink:hover { background: rgba(232,237,247,.12); border-color: #fff; color: #fff; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Text link with a drawn underline */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--blue);
  text-decoration: none;
}
.link-arrow svg { transition: transform var(--fast) var(--ease); }
.link-arrow:hover svg { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --- 2. Prose ------------------------------------------------------------ */

.prose { max-width: 72ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.7em; font-size: var(--fs-2xl); }

/* A sub-heading inside the prose. It is an h2 because it sits directly under
   the page h1 with nothing between — the smaller size is a visual level, not
   a document level. */
.prose h2.sub,
.prose h3 {
  margin-top: 1.7em;
  margin-bottom: .5em;
  font-family: var(--sans);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}
.prose ul { margin: 0 0 1.15em; padding: 0; list-style: none; }
.prose li {
  position: relative;
  padding-inline-start: 22px;
  margin-bottom: 9px;
}
.prose li::before {
  content: "";
  position: absolute;
  inset-inline-start: 1px;
  top: .62em;
  width: 7px;
  height: 7px;
  background: var(--green);
  transform: rotate(45deg);
}
.prose ol { margin: 0 0 1.15em; padding-inline-start: 20px; }
.prose ol li { padding-inline-start: 4px; }
.prose ol li::before { content: none; }

/* A numbered service, as on Oil & Gas Services */
.numbered { counter-reset: svc; }
.numbered > .numbered-item { counter-increment: svc; }
.numbered-item + .numbered-item { margin-top: 40px; }
.numbered-item > h2,
.numbered-item > h3 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 0;
  margin-bottom: .5em;
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}
.numbered-item > h2::before,
.numbered-item > h3::before {
  content: counter(svc);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--green-deep);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2px 8px;
  flex: none;
}

/* --- 3. Fact plates ------------------------------------------------------
   The four figures on the home page. Values are verbatim from the live site.
   ------------------------------------------------------------------------ */

.facts {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0;
}
@media (min-width: 560px)  { .facts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .facts { grid-template-columns: repeat(4, 1fr); } }

.fact {
  background: var(--paper);
  padding: 22px 20px;
}
.fact dt {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green-deep);
  margin-bottom: 8px;
}
.fact dd {
  margin: 0;
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.015em;
  color: var(--ink);
}
.fact dd small {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- 4. Cards ------------------------------------------------------------ */

.grid { display: grid; gap: 22px; }
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(11, 35, 80, .09);
}
.card-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.card h2, .card h3 { margin: 0 0 10px; font-size: var(--fs-lg); letter-spacing: -.01em; }
.card p { color: var(--text-muted); font-size: var(--fs-base); margin: 0; }
.card .link-arrow { margin-top: auto; padding-top: 20px; }

/* Service card — image over a body */
.card--service .card-figure {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--mist);
  border-bottom: 1px solid var(--border);
}
.card--service .card-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 480ms var(--ease);
}
.card--service:hover .card-figure img { transform: scale(1.04); }
/* The card title carries the link, and its ::after covers the whole card so
   the entire card is clickable while only the title is in the tab order. */
.card--service h2 a,
.card--service h3 a { color: inherit; text-decoration: none; }
.card--service h2 a::after,
.card--service h3 a::after { content: ""; position: absolute; inset: 0; }
.card--service h2 a:hover,
.card--service h3 a:hover { color: var(--blue); }
.card--service { position: relative; }

/* Business-area card on the home page — no image, a diamond instead */
.card--area .card-body { gap: 10px; }
.card--area .dia { margin-bottom: 4px; }

/* --- 5. Split: copy beside a figure -------------------------------------- */

.split {
  display: grid;
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1.35fr 1fr; }
  .split--even { grid-template-columns: 1fr 1fr; }
}
/* Grid items default to min-width:auto, which lets a wide child (the awards
   grid) push the column past the viewport. */
.split > * { min-width: 0; }

.split figure { margin: 0; }
.split figure img { border: 1px solid var(--border); border-radius: var(--radius); width: 100%; }

/* The two award photographs are 269×269 originals — never scaled past that */
.awards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 269px));
  justify-content: start;
}
.awards img { background: var(--mist); }
.split figcaption {
  margin-top: 10px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* --- 6. The register (tables) -------------------------------------------
   18 to 36 rows of client work deserve a table, not cards.
   ------------------------------------------------------------------------ */

.register-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}
.register {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.register caption {
  text-align: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-deep);
  background: var(--mist);
}
.register th, .register td {
  padding: 13px 18px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.register thead th {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--mist);
  white-space: nowrap;
}
.register tbody tr:last-child th,
.register tbody tr:last-child td { border-bottom: 0; }
.register tbody tr:hover { background: var(--mist); }
.register .num,
.register .code,
.register .date {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}
.register .title { font-weight: 600; color: var(--ink); min-width: 300px; }
.register .client { white-space: nowrap; font-weight: 600; color: var(--blue); }

/* The approval code plate — the site's structural unit on the Approvals page */
.plate {
  display: inline-block;
  min-width: 42px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
}
.plate--approved { border-color: var(--green); color: var(--green-deep); }

/* Three-column registers need more room than the default 720px */
.register--wide { min-width: 880px; }
.register--wide td:last-child,
.register--wide th:last-child { min-width: 200px; }

.register td .band-value {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  display: block;
}
.register td .band-value + .band-value { margin-top: 6px; }
.register td .sub-code {
  display: block;
  margin-bottom: 6px;
}
.register td .sub-code:last-child { margin-bottom: 0; }

/* A caption the screen reader needs but the heading above already shows */
.visually-hidden-caption {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Two-column definition register, used for the completed projects list */
.pairs {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.pairs td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.pairs tr:last-child td { border-bottom: 0; }
.pairs tr:hover { background: var(--mist); }
.pairs .title { font-weight: 600; color: var(--ink); }
.pairs .client {
  text-align: end;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--blue);
}

/* --- 7. Spec list — label/value rows ------------------------------------- */

.spec {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.spec-row {
  display: grid;
  gap: 4px 20px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 560px) { .spec-row { grid-template-columns: 150px 1fr; align-items: baseline; } }
.spec-row:last-child { border-bottom: 0; }
.spec dt {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green-deep);
}
.spec dd { margin: 0; color: var(--text); }
.spec dd a { font-weight: 600; }

/* --- 8. Document wall — certificates and gallery ------------------------- */

.wall { display: grid; gap: 18px; }
.wall--portrait { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.wall--landscape { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.plate-link {
  display: block;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.plate-link:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(11, 35, 80, .10);
}
.wall--portrait .plate-link img { aspect-ratio: 1000 / 1414; object-fit: cover; width: 100%; }
.wall--landscape .plate-link img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }

.plate-caption {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.plate-caption strong { display: block; font-size: var(--fs-base); }
.plate-caption span {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* --- 9. Lightbox --------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 20, 46, .93);
}
.lightbox[open] { display: flex; }
.lightbox img {
  max-width: min(100%, 1100px);
  max-height: calc(100vh - 130px);
  width: auto;
  object-fit: contain;
  background: var(--paper);
}
.lightbox-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  color: var(--pearl);
  font-family: var(--mono);
  font-size: var(--fs-sm);
}
.lightbox-nav { display: flex; gap: 8px; }
.lightbox button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: rgba(232,237,247,.10);
  border: 1px solid rgba(232,237,247,.28);
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.lightbox button:hover { background: rgba(232,237,247,.22); }
.lightbox-close { position: absolute; top: 20px; inset-inline-end: 24px; }
.lightbox-caption { max-width: 62ch; }

/* --- 10. Form ------------------------------------------------------------ */

.form { display: grid; gap: 18px; }
@media (min-width: 640px) { .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } }

.field { display: grid; gap: 7px; }
.field label {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
}
.field label .req { color: var(--green-deep); }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.field textarea { min-height: 148px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(18, 71, 148, .13);
}
.field input:user-invalid { border-color: #B3261E; }

.field-note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
}

.form-status {
  padding: 13px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--mist);
  font-size: var(--fs-base);
}
.form-status[data-state="error"] { border-color: #B3261E; color: #8C1D18; background: #FCEEEC; }
.form-status[data-state="ok"] { border-color: var(--green); color: var(--green-deep); background: #EDF9F1; }
.form-status[hidden] { display: none; }

/* --- 11. Callout --------------------------------------------------------- */

.callout {
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--green);
  border-radius: var(--radius);
  background: var(--mist);
  padding: 22px 24px;
}
.callout p:last-child { margin-bottom: 0; }
.callout .motto {
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
}

/* --- 12. CTA band -------------------------------------------------------- */

.cta-inner {
  display: grid;
  gap: 24px;
  align-items: center;
}
@media (min-width: 860px) {
  .cta-inner { grid-template-columns: 1fr auto; gap: 40px; }
}
.cta-inner h2 { color: #fff; margin: 0 0 8px; }
.cta-inner p { color: var(--pearl); margin: 0; max-width: 56ch; }
