/* ==========================================================================
   Unique Rail - site stylesheet
   Mobile-first: base styles are for phones, media queries add layout for
   larger screens. No fixed page heights - content sets the height.

   Breakpoints
     600px  large phones / small tablets
     768px  tablets (two-column layouts start)
     992px  desktop navigation
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
   --red:        #ac162c;
   --red-dark:   #8a1123;
   --ink:        #333333;
   --ink-deep:   #222222;
   --heading:    #4d4d4d;
   --text:       #555555;
   --muted:      #6b6b6b;
   --panel:      #efefed;
   --line:       #dddddd;
   --page-bg:    #f1f1f1;
   --white:      #ffffff;

   --font: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
   --radius: 4px;
   --gutter: 16px;
   --max-width: 1200px;
}

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

html {
   -webkit-text-size-adjust: 100%;
   /* Always reserve the scrollbar so short pages (e.g. Unique Partners)
      don't jump sideways compared with longer pages. */
   overflow-y: scroll;
}

body {
   margin: 0;
   background: var(--page-bg);
   color: var(--text);
   font-family: var(--font);
   font-size: 16px;
   line-height: 1.6;
   -webkit-font-smoothing: antialiased;
}

img, video, iframe { max-width: 100%; }
img, video { height: auto; display: block; }

a { color: var(--red); text-decoration: none; transition: color .2s, background-color .2s; }
a:hover, a:focus-visible { color: var(--red-dark); text-decoration: underline; }

h1, h2, h3 { color: var(--heading); line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }
p, ul { margin: 0 0 1em; }
ul { padding-left: 1.25em; }
li { margin-bottom: .25em; }

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

.skip-link {
   position: absolute; left: -9999px; top: 0;
   background: var(--red); color: var(--white); padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; color: var(--white); }

.visually-hidden {
   position: absolute !important; width: 1px; height: 1px; overflow: hidden;
   clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Page shell ---------- */
.page {
   max-width: var(--max-width);
   margin: 0 auto;
   background: var(--white);
   min-height: 100vh;
   display: flex;
   flex-direction: column;
}

@media (min-width: 992px) {
   .page {
      margin: 32px auto;
      min-height: 0;
      box-shadow: 0 3px 14px rgba(0, 0, 0, .18);
   }
}

.site-header {
   padding: 16px var(--gutter);
}
.site-logo { display: inline-block; }
.site-logo img { width: 200px; }

@media (min-width: 768px) {
   .site-header { padding: 20px 24px; }
   .site-logo img { width: 260px; }
}

.site-main {
   flex: 1;
   padding: 24px var(--gutter) 40px;
}
@media (min-width: 768px) {
   .site-main { padding: 32px 24px 48px; }
}

/* ---------- Navigation ---------- */
.nav {
   background: var(--ink);
   position: relative;
   z-index: 50;
}

.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li { margin: 0; }

.nav a,
.nav__toggle {
   display: flex;
   align-items: center;
   justify-content: space-between;
   width: 100%;
   padding: 12px var(--gutter);
   color: var(--white);
   background: none;
   border: 0;
   font: inherit;
   font-size: 15px;
   font-weight: 500;
   text-align: left;
   cursor: pointer;
   text-decoration: none;
}
.nav a:hover, .nav a:focus-visible,
.nav__toggle:hover, .nav__toggle:focus-visible {
   background: var(--red);
   color: var(--white);
   text-decoration: none;
}

.nav__caret {
   width: 0; height: 0; margin-left: 8px; flex-shrink: 0;
   border-left: 5px solid transparent;
   border-right: 5px solid transparent;
   border-top: 5px solid currentColor;
   transition: transform .2s;
}
.nav__toggle[aria-expanded="true"] > .nav__caret { transform: rotate(180deg); }

.nav .is-active > a,
.nav .is-active > .nav__toggle,
.nav .is-current > a { background: var(--red); }

/* Burger (mobile) */
.nav__burger {
   display: flex; align-items: center; gap: 10px;
   width: 100%; padding: 12px var(--gutter);
   background: none; border: 0; color: var(--white);
   font: inherit; font-weight: 600; cursor: pointer;
}
.nav__burger-bars,
.nav__burger-bars::before,
.nav__burger-bars::after {
   display: block; width: 22px; height: 2px; background: currentColor;
   position: relative; transition: transform .2s, opacity .2s;
}
.nav__burger-bars::before, .nav__burger-bars::after { content: ""; position: absolute; left: 0; }
.nav__burger-bars::before { top: -7px; }
.nav__burger-bars::after  { top: 7px; }
.nav__burger[aria-expanded="true"] .nav__burger-bars { background: transparent; }
.nav__burger[aria-expanded="true"] .nav__burger-bars::before { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] .nav__burger-bars::after  { transform: translateY(-7px) rotate(-45deg); }

/* Mobile: stacked accordion menu */
@media (max-width: 991.98px) {
   .nav__menu { display: none; border-top: 1px solid rgba(255,255,255,.15); }
   .nav__menu.is-open { display: block; }
   .nav__menu > li { border-bottom: 1px solid rgba(255,255,255,.1); }

   .nav__sub { display: none; background: var(--ink-deep); }
   .nav__toggle[aria-expanded="true"] + .nav__sub { display: block; }

   .nav__sub a, .nav__sub .nav__toggle { padding-left: calc(var(--gutter) * 2); font-size: 14px; }
   .nav__sub .nav__sub a { padding-left: calc(var(--gutter) * 3); }
   .nav__sub .nav__sub { background: #1a1a1a; }
}

/* Desktop: horizontal bar with drop-downs and fly-outs */
@media (min-width: 992px) {
   .nav__burger { display: none; }

   .nav__menu { display: flex; }
   .nav__menu > li { flex: 1 1 0; position: relative; }
   .nav__menu > li > a,
   .nav__menu > li > .nav__toggle { justify-content: center; padding: 14px 10px; height: 100%; }

   .nav__sub {
      display: none;
      position: absolute;
      top: 100%; left: 0;
      min-width: 240px;
      background: var(--ink-deep);
      box-shadow: 0 6px 16px rgba(0,0,0,.25);
   }
   .nav__sub li { position: relative; border-bottom: 1px dotted rgba(255,255,255,.25); }
   .nav__sub li:last-child { border-bottom: 0; }
   .nav__sub a, .nav__sub .nav__toggle { padding: 9px 16px; font-size: 14px; }

   /* third level flies out to the right */
   .nav__sub .nav__sub { top: 0; left: 100%; }
   .nav__sub .nav__caret { transform: rotate(-90deg); }
   .nav__sub .nav__toggle[aria-expanded="true"] > .nav__caret { transform: rotate(-90deg); }

   /* open on hover, keyboard focus, or click */
   .has-sub:hover > .nav__sub,
   .has-sub:focus-within > .nav__sub,
   .nav__toggle[aria-expanded="true"] + .nav__sub { display: block; }
}

/* ---------- Common content blocks ---------- */
.eyebrow {
   color: var(--red);
   font-weight: 700;
   font-size: 1.1rem;
   margin-bottom: .25em;
}

.lead {
   font-size: 1.15rem;
   line-height: 1.55;
   color: var(--muted);
}

.prose { color: var(--muted); }
.prose p, .prose li { max-width: 70ch; }

figure { margin: 0 0 24px; }
figure img, figure video { width: 100%; border-radius: var(--radius); }
figcaption { margin-top: 8px; font-size: .9rem; color: var(--muted); }

.logo-inline { max-width: 246px; margin-bottom: 12px; }

/* Two-column "text + images" layout used on most pages */
.split { display: grid; gap: 24px; }
.split + .split { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); }

@media (min-width: 768px) {
   .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
   .split__media { border-left: 1px solid var(--line); padding-left: 32px; }
}
@media (min-width: 1100px) {
   .split { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}

.split__media > figure:last-child { margin-bottom: 0; }

/* Page intro (Engineering, Maintenance): full-width text above the feature rows */
.intro {
   margin-bottom: 28px;
   padding-bottom: 24px;
   border-bottom: 1px solid var(--line);
}
.intro p { max-width: 75ch; }

/* Feature rows: image on the left, grey text panel on the right.
   Uses plain flexbox (no container queries / aspect-ratio) so it works on older iPads. */
.features { list-style: none; margin: 0; padding: 0; }
.feature {
   display: flex;
   flex-direction: column;
   margin: 0 0 20px;
   background: var(--panel);
   border-radius: var(--radius);
   overflow: hidden;
}
.feature:last-child { margin-bottom: 0; }
.feature__img { flex: 0 0 auto; }
.feature__img img { width: 100%; height: auto; }
.feature__body { flex: 1 1 auto; min-width: 0; padding: 20px; }
.feature__body h2 { font-size: 1.25rem; margin-bottom: .4em; }
.feature__body p { margin: 0; font-size: 1rem; line-height: 1.7; }

/* From large phones up: image left, text right */
@media (min-width: 600px) {
   .feature { flex-direction: row; align-items: flex-start; }
   .feature__img { width: 220px; }
   .feature__body { padding: 20px 24px; }
}
@media (min-width: 992px) {
   .feature__img { width: 280px; }
   .feature__body { padding: 24px 32px; }
   .feature__body p { font-size: 1.05rem; }
}

/* Desktop only (wide screen with a mouse): intro text on the left,
   feature rows on the right. iPads (touch) keep the stacked layout. */
@media (min-width: 1200px) and (hover: hover) and (pointer: fine) {
   .page-split {
      display: grid;
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: 32px;
      align-items: start;
   }
   .page-split .intro { margin: 0; padding: 0; border: 0; }
   .page-split .features { border-left: 1px solid var(--line); padding-left: 32px; }
   .page-split .feature__img { width: 240px; }
   .page-split .feature__body { padding: 20px 24px; }
   .page-split .feature__body p { font-size: .95rem; }
}

/* ---------- Home page ---------- */
.slider {
   position: relative;
   aspect-ratio: 3 / 1;
   overflow: hidden;
   background: #000;
   margin: calc(-1 * 24px) calc(-1 * var(--gutter)) 24px;
}
@media (min-width: 768px) {
   .slider { margin: -32px -24px 32px; }
}

.slider__slide {
   position: absolute; inset: 0;
   margin: 0;
   opacity: 0;
   transition: opacity .8s ease;
}
.slider__slide.is-active { opacity: 1; z-index: 1; }
.slider__slide img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

.slider__caption {
   position: absolute; left: 0; right: 0; bottom: 0;
   margin: 0;
   padding: 12px 20px;
   background: rgba(0,0,0,.72);
   color: var(--white);
   font-size: .95rem;
   display: none;
}
.slider__caption strong { display: block; font-size: 1.1rem; letter-spacing: .5px; }

@media (min-width: 768px) {
   .slider__caption { display: block; }
}

.slider__btn {
   position: absolute; top: 50%; z-index: 2;
   transform: translateY(-50%);
   width: 40px; height: 40px;
   border: 0; border-radius: 50%;
   background: rgba(0,0,0,.45); color: var(--white);
   font-size: 22px; line-height: 40px; cursor: pointer;
}
.slider__btn:hover { background: var(--red); }
.slider__btn--prev { left: 10px; }
.slider__btn--next { right: 10px; }

.slider__dots {
   position: absolute; top: 10px; right: 12px; z-index: 2;
   display: flex; gap: 6px;
}
.slider__dots button {
   width: 10px; height: 10px; padding: 0;
   border: 1px solid var(--white); border-radius: 50%;
   background: transparent; cursor: pointer;
}
.slider__dots button[aria-current="true"] { background: var(--white); }

.home-cols { display: grid; gap: 28px; }
@media (min-width: 768px) {
   .home-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
   .home-col + .home-col { position: relative; }
   .home-col + .home-col::before {
      content: ""; position: absolute; left: -20px; top: 0; bottom: 0;
      border-left: 1px solid var(--line);
   }
}
.home-col { display: flex; flex-direction: column; }
.home-col h2 { color: var(--heading); }
.home-col p { flex: 1; color: var(--muted); }
.home-col img { width: 100%; border-radius: var(--radius); margin-top: 8px; }

/* ---------- About / partners ---------- */
.quality-logo { margin-top: 16px; }

.logo-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
   gap: 16px;
   list-style: none; padding: 0; margin: 0;
}
.logo-grid li {
   display: flex; align-items: center; justify-content: center;
   min-height: 130px; padding: 20px; margin: 0;
   border: 1px solid var(--line); border-radius: var(--radius);
}
.logo-grid img { max-height: 100px; width: auto; }

/* ---------- News ---------- */
.news-layout { display: grid; gap: 32px; }
@media (min-width: 768px) {
   .news-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }
   .news-layout > .news-article-list,
   .news-layout > article { border-left: 1px solid var(--line); padding-left: 32px; }
}

.news-nav h2 { font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.news-nav h2 span { color: var(--red); }
.news-nav ul { list-style: none; padding: 0; }
.news-nav li { margin-bottom: 14px; }
.news-nav a { font-weight: 600; display: block; line-height: 1.35; }
.news-nav a[aria-current="page"] { color: var(--ink); }
.news-nav time { font-size: .85rem; color: var(--muted); }

.news-article + .news-article { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line); }
.news-article h1, .news-article h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
.news-article time { display: block; color: var(--muted); font-size: .9rem; margin: -4px 0 16px; }
.news-article p { color: var(--muted); }
.news-article img { margin-bottom: 16px; border-radius: var(--radius); }

/* ---------- Contact ---------- */
.contact-layout { display: grid; gap: 32px; }
@media (min-width: 768px) {
   .contact-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--heading); }
.form-field input,
.form-field textarea {
   width: 100%;
   padding: 10px 12px;
   border: 1px solid #bbb;
   border-radius: var(--radius);
   font: inherit;
   color: var(--ink);
   background: var(--white);
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(172,22,44,.15); }
.form-field textarea { min-height: 180px; resize: vertical; }
.form-hp { position: absolute; left: -9999px; }
.form-captcha { min-height: 78px; }
@media (max-width: 350px) {
   .g-recaptcha { transform: scale(.9); transform-origin: 0 0; }
}

.btn {
   display: inline-block;
   padding: 11px 28px;
   background: var(--red); color: var(--white);
   border: 0; border-radius: var(--radius);
   font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover, .btn:focus-visible { background: var(--red-dark); color: var(--white); text-decoration: none; }

.notice { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; }
.notice--ok { background: #e7f4e8; color: #1e5b24; }
.notice--error { background: #fbe9eb; color: var(--red-dark); }

.contact-details address { font-style: normal; margin-bottom: 1em; }
.contact-details dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 1em; }
.contact-details dt { font-weight: 600; color: var(--heading); }
.contact-details dd { margin: 0; }

.map {
   width: 100%;
   aspect-ratio: 4 / 3;
   border: 0;
   border-radius: var(--radius);
}

/* ---------- Footer ---------- */
.site-footer {
   background: var(--ink);
   color: var(--white);
   padding: 18px var(--gutter);
   display: flex;
   flex-wrap: wrap;
   gap: 6px 24px;
   align-items: center;
   justify-content: center;
   text-align: center;
   font-size: 15px;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--white); }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.site-footer__name { font-weight: 700; letter-spacing: .05em; }
.site-footer__contact { display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: center; word-break: break-word; }
.site-footer__copy { width: 100%; font-size: 13px; opacity: .7; }

@media (min-width: 768px) {
   .site-footer { justify-content: space-between; text-align: left; padding: 18px 24px; }
   .site-footer__copy { width: auto; }
}
