/* =========================================================
   P.I.A.C Systems landing page
   All colours are variables below. To change the brand colours later,
   only edit the two theme blocks (light and dark).
   ========================================================= */

/* ---------- Light theme (default) ---------- */
/* Tinted greys rather than white, so the sidebar, sections and cards stand apart like in dark mode. */
:root {
  --accent: #FD4F00;          /* brand orange (from the logo) */
  --accent-strong: #A93400;   /* darker brand orange for small text on the grey backgrounds (contrast 5:1) */
  --accent-soft: rgba(253, 79, 0, 0.12);
  --on-accent: #111827;       /* text on orange buttons */

  --bg: #EEF0F3;
  --bg-alt: #E1E5EA;
  --surface: #FFFFFF;
  --text: #111827;
  --text-muted: #4A4A4C;      /* brand grey (#58585A), a shade darker for the grey backgrounds */
  --border: #C9D0D8;
  --grid: rgba(17, 24, 39, 0.08);
  --header-bg: rgba(238, 240, 243, 0.85);
}

/* ---------- Dark theme ---------- */
/* Used when the visitor's system is dark and they haven't picked light... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #FD4F00;
    --accent-strong: #FF7A3D;
    --accent-soft: rgba(253, 79, 0, 0.14);
    --on-accent: #111827;

    --bg: #0F141A;
    --bg-alt: #151C24;
    --surface: #1A222C;
    --text: #E6EAF0;
    --text-muted: #9AA5B4;
    --border: #2A3542;
    --grid: rgba(230, 234, 240, 0.05);
    --header-bg: rgba(15, 20, 26, 0.85);
  }
}
/* ...or when they picked dark with the switch. */
:root[data-theme="dark"] {
  --accent: #FD4F00;
  --accent-strong: #FF7A3D;
  --accent-soft: rgba(253, 79, 0, 0.14);
  --on-accent: #111827;

  --bg: #0F141A;
  --bg-alt: #151C24;
  --surface: #1A222C;
  --text: #E6EAF0;
  --text-muted: #9AA5B4;
  --border: #2A3542;
  --grid: rgba(230, 234, 240, 0.05);
  --header-bg: rgba(15, 20, 26, 0.85);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Layout sizes used in several places */
:root {
  --rail-w: 96px;                          /* closed sidebar on computers: the icon rail */
  --open-w: 320px;                         /* open sidebar on computers */
  --sidebar-w: var(--rail-w);              /* space the page leaves for the sidebar (open width when docked, see below) */
  --logo-h: clamp(64px, 9vh, 96px);        /* logo height in the sidebar: shrinks on short screens */
  --side-gap: clamp(16px, 3vh, 40px);      /* space between the sidebar blocks: shrinks on short screens */
  --bar-h: 72px;                           /* height of the top bar on phones/tablets */
  --gutter: clamp(16px, 4vw, 80px);        /* side margin: 16px on phones, up to 80px at 1920 */
}

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }
a  { color: var(--accent-strong); }

/* Content uses the full width next to the sidebar (minus side margins),
   and stops growing at 1760px so ultra-wide screens don't stretch it. */
.container {
  width: 100%;
  max-width: calc(1760px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.8em 1.4em;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.15s, background-color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
/* Not a link yet (e.g. Online Training, Coming Soon): grey, no hover */
.btn-static, .btn-static:hover { color: var(--text-muted); border-color: var(--border); border-style: dashed; cursor: default; transform: none; }

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--side-gap);
  padding: clamp(20px, 3.5vh, 36px) 32px;
  overflow-y: auto;            /* only scrolls on very short windows... */
  scrollbar-width: none;       /* ...and even then without a visible scrollbar */
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { display: none; }
.page { margin-left: var(--sidebar-w); }   /* everything else sits right of the sidebar */
/* Wide screens with the sidebar open beside the content (class set in index.html / script.js) */
:root.nav-docked { --sidebar-w: var(--open-w); }

.logo { display: flex; align-items: center; }
.logo img { height: var(--logo-h); width: auto; }
.logo .logo-mark { display: none; width: 40px; height: 40px; }   /* gear only: shown on the closed rail */

/* Show the logo version that matches the theme (same idea as the sun/moon icons below) */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

.sidebar-menu { display: flex; flex-direction: column; gap: var(--side-gap); flex: 1; }

.side-nav { display: flex; flex-direction: column; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: clamp(6px, 1.2vh, 12px) 0 clamp(6px, 1.2vh, 12px) 16px;
  border-left: 3px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}
.side-nav a:hover { color: var(--text); }
.side-nav a.active { color: var(--text); border-left-color: var(--accent); }  /* set by script.js while scrolling */
.side-nav a.active .nav-icon { stroke: var(--accent); }

/* Menu icons (Lucide style: 24px grid, 2px outline, round ends) */
.nav-icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Orange phone icon: only on the closed rail (see the computer rules below) */
.rail-call { display: none; }

.side-contact { margin-top: auto; display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); }
.side-contact a { color: var(--text); text-decoration: none; font-weight: 600; }
.side-contact a:hover { color: var(--accent-strong); }

.side-theme { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 0.9rem; }

/* ☰ menu button: only used on phones/tablets; "+" rail button: only on computers */
.menu-toggle, .rail-toggle { display: none; }

/* Theme switch button */
.theme-toggle, .menu-toggle, .rail-toggle {
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle { display: grid; }
.theme-toggle:hover, .menu-toggle:hover, .rail-toggle:hover { border-color: var(--accent); }
.theme-toggle svg, .menu-toggle svg, .rail-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* Light theme shows the moon (click for dark); dark theme shows the sun. */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- First screen: headline + service cards ---------- */
/* Starts near the top of the screen (no centring), so the headline and cards use the space */
.intro { padding: clamp(28px, 5vh, 56px) 0 80px; }
.hero { margin-bottom: 40px; }
.hero h1 { font-size: clamp(2.3rem, 4.4vw, 5rem); }

/* Desktop: headline on one line. The font size is the space next to the sidebar
   divided by 21.5 (the headline is about 20.4 font-sizes wide in Segoe UI; the rest is spare
   room for other computers whose fonts are a little wider). */
@media (min-width: 1025px) {
  .hero h1 {
    white-space: nowrap;
    font-size: min(5rem, calc((100vw - var(--sidebar-w) - 2 * var(--gutter)) / 21.5));
  }
}
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 34em; }
/* Subheadline under a headline: a little larger and darker than the lead text */
.subhead { font-size: 1.2rem; font-weight: 600; color: var(--text); max-width: 46em; }
.hero .lead { max-width: 46em; }

/* Home: text on the left, "at a glance" panel on the right (desktop only) */
.hero-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 48px; align-items: start; }
.glance {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
}
.glance-title { margin: 0 0 12px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent-strong); }
.glance dl { margin: 0; display: grid; gap: 16px; }
.glance dt { font-size: 1.35rem; font-weight: 800; color: var(--text); }
.glance dd { margin: 2px 0 0; color: var(--text-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* P-I-A-C line above the headline */
.acronym {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.acronym b { color: var(--accent-strong); font-size: 1.1em; }

/* Respect visitors who turn off animations: no smooth scrolling */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Service cards */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
}
.card p { color: var(--text-muted); margin: 0; }

/* Services heading, and the info line under a card grid (Services: support agreements; Training: course packages) */
.services h2 { margin-top: 0; }
.service-cards h3 { white-space: nowrap; }   /* card headings on one line (user, 2026-10-08) */
.support-line { margin: 20px 0 0; color: var(--text-muted); }
.support-line strong { color: var(--text); }
.support-line a { color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.support-line a:hover { text-decoration: underline; }

/* ---------- Sections ---------- */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.eyebrow {
  margin-bottom: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-strong);
}

/* Platforms: trust line */
.trust { margin-top: 20px; color: var(--text-muted); font-style: italic; max-width: 60em; }

/* Industry and smart-factory cards (3 across), and the one-line benefit on a card */
.industry-cards, .next-cards { grid-template-columns: repeat(3, 1fr); margin-top: 32px; }
.card .benefit { color: var(--text); font-weight: 700; margin-bottom: 8px; }

/* How we work */
.steps {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  counter-reset: step;
}
.steps li { counter-increment: step; position: relative; padding-top: 48px; }
.steps li::before {
  content: "0" counter(step);
  position: absolute;
  top: 0;
  left: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-strong);
}
.steps p { color: var(--text-muted); margin: 0; }
/* Breakdown line under the steps: same accent style as the At a Glance panel */
.skip-steps {
  margin: 32px 0 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
}
.skip-steps strong { color: var(--text); }
.skip-steps a { color: var(--accent-strong); font-weight: 700; text-decoration: none; white-space: nowrap; }
.skip-steps a:hover { text-decoration: underline; }

/* Short intro line under a section heading */
.section-lead { color: var(--text-muted); max-width: 46em; }

/* Projects (portfolio) and Training: reuse the service cards */
.projects, .training { margin-top: 32px; }
.projects { grid-template-columns: repeat(3, 1fr); }
.project { display: flex; flex-direction: column; gap: 10px; }
.project h3 { margin: 0; }
.project-meta {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
}
.tags { list-style: none; padding: 0; margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.project-link { font-weight: 700; text-decoration: none; }

/* Contact */
.contact { background: var(--bg-alt); border-top: 1px solid var(--border); }
.contact-inner { text-align: center; max-width: 1080px; }
.contact-inner > p { max-width: 720px; margin-left: auto; margin-right: auto; }
.contact-inner p { color: var(--text-muted); }
.contact-inner .callout { color: var(--text); font-weight: 600; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.contact-inner .contact-meta { margin-top: 4px; font-size: 0.95rem; }
.contact-inner .eyebrow { color: var(--accent-strong); }
/* 24/7 breakdown bar: the most prominent item in Contact (tap to call on phones) */
.emergency {
  display: inline-block;
  margin: 8px 0 16px;
  padding: 14px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}
.emergency:hover { filter: brightness(1.05); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 0.9rem; color: var(--text-muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; }
/* Footer links in the same grey as the footer text, not underlined (user, 2026-10-08); lighter on hover */
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--text); }
/* Phones and tablets: phone number and email together on their own line under the company name */
@media (max-width: 1024px) {
  .footer-contact { display: block; }
  .footer-contact .sep { display: none; }
}

/* ---------- Sidebar on computers (1025px and wider): icon rail, opened with "+" ----------
   Classes on <html> (index.html sets them before the page draws, script.js keeps them up to date):
   nav-open   = the sidebar is open (full width, labels, sales block);
   nav-docked = it is open beside the content (wide screens), so the page moves over.
   nav-open without nav-docked = open over the content (laptops). No class = the icon rail. */
@media (min-width: 1025px) {
  .sidebar { transition: width 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease; }
  .page { transition: margin-left 0.25s ease; }
  .rail-toggle { display: grid; }
  .rail-toggle svg { transition: transform 0.25s ease; }

  /* Open */
  .nav-open .sidebar { width: var(--open-w); }
  .nav-open:not(.nav-docked) .sidebar { z-index: 20; box-shadow: 0 0 48px rgba(0, 0, 0, 0.28); }
  .nav-open .sidebar-top { position: relative; }
  .nav-open .rail-toggle { position: absolute; top: 0; right: -20px; }
  .nav-open .rail-toggle svg { transform: rotate(45deg); }   /* "+" turns into "×" */

  /* Closed: the icon rail */
  :root:not(.nav-open) .sidebar { padding-left: 0; padding-right: 0; align-items: center; overflow: visible; }
  :root:not(.nav-open) .sidebar-top { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  :root:not(.nav-open) .sidebar .logo-light,
  :root:not(.nav-open) .sidebar .logo-dark { display: none; }
  :root:not(.nav-open) .sidebar .logo-mark { display: block; }
  :root:not(.nav-open) .sidebar-menu { align-items: center; }
  :root:not(.nav-open) .side-nav { align-items: center; }
  :root:not(.nav-open) .side-nav a { justify-content: center; width: 52px; min-height: 44px; padding: 0; }
  /* Labels hidden on the rail but still read out by screen readers */
  :root:not(.nav-open) .side-nav .label,
  :root:not(.nav-open) .side-theme span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  :root:not(.nav-open) .side-contact { display: none; }
  :root:not(.nav-open) .rail-call {
    display: grid; place-items: center; width: 44px; height: 44px; margin-top: auto;
    border-radius: 8px; color: var(--accent);
  }
  :root:not(.nav-open) .rail-call .nav-icon { stroke: var(--accent); }
  :root:not(.nav-open) .rail-call:hover { background: var(--accent-soft); }
  :root:not(.nav-open) .side-theme { justify-content: center; }

  /* Tooltip next to a rail icon, on mouse hover and on keyboard focus */
  :root:not(.nav-open) .sidebar [data-tip] { position: relative; }
  :root:not(.nav-open) .sidebar [data-tip]:hover::after,
  :root:not(.nav-open) .sidebar [data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 30;
  }

  /* Labels fade in when the sidebar opens */
  .nav-open .side-nav .label, .nav-open .side-contact { animation: nav-fade 0.25s ease; }
}
@keyframes nav-fade { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sidebar, .page, .rail-toggle svg { transition: none !important; }
  .nav-open .side-nav .label, .nav-open .side-contact { animation: none !important; }
}

/* ---------- Big screens (1600px and wider, e.g. 1920 x 1080) ---------- */
/* Everything sized in rem grows with the root font size. */
@media (min-width: 1600px) {
  :root { --open-w: 340px; --logo-h: clamp(64px, 9vh, 104px); }
  html { font-size: 18px; }
  h2 { font-size: 2.75rem; }
  .lead { font-size: 1.35rem; }
  .btn { font-size: 1.05rem; }
}

/* ---------- Small laptops: service cards in 2 columns ---------- */
@media (max-width: 1280px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Tablet and phone: sidebar becomes a top bar with a ☰ menu ---------- */
@media (max-width: 1024px) {
  html { scroll-padding-top: calc(var(--bar-h) + 16px); }
  .hero-body { grid-template-columns: 1fr; }
  .glance { display: none; }
  .page { margin-left: 0; }
  .sidebar {
    position: sticky;
    bottom: auto;
    width: auto;
    gap: 0;
    padding: 0 var(--gutter);
    overflow: visible;
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-top { display: flex; align-items: center; justify-content: space-between; height: var(--bar-h); }
  .logo img { height: calc(var(--bar-h) - 20px); }
  .menu-toggle { display: grid; }

  /* The menu is hidden until the ☰ button adds .open to the sidebar (script.js) */
  .sidebar-menu { display: none; gap: 24px; padding: 8px 0 24px; }
  .sidebar.open .sidebar-menu { display: flex; }
  .side-contact { margin-top: 0; }

  .projects { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .industry-cards, .next-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Phone ---------- */
@media (max-width: 560px) {
  .intro { padding: 40px 0; }
  .section { padding: 56px 0; }
  .cards, .steps, .projects, .industry-cards, .next-cards { grid-template-columns: 1fr; }
}

/* ---------- Five cards (Services and Projects): 3 + 2 on desktops (headings stay on one line), 2 + 2 + one full-width card
   on small laptops and tablets, one column on phones (no card left alone in a row) ---------- */
@media (min-width: 1281px) {
  .service-cards, .five-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .service-cards .card, .five-cards .card { grid-column: span 2; }
  .service-cards .card:nth-child(n+4), .five-cards .card:nth-child(n+4) { grid-column: span 3; }
}
@media (min-width: 561px) and (max-width: 1280px) {
  .five-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-cards .card:last-child, .five-cards .card:last-child { grid-column: 1 / -1; }
}
/* Small laptops: no room next to the Home text for the At a Glance panel */
@media (max-width: 1280px) { .hero-body { grid-template-columns: 1fr; } .glance { display: none; } }

/* ---------- Training cards: 4 in a row only on wide screens, 2 + 2 otherwise; the bold benefit line stays on
   one line on computers (user, 2026-10-08) ---------- */
@media (min-width: 561px) and (max-width: 1799px) { .training-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1800px) { .training-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1025px) { .training-cards .benefit { white-space: nowrap; } }

/* Phones: contact and enquiry buttons stacked at one equal width */
@media (max-width: 560px) {
  .contact-actions { flex-direction: column; align-items: center; }
  .contact-actions .btn { width: 100%; max-width: 300px; text-align: center; }
}
