/* ==========================================================================
   Telamorph — Main Stylesheet
   Dark theme, mobile-first, clean/minimal
   ========================================================================== */

/* --- Design Tokens --- */
:root {
  /* Background tones — dark grey palette */
  --bg-primary: #111215;
  --bg-secondary: #18191d;
  --bg-card: #1e2024;
  --bg-elevated: #252730;

  /* Text */
  --text-primary: #eaedf0;
  --text-secondary: #6fb7fb;
  --text-muted: #909295;

  /* Accent — light blue */
  --accent: #5ba8f5;
  --accent-hover: #3d93ed;
  --accent-deep: #3d93ed;
  --accent-deep-hover: #2d79c7;
  --accent-subtle: rgba(91, 168, 245, 0.1);

  /* Teal — pairs with --accent for the gradient-border buttons */
  --accent-teal: #2dd4bf;
  --accent-gradient: linear-gradient(90deg, var(--accent-teal), var(--accent));

  /* Borders */
  --border-color: #2a3038;
  --border-light: #333a44;

  /* Misc */
  --nav-height: 72px;
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Shared value cards --- */
.value-card {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  height: 100%;
  overflow: hidden;
  transition:
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.value-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.value-card h3 {
  font-size: 1.26rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
  letter-spacing: 0;
}

.value-card p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.value-card .btn {
  margin-top: 1.25rem;
}

/* --- Section spacing --- */
.section {
  padding: 3rem 0;
}

@media (min-width: 768px) {
  .section {
    padding: 5rem 0;
  }
}

/* --- Utility: dark override for Bootstrap --- */
.bg-dark-custom {
  background-color: var(--bg-secondary) !important;
}

/* --- Dark form controls --- */
.form-control-dark {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

.form-control-dark:focus {
  background-color: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.2rem var(--accent-subtle);
}

.form-control-dark::placeholder {
  color: var(--text-muted);
}

/* --- Reveal on scroll ---
   The reveal motion rides the independent `opacity` + `translate` properties
   (NOT `transform`) so it never collides with an element's hover `transform`.
   The rule is `html .reveal` for a touch more specificity: many component
   classes (.product-card, .svc-media, .svc-frame, …) declare their own
   `transition`, and being loaded after this file they would otherwise REPLACE
   the reveal transition wholesale — dropping opacity/translate easing so image
   cards snapped ("popped") into view. Winning the cascade keeps the fade + rise.
   transform/scale/colour/shadow are listed at the normal hover speed so element
   hovers still ease exactly as before. aspect-ratio (media-fit.css) is listed
   here too — media-fit's .svc-media/.cd-step-media rules deliberately omit
   their own `transition` (they're commonly also `.reveal`), so this is the
   only rule that carries it for those elements. */
html .reveal {
  opacity: 0;
  translate: 0 24px;
  transition:
    opacity 1.5s ease,
    translate 1.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform var(--transition),
    scale var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition),
    background-color var(--transition),
    aspect-ratio 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, translate;
}

.reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
  html .reveal {
    opacity: 1;
    translate: none;
    transform: none;
    transition: none;
  }
}

/* --- Hero scroll cue — stacked stylized chevrons ---
   Shared by any hero-style section (.hero on the landing page, .svc-hero on
   service pages) that sits over a dark image/scrim and benefits from a nudge
   to keep scrolling. */
.hero-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 2;
  display: block;
  color: rgba(234, 237, 240, 0.55);
  transition: color var(--transition);
}

.hero-scroll-cue:hover {
  color: var(--accent);
}

.hero-chevrons {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* overlap the two chevrons into a tight double-arrow */
  gap: 4px;
}

.hero-chevrons span {
  display: block;
  width: 16px;
  height: 16px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  border-radius: 0 0 3px 0;
  transform: rotate(45deg);
  opacity: 0;
  animation: hero-chevron 1.9s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.hero-chevrons span:nth-child(2) {
  animation-delay: 0.18s;
}

@keyframes hero-chevron {
  0% {
    opacity: 0;
    transform: rotate(45deg) translate(-3px, -3px);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(45deg) translate(4px, 4px);
  }
}

@media (max-width: 575.98px) {
  .hero-scroll-cue {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-chevrons span {
    animation: none;
    opacity: 0.7;
  }
}

/* --- Toast notifications (bottom-center, transient) --- */
.toast-stack {
  position: fixed;
  left: 50%;
  top: clamp(1.25rem, 4vh, 2.5rem);
  translate: -50% 0;
  z-index: 1070;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  pointer-events: none;
}

.toast-msg {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(30, 32, 36, 0.92);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  translate: 0 14px;
  transition:
    opacity 0.35s ease,
    translate 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.is-visible {
  opacity: 1;
  translate: 0 0;
}

.toast-msg.is-success {
  border-color: var(--accent);
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .toast-msg {
    transition: opacity 0.2s ease;
    translate: none;
  }
}

/* --- Icon cycle: a chevron "head" (same shape as the hero scroll cue) that
   swaps for a second identical chevron on hover ---
   Two CSS-border chevrons (::before idle, ::after waiting just off the opposite
   edge) share one small overflow-hidden box. On hover/focus of the containing
   link or button, the first chevron slides out + fades in its pointing
   direction while the second slides in + fades from behind — and reverses on
   mouse-leave, since it's a plain hover-state transition. `rotate` orients the
   chevron; `translate` drives the slide. They're independent transform
   properties (translate is applied in screen axes regardless of rotation) so
   the chevron always points one way while sliding cleanly along the other.
   Presets: default → right; --down / --up for the vertical cues (jump-to-
   section buttons and the scroll-to-top chip). Border width / chevron size are
   tunable below. */
.icon-cycle {
  --icon-cycle-rotate: -45deg; /* right-pointing */
  --icon-cycle-shift-x: 150%;
  --icon-cycle-shift-y: 0%;
  --icon-cycle-nudge: 3px 0; /* the subtle hover slide the old arrows had */
  /* Feather the travel edges so a chevron dissolves into the frame instead of
     being hard-clipped by the box. Solid band (15–85%) clears the resting,
     rotated chevron; the outer 15% on each side fades. Axis matches the slide:
     horizontal here, vertical on the --down/--up variants. */
  --icon-cycle-fade: linear-gradient(
    90deg,
    transparent,
    #000 40%,
    #000 50%,
    transparent
  );
  position: relative;
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  flex-shrink: 0;
  overflow: hidden;
  -webkit-mask: var(--icon-cycle-fade) center / 100% 100% no-repeat;
  mask: var(--icon-cycle-fade) center / 100% 100% no-repeat;
  translate: 0 0;
  transition: translate 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-cycle::before,
.icon-cycle::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto; /* centre the fixed-size chevron in the box */
  width: 45%;
  height: 45%;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 2px 0; /* round the chevron's vertex, like the hero cue */
  rotate: var(--icon-cycle-rotate);
  transition:
    translate 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.6s ease;
}

.icon-cycle::before {
  translate: 0 0;
  opacity: 1;
}

.icon-cycle::after {
  translate: calc(-1 * var(--icon-cycle-shift-x))
    calc(-1 * var(--icon-cycle-shift-y));
  opacity: 0;
}

a:hover .icon-cycle::before,
a:focus-visible .icon-cycle::before,
button:hover .icon-cycle::before,
button:focus-visible .icon-cycle::before {
  translate: var(--icon-cycle-shift-x) var(--icon-cycle-shift-y);
  opacity: 0;
}

a:hover .icon-cycle::after,
a:focus-visible .icon-cycle::after,
button:hover .icon-cycle::after,
button:focus-visible .icon-cycle::after {
  translate: 0 0;
  opacity: 1;
}

/* The whole icon also nudges a touch in its pointing direction on hover —
   the small slide the trailing arrows had before the chevron swap. */
a:hover .icon-cycle,
a:focus-visible .icon-cycle,
button:hover .icon-cycle,
button:focus-visible .icon-cycle {
  translate: var(--icon-cycle-nudge);
}

.icon-cycle--down {
  --icon-cycle-rotate: 45deg; /* down-pointing (same as hero cue) */
  --icon-cycle-shift-x: 0%;
  --icon-cycle-shift-y: 150%;
  --icon-cycle-nudge: 0 3px;
  --icon-cycle-fade: linear-gradient(
    180deg,
    transparent,
    #000 15%,
    #000 85%,
    transparent
  );
}

.icon-cycle--up {
  --icon-cycle-rotate: -135deg; /* up-pointing */
  --icon-cycle-shift-x: 0%;
  --icon-cycle-shift-y: -150%;
  --icon-cycle-nudge: 0 -3px;
  --icon-cycle-fade: linear-gradient(
    180deg,
    transparent,
    #000 15%,
    #000 85%,
    transparent
  );
}

.icon-cycle--left {
  --icon-cycle-rotate: 135deg; /* left-pointing (mirror of the default right) */
  --icon-cycle-shift-x: -150%;
  --icon-cycle-shift-y: 0%;
  --icon-cycle-nudge: -3px 0;
  /* fade axis is still horizontal, so the default --icon-cycle-fade applies */
}

@media (prefers-reduced-motion: reduce) {
  .icon-cycle,
  .icon-cycle::before,
  .icon-cycle::after {
    transition: none;
  }
  .icon-cycle::after {
    content: none;
  }
  a:hover .icon-cycle,
  a:focus-visible .icon-cycle,
  button:hover .icon-cycle,
  button:focus-visible .icon-cycle {
    translate: 0 0;
  }
  a:hover .icon-cycle::before,
  a:focus-visible .icon-cycle::before,
  button:hover .icon-cycle::before,
  button:focus-visible .icon-cycle::before {
    translate: 0 0;
    opacity: 1;
  }
}

/* --- Scroll-to-top button (bottom-right, fades in once scrolled) --- */
.scroll-top {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2rem);
  bottom: clamp(1rem, 2.5vw, 2rem);
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--accent-deep);
  border-radius: 50%;
  background-color: rgba(30, 32, 36, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow:
    0 8px 26px -10px rgba(0, 0, 0, 0.6),
    0 0 0 0 rgba(91, 168, 245, 0);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.92);
  transition:
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.35s ease,
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition);
}

.scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.scroll-top:hover {
  color: #fff;
  border-color: var(--accent);
  box-shadow:
    0 12px 30px -10px rgba(0, 0, 0, 0.65),
    0 0 0 4px var(--accent-subtle);
}

.scroll-top .icon-cycle {
  width: 22px;
  height: 22px;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-top {
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease;
    transform: none;
  }
  .scroll-top.is-visible {
    transform: none;
  }
}
