/* Wizad - global styles (ported from app/globals.css) */

html {
  scroll-behavior: smooth;
  background: #060706;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background: #060706;
  color: #f2f4f2;
  font-family: var(--font-sans), sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* faint global grain, sits above everything but ignores pointer events */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
  font-family: var(--font-display), sans-serif;
  letter-spacing: -0.01em;
  color: #f2f4f2;
}

h1, h2 {
  font-weight: 650 !important;
}

h3, h4 {
  font-weight: 600 !important;
}

::selection {
  background: #0d7d73;
  color: #060706;
}

:focus-visible {
  outline: 1.5px solid #2ce8d4;
  outline-offset: 3px;
  border-radius: 3px;
}

/* Scroll-reveal (replaces Framer Motion's Reveal component).
   JS toggles .is-visible once an element enters the viewport;
   prefers-reduced-motion users get the content with no animation (see js/main.js). */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(.22,.61,.36,1), transform 0.7s cubic-bezier(.22,.61,.36,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero entrance stagger (replaces Framer Motion's container/item variants) */
.hero-item {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s cubic-bezier(.22,.61,.36,1), transform 0.7s cubic-bezier(.22,.61,.36,1);
}
.hero-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero headline word swapper (Builder / Designer / Web3 Native).
   .word-glitch reserves exactly one line of height so the headline never
   shifts as the word changes length. .word-glitch-text holds the current
   word; main.js adds .is-glitching, swaps the text mid-animation, then
   removes the class - so each word tears into the next and the cycle
   repeats seamlessly. */
.word-glitch {
  height: 1.02em;
  line-height: 1.02;
}
.word-glitch-text {
  position: relative;
  display: inline-block;
  line-height: 1.02;
}
.word-glitch-text::before,
.word-glitch-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.word-glitch-text::before { color: #2ce8d4; }
.word-glitch-text::after  { color: #ff3fa4; }

.word-glitch-text.is-glitching {
  animation: word-glitch-body 620ms steps(1, end) both;
}
.word-glitch-text.is-glitching::before {
  animation: word-glitch-ghost-a 620ms steps(1, end) both;
}
.word-glitch-text.is-glitching::after {
  animation: word-glitch-ghost-b 620ms steps(1, end) both;
}

@keyframes word-glitch-body {
  0%   { transform: none; clip-path: none; opacity: 1; }
  12%  { transform: translate(-2px, 1px) skewX(-6deg); clip-path: inset(18% 0 46% 0); }
  24%  { transform: translate(3px, -2px) skewX(5deg);  clip-path: inset(56% 0 12% 0); }
  36%  { transform: translate(-4px, 0) skewX(-3deg);   clip-path: inset(6% 0 70% 0); opacity: 0.75; }
  48%  { transform: translate(4px, 2px) skewX(8deg);   clip-path: inset(64% 0 8% 0);  opacity: 0.85; }
  60%  { transform: translate(-3px, -1px) skewX(-4deg); clip-path: inset(30% 0 38% 0); }
  72%  { transform: translate(2px, 1px) skewX(3deg);   clip-path: inset(0 0 62% 0); }
  84%  { transform: translate(-1px, 0) skewX(-1deg);   clip-path: none; }
  100% { transform: none; clip-path: none; opacity: 1; }
}
@keyframes word-glitch-ghost-a {
  0%   { opacity: 0; transform: none; clip-path: none; }
  12%  { opacity: 0.9; transform: translate(-6px, -2px); clip-path: inset(10% 0 58% 0); }
  30%  { opacity: 0.8; transform: translate(5px, 2px);   clip-path: inset(62% 0 10% 0); }
  48%  { opacity: 0.9; transform: translate(-7px, 1px);  clip-path: inset(34% 0 34% 0); }
  66%  { opacity: 0.6; transform: translate(4px, -2px);  clip-path: inset(4% 0 72% 0); }
  84%  { opacity: 0.25; transform: translate(-2px, 0);   clip-path: inset(48% 0 28% 0); }
  100% { opacity: 0; transform: none; clip-path: none; }
}
@keyframes word-glitch-ghost-b {
  0%   { opacity: 0; transform: none; clip-path: none; }
  12%  { opacity: 0.75; transform: translate(6px, 2px);   clip-path: inset(52% 0 16% 0); }
  30%  { opacity: 0.85; transform: translate(-5px, -2px); clip-path: inset(8% 0 64% 0); }
  48%  { opacity: 0.7; transform: translate(7px, -1px);   clip-path: inset(40% 0 26% 0); }
  66%  { opacity: 0.5; transform: translate(-4px, 2px);   clip-path: inset(70% 0 4% 0); }
  84%  { opacity: 0.2; transform: translate(2px, 0);      clip-path: inset(22% 0 54% 0); }
  100% { opacity: 0; transform: none; clip-path: none; }
}

@media (prefers-reduced-motion: reduce) {
  .word-glitch-text.is-glitching,
  .word-glitch-text.is-glitching::before,
  .word-glitch-text.is-glitching::after { animation: none; }
}

/* Sticky nav must extend its opaque background under the device
   safe-area (notch / status bar / Dynamic Island), not just to the CSS
   viewport top. viewport-fit=cover (see <meta name="viewport">) makes
   env(safe-area-inset-top) resolve to the real inset instead of 0.
   Larger-screen iPhones (Pro Max / Dynamic Island models) are frequently
   under-reported by in-app browsers (Instagram/Twitter/Discord webviews),
   returning 0 or too small a value even though a real inset exists, so a
   34px floor is enforced via max() regardless of what env() reports.
   !important guards against the Tailwind CDN's async-injected utility
   styles landing after this file. */
[data-nav] {
  padding-top: max(env(safe-area-inset-top, 0px), 34px) !important;
}

/* Hero needs to reserve space for the now-taller nav (76px content
   height + whatever safe-area inset was added above). */
header.pt-\[76px\] {
  padding-top: calc(76px + max(env(safe-area-inset-top, 0px), 34px)) !important;
}

/* Mobile menu */
.mobile-menu {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(.22,.61,.36,1), transform 0.35s cubic-bezier(.22,.61,.36,1);
}
[data-mobile-menu] {
  /* Full-bleed mobile menu shouldn't start its content under the notch */
  padding-top: calc(100px + max(env(safe-area-inset-top, 0px), 34px)) !important;
}
.mobile-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Contact chooser (compact modal opened from the primary Contact CTA) */
.contact-chooser {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.contact-chooser.is-open {
  opacity: 1;
  pointer-events: auto;
}
.contact-chooser__panel {
  transform: translateY(10px) scale(0.98);
  transition: transform 0.3s cubic-bezier(.22,.61,.36,1);
}
.contact-chooser.is-open .contact-chooser__panel {
  transform: translateY(0) scale(1);
}

/* Media lightbox */
.lightbox {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Media frame component ("CaseStudyImage / Gallery / Video / Gif") ----
   Point an <img src> or <video><source src> at a real file - same path,
   same filename - and it just works. Until that file exists, the frame
   shows a quiet, intentional placeholder instead of a broken image or an
   ugly "PLACEHOLDER" label. Drop media into /assets/work/primals/ using
   the filenames noted in that folder's README.md. */
.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(155deg, #10141300, #0a0c0b 65%), #0f1211;
}
.media-frame img,
.media-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame--contain img,
.media-frame--contain video {
  object-fit: contain;
}
.media-frame__empty {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 42%, rgba(18, 168, 154, 0.16), transparent 70%);
}
.media-frame.is-empty .media-frame__empty {
  display: flex;
}
.media-frame.is-empty img,
.media-frame.is-empty video {
  display: none;
}
.media-frame__empty-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2ce8d4;
  box-shadow: 0 0 8px 1px rgba(44, 232, 212, 0.7);
}
.media-frame__empty-title {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #aab2ae;
}
.media-frame__empty-hint {
  max-width: 30ch;
  font-size: 11.5px;
  color: #6d7674;
}
.media-frame__tag {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(6, 7, 6, 0.65);
  padding: 4px 10px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #aab2ae;
  backdrop-filter: blur(6px);
}

/* Editorial gallery - grid on larger screens, snap-scroll strip on mobile
   so multiple screenshots stay readable at a usable size instead of being
   squeezed into a small grid cell (see MOBILE guidance). */
.media-gallery-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin: 0 -1px;
}
.media-gallery-scroll > * {
  flex: 0 0 78%;
  scroll-snap-align: start;
}
@media (min-width: 640px) {
  .media-gallery-scroll {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow: visible;
  }
  .media-gallery-scroll > * {
    flex: initial;
  }
}

/* Magnetic button - JS sets transform on mousemove */
.magnetic-btn {
  transition: transform 0.25s cubic-bezier(.22,.61,.36,1), background-color 0.2s, border-color 0.2s;
}

/* Electric glow pulse - soft teal glow pulses while hovered, echoing the
   status-dot pulse used elsewhere on the page. */
.btn-glow-pulse {
  position: relative;
}
.btn-glow-pulse:hover,
.btn-glow-pulse:focus-visible {
  animation: btn-glow-pulse 1.3s ease-in-out infinite;
}
@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 0px 0px rgba(44, 232, 212, 0); }
  50% { box-shadow: 0 0 20px 3px rgba(44, 232, 212, 0.55); }
}

/* Email copy toast - shown when an email link is clicked, so the action is
   never silent on machines with no default mail client. */
.email-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border: 1px solid rgba(44, 232, 212, 0.3);
  border-radius: 6px;
  background: #0f1211;
  color: #f2f4f2;
  font-size: 13px;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.email-toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Footer nav links + social icon buttons.
   Hover color is only applied on devices that actually have hover
   (mouse/trackpad). On touch devices, tapping an icon applies the same
   look as desktop :hover, but as a persistent ".is-tapped" class (set by
   js/main.js) instead of a native pseudo-class - it stays on after the
   finger lifts / after the link opens, and only clears on the next tap
   anywhere else on the page. */
.footer-nav-link:focus-visible,
.footer-icon-btn:focus-visible {
  outline: 2px solid #2ce8d4;
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .footer-nav-link:hover { color: #2ce8d4; }
  .footer-icon-btn:hover {
    border-color: #12a89a;
    background-color: rgba(18, 168, 154, 0.06);
    color: #2ce8d4;
  }
}
.footer-nav-link:active { color: #2ce8d4; }
.footer-icon-btn:active,
.footer-icon-btn.is-tapped {
  border-color: #12a89a;
  background-color: rgba(18, 168, 154, 0.06);
  color: #2ce8d4;
}
