/* ==========================================================================
   Amirreza Imanzade — personal site
   Sections:
   1. Tokens
   2. Base & reset
   3. Background (atmosphere, particles, grain)
   4. Layout shell
   5. Header
   6. Hero typography (+ 6b. Profile: roles and skills)
   7. Social links
   8. Footer
   9. Entrance sequence
   10. Larger screens
   11. Short / landscape screens
   12. Reduced motion
   ========================================================================== */


/* 1. Tokens ---------------------------------------------------------------- */

/* Metric-matched fallback so text barely shifts when Inter loads */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 107.4%;
  ascent-override: 90.2%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}

:root {
  --bg: #07060D;
  --surface: #101018;
  --surface-raised: #151322;
  --accent: #A970FF;
  --accent-soft: #C8AEFF;
  --text: #F5F3FA;
  --muted: #9996A8;

  --border: rgba(169, 112, 255, 0.15);
  --border-strong: rgba(200, 174, 255, 0.38);

  --font-sans: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-fa: "Vazirmatn", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif;

  --gutter: clamp(1.5rem, 5.5vw, 4.5rem);
  --max-width: 80rem;
  --ease-out: cubic-bezier(0.22, 0.8, 0.24, 1);

  color-scheme: dark;
}


/* 2. Base & reset ---------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  background-color: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, p, ul {
  margin: 0;
  padding: 0;
}

ul { list-style: none; }

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

svg { display: block; }

::selection {
  background: rgba(169, 112, 255, 0.35);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 4px;
  border-radius: 6px;
}


/* 3. Background ------------------------------------------------------------ */

/* Layer order: atmosphere (0) → particles (1) → grain (2) → page (3) */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 75% at 18% -8%, rgba(62, 30, 118, 0.30) 0%, rgba(62, 30, 118, 0) 62%),
    radial-gradient(90% 70% at 102% 104%, rgba(40, 18, 84, 0.38) 0%, rgba(40, 18, 84, 0) 66%),
    linear-gradient(180deg, #08070F 0%, #06050B 100%);
}

/* Soft vignette keeps edges deep and text area calm */
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 42% 42%, rgba(0, 0, 0, 0) 38%, rgba(3, 2, 8, 0.62) 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Main glow sits behind the headline */
.glow--a {
  width: clamp(380px, 72vw, 980px);
  aspect-ratio: 1;
  left: -6%;
  top: 6%;
  background: radial-gradient(closest-side, rgba(169, 112, 255, 0.26), rgba(120, 70, 220, 0.09) 55%, rgba(120, 70, 220, 0) 100%);
  animation:
    drift-a 47s ease-in-out infinite alternate,
    breathe-a 19s ease-in-out infinite alternate;
}

/* Deeper violet, lower right */
.glow--b {
  width: clamp(320px, 62vw, 820px);
  aspect-ratio: 1;
  right: -14%;
  bottom: -12%;
  background: radial-gradient(closest-side, rgba(104, 56, 210, 0.24), rgba(80, 40, 170, 0.08) 58%, rgba(80, 40, 170, 0) 100%);
  animation:
    drift-b 61s ease-in-out infinite alternate,
    breathe-b 23s ease-in-out infinite alternate;
}

/* Small lavender highlight, upper right */
.glow--c {
  width: clamp(200px, 34vw, 460px);
  aspect-ratio: 1;
  right: 8%;
  top: -6%;
  background: radial-gradient(closest-side, rgba(200, 174, 255, 0.15), rgba(200, 174, 255, 0) 100%);
  animation:
    drift-c 79s ease-in-out infinite alternate,
    breathe-c 29s ease-in-out infinite alternate;
}

/* Durations are deliberately unrelated so the pattern never visibly repeats */
@keyframes drift-a {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  35%  { transform: translate3d(5vw, 4vh, 0) scale(1.08); }
  70%  { transform: translate3d(-2vw, 8vh, 0) scale(0.97); }
  100% { transform: translate3d(3vw, -3vh, 0) scale(1.05); }
}

@keyframes drift-b {
  0%   { transform: translate3d(0, 0, 0) scale(1.04); }
  40%  { transform: translate3d(-6vw, -4vh, 0) scale(0.96); }
  100% { transform: translate3d(-2vw, -9vh, 0) scale(1.1); }
}

@keyframes drift-c {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-7vw, 5vh, 0) scale(1.12); }
  100% { transform: translate3d(4vw, 9vh, 0) scale(0.94); }
}

@keyframes breathe-a {
  0%   { opacity: 0.72; }
  100% { opacity: 1; }
}

@keyframes breathe-b {
  0%   { opacity: 1; }
  100% { opacity: 0.62; }
}

@keyframes breathe-c {
  0%   { opacity: 0.45; }
  100% { opacity: 1; }
}

.particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

/* Static film grain: adds depth to the dark without banding */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}


/* 4. Layout shell ---------------------------------------------------------- */

.page {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.site-header,
.hero__inner,
.site-footer {
  width: min(100% - (var(--gutter) * 2), var(--max-width));
  margin-inline: auto;
}

.hero {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(1.5rem, 5vh, 3rem) clamp(2.5rem, 9vh, 6rem);
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}


/* 5. Header ---------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: clamp(1.25rem, 3.2vw, 2.25rem);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 500;
  color: var(--text);
}

.brand::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 1px rgba(169, 112, 255, 0.65);
}

.header-link {
  position: relative;
  padding-block: 0.5rem;
  color: var(--muted);
  transition: color 0.3s ease;
}

.header-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 1px;
  background: var(--accent-soft);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--ease-out);
}

.header-link:hover,
.header-link:focus-visible {
  color: var(--text);
}

.header-link:hover::after,
.header-link:focus-visible::after {
  transform: scaleX(1);
}


/* 6. Hero typography ------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: clamp(1.5rem, 3.5vw, 2.25rem);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.17em;
  color: var(--accent-soft);
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), rgba(169, 112, 255, 0.2));
}

.title {
  font-size: clamp(2.75rem, 1.2rem + 9vw, 9rem);
  font-weight: 600;
  line-height: 0.96;
  letter-spacing: -0.055em;
  color: var(--text);
}

.title__line {
  display: block;
  padding-bottom: 0.05em;
}

/* Soft top-to-bottom light on the heading; falls back to solid off-white */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .title {
    background-image: linear-gradient(180deg, #FFFFFF 18%, #CBC3E0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  .title .dot {
    -webkit-text-fill-color: var(--accent);
  }
}

.dot {
  color: var(--accent);
}

.tagline {
  margin-top: clamp(1.1rem, 2.4vw, 1.75rem);
  font-size: clamp(1.3125rem, 0.95rem + 1.6vw, 2.125rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--accent-soft);
}

.copy {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  max-width: 34rem;
}

.intro {
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1875rem);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -0.005em;
  color: var(--muted);
  text-wrap: pretty;
}

.persian {
  display: block;
  width: fit-content;
  margin-top: 1.125rem;
  font-family: var(--font-fa);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem);
  font-weight: 400;
  line-height: 1.9;
  color: rgba(200, 174, 255, 0.86);
  unicode-bidi: isolate;
}


/* 6b. Profile: roles and skills ------------------------------------------- */

.profile {
  width: 100%;
  max-width: 44rem;
  margin-top: clamp(2rem, 4.5vw, 3rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid rgba(169, 112, 255, 0.13);
}

.roles {
  display: grid;
  gap: 1.5rem;
  margin: 0;
}

.role dt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
}

.role dt::before {
  content: "";
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(169, 112, 255, 0.6);
}

.role dd {
  margin: 0;
  max-width: 30ch;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: clamp(1.5rem, 3vw, 2rem);
}

.skills li {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: rgba(200, 174, 255, 0.88);
  background: rgba(16, 16, 24, 0.55);
}


/* 7. Social links ---------------------------------------------------------- */

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: clamp(2rem, 5vw, 3.25rem);
}

.social {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(21, 19, 34, 0.9), rgba(14, 13, 22, 0.9));
  color: var(--accent-soft);
  transition:
    transform 0.4s var(--ease-out),
    border-color 0.4s ease,
    color 0.4s ease,
    box-shadow 0.4s ease,
    background-color 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}

.social svg {
  width: 1.375rem;
  height: 1.375rem;
}

@media (hover: hover) {
  .social:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow:
      0 12px 32px -12px rgba(169, 112, 255, 0.6),
      inset 0 0 0 1px rgba(169, 112, 255, 0.08);
  }
}

.social:active {
  transform: translateY(-1px);
}

.social:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 4px;
  border-radius: 1rem;
  border-color: var(--border-strong);
  color: var(--text);
}

/* Easier targets on touch devices */
@media (pointer: coarse) {
  .socials { gap: 0.875rem; }
  .social { width: 3.5rem; height: 3.5rem; }
}


/* 8. Footer ---------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 1.5rem calc(1.5rem + 0.25rem);
  border-top: 1px solid rgba(169, 112, 255, 0.09);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: rgba(153, 150, 168, 0.72);
}


/* 9. Entrance sequence ----------------------------------------------------- */
/* One orchestrated load-in. Content stays visible if animation is unavailable. */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 1s var(--ease-out) both;
    animation-delay: calc(0.12s + var(--i, 0) * 0.11s);
  }

  .site-header,
  .site-footer {
    animation: fade 1.4s ease 0.5s both;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* 10. Larger screens ------------------------------------------------------- */

@media (min-width: 48em) {
  .eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.22em;
  }

  .socials { gap: 1rem; }

  .roles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
  }

  .site-footer {
    font-size: 0.8125rem;
  }
}

@media (min-width: 90em) {
  :root { --max-width: 88rem; }
  .copy { max-width: 38rem; }
}


/* 11. Short / landscape screens -------------------------------------------- */

@media (max-height: 34em) and (orientation: landscape) {
  .hero { padding-block: 0.5rem 2rem; }
  .title { font-size: clamp(2.5rem, 12vh, 5rem); }
  .eyebrow { margin-bottom: 1rem; }
  .socials { margin-top: 1.5rem; }
}


/* 12. Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .social:hover {
    transform: none;
  }
}
