/*
 * Global Utilities & Layout Primitives
 *
 * Developed by: Rhyll Neri
 */

img {
  object-fit: cover;
}

/* Lenis smooth scroll */
html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Preloader — covers the page until all assets are loaded */
html.is-preloading,
html.is-preloading body { overflow: hidden !important; height: 100%; }

.preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-top);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  background-image: radial-gradient(ellipse at 50% 30%, var(--color-primary-light), var(--color-primary) 60%, var(--color-primary-dark));
  transition: opacity 0.6s var(--ease-out), visibility 0.6s var(--ease-out);
}

.preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__inner {
  width: min(340px, 80vw);
  text-align: center;
  color: var(--color-white);
}

.preloader__brand {
  margin-bottom: var(--space-5);
}

.preloader__brand-text {
  font-family: var(--font-display);
  font-size: var(--fs-28);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  opacity: 0.9;
}

.preloader__logo {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: min(260px, 64vw);
  max-height: 76px;
  object-fit: contain;
  /* Subtle entrance so the mark "settles" while assets load. */
  animation: ardent-preloader-logo 0.8s var(--ease-out) both;
}

@keyframes ardent-preloader-logo {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .preloader__logo { animation: none; }
}

.preloader__count {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, var(--fs-72));
  font-weight: var(--fw-semibold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.preloader__bar {
  margin-top: var(--space-5);
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.preloader__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--color-accent);
  border-radius: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .preloader { transition: none; }
}

figure {
  margin: 0;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--color-white);
  clip: auto !important;
  -webkit-clip-path: none;
  clip-path: none;
  color: var(--color-primary);
  display: block;
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: var(--z-top);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  z-index: var(--z-top);
  transition: top var(--dur-200) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-white);
}

/* Section spacing */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}

.section--sm { padding-top: clamp(3rem, 5vw, 5rem); padding-bottom: clamp(3rem, 5vw, 5rem); }
.section--lg { padding-top: clamp(5rem, 11vw, 10rem); padding-bottom: clamp(5rem, 11vw, 10rem); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.section--dark {
  background-color: var(--color-primary);
  color: var(--color-white);
}
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 { color: var(--color-white); }

/* Body copy on dark surfaces — override the dark default from typography.css. */
.section--dark,
.section--dark p,
.section--dark li,
.section--dark dd,
.section--dark dt,
.section--dark blockquote,
.section--dark .lead,
.section--dark .section__subtitle,
.section--dark .entry-content { color: rgba(255,255,255,0.82); }
.section--dark a:not(.btn):not(.link-arrow):not(.tag) { color: var(--color-white); text-decoration: underline; text-underline-offset: 3px; }
.section--dark a:not(.btn):not(.link-arrow):not(.tag):hover { color: var(--color-accent); }
.section--dark .text-muted { color: rgba(255,255,255,0.65); }

.section--mist  { background-color: var(--color-mist); }
.section--fog   { background-color: var(--color-fog); }
.section--ink   { background-color: var(--color-ink); color: var(--color-white); }
.section--ink h1, .section--ink h2, .section--ink h3,
.section--ink h4, .section--ink h5, .section--ink h6 { color: var(--color-white); }
.section--ink,
.section--ink p,
.section--ink li,
.section--ink .lead,
.section--ink .section__subtitle,
.section--ink .entry-content { color: rgba(255,255,255,0.82); }
.section--ink .text-muted { color: rgba(255,255,255,0.65); }

.section__head {
  max-width: 760px;
  margin: 0 auto var(--space-9);
  text-align: center;
}

.section__title {
  margin-bottom: var(--space-4);
}

.section__subtitle {
  color: var(--color-text-muted);
  font-size: clamp(1.0625rem, 0.6vw + 1rem, var(--fs-20));
}

.section__head--left {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

/* Eyebrow line accent */
.section__divider {
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  margin: 0 auto var(--space-5);
}

.section__divider--left { margin-left: 0; }

/* Animated reveal helpers */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-700) var(--ease-out),
              transform var(--dur-700) var(--ease-out);
  will-change: opacity, transform;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Pop variant — fades up with a springy scale "pop". */
[data-reveal-pop] {
  transform: translateY(28px) scale(0.92);
  transition-timing-function: var(--ease-spring);
}
[data-reveal-pop].is-visible {
  transform: translateY(0) scale(1);
}

[data-reveal-delay="100"] { transition-delay: 100ms; }
[data-reveal-delay="200"] { transition-delay: 200ms; }
[data-reveal-delay="300"] { transition-delay: 300ms; }
[data-reveal-delay="400"] { transition-delay: 400ms; }
[data-reveal-delay="500"] { transition-delay: 500ms; }
[data-reveal-delay="600"] { transition-delay: 600ms; }

/* Utility */
.is-hidden { display: none !important; }

.no-scroll {
  overflow: hidden;
}

/* Surface tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.85em;
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  background: var(--color-primary-50);
  color: var(--color-primary);
  border-radius: var(--radius-pill);
}

.tag--accent    { background: var(--color-accent-50); color: var(--color-accent-dark); }
.tag--ink       { background: var(--color-ink); color: var(--color-white); }
.tag--outline   { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.tag--success   { background: rgba(28,139,90,0.1); color: var(--color-success); }
.tag--warning   { background: rgba(201,122,14,0.12); color: var(--color-warning); }
.tag--error     { background: rgba(200,54,46,0.1); color: var(--color-error); }

/* Generic image plate */
.media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-slate-100);
}

.media__img {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform var(--dur-700) var(--ease-out);
}

.media:hover .media__img {
  transform: scale(1.03);
}

.media__aspect-16-9 { aspect-ratio: 16 / 9; }
.media__aspect-4-3  { aspect-ratio: 4 / 3; }
.media__aspect-1-1  { aspect-ratio: 1 / 1; }
.media__aspect-3-4  { aspect-ratio: 3 / 4; }

/* SVG icon */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Material Symbols (editor-chosen icons) */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Divider */
.divider {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

.divider--vertical {
  width: 1px;
  height: 100%;
  margin: 0 var(--space-4);
}

/* Responsive helpers */
@media (max-width: 768px) {
  .hide-mobile  { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
