/* ============================================================
   Yashwika Studio — Core
   Reset, tokens, shared chrome + utilities used by every template
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }

body {
  margin: 0;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

html { overflow-x: clip; }

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

img { height: auto; }

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

ul, ol { margin: 0; padding: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(255, 255, 255, 0.25); }

:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100000;
  padding: 10px 18px;
  background: #fff;
  color: #000;
  font-weight: 600;
  border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Scrollbar (desktop, non-critical) ---------- */
@media (min-width: 900px) and (hover: hover) {
  * { scrollbar-width: thin; scrollbar-color: rgba(120,120,130,.5) transparent; }
}

/* ============================================================
   Platform chrome (template viewer toolbar)
   ============================================================ */

.template-view { min-height: 100vh; }

body.in-template { background: #0b0d13; }

.tpl-canvas { padding-bottom: 96px; }
.tpl-canvas > *:first-child { padding-top: 0; }

.tpl-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60000;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}
.tpl-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffd166, #ff6b5e);
  transition: width .08s linear;
}

.tpl-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 50000;
  display: flex;
  justify-content: center;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.tpl-bar-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(18, 19, 22, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.12);
  color: #e9e9ee;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  font-size: 13px;
  max-width: calc(100vw - 20px);
}
.tpl-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #e9e9ee;
  font-weight: 500;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.tpl-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.tpl-btn svg { width: 16px; height: 16px; }
.tpl-arrow { padding: 8px 10px; }
.tpl-id {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: #c9c9d2;
  padding: 0 2px;
  letter-spacing: .03em;
}
.tpl-divider { width: 1px; height: 22px; background: rgba(255,255,255,.14); }
.tpl-hint {
  font-size: 11px;
  color: #8f8f9a;
  padding: 0 6px;
  white-space: nowrap;
  display: none;
}
.tpl-variant {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  padding: 3px;
  gap: 3px;
}
.tpl-vbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #a9a9b4;
  font-size: 12.5px;
  transition: background .2s, color .2s;
}
.tpl-vbtn svg { width: 14px; height: 14px; }
.tpl-vbtn:hover { color: #fff; }
.tpl-vbtn.is-active { background: #fff; color: #101014; font-weight: 600; }

@media (max-width: 720px) {
  .tpl-bar-inner { gap: 6px; padding: 6px; }
  .tpl-back span { display: none; }
  .tpl-back { padding: 8px 10px; }
  .tpl-vbtn span { display: none; }
  .tpl-vbtn { padding: 8px 10px; }
  .tpl-vbtn svg { width: 15px; height: 15px; }
  .tpl-divider { height: 18px; }
  .tpl-hint { display: none; }
  .tpl-canvas { padding-bottom: 80px; }
}

@media (min-width: 980px) {
  .tpl-hint { display: inline; }
}

/* ============================================================
   Custom cursor
   ============================================================ */
.cursor-root { display: none; }
@media (hover: hover) and (pointer: fine) {
  body.cursor-on .cursor-root { display: block; }
  body.cursor-hide-native, body.cursor-hide-native a, body.cursor-hide-native button { cursor: none; }
  body.cursor-hide-native input, body.cursor-hide-native textarea,
  body.cursor-hide-native select, body.cursor-hide-native [contenteditable="true"] { cursor: auto; }
}
.cursor-root { position: fixed; inset: 0; pointer-events: none; z-index: 90000; }
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor-dot {
  width: 7px; height: 7px;
  background: var(--cur-color, #fff);
  z-index: 90002;
  transition: opacity .2s;
}
.cursor-ring {
  width: 38px; height: 38px;
  border: 1.5px solid var(--cur-color, rgba(255,255,255,.6));
  z-index: 90001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .18s, height .18s, border-color .25s, background .25s;
}
.cursor-dot, .cursor-ring {
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
.cursor-root.is-hover .cursor-dot {
  opacity: .6;
}
.cursor-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
  text-transform: uppercase;
  font-family: "Space Grotesk", sans-serif;
}
body.cursor-on .cursor-root .cursor-ring.is-label {
  width: 84px; height: 84px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  border-color: transparent;
  opacity: 1;
}
.cursor-ring.is-label .cursor-label { opacity: 1; }
body.cursor-on .cursor-root.is-down .cursor-ring { width: 30px; height: 30px; }
body.cursor-on .cursor-root.is-hover .cursor-ring { width: 52px; height: 52px; }
body.cursor-on .cursor-root.is-hover .cursor-ring.is-label { width: 84px; height: 84px; }
.cursor-ring, .cursor-ring.is-hover, .cursor-ring.is-label {
  will-change: transform;
}

/* ---- Cursor style variants (one distinct design per template) ---- */
.cursor-ring::before,
.cursor-ring::after { position: absolute; content: ""; pointer-events: none; }
.cursor-ring.is-label::before,
.cursor-ring.is-label::after { display: none; }

/* dot — quiet, only the pointer dot (minimal) */
.cursor-root[data-style="dot"] .cursor-ring { display: none; }
.cursor-root[data-style="dot"] .cursor-dot { width: 9px; height: 9px; }

/* box — bold rounded square ring (play) */
.cursor-root[data-style="box"] .cursor-ring { border-radius: 11px; width: 40px; height: 40px; }

/* square — sharp sticker square ring (mono) */
.cursor-root[data-style="square"] .cursor-ring { border-radius: 2px; width: 40px; height: 40px; border-width: 2px; }
.cursor-root[data-style="square"] .cursor-dot { width: 4px; height: 4px; border-radius: 0; }

/* line — editorial slash: vertical bar through a fine ring (editorial) */
.cursor-root[data-style="line"] .cursor-ring { width: 30px; height: 30px; border-width: 1px; }
.cursor-root[data-style="line"] .cursor-ring::before {
  width: 3px; height: 36px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cur-color);
  border-radius: 2px;
}
.cursor-root[data-style="line"] .cursor-dot { width: 4px; height: 4px; }

/* cross — technical crosshair (grid) */
.cursor-root[data-style="cross"] .cursor-ring { border-color: transparent; }
.cursor-root[data-style="cross"] .cursor-ring::before {
  width: 1px; height: 30px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cur-color);
}
.cursor-root[data-style="cross"] .cursor-ring::after {
  width: 30px; height: 1px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cur-color);
}
.cursor-root[data-style="cross"] .cursor-dot { width: 3px; height: 3px; }

/* stamp — rubber-stamp double ring (ink) */
.cursor-root[data-style="stamp"] .cursor-ring { width: 44px; height: 44px; border-width: 4px; border-style: double; }
.cursor-root[data-style="stamp"] .cursor-dot { width: 3px; height: 3px; }

/* glow — soft luminous dot with halo (sable) */
.cursor-root[data-style="glow"] .cursor-dot {
  width: 13px; height: 13px;
  box-shadow: 0 0 10px 2px var(--cur-color), 0 0 26px 8px color-mix(in srgb, var(--cur-color) 40%, transparent);
}
.cursor-root[data-style="glow"] .cursor-ring { width: 46px; height: 46px; border-width: 1px; opacity: .7; }

/* orbit — satellite dot circling the pointer (aurora, nova) */
.cursor-root[data-style="orbit"] .cursor-ring { width: 40px; height: 40px; }
.cursor-root[data-style="orbit"] .cursor-ring::after {
  width: 5px; height: 5px;
  top: 50%; left: 50%;
  border-radius: 50%;
  background: var(--cur-color);
  box-shadow: 0 0 6px var(--cur-color);
  animation: cur-orbit 1.9s linear infinite;
}
@keyframes cur-orbit {
  from { transform: translate(-50%, -50%) rotate(0deg) translateX(19px); }
  to { transform: translate(-50%, -50%) rotate(360deg) translateX(19px); }
}

/* dir — north arrow pointer (north) */
.cursor-root[data-style="dir"] .cursor-ring { border-color: transparent; }
.cursor-root[data-style="dir"] .cursor-ring::before {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--cur-color);
}
.cursor-root[data-style="dir"] .cursor-dot { width: 4px; height: 4px; }

/* pulse — expanding sonar ring (pulse) */
.cursor-root[data-style="pulse"] .cursor-ring { border-color: transparent; }
.cursor-root[data-style="pulse"] .cursor-ring::before {
  inset: 0;
  border: 1.5px solid var(--cur-color);
  border-radius: 50%;
  animation: cur-pulse 1.6s ease-out infinite;
}
.cursor-root[data-style="pulse"] .cursor-dot { width: 8px; height: 8px; box-shadow: 0 0 8px var(--cur-color); }
@keyframes cur-pulse {
  0% { transform: scale(.6); opacity: .95; }
  70% { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* glass — frosted translucent bubble (quartz) */
.cursor-root[data-style="glass"] .cursor-ring {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  width: 44px; height: 44px;
  border-width: 1px;
}
.cursor-root[data-style="glass"] .cursor-dot { width: 4px; height: 4px; }

/* ============================================================
   Shared animation primitives (used by every template)
   ============================================================ */

[data-reveal] {
  opacity: 0;
  transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1);
  transition-delay: var(--rd, 0s);
  will-change: opacity, transform;
}
[data-reveal="up"] { transform: translateY(34px); }
[data-reveal="down"] { transform: translateY(-34px); }
[data-reveal="left"] { transform: translateX(44px); }
[data-reveal="right"] { transform: translateX(-44px); }
[data-reveal="scale"] { transform: scale(.92); }
[data-reveal="fade"] { transform: none; }
[data-reveal="blur"] { transform: translateY(20px); filter: blur(8px); }
[data-reveal].is-in { opacity: 1; transform: none; filter: none; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
  body.cursor-on .cursor-root { display: block; }
  .cursor-ring::before, .cursor-ring::after { display: none; }
}

/* ============================================================
   Monogram avatar placeholder
   Themed by each template via --av-* custom properties.
   ============================================================ */
.yk-avatar {
  --av-bg1: #3a3f55;
  --av-bg2: #14161f;
  --av-ink: #fff;
  --av-line: rgba(255, 255, 255, .28);
  --av-font: "Space Grotesk", system-ui, sans-serif;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 7.5em;
  height: 7.5em;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  background: radial-gradient(125% 125% at 28% 18%, var(--av-bg1), var(--av-bg2) 74%);
  border: 1px solid var(--av-line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .38);
  flex: none;
  z-index: 1;
}
.yk-avatar::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 1px solid var(--av-line);
  opacity: .55;
  animation: yk-av-breathe 6s ease-in-out infinite;
}
.yk-avatar::after {
  content: "";
  position: absolute;
  top: 11%;
  right: 17%;
  width: 13%;
  height: 13%;
  border-radius: 50%;
  background: var(--av-ink);
  opacity: .85;
}
.yk-avatar-mark {
  position: relative;
  z-index: 1;
  font-family: var(--av-font);
  font-weight: 700;
  font-size: 2.35em;
  letter-spacing: .04em;
  color: var(--av-ink);
}
@keyframes yk-av-breathe {
  0%, 100% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.06); opacity: .85; }
}
@media (prefers-reduced-motion: reduce) {
  .yk-avatar::before { animation: none; }
}

/* ============================================================
   Text reveal (staggered characters/words)
   Applied via JS: YK.anim.letters adds .sp-w / .sp-c spans.
   ============================================================ */
.sp-w { display: inline-block; overflow: hidden; vertical-align: bottom; }
.sp-w.is-anim { opacity: 0; }
.sp-c {
  display: inline-block;
  transform: translateY(112%);
  transition: transform .8s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(var(--wi, 0) * 0.04s);
}
.sp-w.is-in .sp-c { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .sp-c { transform: none; transition: none; }
}

/* ============================================================
   View transition
   ============================================================ */
#gallery-view, #template-view {
  transition: opacity .35s ease;
}
.view-swap { opacity: 0 !important; pointer-events: none; }

/* ============================================================
   Toast
   ============================================================ */
.yk-toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(16px);
  background: #1a1b20;
  color: #f2f2f2;
  border: 1px solid rgba(255,255,255,.16);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 95000;
  max-width: calc(100vw - 32px);
}
.yk-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
