/* ==========================================================================
   TIS Group — redesign prototype shared styles
   "Calibration certificate" direction: navy + amber accent, technical-paper
   background, hairline datasheet rules, monospace for measured data.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css?family=Kanit:300,400,500,600,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --ink: #0b1f33;
  --blue: #0a5fa8;
  --blue-deep: #063d6e;
  /* Accent: vivid signal-orange (same family SGS/UL use as their certification-mark
     accent) at higher chroma than the old muted amber, so it reads as a distinct
     "action/certified" signal against the navy instead of blending into it.
     Reserved for CTAs, the calibration-scale divider and certified/status marks —
     not used decoratively on every heading. */
  --amber: #ea580c;
  --amber-deep: #c2410c;
  --paper: #f4f6f8;
  --card: #ffffff;
  --line: #d8dee4;
  --muted: #5b6b7a;

  --status-pass: #1a7a4c;
  --status-pass-bg: #e6f4ec;
  --status-pending: #8a5d00;
  --status-pending-bg: #fdecc8;
  --status-fail: #b3261e;
  --status-fail-bg: #fbe9e8;
  --status-progress: #0a5fa8;
  --status-progress-bg: #e7f0f8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: 108px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Kanit", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  color: var(--blue-deep);
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- layout shells ---------- */

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-sub {
  min-height: 300px;
  padding: 2.5rem 0 3rem;
}

/* ---------- header / nav ---------- */

.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
}

.header-bar-top {
  background: var(--ink);
  height: 34px;
  display: flex;
  align-items: center;
}

.header-bar-top .container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
}

.header-bar-top a,
.header-bar-top span {
  color: #cdd9e4;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-bar-top a:hover {
  color: var(--amber);
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search i {
  position: absolute;
  left: 10px;
  color: #8ea3b6;
  font-size: 0.8rem;
  pointer-events: none;
}

.header-search input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 3px;
  padding: 5px 10px 5px 28px;
  font-size: 0.8rem;
  font-family: "Kanit", sans-serif;
  width: 160px;
}

.header-search input::placeholder {
  color: #93a6b7;
}

/* global :focus-visible draws an outline outside the box; on the dark header
   bar that reads as an extra line, so show focus with the border instead */
.header-search input:focus,
.header-search input:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
}

/* company page heading: logo beside the name, same height on every company */
.company-head {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.company-head img {
  height: 72px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  flex-shrink: 0;
}
.company-head .header { margin: 0; }

.navbar-main {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(11, 31, 51, 0.03);
}

.navbar-main .container {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 74px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 46px;
  display: block;
}

.brand .brand-type {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  border-left: 1px solid var(--line);
  padding-left: 10px;
  line-height: 1.3;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-main {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-main > li {
  position: relative;
  display: flex;
}

.nav-main > li > a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  /* sit 1px lower so the accent line overlaps navbar-main's own hairline
     instead of floating above it as a visually separate second line */
  margin-bottom: -1px;
}

.nav-main > li > a:hover {
  color: var(--blue);
  /* bootstrap.min.css adds text-decoration:underline to every a:hover */
  text-decoration: none;
}

.nav-main > li > a.active {
  color: var(--blue);
  border-bottom-color: var(--amber);
}

.nav-main .dropdown-panel {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--blue-deep);
  min-width: 190px;
  padding: 6px 0;
  border-radius: 4px;
  box-shadow: 0 12px 24px rgba(11, 31, 51, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: 0.15s ease;
}

.nav-main li:hover .dropdown-panel,
.nav-main li:focus-within .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-panel a {
  display: block;
  padding: 9px 16px;
  color: #dce8f2;
  font-size: 0.86rem;
}

.dropdown-panel a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-cta {
  background: var(--amber);
  color: #fff !important;
  border-radius: 3px;
  padding: 8px 16px !important;
  border-bottom: none !important;
  align-self: center;
  margin-bottom: 0 !important;
}
.nav-cta:hover {
  background: var(--amber-deep);
  color: #fff !important;
}

/* ---------- calibration scale divider (signature element) ---------- */

.scale-divider {
  --tick: 28px;
  height: 18px;
  margin: 0;
  background-image:
    linear-gradient(var(--line), var(--line)),
    repeating-linear-gradient(
      90deg,
      var(--line) 0,
      var(--line) 1px,
      transparent 1px,
      transparent var(--tick)
    );
  background-size: 100% 1px, 100% 100%;
  background-position: center, top;
  background-repeat: no-repeat, repeat-x;
  position: relative;
}

.scale-divider::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 9px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--amber) 0,
    var(--amber) 1px,
    transparent 1px,
    transparent calc(var(--tick) * 4)
  );
}

.scale-divider.on-dark {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.18) 0,
      rgba(255, 255, 255, 0.18) 1px,
      transparent 1px,
      transparent var(--tick)
    );
}

/* ---------- eyebrow / section headings ---------- */

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--blue-deep);
  margin: 0 0 6px;
}

/* Eyebrow variant for a real certified/accredited claim — the one place
   the accent color earns its keep as a "stamp" rather than decoration. */
.eyebrow.certified {
  color: var(--amber-deep);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1.6rem;
}

h1.header {
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1.6rem;
  padding-top: 6px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Kanit", sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 10px 20px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
}

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

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

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-outline:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ---------- cards / datasheet blocks ---------- */

.card-flat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.card-corner {
  position: relative;
}
.card-corner::before,
.card-corner::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--amber);
}
.card-corner::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
.card-corner::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

/* ---------- status labels ---------- */

.status {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
}
.status-pending { background: var(--status-pending-bg); color: var(--status-pending); }
.status-progress { background: var(--status-progress-bg); color: var(--status-progress); }
.status-fail { background: var(--status-fail-bg); color: var(--status-fail); }
.status-pass { background: var(--status-pass-bg); color: var(--status-pass); }

/* ---------- form controls ---------- */

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input,
.field select {
  width: 100%;
  font-family: "Kanit", sans-serif;
  font-size: 0.94rem;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
}
.field input:focus,
.field select:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 95, 168, 0.12);
}

/* ---------- footer ---------- */

footer.site-footer {
  background: var(--ink);
  color: #cdd9e4;
  margin-top: 3rem;
}

.footer-links {
  padding: 2.5rem 0 2rem;
}

.footer-links h3 {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: #7f93a5;
  margin: 0 0 12px;
}

.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links li {
  padding: 3px 0;
  font-size: 0.88rem;
}
.footer-links a {
  color: #cdd9e4;
}
.footer-links a:hover {
  color: var(--amber);
}

.footer-base {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.2rem 0;
  font-size: 0.82rem;
  color: #8ea3b6;
}
.footer-base strong {
  color: #fff;
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

/* ---------- breadcrumb ---------- */

.breadcrumb-bar {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  color: var(--muted);
  /* padding-top only: a shorthand here zeroed .container's side padding and
     pushed breadcrumbs 20px left of the page content */
  padding-top: 1.4rem;
}
.breadcrumb-bar a { color: var(--muted); }
.breadcrumb-bar a:hover { color: var(--blue); }

/* ---------- generic content article (aboutus/support/tis/iec/idasset) ---------- */

.article-body {
  max-width: 820px;
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--ink);
}
.article-body h2 { color: var(--blue); font-size: 1.15rem; margin: 1.8rem 0 0.8rem; }
.article-body p { margin: 0 0 1rem; color: var(--ink); }
.article-body ul { margin: 0 0 1rem; padding-left: 1.3rem; }

.p-date {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  margin: -0.8rem 0 1.6rem;
}

/* ---------- list-card (news / events / technical / search / links) ---------- */

.list-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 14px;
}
.list-card img { width: 100%; height: 100px; object-fit: cover; border-radius: 3px; }
.list-card .meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.list-card h3 { font-size: 1.02rem; font-weight: 500; margin: 0 0 8px; }
.list-card h3 a { color: var(--ink); }
.list-card h3 a:hover { color: var(--blue); }
.list-card p { font-size: 0.87rem; color: var(--muted); line-height: 1.6; margin: 0; }

.list-card.event { grid-template-columns: 110px 1fr; }
.list-card.event .date-block {
  background: var(--blue);
  color: #fff;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  text-align: center;
  padding: 8px;
}
.list-card.event .date-block .d { font-size: 1.15rem; font-weight: 600; line-height: 1.25; }

.list-card.technical { grid-template-columns: 8px 1fr; padding-left: 0; }
.list-card.technical .bar { background: var(--amber); border-radius: 3px 0 0 3px; }
.list-card.technical .body { padding: 16px 16px 16px 4px; }

.list-card.link-card { grid-template-columns: 88px 1fr; align-items: center; }
.list-card.link-card img { height: 64px; object-fit: contain; background: #fff; }
.list-card.link-card .url { font-size: 0.82rem; color: var(--blue); display: inline-block; margin-bottom: 6px; }

/* ---------- sub-item grid (service / solution detail children) ---------- */

.sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 1.4rem;
}
.sub-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
  position: relative;
}
.sub-card img { width: 100%; height: 120px; object-fit: cover; border-radius: 3px; margin-bottom: 12px; }
.sub-card .idx {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--blue);
  display: block;
  margin-bottom: 8px;
}
.sub-card h3 { font-size: 1rem; font-weight: 500; margin: 0 0 10px; color: var(--ink); }
.sub-card h3 a { color: var(--ink); }
.sub-card h3 a:hover { color: var(--blue); }
.sub-card p { font-size: 0.86rem; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.sub-card .more { font-family: "IBM Plex Mono", monospace; font-size: 0.76rem; }

/* ---------- pagination ---------- */

.pagination-row { display: flex; justify-content: center; gap: 6px; margin-top: 2rem; }
.pagination-row a, .pagination-row span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px;
  font-family: "IBM Plex Mono", monospace; font-size: 0.82rem; color: var(--ink);
}
.pagination-row a:hover { border-color: var(--blue); color: var(--blue); }
.pagination-row .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- item cards with cover image (events, papers) ---------- */

.item-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 14px;
}
.item-card > img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.item-card .item-date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 2px 0 6px;
}
.item-card h3 { font-size: 1.02rem; font-weight: 500; margin: 0 0 8px; }
.item-card h3 a { color: var(--ink); }
.item-card h3 a:hover { color: var(--blue); }
.item-card .item-desc { font-size: 0.87rem; color: var(--muted); line-height: 1.6; margin: 0 0 8px; }

/* papers: amber rule runs the full height of the card (border on the card itself) */
.item-card.paper { border-left: 4px solid var(--amber); }

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--blue);
}
.file-link:hover { color: var(--blue-deep); }

.file-embed { margin: 1.4rem 0 0.6rem; }
.pdf-embed {
  display: block;
  width: 100%;
  height: 800px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: 0.6rem 0 1.6rem;
}
.gallery-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

@media (max-width: 700px) {
  .item-card { grid-template-columns: 1fr; }
  .item-card > img { height: 180px; }
  .pdf-embed { height: 520px; }
}

/* ---------- embed / document viewer placeholder ---------- */

.doc-embed {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}
.doc-embed i { font-size: 2.6rem; color: var(--amber); }

/* ---------- simple search box ---------- */

.search-box {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin-bottom: 1.8rem;
}
.search-box input {
  flex: 1;
  font-family: "Kanit", sans-serif;
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.search-box input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(10,95,168,0.12); }

/* ---------- map placeholder ---------- */

.map-block {
  height: 340px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--card) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><path d="M0 0H40V40" fill="none" stroke="%23d8dee4" stroke-width="1"/></svg>');
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  flex-direction: column;
  gap: 8px;
}
.map-block i { font-size: 1.8rem; color: var(--blue); }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .sub-grid { grid-template-columns: 1fr; }
  .list-card, .list-card.event, .list-card.link-card { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
  body { padding-top: 96px; }
  .header-bar-top { display: none; }
  .navbar-main .container { height: 62px; }
  .nav-toggle { display: flex; }

  .nav-main {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    height: auto;
    max-height: calc(100vh - 62px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 16px 28px rgba(11, 31, 51, 0.14);
    padding: 6px 0 14px;
  }
  .nav-main.open { display: flex; }

  .nav-main > li { display: block; }
  .nav-main > li > a {
    display: block;
    padding: 13px 20px;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
  }
  .nav-main > li > a:hover,
  .nav-main > li > a.active {
    border-bottom-color: transparent;
    border-left-color: var(--amber);
    background: var(--paper);
  }

  .nav-main .dropdown-panel {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: var(--paper);
    border-radius: 0;
    padding: 0;
    display: none;
  }
  .nav-main li.dd-open .dropdown-panel { display: block; }
  .nav-main li.dd-open > a .fa-angle-down { transform: rotate(180deg); }
  .dropdown-panel a { color: var(--ink); padding: 10px 30px; }
  .dropdown-panel a:hover { background: rgba(10, 95, 168, 0.06); color: var(--blue); }

  .nav-cta { margin: 10px 20px 0 !important; justify-content: center; align-self: stretch; }
}

@media (max-width: 560px) {
  .header-bar-top .container { justify-content: space-between; }
  .header-search input { width: 120px; }
  h1.header { font-size: 1.6rem; }
  .section-title { font-size: 1.25rem; }
}
