/* ==========================================================================
   Alex Grinyayev — Portfolio
   Shared design system: tokens, reset, and site-wide components.
   Page-specific styles (case study visualizations, etc.) live in each
   page's own <style> block, loaded after this file.
   ========================================================================== */

:root {
  --bg: #14171F;
  --bg-panel: #1B1F29;
  --bg-card: #20242F;
  --line: rgba(255, 255, 255, .10);
  --ink: #F3F1EC;
  --ink-dim: #A6ADBB;
  --ink-faint: #7A8290;
  --coral: #FF6A4C;
  --cyan: #45E0FF;
  --grad: linear-gradient(100deg, #FF6A4C 0%, #FF9C5B 35%, #45E0FF 100%);

  --nav-height: 96px;
  --wrap-max: 1160px;
  --wrap-pad: 48px;
}

@media (max-width: 860px) {
  :root {
    --nav-height: 80px;
    --wrap-pad: 22px;
  }
}

* { box-sizing: border-box }

html { background: var(--bg) }

body {
  margin: 0;
  background: var(--bg);
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--ink);
}

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

/* ---- kill the default mobile tap/focus glow on every link & button ---- */
a, button {
  -webkit-tap-highlight-color: transparent;
}
a:focus, button:focus {
  outline: none;
}
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 400; margin: 0 }

.wrap {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 0 var(--wrap-pad);
}

@media (max-width: 860px) {
  .wrap { max-width: none }
}

/* ---- pill / status dot ---- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .03);
}

@media (max-width: 860px) {
  .pill { padding: 7px 14px; font-size: 12px; letter-spacing: 0 }
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 12px 2px #4ADE80;
}

/* ---- site wordmark (nav) ---- */
.site-name { white-space: nowrap }
@media (max-width: 860px) {
  .site-name { font-size: 13px }
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: transform .25s ease, box-shadow .25s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--grad);
  color: #0A0C10;
  box-shadow: 0 8px 24px -8px rgba(255, 106, 76, .55);
}

.btn-primary:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 14px 32px -8px rgba(255, 106, 76, .7) }
.btn-primary:active { transform: scale(.97) }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line) }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-3px) }

@media (max-width: 860px) {
  .btn { padding: 15px 22px; width: 100% }
  .btn-ghost:hover, .btn-primary:hover { transform: none }
}

/* ---- nav links (desktop top nav) ---- */

.navlink { position: relative; font-size: 15px; color: var(--ink-dim); padding: 6px 2px }

.navlink::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  background-size: 200% 100%;
  background-position: 0% 50%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}

.navlink:hover { color: var(--ink) }
.navlink:hover::after { transform: scaleX(1); animation: navUnderlineMove 1.6s linear infinite }

@keyframes navUnderlineMove { 0% { background-position: 0% 50% } 100% { background-position: 200% 50% } }

.magnetic { transition: transform .25s cubic-bezier(.2, .7, .3, 1) }

/* ---- mobile menu ---- */

.menu-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
}

.menu-btn span { width: 16px; height: 2px; background: var(--ink); border-radius: 2px }

.overlay {
  position: fixed; inset: 0;
  background: #0A0C10;
  z-index: 50;
  display: none;
  flex-direction: column;
  padding: 22px;
  animation: slideDown .25s ease;
}

.overlay.is-open { display: flex }

.overlay a { font-family: 'Fraunces', serif; font-size: 32px; padding: 14px 0; border-bottom: 1px solid var(--line) }

@keyframes slideDown { from { opacity: 0; transform: translateY(-12px) } to { opacity: 1; transform: translateY(0) } }

/* ---- fade-in entrance animation ---- */

.fade-in { opacity: 0; animation: fadeUp .9s cubic-bezier(.2, .7, .3, 1) forwards }

@keyframes fadeUp { from { opacity: 0; transform: translateY(28px) } to { opacity: 1; transform: translateY(0) } }

@media (max-width: 860px) {
  @keyframes fadeUp { from { opacity: 0; transform: translateY(22px) } to { opacity: 1; transform: translateY(0) } }
}

.split-word { display: inline-block; opacity: 0; transform: translateY(60%) rotate(3deg); animation: wordUp .6s cubic-bezier(.2, .7, .3, 1) forwards }

@keyframes wordUp { to { opacity: 1; transform: translateY(0) rotate(0) } }

/* ---- decorative motion system (grain / aura / blobs / grid overlay) ----
   Carried over byte-for-byte from the original design — not a subject of
   redesign in this migration. */

.grain {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .16;
  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.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainFlicker 2.2s steps(8) infinite;
}

@keyframes grainFlicker { 0%, 100% { opacity: .16 } 20% { opacity: .1 } 35% { opacity: .21 } 55% { opacity: .13 } 70% { opacity: .19 } 85% { opacity: .11 } }

.grain-clear { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 50% 50%, var(--bg) 0%, var(--bg) 28%, rgba(20, 23, 31, 0) 68%) }

.aura {
  position: absolute; top: -320px; left: 50%;
  width: 920px; height: 920px; margin-left: -460px;
  background: conic-gradient(from 0deg, rgba(255, 106, 76, .22), rgba(69, 224, 255, .18), rgba(255, 156, 91, .2), rgba(255, 106, 76, .22));
  border-radius: 50%;
  filter: blur(100px);
  opacity: .55;
  animation: auraSpin 34s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 860px) {
  .aura {
    top: -200px; width: 520px; height: 520px; margin-left: -260px;
    filter: blur(70px);
  }
}

@keyframes auraSpin { to { transform: rotate(360deg) } }

.grid-overlay {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
  background-size: 95px 95px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 65%);
  mask-image: linear-gradient(to bottom, black, transparent 65%);
  animation: gridPan .5s steps(3) infinite;
}

@keyframes gridPan { 0% { background-position: 0 0 } 33% { background-position: -42px 21px } 66% { background-position: 25px -36px } 100% { background-position: 0 0 } }

.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; pointer-events: none }
.blob.coral { background: radial-gradient(circle at 35% 35%, var(--coral) 0%, rgba(255, 106, 76, 0) 70%) }
.blob.cyan { background: radial-gradient(circle at 65% 65%, var(--cyan) 0%, rgba(69, 224, 255, 0) 70%) }

@media (max-width: 860px) {
  .blob { filter: blur(60px) }
}

/* ---- generic content components ---- */

.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; transition: transform .3s ease }
.card:active { transform: scale(.98) }

.footer-line { border-top: 1px solid var(--line) }

.photo-placeholder {
  border-radius: 20px; border: 1px dashed var(--line); background: var(--bg-card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink-faint); flex-shrink: 0;
}

/* ---- mailto fallback toast ----
   Shown by site.js (initMailtoCopy) whenever a mailto: link is clicked, so
   a laptop with no default mail client configured still leaves the person
   with the address ready to paste, instead of the click silently doing
   nothing. */
.mailto-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px);
  background: var(--bg-card); border: 1px solid var(--line); color: var(--ink);
  padding: 12px 22px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 500; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}
.mailto-toast.is-visible { opacity: 1; transform: translate(-50%, 0) }
@media (max-width: 860px) {
  .mailto-toast { font-size: 13px; padding: 11px 18px; max-width: calc(100vw - 44px); white-space: normal; text-align: center }
}
