/* ==========================================================================
   Base: reset, typography, layout helpers and the small utilities shared
   by every page. Component styles live in components.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-xl); letter-spacing: -0.02em; }

p,
ul,
ol,
dl,
dd,
figure,
address {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

address {
  font-style: normal;
}

p {
  max-width: 62ch;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: var(--color-brand);
  text-underline-offset: 0.2em;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-aqua);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--color-resin);
  color: var(--color-on-resin);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--color-resin);
  color: var(--color-on-resin);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--page-gutter));
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.section {
  position: relative;
  padding-block: var(--section-space);
}

.section--tint {
  background: var(--color-tint);
}

/* Dark sections re-point the text tokens, so components placed inside
   them pick up light text without any dark-specific rules. */
.section--dark,
.hero,
.page-hero,
.cta,
.site-footer,
.mobile-menu {
  --color-ink: var(--color-on-night);
  --color-text: var(--color-on-night-muted);
  --color-muted: var(--color-on-night-muted);
  --color-line: var(--color-on-night-line);
  --color-brand: var(--color-aqua);
  background: var(--color-night);
  color: var(--color-text);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 20px 40px;
  margin-bottom: clamp(36px, 5vw, 72px);
}

.section__head h2 {
  max-width: 16ch;
}

.lead {
  color: var(--color-ink);
  font-size: var(--text-xl);
  line-height: 1.45;
}

.prose {
  display: grid;
  gap: 20px;
  justify-items: start;
}

/* Two columns: text beside a tall image. Used on About and Products. */
.split {
  display: grid;
  gap: 48px;
  align-items: center;
}

.split__text {
  display: grid;
  gap: 28px;
}

.split__media {
  aspect-ratio: 4 / 5;
  max-height: 720px;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: clamp(48px, 7vw, 120px);
  }
}

/* ---------- Media frames ----------
   [data-wipe] frames are revealed with a clip-path wipe and [data-parallax]
   inner wrappers drift as the page scrolls (both in modules/motion.js).
   The inner image is oversized so the drift never exposes an edge. */

[data-wipe] {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

[data-wipe] > [data-parallax],
[data-wipe] img {
  width: 100%;
  height: 100%;
}

[data-parallax] img {
  width: 100%;
  height: 116%;
  object-fit: cover;
}

/* ---------- Buttons and links ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ease-out);
}

.button:active {
  transform: scale(0.97);
}

.button--small {
  min-height: 42px;
  padding: 10px 20px;
  font-size: var(--text-sm);
}

.button--large {
  min-height: 58px;
  padding: 16px 30px;
}

.button--accent {
  background: var(--color-resin);
  color: var(--color-on-resin);
}

.button--accent:hover {
  background: var(--color-on-night);
}

.button--brand {
  background: var(--color-brand);
  color: #ffffff;
}

.button--brand:hover {
  background: var(--color-ink);
}

.button--ghost {
  border-color: var(--color-on-night-line);
  color: var(--color-on-night);
  backdrop-filter: blur(8px);
}

.button--ghost:hover {
  border-color: var(--color-on-night);
  background: rgba(238, 246, 248, 0.08);
}

.arrow {
  flex: none;
  transition: transform 0.35s var(--ease-out);
}

a:hover > .arrow,
button:hover > .arrow,
a:hover .service-card__more .arrow {
  transform: translateX(5px);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

.link-arrow:hover {
  color: var(--color-brand);
}

/* ---------- Motion support ----------
   Elements the page-load animation reveals are hidden until the animation
   code takes over. The inline script in base.njk adds `motion-ready` after
   a short timeout as a safety net, so content can never stay hidden. */

.js:not(.motion-ready) [data-hero-title],
.js:not(.motion-ready) [data-hero-fade] {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .js:not(.motion-ready) [data-hero-title],
  .js:not(.motion-ready) [data-hero-fade] {
    visibility: visible;
  }
}

/* Lenis smooth scrolling (recommended rules from the library). */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* Cross-page fade, in browsers that support view transitions. */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: 0.25s ease-in both page-out;
  }

  ::view-transition-new(root) {
    animation: 0.45s var(--ease-out) both page-in;
  }
}

@keyframes page-out {
  to { opacity: 0; }
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(16px); }
}
